aws_sdk_ram/operation/associate_resource_share/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::associate_resource_share::_associate_resource_share_output::AssociateResourceShareOutputBuilder;
3
4pub use crate::operation::associate_resource_share::_associate_resource_share_input::AssociateResourceShareInputBuilder;
5
6impl crate::operation::associate_resource_share::builders::AssociateResourceShareInputBuilder {
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::associate_resource_share::AssociateResourceShareOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::associate_resource_share::AssociateResourceShareError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.associate_resource_share();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AssociateResourceShare`.
24///
25/// <p>Adds the specified list of principals and list of resources to a resource share. Principals that already have access to this resource share immediately receive access to the added resources. Newly added principals immediately receive access to the resources shared in this resource share.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct AssociateResourceShareFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::associate_resource_share::builders::AssociateResourceShareInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::associate_resource_share::AssociateResourceShareOutput,
35        crate::operation::associate_resource_share::AssociateResourceShareError,
36    > for AssociateResourceShareFluentBuilder
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::associate_resource_share::AssociateResourceShareOutput,
44            crate::operation::associate_resource_share::AssociateResourceShareError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl AssociateResourceShareFluentBuilder {
51    /// Creates a new `AssociateResourceShareFluentBuilder`.
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 AssociateResourceShare as a reference.
60    pub fn as_input(&self) -> &crate::operation::associate_resource_share::builders::AssociateResourceShareInputBuilder {
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::associate_resource_share::AssociateResourceShareOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::associate_resource_share::AssociateResourceShareError,
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::associate_resource_share::AssociateResourceShare::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::associate_resource_share::AssociateResourceShare::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::associate_resource_share::AssociateResourceShareOutput,
97        crate::operation::associate_resource_share::AssociateResourceShareError,
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 <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the resource share that you want to add principals or resources to.</p>
112    pub fn resource_share_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.resource_share_arn(input.into());
114        self
115    }
116    /// <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the resource share that you want to add principals or resources to.</p>
117    pub fn set_resource_share_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_resource_share_arn(input);
119        self
120    }
121    /// <p>Specifies the <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of the resource share that you want to add principals or resources to.</p>
122    pub fn get_resource_share_arn(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_resource_share_arn()
124    }
125    ///
126    /// Appends an item to `resourceArns`.
127    ///
128    /// To override the contents of this collection use [`set_resource_arns`](Self::set_resource_arns).
129    ///
130    /// <p>Specifies a list of <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> of the resources that you want to share. This can be <code>null</code> if you want to add only principals.</p>
131    pub fn resource_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.inner = self.inner.resource_arns(input.into());
133        self
134    }
135    /// <p>Specifies a list of <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> of the resources that you want to share. This can be <code>null</code> if you want to add only principals.</p>
136    pub fn set_resource_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
137        self.inner = self.inner.set_resource_arns(input);
138        self
139    }
140    /// <p>Specifies a list of <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> of the resources that you want to share. This can be <code>null</code> if you want to add only principals.</p>
141    pub fn get_resource_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
142        self.inner.get_resource_arns()
143    }
144    ///
145    /// Appends an item to `principals`.
146    ///
147    /// To override the contents of this collection use [`set_principals`](Self::set_principals).
148    ///
149    /// <p>Specifies a list of principals to whom you want to the resource share. This can be <code>null</code> if you want to add only resources.</p>
150    /// <p>What the principals can do with the resources in the share is determined by the RAM permissions that you associate with the resource share. See <code>AssociateResourceSharePermission</code>.</p>
151    /// <p>You can include the following values:</p>
152    /// <ul>
153    /// <li>
154    /// <p>An Amazon Web Services account ID, for example: <code>123456789012</code></p></li>
155    /// <li>
156    /// <p>An <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an organization in Organizations, for example: <code>organizations::123456789012:organization/o-exampleorgid</code></p></li>
157    /// <li>
158    /// <p>An ARN of an organizational unit (OU) in Organizations, for example: <code>organizations::123456789012:ou/o-exampleorgid/ou-examplerootid-exampleouid123</code></p></li>
159    /// <li>
160    /// <p>An ARN of an IAM role, for example: <code>iam::123456789012:role/rolename</code></p></li>
161    /// <li>
162    /// <p>An ARN of an IAM user, for example: <code>iam::123456789012user/username</code></p></li>
163    /// </ul><note>
164    /// <p>Not all resource types can be shared with IAM roles and users. For more information, see <a href="https://docs.aws.amazon.com/ram/latest/userguide/permissions.html#permissions-rbp-supported-resource-types">Sharing with IAM roles and users</a> in the <i>Resource Access Manager User Guide</i>.</p>
165    /// </note>
166    pub fn principals(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
167        self.inner = self.inner.principals(input.into());
168        self
169    }
170    /// <p>Specifies a list of principals to whom you want to the resource share. This can be <code>null</code> if you want to add only resources.</p>
171    /// <p>What the principals can do with the resources in the share is determined by the RAM permissions that you associate with the resource share. See <code>AssociateResourceSharePermission</code>.</p>
172    /// <p>You can include the following values:</p>
173    /// <ul>
174    /// <li>
175    /// <p>An Amazon Web Services account ID, for example: <code>123456789012</code></p></li>
176    /// <li>
177    /// <p>An <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an organization in Organizations, for example: <code>organizations::123456789012:organization/o-exampleorgid</code></p></li>
178    /// <li>
179    /// <p>An ARN of an organizational unit (OU) in Organizations, for example: <code>organizations::123456789012:ou/o-exampleorgid/ou-examplerootid-exampleouid123</code></p></li>
180    /// <li>
181    /// <p>An ARN of an IAM role, for example: <code>iam::123456789012:role/rolename</code></p></li>
182    /// <li>
183    /// <p>An ARN of an IAM user, for example: <code>iam::123456789012user/username</code></p></li>
184    /// </ul><note>
185    /// <p>Not all resource types can be shared with IAM roles and users. For more information, see <a href="https://docs.aws.amazon.com/ram/latest/userguide/permissions.html#permissions-rbp-supported-resource-types">Sharing with IAM roles and users</a> in the <i>Resource Access Manager User Guide</i>.</p>
186    /// </note>
187    pub fn set_principals(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
188        self.inner = self.inner.set_principals(input);
189        self
190    }
191    /// <p>Specifies a list of principals to whom you want to the resource share. This can be <code>null</code> if you want to add only resources.</p>
192    /// <p>What the principals can do with the resources in the share is determined by the RAM permissions that you associate with the resource share. See <code>AssociateResourceSharePermission</code>.</p>
193    /// <p>You can include the following values:</p>
194    /// <ul>
195    /// <li>
196    /// <p>An Amazon Web Services account ID, for example: <code>123456789012</code></p></li>
197    /// <li>
198    /// <p>An <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Name (ARN)</a> of an organization in Organizations, for example: <code>organizations::123456789012:organization/o-exampleorgid</code></p></li>
199    /// <li>
200    /// <p>An ARN of an organizational unit (OU) in Organizations, for example: <code>organizations::123456789012:ou/o-exampleorgid/ou-examplerootid-exampleouid123</code></p></li>
201    /// <li>
202    /// <p>An ARN of an IAM role, for example: <code>iam::123456789012:role/rolename</code></p></li>
203    /// <li>
204    /// <p>An ARN of an IAM user, for example: <code>iam::123456789012user/username</code></p></li>
205    /// </ul><note>
206    /// <p>Not all resource types can be shared with IAM roles and users. For more information, see <a href="https://docs.aws.amazon.com/ram/latest/userguide/permissions.html#permissions-rbp-supported-resource-types">Sharing with IAM roles and users</a> in the <i>Resource Access Manager User Guide</i>.</p>
207    /// </note>
208    pub fn get_principals(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
209        self.inner.get_principals()
210    }
211    /// <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>
212    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
213    /// <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>
214    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
215        self.inner = self.inner.client_token(input.into());
216        self
217    }
218    /// <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>
219    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
220    /// <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>
221    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222        self.inner = self.inner.set_client_token(input);
223        self
224    }
225    /// <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>
226    /// <p>If you don't provide this value, then Amazon Web Services generates a random one for you.</p>
227    /// <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>
228    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
229        self.inner.get_client_token()
230    }
231    ///
232    /// Appends an item to `sources`.
233    ///
234    /// To override the contents of this collection use [`set_sources`](Self::set_sources).
235    ///
236    /// <p>Specifies from which source accounts the service principal has access to the resources in this resource share.</p>
237    pub fn sources(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
238        self.inner = self.inner.sources(input.into());
239        self
240    }
241    /// <p>Specifies from which source accounts the service principal has access to the resources in this resource share.</p>
242    pub fn set_sources(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
243        self.inner = self.inner.set_sources(input);
244        self
245    }
246    /// <p>Specifies from which source accounts the service principal has access to the resources in this resource share.</p>
247    pub fn get_sources(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
248        self.inner.get_sources()
249    }
250}