aws_sdk_iam/operation/create_user/
_create_user_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateUserInput {
6    /// <p>The path for the user name. For more information about paths, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
7    /// <p>This parameter is optional. If it is not included, it defaults to a slash (/).</p>
8    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
9    pub path: ::std::option::Option<::std::string::String>,
10    /// <p>The name of the user to create.</p>
11    /// <p>IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".</p>
12    pub user_name: ::std::option::Option<::std::string::String>,
13    /// <p>The ARN of the managed policy that is used to set the permissions boundary for the user.</p>
14    /// <p>A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html">Permissions boundaries for IAM entities</a> in the <i>IAM User Guide</i>.</p>
15    /// <p>For more information about policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types">Policy types </a> in the <i>IAM User Guide</i>.</p>
16    pub permissions_boundary: ::std::option::Option<::std::string::String>,
17    /// <p>A list of tags that you want to attach to the new user. Each tag consists of a key name and an associated value. For more information about tagging, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html">Tagging IAM resources</a> in the <i>IAM User Guide</i>.</p><note>
18    /// <p>If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.</p>
19    /// </note>
20    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
21}
22impl CreateUserInput {
23    /// <p>The path for the user name. For more information about paths, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
24    /// <p>This parameter is optional. If it is not included, it defaults to a slash (/).</p>
25    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
26    pub fn path(&self) -> ::std::option::Option<&str> {
27        self.path.as_deref()
28    }
29    /// <p>The name of the user to create.</p>
30    /// <p>IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".</p>
31    pub fn user_name(&self) -> ::std::option::Option<&str> {
32        self.user_name.as_deref()
33    }
34    /// <p>The ARN of the managed policy that is used to set the permissions boundary for the user.</p>
35    /// <p>A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html">Permissions boundaries for IAM entities</a> in the <i>IAM User Guide</i>.</p>
36    /// <p>For more information about policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types">Policy types </a> in the <i>IAM User Guide</i>.</p>
37    pub fn permissions_boundary(&self) -> ::std::option::Option<&str> {
38        self.permissions_boundary.as_deref()
39    }
40    /// <p>A list of tags that you want to attach to the new user. Each tag consists of a key name and an associated value. For more information about tagging, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html">Tagging IAM resources</a> in the <i>IAM User Guide</i>.</p><note>
41    /// <p>If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.</p>
42    /// </note>
43    ///
44    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
45    pub fn tags(&self) -> &[crate::types::Tag] {
46        self.tags.as_deref().unwrap_or_default()
47    }
48}
49impl CreateUserInput {
50    /// Creates a new builder-style object to manufacture [`CreateUserInput`](crate::operation::create_user::CreateUserInput).
51    pub fn builder() -> crate::operation::create_user::builders::CreateUserInputBuilder {
52        crate::operation::create_user::builders::CreateUserInputBuilder::default()
53    }
54}
55
56/// A builder for [`CreateUserInput`](crate::operation::create_user::CreateUserInput).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct CreateUserInputBuilder {
60    pub(crate) path: ::std::option::Option<::std::string::String>,
61    pub(crate) user_name: ::std::option::Option<::std::string::String>,
62    pub(crate) permissions_boundary: ::std::option::Option<::std::string::String>,
63    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
64}
65impl CreateUserInputBuilder {
66    /// <p>The path for the user name. For more information about paths, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
67    /// <p>This parameter is optional. If it is not included, it defaults to a slash (/).</p>
68    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
69    pub fn path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.path = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>The path for the user name. For more information about paths, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
74    /// <p>This parameter is optional. If it is not included, it defaults to a slash (/).</p>
75    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
76    pub fn set_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
77        self.path = input;
78        self
79    }
80    /// <p>The path for the user name. For more information about paths, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html">IAM identifiers</a> in the <i>IAM User Guide</i>.</p>
81    /// <p>This parameter is optional. If it is not included, it defaults to a slash (/).</p>
82    /// <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of either a forward slash (/) by itself or a string that must begin and end with forward slashes. In addition, it can contain any ASCII character from the ! (<code>\u0021</code>) through the DEL character (<code>\u007F</code>), including most punctuation characters, digits, and upper and lowercased letters.</p>
83    pub fn get_path(&self) -> &::std::option::Option<::std::string::String> {
84        &self.path
85    }
86    /// <p>The name of the user to create.</p>
87    /// <p>IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".</p>
88    /// This field is required.
89    pub fn user_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.user_name = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>The name of the user to create.</p>
94    /// <p>IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".</p>
95    pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.user_name = input;
97        self
98    }
99    /// <p>The name of the user to create.</p>
100    /// <p>IAM user, group, role, and policy names must be unique within the account. Names are not distinguished by case. For example, you cannot create resources named both "MyResource" and "myresource".</p>
101    pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
102        &self.user_name
103    }
104    /// <p>The ARN of the managed policy that is used to set the permissions boundary for the user.</p>
105    /// <p>A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html">Permissions boundaries for IAM entities</a> in the <i>IAM User Guide</i>.</p>
106    /// <p>For more information about policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types">Policy types </a> in the <i>IAM User Guide</i>.</p>
107    pub fn permissions_boundary(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108        self.permissions_boundary = ::std::option::Option::Some(input.into());
109        self
110    }
111    /// <p>The ARN of the managed policy that is used to set the permissions boundary for the user.</p>
112    /// <p>A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html">Permissions boundaries for IAM entities</a> in the <i>IAM User Guide</i>.</p>
113    /// <p>For more information about policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types">Policy types </a> in the <i>IAM User Guide</i>.</p>
114    pub fn set_permissions_boundary(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115        self.permissions_boundary = input;
116        self
117    }
118    /// <p>The ARN of the managed policy that is used to set the permissions boundary for the user.</p>
119    /// <p>A permissions boundary policy defines the maximum permissions that identity-based policies can grant to an entity, but does not grant permissions. Permissions boundaries do not define the maximum permissions that a resource-based policy can grant to an entity. To learn more, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html">Permissions boundaries for IAM entities</a> in the <i>IAM User Guide</i>.</p>
120    /// <p>For more information about policy types, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policy-types">Policy types </a> in the <i>IAM User Guide</i>.</p>
121    pub fn get_permissions_boundary(&self) -> &::std::option::Option<::std::string::String> {
122        &self.permissions_boundary
123    }
124    /// Appends an item to `tags`.
125    ///
126    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
127    ///
128    /// <p>A list of tags that you want to attach to the new user. Each tag consists of a key name and an associated value. For more information about tagging, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html">Tagging IAM resources</a> in the <i>IAM User Guide</i>.</p><note>
129    /// <p>If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.</p>
130    /// </note>
131    pub fn tags(mut self, input: crate::types::Tag) -> Self {
132        let mut v = self.tags.unwrap_or_default();
133        v.push(input);
134        self.tags = ::std::option::Option::Some(v);
135        self
136    }
137    /// <p>A list of tags that you want to attach to the new user. Each tag consists of a key name and an associated value. For more information about tagging, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html">Tagging IAM resources</a> in the <i>IAM User Guide</i>.</p><note>
138    /// <p>If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.</p>
139    /// </note>
140    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
141        self.tags = input;
142        self
143    }
144    /// <p>A list of tags that you want to attach to the new user. Each tag consists of a key name and an associated value. For more information about tagging, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html">Tagging IAM resources</a> in the <i>IAM User Guide</i>.</p><note>
145    /// <p>If any one of the tags is invalid or if you exceed the allowed maximum number of tags, then the entire request fails and the resource is not created.</p>
146    /// </note>
147    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
148        &self.tags
149    }
150    /// Consumes the builder and constructs a [`CreateUserInput`](crate::operation::create_user::CreateUserInput).
151    pub fn build(self) -> ::std::result::Result<crate::operation::create_user::CreateUserInput, ::aws_smithy_types::error::operation::BuildError> {
152        ::std::result::Result::Ok(crate::operation::create_user::CreateUserInput {
153            path: self.path,
154            user_name: self.user_name,
155            permissions_boundary: self.permissions_boundary,
156            tags: self.tags,
157        })
158    }
159}