aws_sdk_cognitoidentityprovider/operation/update_user_attributes/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_user_attributes::_update_user_attributes_output::UpdateUserAttributesOutputBuilder;
3
4pub use crate::operation::update_user_attributes::_update_user_attributes_input::UpdateUserAttributesInputBuilder;
5
6impl crate::operation::update_user_attributes::builders::UpdateUserAttributesInputBuilder {
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::update_user_attributes::UpdateUserAttributesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_user_attributes::UpdateUserAttributesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_user_attributes();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateUserAttributes`.
24///
25/// <p>Updates the currently signed-in user's attributes. To delete an attribute from the user, submit the attribute in your API request with a blank value.</p>
26/// <p>For custom attributes, you must add a <code>custom:</code> prefix to the attribute name, for example <code>custom:department</code>.</p>
27/// <p>Authorize this action with a signed-in user's access token. It must include the scope <code>aws.cognito.signin.user.admin</code>.</p><note>
28/// <p>Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see <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>
29/// </note> <note>
30/// <p>This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with <a href="https://console.aws.amazon.com/pinpoint/home/">Amazon Pinpoint</a>. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.</p>
31/// <p>If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In <i> <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html">sandbox mode</a> </i>, you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html"> SMS message settings for Amazon Cognito user pools</a> in the <i>Amazon Cognito Developer Guide</i>.</p>
32/// </note>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct UpdateUserAttributesFluentBuilder {
35    handle: ::std::sync::Arc<crate::client::Handle>,
36    inner: crate::operation::update_user_attributes::builders::UpdateUserAttributesInputBuilder,
37    config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40    crate::client::customize::internal::CustomizableSend<
41        crate::operation::update_user_attributes::UpdateUserAttributesOutput,
42        crate::operation::update_user_attributes::UpdateUserAttributesError,
43    > for UpdateUserAttributesFluentBuilder
44{
45    fn send(
46        self,
47        config_override: crate::config::Builder,
48    ) -> crate::client::customize::internal::BoxFuture<
49        crate::client::customize::internal::SendResult<
50            crate::operation::update_user_attributes::UpdateUserAttributesOutput,
51            crate::operation::update_user_attributes::UpdateUserAttributesError,
52        >,
53    > {
54        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55    }
56}
57impl UpdateUserAttributesFluentBuilder {
58    /// Creates a new `UpdateUserAttributesFluentBuilder`.
59    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60        Self {
61            handle,
62            inner: ::std::default::Default::default(),
63            config_override: ::std::option::Option::None,
64        }
65    }
66    /// Access the UpdateUserAttributes as a reference.
67    pub fn as_input(&self) -> &crate::operation::update_user_attributes::builders::UpdateUserAttributesInputBuilder {
68        &self.inner
69    }
70    /// Sends the request and returns the response.
71    ///
72    /// If an error occurs, an `SdkError` will be returned with additional details that
73    /// can be matched against.
74    ///
75    /// By default, any retryable failures will be retried twice. Retry behavior
76    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77    /// set when configuring the client.
78    pub async fn send(
79        self,
80    ) -> ::std::result::Result<
81        crate::operation::update_user_attributes::UpdateUserAttributesOutput,
82        ::aws_smithy_runtime_api::client::result::SdkError<
83            crate::operation::update_user_attributes::UpdateUserAttributesError,
84            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85        >,
86    > {
87        let input = self
88            .inner
89            .build()
90            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91        let runtime_plugins = crate::operation::update_user_attributes::UpdateUserAttributes::operation_runtime_plugins(
92            self.handle.runtime_plugins.clone(),
93            &self.handle.conf,
94            self.config_override,
95        );
96        crate::operation::update_user_attributes::UpdateUserAttributes::orchestrate(&runtime_plugins, input).await
97    }
98
99    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100    pub fn customize(
101        self,
102    ) -> crate::client::customize::CustomizableOperation<
103        crate::operation::update_user_attributes::UpdateUserAttributesOutput,
104        crate::operation::update_user_attributes::UpdateUserAttributesError,
105        Self,
106    > {
107        crate::client::customize::CustomizableOperation::new(self)
108    }
109    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110        self.set_config_override(::std::option::Option::Some(config_override.into()));
111        self
112    }
113
114    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115        self.config_override = config_override;
116        self
117    }
118    ///
119    /// Appends an item to `UserAttributes`.
120    ///
121    /// To override the contents of this collection use [`set_user_attributes`](Self::set_user_attributes).
122    ///
123    /// <p>An array of name-value pairs representing user attributes.</p>
124    /// <p>For custom attributes, you must add a <code>custom:</code> prefix to the attribute name.</p>
125    /// <p>If you have set an attribute to require verification before Amazon Cognito updates its value, this request doesn’t immediately update the value of that attribute. After your user receives and responds to a verification message to verify the new value, Amazon Cognito updates the attribute value. Your user can sign in and receive messages with the original attribute value until they verify the new value.</p>
126    pub fn user_attributes(mut self, input: crate::types::AttributeType) -> Self {
127        self.inner = self.inner.user_attributes(input);
128        self
129    }
130    /// <p>An array of name-value pairs representing user attributes.</p>
131    /// <p>For custom attributes, you must add a <code>custom:</code> prefix to the attribute name.</p>
132    /// <p>If you have set an attribute to require verification before Amazon Cognito updates its value, this request doesn’t immediately update the value of that attribute. After your user receives and responds to a verification message to verify the new value, Amazon Cognito updates the attribute value. Your user can sign in and receive messages with the original attribute value until they verify the new value.</p>
133    pub fn set_user_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AttributeType>>) -> Self {
134        self.inner = self.inner.set_user_attributes(input);
135        self
136    }
137    /// <p>An array of name-value pairs representing user attributes.</p>
138    /// <p>For custom attributes, you must add a <code>custom:</code> prefix to the attribute name.</p>
139    /// <p>If you have set an attribute to require verification before Amazon Cognito updates its value, this request doesn’t immediately update the value of that attribute. After your user receives and responds to a verification message to verify the new value, Amazon Cognito updates the attribute value. Your user can sign in and receive messages with the original attribute value until they verify the new value.</p>
140    pub fn get_user_attributes(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AttributeType>> {
141        self.inner.get_user_attributes()
142    }
143    /// <p>A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for <code>aws.cognito.signin.user.admin</code>.</p>
144    pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.access_token(input.into());
146        self
147    }
148    /// <p>A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for <code>aws.cognito.signin.user.admin</code>.</p>
149    pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_access_token(input);
151        self
152    }
153    /// <p>A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for <code>aws.cognito.signin.user.admin</code>.</p>
154    pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_access_token()
156    }
157    ///
158    /// Adds a key-value pair to `ClientMetadata`.
159    ///
160    /// To override the contents of this collection use [`set_client_metadata`](Self::set_client_metadata).
161    ///
162    /// <p>A map of custom key-value pairs that you can provide as input for any custom workflows that this action initiates.</p>
163    /// <p>You create custom workflows by assigning Lambda functions to user pool triggers. When you use the UpdateUserAttributes API action, Amazon Cognito invokes the function that is assigned to the <i>custom message</i> trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a <code>clientMetadata</code> attribute, which provides the data that you assigned to the ClientMetadata parameter in your UpdateUserAttributes request. In your function code in Lambda, you can process the <code>clientMetadata</code> value to enhance your workflow for your specific needs.</p>
164    /// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Using Lambda triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p><note>
165    /// <p>When you use the <code>ClientMetadata</code> parameter, note that Amazon Cognito won't do the following:</p>
166    /// <ul>
167    /// <li>
168    /// <p>Store the <code>ClientMetadata</code> value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the <code>ClientMetadata</code> parameter serves no purpose.</p></li>
169    /// <li>
170    /// <p>Validate the <code>ClientMetadata</code> value.</p></li>
171    /// <li>
172    /// <p>Encrypt the <code>ClientMetadata</code> value. Don't send sensitive information in this parameter.</p></li>
173    /// </ul>
174    /// </note>
175    pub fn client_metadata(
176        mut self,
177        k: impl ::std::convert::Into<::std::string::String>,
178        v: impl ::std::convert::Into<::std::string::String>,
179    ) -> Self {
180        self.inner = self.inner.client_metadata(k.into(), v.into());
181        self
182    }
183    /// <p>A map of custom key-value pairs that you can provide as input for any custom workflows that this action initiates.</p>
184    /// <p>You create custom workflows by assigning Lambda functions to user pool triggers. When you use the UpdateUserAttributes API action, Amazon Cognito invokes the function that is assigned to the <i>custom message</i> trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a <code>clientMetadata</code> attribute, which provides the data that you assigned to the ClientMetadata parameter in your UpdateUserAttributes request. In your function code in Lambda, you can process the <code>clientMetadata</code> value to enhance your workflow for your specific needs.</p>
185    /// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Using Lambda triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p><note>
186    /// <p>When you use the <code>ClientMetadata</code> parameter, note that Amazon Cognito won't do the following:</p>
187    /// <ul>
188    /// <li>
189    /// <p>Store the <code>ClientMetadata</code> value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the <code>ClientMetadata</code> parameter serves no purpose.</p></li>
190    /// <li>
191    /// <p>Validate the <code>ClientMetadata</code> value.</p></li>
192    /// <li>
193    /// <p>Encrypt the <code>ClientMetadata</code> value. Don't send sensitive information in this parameter.</p></li>
194    /// </ul>
195    /// </note>
196    pub fn set_client_metadata(
197        mut self,
198        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
199    ) -> Self {
200        self.inner = self.inner.set_client_metadata(input);
201        self
202    }
203    /// <p>A map of custom key-value pairs that you can provide as input for any custom workflows that this action initiates.</p>
204    /// <p>You create custom workflows by assigning Lambda functions to user pool triggers. When you use the UpdateUserAttributes API action, Amazon Cognito invokes the function that is assigned to the <i>custom message</i> trigger. When Amazon Cognito invokes this function, it passes a JSON payload, which the function receives as input. This payload contains a <code>clientMetadata</code> attribute, which provides the data that you assigned to the ClientMetadata parameter in your UpdateUserAttributes request. In your function code in Lambda, you can process the <code>clientMetadata</code> value to enhance your workflow for your specific needs.</p>
205    /// <p>For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html"> Using Lambda triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p><note>
206    /// <p>When you use the <code>ClientMetadata</code> parameter, note that Amazon Cognito won't do the following:</p>
207    /// <ul>
208    /// <li>
209    /// <p>Store the <code>ClientMetadata</code> value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the <code>ClientMetadata</code> parameter serves no purpose.</p></li>
210    /// <li>
211    /// <p>Validate the <code>ClientMetadata</code> value.</p></li>
212    /// <li>
213    /// <p>Encrypt the <code>ClientMetadata</code> value. Don't send sensitive information in this parameter.</p></li>
214    /// </ul>
215    /// </note>
216    pub fn get_client_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
217        self.inner.get_client_metadata()
218    }
219}