aws_sdk_elasticache/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 ID of the user.</p>
7    pub user_id: ::std::option::Option<::std::string::String>,
8    /// <p>The username of the user.</p>
9    pub user_name: ::std::option::Option<::std::string::String>,
10    /// <p>The options are valkey or redis.</p>
11    pub engine: ::std::option::Option<::std::string::String>,
12    /// <p>Passwords used for this user. You can create up to two passwords for each user.</p>
13    pub passwords: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14    /// <p>Access permissions string used for this user.</p>
15    pub access_string: ::std::option::Option<::std::string::String>,
16    /// <p>Indicates a password is not required for this user.</p>
17    pub no_password_required: ::std::option::Option<bool>,
18    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
19    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
20    /// <p>Specifies how to authenticate the user.</p>
21    pub authentication_mode: ::std::option::Option<crate::types::AuthenticationMode>,
22}
23impl CreateUserInput {
24    /// <p>The ID of the user.</p>
25    pub fn user_id(&self) -> ::std::option::Option<&str> {
26        self.user_id.as_deref()
27    }
28    /// <p>The username of the user.</p>
29    pub fn user_name(&self) -> ::std::option::Option<&str> {
30        self.user_name.as_deref()
31    }
32    /// <p>The options are valkey or redis.</p>
33    pub fn engine(&self) -> ::std::option::Option<&str> {
34        self.engine.as_deref()
35    }
36    /// <p>Passwords used for this user. You can create up to two passwords for each user.</p>
37    ///
38    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.passwords.is_none()`.
39    pub fn passwords(&self) -> &[::std::string::String] {
40        self.passwords.as_deref().unwrap_or_default()
41    }
42    /// <p>Access permissions string used for this user.</p>
43    pub fn access_string(&self) -> ::std::option::Option<&str> {
44        self.access_string.as_deref()
45    }
46    /// <p>Indicates a password is not required for this user.</p>
47    pub fn no_password_required(&self) -> ::std::option::Option<bool> {
48        self.no_password_required
49    }
50    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
51    ///
52    /// 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()`.
53    pub fn tags(&self) -> &[crate::types::Tag] {
54        self.tags.as_deref().unwrap_or_default()
55    }
56    /// <p>Specifies how to authenticate the user.</p>
57    pub fn authentication_mode(&self) -> ::std::option::Option<&crate::types::AuthenticationMode> {
58        self.authentication_mode.as_ref()
59    }
60}
61impl CreateUserInput {
62    /// Creates a new builder-style object to manufacture [`CreateUserInput`](crate::operation::create_user::CreateUserInput).
63    pub fn builder() -> crate::operation::create_user::builders::CreateUserInputBuilder {
64        crate::operation::create_user::builders::CreateUserInputBuilder::default()
65    }
66}
67
68/// A builder for [`CreateUserInput`](crate::operation::create_user::CreateUserInput).
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
70#[non_exhaustive]
71pub struct CreateUserInputBuilder {
72    pub(crate) user_id: ::std::option::Option<::std::string::String>,
73    pub(crate) user_name: ::std::option::Option<::std::string::String>,
74    pub(crate) engine: ::std::option::Option<::std::string::String>,
75    pub(crate) passwords: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
76    pub(crate) access_string: ::std::option::Option<::std::string::String>,
77    pub(crate) no_password_required: ::std::option::Option<bool>,
78    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
79    pub(crate) authentication_mode: ::std::option::Option<crate::types::AuthenticationMode>,
80}
81impl CreateUserInputBuilder {
82    /// <p>The ID of the user.</p>
83    /// This field is required.
84    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85        self.user_id = ::std::option::Option::Some(input.into());
86        self
87    }
88    /// <p>The ID of the user.</p>
89    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90        self.user_id = input;
91        self
92    }
93    /// <p>The ID of the user.</p>
94    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
95        &self.user_id
96    }
97    /// <p>The username of the user.</p>
98    /// This field is required.
99    pub fn user_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100        self.user_name = ::std::option::Option::Some(input.into());
101        self
102    }
103    /// <p>The username of the user.</p>
104    pub fn set_user_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105        self.user_name = input;
106        self
107    }
108    /// <p>The username of the user.</p>
109    pub fn get_user_name(&self) -> &::std::option::Option<::std::string::String> {
110        &self.user_name
111    }
112    /// <p>The options are valkey or redis.</p>
113    /// This field is required.
114    pub fn engine(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.engine = ::std::option::Option::Some(input.into());
116        self
117    }
118    /// <p>The options are valkey or redis.</p>
119    pub fn set_engine(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.engine = input;
121        self
122    }
123    /// <p>The options are valkey or redis.</p>
124    pub fn get_engine(&self) -> &::std::option::Option<::std::string::String> {
125        &self.engine
126    }
127    /// Appends an item to `passwords`.
128    ///
129    /// To override the contents of this collection use [`set_passwords`](Self::set_passwords).
130    ///
131    /// <p>Passwords used for this user. You can create up to two passwords for each user.</p>
132    pub fn passwords(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        let mut v = self.passwords.unwrap_or_default();
134        v.push(input.into());
135        self.passwords = ::std::option::Option::Some(v);
136        self
137    }
138    /// <p>Passwords used for this user. You can create up to two passwords for each user.</p>
139    pub fn set_passwords(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
140        self.passwords = input;
141        self
142    }
143    /// <p>Passwords used for this user. You can create up to two passwords for each user.</p>
144    pub fn get_passwords(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
145        &self.passwords
146    }
147    /// <p>Access permissions string used for this user.</p>
148    /// This field is required.
149    pub fn access_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.access_string = ::std::option::Option::Some(input.into());
151        self
152    }
153    /// <p>Access permissions string used for this user.</p>
154    pub fn set_access_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.access_string = input;
156        self
157    }
158    /// <p>Access permissions string used for this user.</p>
159    pub fn get_access_string(&self) -> &::std::option::Option<::std::string::String> {
160        &self.access_string
161    }
162    /// <p>Indicates a password is not required for this user.</p>
163    pub fn no_password_required(mut self, input: bool) -> Self {
164        self.no_password_required = ::std::option::Option::Some(input);
165        self
166    }
167    /// <p>Indicates a password is not required for this user.</p>
168    pub fn set_no_password_required(mut self, input: ::std::option::Option<bool>) -> Self {
169        self.no_password_required = input;
170        self
171    }
172    /// <p>Indicates a password is not required for this user.</p>
173    pub fn get_no_password_required(&self) -> &::std::option::Option<bool> {
174        &self.no_password_required
175    }
176    /// Appends an item to `tags`.
177    ///
178    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
179    ///
180    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
181    pub fn tags(mut self, input: crate::types::Tag) -> Self {
182        let mut v = self.tags.unwrap_or_default();
183        v.push(input);
184        self.tags = ::std::option::Option::Some(v);
185        self
186    }
187    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
188    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
189        self.tags = input;
190        self
191    }
192    /// <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>
193    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
194        &self.tags
195    }
196    /// <p>Specifies how to authenticate the user.</p>
197    pub fn authentication_mode(mut self, input: crate::types::AuthenticationMode) -> Self {
198        self.authentication_mode = ::std::option::Option::Some(input);
199        self
200    }
201    /// <p>Specifies how to authenticate the user.</p>
202    pub fn set_authentication_mode(mut self, input: ::std::option::Option<crate::types::AuthenticationMode>) -> Self {
203        self.authentication_mode = input;
204        self
205    }
206    /// <p>Specifies how to authenticate the user.</p>
207    pub fn get_authentication_mode(&self) -> &::std::option::Option<crate::types::AuthenticationMode> {
208        &self.authentication_mode
209    }
210    /// Consumes the builder and constructs a [`CreateUserInput`](crate::operation::create_user::CreateUserInput).
211    pub fn build(self) -> ::std::result::Result<crate::operation::create_user::CreateUserInput, ::aws_smithy_types::error::operation::BuildError> {
212        ::std::result::Result::Ok(crate::operation::create_user::CreateUserInput {
213            user_id: self.user_id,
214            user_name: self.user_name,
215            engine: self.engine,
216            passwords: self.passwords,
217            access_string: self.access_string,
218            no_password_required: self.no_password_required,
219            tags: self.tags,
220            authentication_mode: self.authentication_mode,
221        })
222    }
223}