aws_sdk_cognitoidentityprovider/operation/add_custom_attributes/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::add_custom_attributes::_add_custom_attributes_output::AddCustomAttributesOutputBuilder;
3
4pub use crate::operation::add_custom_attributes::_add_custom_attributes_input::AddCustomAttributesInputBuilder;
5
6impl crate::operation::add_custom_attributes::builders::AddCustomAttributesInputBuilder {
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::add_custom_attributes::AddCustomAttributesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::add_custom_attributes::AddCustomAttributesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.add_custom_attributes();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AddCustomAttributes`.
24///
25/// <p>Adds additional user attributes to the user pool schema. Custom attributes can be mutable or immutable and have a <code>custom:</code> or <code>dev:</code> prefix. For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-custom-attributes">Custom attributes</a>.</p><note>
26/// <p>Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.</p>
27/// <p class="title"><b>Learn more</b></p>
28/// <ul>
29/// <li>
30/// <p><a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html">Signing Amazon Web Services API Requests</a></p></li>
31/// <li>
32/// <p><a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html">Using the Amazon Cognito user pools API and user pool endpoints</a></p></li>
33/// </ul>
34/// </note>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct AddCustomAttributesFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::add_custom_attributes::builders::AddCustomAttributesInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::add_custom_attributes::AddCustomAttributesOutput,
44        crate::operation::add_custom_attributes::AddCustomAttributesError,
45    > for AddCustomAttributesFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::add_custom_attributes::AddCustomAttributesOutput,
53            crate::operation::add_custom_attributes::AddCustomAttributesError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl AddCustomAttributesFluentBuilder {
60    /// Creates a new `AddCustomAttributesFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the AddCustomAttributes as a reference.
69    pub fn as_input(&self) -> &crate::operation::add_custom_attributes::builders::AddCustomAttributesInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::add_custom_attributes::AddCustomAttributesOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::add_custom_attributes::AddCustomAttributesError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::add_custom_attributes::AddCustomAttributes::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::add_custom_attributes::AddCustomAttributes::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::add_custom_attributes::AddCustomAttributesOutput,
106        crate::operation::add_custom_attributes::AddCustomAttributesError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>The ID of the user pool where you want to add custom attributes.</p>
121    pub fn user_pool_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.user_pool_id(input.into());
123        self
124    }
125    /// <p>The ID of the user pool where you want to add custom attributes.</p>
126    pub fn set_user_pool_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_user_pool_id(input);
128        self
129    }
130    /// <p>The ID of the user pool where you want to add custom attributes.</p>
131    pub fn get_user_pool_id(&self) -> &::std::option::Option<::std::string::String> {
132        self.inner.get_user_pool_id()
133    }
134    ///
135    /// Appends an item to `CustomAttributes`.
136    ///
137    /// To override the contents of this collection use [`set_custom_attributes`](Self::set_custom_attributes).
138    ///
139    /// <p>An array of custom attribute names and other properties. Sets the following characteristics:</p>
140    /// <dl>
141    /// <dt>
142    /// AttributeDataType
143    /// </dt>
144    /// <dd>
145    /// <p>The expected data type. Can be a string, a number, a date and time, or a boolean.</p>
146    /// </dd>
147    /// <dt>
148    /// Mutable
149    /// </dt>
150    /// <dd>
151    /// <p>If true, you can grant app clients write access to the attribute value. If false, the attribute value can only be set up on sign-up or administrator creation of users.</p>
152    /// </dd>
153    /// <dt>
154    /// Name
155    /// </dt>
156    /// <dd>
157    /// <p>The attribute name. For an attribute like <code>custom:myAttribute</code>, enter <code>myAttribute</code> for this field.</p>
158    /// </dd>
159    /// <dt>
160    /// Required
161    /// </dt>
162    /// <dd>
163    /// <p>When true, users who sign up or are created must set a value for the attribute.</p>
164    /// </dd>
165    /// <dt>
166    /// NumberAttributeConstraints
167    /// </dt>
168    /// <dd>
169    /// <p>The minimum and maximum length of accepted values for a <code>Number</code>-type attribute.</p>
170    /// </dd>
171    /// <dt>
172    /// StringAttributeConstraints
173    /// </dt>
174    /// <dd>
175    /// <p>The minimum and maximum length of accepted values for a <code>String</code>-type attribute.</p>
176    /// </dd>
177    /// <dt>
178    /// DeveloperOnlyAttribute
179    /// </dt>
180    /// <dd>
181    /// <p>This legacy option creates an attribute with a <code>dev:</code> prefix. You can only set the value of a developer-only attribute with administrative IAM credentials.</p>
182    /// </dd>
183    /// </dl>
184    pub fn custom_attributes(mut self, input: crate::types::SchemaAttributeType) -> Self {
185        self.inner = self.inner.custom_attributes(input);
186        self
187    }
188    /// <p>An array of custom attribute names and other properties. Sets the following characteristics:</p>
189    /// <dl>
190    /// <dt>
191    /// AttributeDataType
192    /// </dt>
193    /// <dd>
194    /// <p>The expected data type. Can be a string, a number, a date and time, or a boolean.</p>
195    /// </dd>
196    /// <dt>
197    /// Mutable
198    /// </dt>
199    /// <dd>
200    /// <p>If true, you can grant app clients write access to the attribute value. If false, the attribute value can only be set up on sign-up or administrator creation of users.</p>
201    /// </dd>
202    /// <dt>
203    /// Name
204    /// </dt>
205    /// <dd>
206    /// <p>The attribute name. For an attribute like <code>custom:myAttribute</code>, enter <code>myAttribute</code> for this field.</p>
207    /// </dd>
208    /// <dt>
209    /// Required
210    /// </dt>
211    /// <dd>
212    /// <p>When true, users who sign up or are created must set a value for the attribute.</p>
213    /// </dd>
214    /// <dt>
215    /// NumberAttributeConstraints
216    /// </dt>
217    /// <dd>
218    /// <p>The minimum and maximum length of accepted values for a <code>Number</code>-type attribute.</p>
219    /// </dd>
220    /// <dt>
221    /// StringAttributeConstraints
222    /// </dt>
223    /// <dd>
224    /// <p>The minimum and maximum length of accepted values for a <code>String</code>-type attribute.</p>
225    /// </dd>
226    /// <dt>
227    /// DeveloperOnlyAttribute
228    /// </dt>
229    /// <dd>
230    /// <p>This legacy option creates an attribute with a <code>dev:</code> prefix. You can only set the value of a developer-only attribute with administrative IAM credentials.</p>
231    /// </dd>
232    /// </dl>
233    pub fn set_custom_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SchemaAttributeType>>) -> Self {
234        self.inner = self.inner.set_custom_attributes(input);
235        self
236    }
237    /// <p>An array of custom attribute names and other properties. Sets the following characteristics:</p>
238    /// <dl>
239    /// <dt>
240    /// AttributeDataType
241    /// </dt>
242    /// <dd>
243    /// <p>The expected data type. Can be a string, a number, a date and time, or a boolean.</p>
244    /// </dd>
245    /// <dt>
246    /// Mutable
247    /// </dt>
248    /// <dd>
249    /// <p>If true, you can grant app clients write access to the attribute value. If false, the attribute value can only be set up on sign-up or administrator creation of users.</p>
250    /// </dd>
251    /// <dt>
252    /// Name
253    /// </dt>
254    /// <dd>
255    /// <p>The attribute name. For an attribute like <code>custom:myAttribute</code>, enter <code>myAttribute</code> for this field.</p>
256    /// </dd>
257    /// <dt>
258    /// Required
259    /// </dt>
260    /// <dd>
261    /// <p>When true, users who sign up or are created must set a value for the attribute.</p>
262    /// </dd>
263    /// <dt>
264    /// NumberAttributeConstraints
265    /// </dt>
266    /// <dd>
267    /// <p>The minimum and maximum length of accepted values for a <code>Number</code>-type attribute.</p>
268    /// </dd>
269    /// <dt>
270    /// StringAttributeConstraints
271    /// </dt>
272    /// <dd>
273    /// <p>The minimum and maximum length of accepted values for a <code>String</code>-type attribute.</p>
274    /// </dd>
275    /// <dt>
276    /// DeveloperOnlyAttribute
277    /// </dt>
278    /// <dd>
279    /// <p>This legacy option creates an attribute with a <code>dev:</code> prefix. You can only set the value of a developer-only attribute with administrative IAM credentials.</p>
280    /// </dd>
281    /// </dl>
282    pub fn get_custom_attributes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SchemaAttributeType>> {
283        self.inner.get_custom_attributes()
284    }
285}