aws_sdk_ram/operation/create_permission/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_permission::_create_permission_output::CreatePermissionOutputBuilder;
3
4pub use crate::operation::create_permission::_create_permission_input::CreatePermissionInputBuilder;
5
6impl crate::operation::create_permission::builders::CreatePermissionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::create_permission::CreatePermissionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_permission::CreatePermissionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_permission();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreatePermission`.
24///
25/// <p>Creates a customer managed permission for a specified resource type that you can attach to resource shares. It is created in the Amazon Web Services Region in which you call the operation.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreatePermissionFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_permission::builders::CreatePermissionInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_permission::CreatePermissionOutput,
35        crate::operation::create_permission::CreatePermissionError,
36    > for CreatePermissionFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::create_permission::CreatePermissionOutput,
44            crate::operation::create_permission::CreatePermissionError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreatePermissionFluentBuilder {
51    /// Creates a new `CreatePermissionFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the CreatePermission as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_permission::builders::CreatePermissionInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::create_permission::CreatePermissionOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_permission::CreatePermissionError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::create_permission::CreatePermission::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_permission::CreatePermission::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::create_permission::CreatePermissionOutput,
97        crate::operation::create_permission::CreatePermissionError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
112    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.name(input.into());
114        self
115    }
116    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
117    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_name(input);
119        self
120    }
121    /// <p>Specifies the name of the customer managed permission. The name must be unique within the Amazon Web Services Region.</p>
122    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_name()
124    }
125    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
126    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
127    pub fn resource_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.resource_type(input.into());
129        self
130    }
131    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
132    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
133    pub fn set_resource_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_resource_type(input);
135        self
136    }
137    /// <p>Specifies the name of the resource type that this customer managed permission applies to.</p>
138    /// <p>The format is <code> <i><service-code></service-code></i>:<i><resource-type></resource-type></i> </code> and is not case sensitive. For example, to specify an Amazon EC2 Subnet, you can use the string <code>ec2:subnet</code>. To see the list of valid values for this parameter, query the <code>ListResourceTypes</code> operation.</p>
139    pub fn get_resource_type(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_resource_type()
141    }
142    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
143    /// <ul>
144    /// <li>
145    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
146    /// <li>
147    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
148    /// <li>
149    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
150    /// </ul>
151    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
152    pub fn policy_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.policy_template(input.into());
154        self
155    }
156    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
157    /// <ul>
158    /// <li>
159    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
160    /// <li>
161    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
162    /// <li>
163    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
164    /// </ul>
165    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
166    pub fn set_policy_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167        self.inner = self.inner.set_policy_template(input);
168        self
169    }
170    /// <p>A string in JSON format string that contains the following elements of a resource-based policy:</p>
171    /// <ul>
172    /// <li>
173    /// <p><b>Effect</b>: must be set to <code>ALLOW</code>.</p></li>
174    /// <li>
175    /// <p><b>Action</b>: specifies the actions that are allowed by this customer managed permission. The list must contain only actions that are supported by the specified resource type. For a list of all actions supported by each resource type, see <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html">Actions, resources, and condition keys for Amazon Web Services services</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
176    /// <li>
177    /// <p><b>Condition</b>: (optional) specifies conditional parameters that must evaluate to true when a user attempts an action for that action to be allowed. For more information about the Condition element, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html">IAM policies: Condition element</a> in the <i>Identity and Access Management User Guide</i>.</p></li>
178    /// </ul>
179    /// <p>This template can't include either the <code>Resource</code> or <code>Principal</code> elements. Those are both filled in by RAM when it instantiates the resource-based policy on each resource shared using this managed permission. The <code>Resource</code> comes from the ARN of the specific resource that you are sharing. The <code>Principal</code> comes from the list of identities added to the resource share.</p>
180    pub fn get_policy_template(&self) -> &::std::option::Option<::std::string::String> {
181        self.inner.get_policy_template()
182    }
183    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
184    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
185    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
186    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187        self.inner = self.inner.client_token(input.into());
188        self
189    }
190    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
191    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
192    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
193    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.inner = self.inner.set_client_token(input);
195        self
196    }
197    /// <p>Specifies a unique, case-sensitive identifier that you provide to ensure the idempotency of the request. This lets you safely retry the request without accidentally performing the same operation a second time. Passing the same value to a later call to an operation requires that you also pass the same value for all other parameters. We recommend that you use a <a href="https://wikipedia.org/wiki/Universally_unique_identifier">UUID type of value.</a>.</p>
198    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
199    /// <p>If you retry the operation with the same <code>ClientToken</code>, but with different parameters, the retry fails with an <code>IdempotentParameterMismatch</code> error.</p>
200    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
201        self.inner.get_client_token()
202    }
203    ///
204    /// Appends an item to `tags`.
205    ///
206    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
207    ///
208    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
209    pub fn tags(mut self, input: crate::types::Tag) -> Self {
210        self.inner = self.inner.tags(input);
211        self
212    }
213    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
214    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
215        self.inner = self.inner.set_tags(input);
216        self
217    }
218    /// <p>Specifies a list of one or more tag key and value pairs to attach to the permission.</p>
219    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
220        self.inner.get_tags()
221    }
222}