aws_sdk_connect/operation/create_user/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_user::_create_user_output::CreateUserOutputBuilder;
3
4pub use crate::operation::create_user::_create_user_input::CreateUserInputBuilder;
5
6impl crate::operation::create_user::builders::CreateUserInputBuilder {
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_user::CreateUserOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_user::CreateUserError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_user();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateUser`.
24///
25/// <p>Creates a user account for the specified Amazon Connect instance.</p><important>
26/// <p>Certain <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_UserIdentityInfo.html">UserIdentityInfo</a> parameters are required in some situations. For example, <code>Email</code>, <code>FirstName</code> and <code>LastName</code> are required if you are using Amazon Connect or SAML for identity management.</p>
27/// </important>
28/// <p>For information about how to create users using the Amazon Connect admin website, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/user-management.html">Add Users</a> in the <i>Amazon Connect Administrator Guide</i>.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct CreateUserFluentBuilder {
31    handle: ::std::sync::Arc<crate::client::Handle>,
32    inner: crate::operation::create_user::builders::CreateUserInputBuilder,
33    config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36    crate::client::customize::internal::CustomizableSend<
37        crate::operation::create_user::CreateUserOutput,
38        crate::operation::create_user::CreateUserError,
39    > for CreateUserFluentBuilder
40{
41    fn send(
42        self,
43        config_override: crate::config::Builder,
44    ) -> crate::client::customize::internal::BoxFuture<
45        crate::client::customize::internal::SendResult<
46            crate::operation::create_user::CreateUserOutput,
47            crate::operation::create_user::CreateUserError,
48        >,
49    > {
50        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51    }
52}
53impl CreateUserFluentBuilder {
54    /// Creates a new `CreateUserFluentBuilder`.
55    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56        Self {
57            handle,
58            inner: ::std::default::Default::default(),
59            config_override: ::std::option::Option::None,
60        }
61    }
62    /// Access the CreateUser as a reference.
63    pub fn as_input(&self) -> &crate::operation::create_user::builders::CreateUserInputBuilder {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::create_user::CreateUserOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::create_user::CreateUserError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::create_user::CreateUser::operation_runtime_plugins(
88            self.handle.runtime_plugins.clone(),
89            &self.handle.conf,
90            self.config_override,
91        );
92        crate::operation::create_user::CreateUser::orchestrate(&runtime_plugins, input).await
93    }
94
95    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96    pub fn customize(
97        self,
98    ) -> crate::client::customize::CustomizableOperation<
99        crate::operation::create_user::CreateUserOutput,
100        crate::operation::create_user::CreateUserError,
101        Self,
102    > {
103        crate::client::customize::CustomizableOperation::new(self)
104    }
105    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106        self.set_config_override(::std::option::Option::Some(config_override.into()));
107        self
108    }
109
110    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111        self.config_override = config_override;
112        self
113    }
114    /// <p>The user name for the account. For instances not using SAML for identity management, the user name can include up to 20 characters. If you are using SAML for identity management, the user name can include up to 64 characters from \[a-zA-Z0-9_-.\@\]+.</p>
115    /// <p>Username can include @ only if used in an email format. For example:</p>
116    /// <ul>
117    /// <li>
118    /// <p>Correct: testuser</p></li>
119    /// <li>
120    /// <p>Correct: testuser@example.com</p></li>
121    /// <li>
122    /// <p>Incorrect: testuser@example</p></li>
123    /// </ul>
124    pub fn username(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.inner = self.inner.username(input.into());
126        self
127    }
128    /// <p>The user name for the account. For instances not using SAML for identity management, the user name can include up to 20 characters. If you are using SAML for identity management, the user name can include up to 64 characters from \[a-zA-Z0-9_-.\@\]+.</p>
129    /// <p>Username can include @ only if used in an email format. For example:</p>
130    /// <ul>
131    /// <li>
132    /// <p>Correct: testuser</p></li>
133    /// <li>
134    /// <p>Correct: testuser@example.com</p></li>
135    /// <li>
136    /// <p>Incorrect: testuser@example</p></li>
137    /// </ul>
138    pub fn set_username(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.inner = self.inner.set_username(input);
140        self
141    }
142    /// <p>The user name for the account. For instances not using SAML for identity management, the user name can include up to 20 characters. If you are using SAML for identity management, the user name can include up to 64 characters from \[a-zA-Z0-9_-.\@\]+.</p>
143    /// <p>Username can include @ only if used in an email format. For example:</p>
144    /// <ul>
145    /// <li>
146    /// <p>Correct: testuser</p></li>
147    /// <li>
148    /// <p>Correct: testuser@example.com</p></li>
149    /// <li>
150    /// <p>Incorrect: testuser@example</p></li>
151    /// </ul>
152    pub fn get_username(&self) -> &::std::option::Option<::std::string::String> {
153        self.inner.get_username()
154    }
155    /// <p>The password for the user account. A password is required if you are using Amazon Connect for identity management. Otherwise, it is an error to include a password.</p>
156    pub fn password(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157        self.inner = self.inner.password(input.into());
158        self
159    }
160    /// <p>The password for the user account. A password is required if you are using Amazon Connect for identity management. Otherwise, it is an error to include a password.</p>
161    pub fn set_password(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162        self.inner = self.inner.set_password(input);
163        self
164    }
165    /// <p>The password for the user account. A password is required if you are using Amazon Connect for identity management. Otherwise, it is an error to include a password.</p>
166    pub fn get_password(&self) -> &::std::option::Option<::std::string::String> {
167        self.inner.get_password()
168    }
169    /// <p>The information about the identity of the user.</p>
170    pub fn identity_info(mut self, input: crate::types::UserIdentityInfo) -> Self {
171        self.inner = self.inner.identity_info(input);
172        self
173    }
174    /// <p>The information about the identity of the user.</p>
175    pub fn set_identity_info(mut self, input: ::std::option::Option<crate::types::UserIdentityInfo>) -> Self {
176        self.inner = self.inner.set_identity_info(input);
177        self
178    }
179    /// <p>The information about the identity of the user.</p>
180    pub fn get_identity_info(&self) -> &::std::option::Option<crate::types::UserIdentityInfo> {
181        self.inner.get_identity_info()
182    }
183    /// <p>The phone settings for the user.</p>
184    pub fn phone_config(mut self, input: crate::types::UserPhoneConfig) -> Self {
185        self.inner = self.inner.phone_config(input);
186        self
187    }
188    /// <p>The phone settings for the user.</p>
189    pub fn set_phone_config(mut self, input: ::std::option::Option<crate::types::UserPhoneConfig>) -> Self {
190        self.inner = self.inner.set_phone_config(input);
191        self
192    }
193    /// <p>The phone settings for the user.</p>
194    pub fn get_phone_config(&self) -> &::std::option::Option<crate::types::UserPhoneConfig> {
195        self.inner.get_phone_config()
196    }
197    /// <p>The identifier of the user account in the directory used for identity management. If Amazon Connect cannot access the directory, you can specify this identifier to authenticate users. If you include the identifier, we assume that Amazon Connect cannot access the directory. Otherwise, the identity information is used to authenticate users from your directory.</p>
198    /// <p>This parameter is required if you are using an existing directory for identity management in Amazon Connect when Amazon Connect cannot access your directory to authenticate users. If you are using SAML for identity management and include this parameter, an error is returned.</p>
199    pub fn directory_user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
200        self.inner = self.inner.directory_user_id(input.into());
201        self
202    }
203    /// <p>The identifier of the user account in the directory used for identity management. If Amazon Connect cannot access the directory, you can specify this identifier to authenticate users. If you include the identifier, we assume that Amazon Connect cannot access the directory. Otherwise, the identity information is used to authenticate users from your directory.</p>
204    /// <p>This parameter is required if you are using an existing directory for identity management in Amazon Connect when Amazon Connect cannot access your directory to authenticate users. If you are using SAML for identity management and include this parameter, an error is returned.</p>
205    pub fn set_directory_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
206        self.inner = self.inner.set_directory_user_id(input);
207        self
208    }
209    /// <p>The identifier of the user account in the directory used for identity management. If Amazon Connect cannot access the directory, you can specify this identifier to authenticate users. If you include the identifier, we assume that Amazon Connect cannot access the directory. Otherwise, the identity information is used to authenticate users from your directory.</p>
210    /// <p>This parameter is required if you are using an existing directory for identity management in Amazon Connect when Amazon Connect cannot access your directory to authenticate users. If you are using SAML for identity management and include this parameter, an error is returned.</p>
211    pub fn get_directory_user_id(&self) -> &::std::option::Option<::std::string::String> {
212        self.inner.get_directory_user_id()
213    }
214    ///
215    /// Appends an item to `SecurityProfileIds`.
216    ///
217    /// To override the contents of this collection use [`set_security_profile_ids`](Self::set_security_profile_ids).
218    ///
219    /// <p>The identifier of the security profile for the user.</p>
220    pub fn security_profile_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
221        self.inner = self.inner.security_profile_ids(input.into());
222        self
223    }
224    /// <p>The identifier of the security profile for the user.</p>
225    pub fn set_security_profile_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
226        self.inner = self.inner.set_security_profile_ids(input);
227        self
228    }
229    /// <p>The identifier of the security profile for the user.</p>
230    pub fn get_security_profile_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
231        self.inner.get_security_profile_ids()
232    }
233    /// <p>The identifier of the routing profile for the user.</p>
234    pub fn routing_profile_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
235        self.inner = self.inner.routing_profile_id(input.into());
236        self
237    }
238    /// <p>The identifier of the routing profile for the user.</p>
239    pub fn set_routing_profile_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
240        self.inner = self.inner.set_routing_profile_id(input);
241        self
242    }
243    /// <p>The identifier of the routing profile for the user.</p>
244    pub fn get_routing_profile_id(&self) -> &::std::option::Option<::std::string::String> {
245        self.inner.get_routing_profile_id()
246    }
247    /// <p>The identifier of the hierarchy group for the user.</p>
248    pub fn hierarchy_group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
249        self.inner = self.inner.hierarchy_group_id(input.into());
250        self
251    }
252    /// <p>The identifier of the hierarchy group for the user.</p>
253    pub fn set_hierarchy_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
254        self.inner = self.inner.set_hierarchy_group_id(input);
255        self
256    }
257    /// <p>The identifier of the hierarchy group for the user.</p>
258    pub fn get_hierarchy_group_id(&self) -> &::std::option::Option<::std::string::String> {
259        self.inner.get_hierarchy_group_id()
260    }
261    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
262    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
263        self.inner = self.inner.instance_id(input.into());
264        self
265    }
266    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
267    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
268        self.inner = self.inner.set_instance_id(input);
269        self
270    }
271    /// <p>The identifier of the Amazon Connect instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
272    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
273        self.inner.get_instance_id()
274    }
275    ///
276    /// Adds a key-value pair to `Tags`.
277    ///
278    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
279    ///
280    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
281    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
282        self.inner = self.inner.tags(k.into(), v.into());
283        self
284    }
285    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
286    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
287        self.inner = self.inner.set_tags(input);
288        self
289    }
290    /// <p>The tags used to organize, track, or control access for this resource. For example, { "Tags": {"key1":"value1", "key2":"value2"} }.</p>
291    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
292        self.inner.get_tags()
293    }
294}