aws_sdk_elasticache/operation/modify_user/
_modify_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 ModifyUserInput {
6    /// <p>The ID of the user.</p>
7    pub user_id: ::std::option::Option<::std::string::String>,
8    /// <p>Access permissions string used for this user.</p>
9    pub access_string: ::std::option::Option<::std::string::String>,
10    /// <p>Adds additional user permissions to the access string.</p>
11    pub append_access_string: ::std::option::Option<::std::string::String>,
12    /// <p>The passwords belonging to the user. You are allowed up to two.</p>
13    pub passwords: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
14    /// <p>Indicates no password is required for the user.</p>
15    pub no_password_required: ::std::option::Option<bool>,
16    /// <p>Specifies how to authenticate the user.</p>
17    pub authentication_mode: ::std::option::Option<crate::types::AuthenticationMode>,
18    /// <p>Modifies the engine listed for a user. The options are valkey or redis.</p>
19    pub engine: ::std::option::Option<::std::string::String>,
20}
21impl ModifyUserInput {
22    /// <p>The ID of the user.</p>
23    pub fn user_id(&self) -> ::std::option::Option<&str> {
24        self.user_id.as_deref()
25    }
26    /// <p>Access permissions string used for this user.</p>
27    pub fn access_string(&self) -> ::std::option::Option<&str> {
28        self.access_string.as_deref()
29    }
30    /// <p>Adds additional user permissions to the access string.</p>
31    pub fn append_access_string(&self) -> ::std::option::Option<&str> {
32        self.append_access_string.as_deref()
33    }
34    /// <p>The passwords belonging to the user. You are allowed up to two.</p>
35    ///
36    /// 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()`.
37    pub fn passwords(&self) -> &[::std::string::String] {
38        self.passwords.as_deref().unwrap_or_default()
39    }
40    /// <p>Indicates no password is required for the user.</p>
41    pub fn no_password_required(&self) -> ::std::option::Option<bool> {
42        self.no_password_required
43    }
44    /// <p>Specifies how to authenticate the user.</p>
45    pub fn authentication_mode(&self) -> ::std::option::Option<&crate::types::AuthenticationMode> {
46        self.authentication_mode.as_ref()
47    }
48    /// <p>Modifies the engine listed for a user. The options are valkey or redis.</p>
49    pub fn engine(&self) -> ::std::option::Option<&str> {
50        self.engine.as_deref()
51    }
52}
53impl ModifyUserInput {
54    /// Creates a new builder-style object to manufacture [`ModifyUserInput`](crate::operation::modify_user::ModifyUserInput).
55    pub fn builder() -> crate::operation::modify_user::builders::ModifyUserInputBuilder {
56        crate::operation::modify_user::builders::ModifyUserInputBuilder::default()
57    }
58}
59
60/// A builder for [`ModifyUserInput`](crate::operation::modify_user::ModifyUserInput).
61#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
62#[non_exhaustive]
63pub struct ModifyUserInputBuilder {
64    pub(crate) user_id: ::std::option::Option<::std::string::String>,
65    pub(crate) access_string: ::std::option::Option<::std::string::String>,
66    pub(crate) append_access_string: ::std::option::Option<::std::string::String>,
67    pub(crate) passwords: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
68    pub(crate) no_password_required: ::std::option::Option<bool>,
69    pub(crate) authentication_mode: ::std::option::Option<crate::types::AuthenticationMode>,
70    pub(crate) engine: ::std::option::Option<::std::string::String>,
71}
72impl ModifyUserInputBuilder {
73    /// <p>The ID of the user.</p>
74    /// This field is required.
75    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
76        self.user_id = ::std::option::Option::Some(input.into());
77        self
78    }
79    /// <p>The ID of the user.</p>
80    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
81        self.user_id = input;
82        self
83    }
84    /// <p>The ID of the user.</p>
85    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
86        &self.user_id
87    }
88    /// <p>Access permissions string used for this user.</p>
89    pub fn access_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
90        self.access_string = ::std::option::Option::Some(input.into());
91        self
92    }
93    /// <p>Access permissions string used for this user.</p>
94    pub fn set_access_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
95        self.access_string = input;
96        self
97    }
98    /// <p>Access permissions string used for this user.</p>
99    pub fn get_access_string(&self) -> &::std::option::Option<::std::string::String> {
100        &self.access_string
101    }
102    /// <p>Adds additional user permissions to the access string.</p>
103    pub fn append_access_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.append_access_string = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>Adds additional user permissions to the access string.</p>
108    pub fn set_append_access_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.append_access_string = input;
110        self
111    }
112    /// <p>Adds additional user permissions to the access string.</p>
113    pub fn get_append_access_string(&self) -> &::std::option::Option<::std::string::String> {
114        &self.append_access_string
115    }
116    /// Appends an item to `passwords`.
117    ///
118    /// To override the contents of this collection use [`set_passwords`](Self::set_passwords).
119    ///
120    /// <p>The passwords belonging to the user. You are allowed up to two.</p>
121    pub fn passwords(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        let mut v = self.passwords.unwrap_or_default();
123        v.push(input.into());
124        self.passwords = ::std::option::Option::Some(v);
125        self
126    }
127    /// <p>The passwords belonging to the user. You are allowed up to two.</p>
128    pub fn set_passwords(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
129        self.passwords = input;
130        self
131    }
132    /// <p>The passwords belonging to the user. You are allowed up to two.</p>
133    pub fn get_passwords(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
134        &self.passwords
135    }
136    /// <p>Indicates no password is required for the user.</p>
137    pub fn no_password_required(mut self, input: bool) -> Self {
138        self.no_password_required = ::std::option::Option::Some(input);
139        self
140    }
141    /// <p>Indicates no password is required for the user.</p>
142    pub fn set_no_password_required(mut self, input: ::std::option::Option<bool>) -> Self {
143        self.no_password_required = input;
144        self
145    }
146    /// <p>Indicates no password is required for the user.</p>
147    pub fn get_no_password_required(&self) -> &::std::option::Option<bool> {
148        &self.no_password_required
149    }
150    /// <p>Specifies how to authenticate the user.</p>
151    pub fn authentication_mode(mut self, input: crate::types::AuthenticationMode) -> Self {
152        self.authentication_mode = ::std::option::Option::Some(input);
153        self
154    }
155    /// <p>Specifies how to authenticate the user.</p>
156    pub fn set_authentication_mode(mut self, input: ::std::option::Option<crate::types::AuthenticationMode>) -> Self {
157        self.authentication_mode = input;
158        self
159    }
160    /// <p>Specifies how to authenticate the user.</p>
161    pub fn get_authentication_mode(&self) -> &::std::option::Option<crate::types::AuthenticationMode> {
162        &self.authentication_mode
163    }
164    /// <p>Modifies the engine listed for a user. The options are valkey or redis.</p>
165    pub fn engine(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.engine = ::std::option::Option::Some(input.into());
167        self
168    }
169    /// <p>Modifies the engine listed for a user. The options are valkey or redis.</p>
170    pub fn set_engine(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.engine = input;
172        self
173    }
174    /// <p>Modifies the engine listed for a user. The options are valkey or redis.</p>
175    pub fn get_engine(&self) -> &::std::option::Option<::std::string::String> {
176        &self.engine
177    }
178    /// Consumes the builder and constructs a [`ModifyUserInput`](crate::operation::modify_user::ModifyUserInput).
179    pub fn build(self) -> ::std::result::Result<crate::operation::modify_user::ModifyUserInput, ::aws_smithy_types::error::operation::BuildError> {
180        ::std::result::Result::Ok(crate::operation::modify_user::ModifyUserInput {
181            user_id: self.user_id,
182            access_string: self.access_string,
183            append_access_string: self.append_access_string,
184            passwords: self.passwords,
185            no_password_required: self.no_password_required,
186            authentication_mode: self.authentication_mode,
187            engine: self.engine,
188        })
189    }
190}