aws_sdk_redshift/operation/get_cluster_credentials/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::get_cluster_credentials::_get_cluster_credentials_output::GetClusterCredentialsOutputBuilder;
3
4pub use crate::operation::get_cluster_credentials::_get_cluster_credentials_input::GetClusterCredentialsInputBuilder;
5
6impl crate::operation::get_cluster_credentials::builders::GetClusterCredentialsInputBuilder {
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::get_cluster_credentials::GetClusterCredentialsOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::get_cluster_credentials::GetClusterCredentialsError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.get_cluster_credentials();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `GetClusterCredentials`.
24///
25/// <p>Returns a database user name and temporary password with temporary authorization to log on to an Amazon Redshift database. The action returns the database user name prefixed with <code>IAM:</code> if <code>AutoCreate</code> is <code>False</code> or <code>IAMA:</code> if <code>AutoCreate</code> is <code>True</code>. You can optionally specify one or more database user groups that the user will join at log on. By default, the temporary credentials expire in 900 seconds. You can optionally specify a duration between 900 seconds (15 minutes) and 3600 seconds (60 minutes). For more information, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/generating-user-credentials.html">Using IAM Authentication to Generate Database User Credentials</a> in the Amazon Redshift Cluster Management Guide.</p>
26/// <p>The Identity and Access Management (IAM) user or role that runs GetClusterCredentials must have an IAM policy attached that allows access to all necessary actions and resources. For more information about permissions, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-iam-access-control-identity-based.html#redshift-policy-resources.getclustercredentials-resources">Resource Policies for GetClusterCredentials</a> in the Amazon Redshift Cluster Management Guide.</p>
27/// <p>If the <code>DbGroups</code> parameter is specified, the IAM policy must allow the <code>redshift:JoinGroup</code> action with access to the listed <code>dbgroups</code>.</p>
28/// <p>In addition, if the <code>AutoCreate</code> parameter is set to <code>True</code>, then the policy must include the <code>redshift:CreateClusterUser</code> permission.</p>
29/// <p>If the <code>DbName</code> parameter is specified, the IAM policy must allow access to the resource <code>dbname</code> for the specified database name.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct GetClusterCredentialsFluentBuilder {
32 handle: ::std::sync::Arc<crate::client::Handle>,
33 inner: crate::operation::get_cluster_credentials::builders::GetClusterCredentialsInputBuilder,
34 config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37 crate::client::customize::internal::CustomizableSend<
38 crate::operation::get_cluster_credentials::GetClusterCredentialsOutput,
39 crate::operation::get_cluster_credentials::GetClusterCredentialsError,
40 > for GetClusterCredentialsFluentBuilder
41{
42 fn send(
43 self,
44 config_override: crate::config::Builder,
45 ) -> crate::client::customize::internal::BoxFuture<
46 crate::client::customize::internal::SendResult<
47 crate::operation::get_cluster_credentials::GetClusterCredentialsOutput,
48 crate::operation::get_cluster_credentials::GetClusterCredentialsError,
49 >,
50 > {
51 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52 }
53}
54impl GetClusterCredentialsFluentBuilder {
55 /// Creates a new `GetClusterCredentialsFluentBuilder`.
56 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57 Self {
58 handle,
59 inner: ::std::default::Default::default(),
60 config_override: ::std::option::Option::None,
61 }
62 }
63 /// Access the GetClusterCredentials as a reference.
64 pub fn as_input(&self) -> &crate::operation::get_cluster_credentials::builders::GetClusterCredentialsInputBuilder {
65 &self.inner
66 }
67 /// Sends the request and returns the response.
68 ///
69 /// If an error occurs, an `SdkError` will be returned with additional details that
70 /// can be matched against.
71 ///
72 /// By default, any retryable failures will be retried twice. Retry behavior
73 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74 /// set when configuring the client.
75 pub async fn send(
76 self,
77 ) -> ::std::result::Result<
78 crate::operation::get_cluster_credentials::GetClusterCredentialsOutput,
79 ::aws_smithy_runtime_api::client::result::SdkError<
80 crate::operation::get_cluster_credentials::GetClusterCredentialsError,
81 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82 >,
83 > {
84 let input = self
85 .inner
86 .build()
87 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88 let runtime_plugins = crate::operation::get_cluster_credentials::GetClusterCredentials::operation_runtime_plugins(
89 self.handle.runtime_plugins.clone(),
90 &self.handle.conf,
91 self.config_override,
92 );
93 crate::operation::get_cluster_credentials::GetClusterCredentials::orchestrate(&runtime_plugins, input).await
94 }
95
96 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97 pub fn customize(
98 self,
99 ) -> crate::client::customize::CustomizableOperation<
100 crate::operation::get_cluster_credentials::GetClusterCredentialsOutput,
101 crate::operation::get_cluster_credentials::GetClusterCredentialsError,
102 Self,
103 > {
104 crate::client::customize::CustomizableOperation::new(self)
105 }
106 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107 self.set_config_override(::std::option::Option::Some(config_override.into()));
108 self
109 }
110
111 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112 self.config_override = config_override;
113 self
114 }
115 /// <p>The name of a database user. If a user name matching <code>DbUser</code> exists in the database, the temporary user credentials have the same permissions as the existing user. If <code>DbUser</code> doesn't exist in the database and <code>Autocreate</code> is <code>True</code>, a new user is created using the value for <code>DbUser</code> with PUBLIC permissions. If a database user matching the value for <code>DbUser</code> doesn't exist and <code>Autocreate</code> is <code>False</code>, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.</p>
116 /// <p>For more information, see <a href="https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html">CREATE USER</a> in the Amazon Redshift Database Developer Guide.</p>
117 /// <p>Constraints:</p>
118 /// <ul>
119 /// <li>
120 /// <p>Must be 1 to 64 alphanumeric characters or hyphens. The user name can't be <code>PUBLIC</code>.</p></li>
121 /// <li>
122 /// <p>Must contain uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
123 /// <li>
124 /// <p>First character must be a letter.</p></li>
125 /// <li>
126 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
127 /// <li>
128 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
129 /// </ul>
130 pub fn db_user(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.inner = self.inner.db_user(input.into());
132 self
133 }
134 /// <p>The name of a database user. If a user name matching <code>DbUser</code> exists in the database, the temporary user credentials have the same permissions as the existing user. If <code>DbUser</code> doesn't exist in the database and <code>Autocreate</code> is <code>True</code>, a new user is created using the value for <code>DbUser</code> with PUBLIC permissions. If a database user matching the value for <code>DbUser</code> doesn't exist and <code>Autocreate</code> is <code>False</code>, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.</p>
135 /// <p>For more information, see <a href="https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html">CREATE USER</a> in the Amazon Redshift Database Developer Guide.</p>
136 /// <p>Constraints:</p>
137 /// <ul>
138 /// <li>
139 /// <p>Must be 1 to 64 alphanumeric characters or hyphens. The user name can't be <code>PUBLIC</code>.</p></li>
140 /// <li>
141 /// <p>Must contain uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
142 /// <li>
143 /// <p>First character must be a letter.</p></li>
144 /// <li>
145 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
146 /// <li>
147 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
148 /// </ul>
149 pub fn set_db_user(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150 self.inner = self.inner.set_db_user(input);
151 self
152 }
153 /// <p>The name of a database user. If a user name matching <code>DbUser</code> exists in the database, the temporary user credentials have the same permissions as the existing user. If <code>DbUser</code> doesn't exist in the database and <code>Autocreate</code> is <code>True</code>, a new user is created using the value for <code>DbUser</code> with PUBLIC permissions. If a database user matching the value for <code>DbUser</code> doesn't exist and <code>Autocreate</code> is <code>False</code>, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.</p>
154 /// <p>For more information, see <a href="https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_USER.html">CREATE USER</a> in the Amazon Redshift Database Developer Guide.</p>
155 /// <p>Constraints:</p>
156 /// <ul>
157 /// <li>
158 /// <p>Must be 1 to 64 alphanumeric characters or hyphens. The user name can't be <code>PUBLIC</code>.</p></li>
159 /// <li>
160 /// <p>Must contain uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
161 /// <li>
162 /// <p>First character must be a letter.</p></li>
163 /// <li>
164 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
165 /// <li>
166 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
167 /// </ul>
168 pub fn get_db_user(&self) -> &::std::option::Option<::std::string::String> {
169 self.inner.get_db_user()
170 }
171 /// <p>The name of a database that <code>DbUser</code> is authorized to log on to. If <code>DbName</code> is not specified, <code>DbUser</code> can log on to any existing database.</p>
172 /// <p>Constraints:</p>
173 /// <ul>
174 /// <li>
175 /// <p>Must be 1 to 64 alphanumeric characters or hyphens</p></li>
176 /// <li>
177 /// <p>Must contain uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
178 /// <li>
179 /// <p>First character must be a letter.</p></li>
180 /// <li>
181 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
182 /// <li>
183 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
184 /// </ul>
185 pub fn db_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186 self.inner = self.inner.db_name(input.into());
187 self
188 }
189 /// <p>The name of a database that <code>DbUser</code> is authorized to log on to. If <code>DbName</code> is not specified, <code>DbUser</code> can log on to any existing database.</p>
190 /// <p>Constraints:</p>
191 /// <ul>
192 /// <li>
193 /// <p>Must be 1 to 64 alphanumeric characters or hyphens</p></li>
194 /// <li>
195 /// <p>Must contain uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
196 /// <li>
197 /// <p>First character must be a letter.</p></li>
198 /// <li>
199 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
200 /// <li>
201 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
202 /// </ul>
203 pub fn set_db_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204 self.inner = self.inner.set_db_name(input);
205 self
206 }
207 /// <p>The name of a database that <code>DbUser</code> is authorized to log on to. If <code>DbName</code> is not specified, <code>DbUser</code> can log on to any existing database.</p>
208 /// <p>Constraints:</p>
209 /// <ul>
210 /// <li>
211 /// <p>Must be 1 to 64 alphanumeric characters or hyphens</p></li>
212 /// <li>
213 /// <p>Must contain uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
214 /// <li>
215 /// <p>First character must be a letter.</p></li>
216 /// <li>
217 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
218 /// <li>
219 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
220 /// </ul>
221 pub fn get_db_name(&self) -> &::std::option::Option<::std::string::String> {
222 self.inner.get_db_name()
223 }
224 /// <p>The unique identifier of the cluster that contains the database for which you are requesting credentials. This parameter is case sensitive.</p>
225 pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
226 self.inner = self.inner.cluster_identifier(input.into());
227 self
228 }
229 /// <p>The unique identifier of the cluster that contains the database for which you are requesting credentials. This parameter is case sensitive.</p>
230 pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
231 self.inner = self.inner.set_cluster_identifier(input);
232 self
233 }
234 /// <p>The unique identifier of the cluster that contains the database for which you are requesting credentials. This parameter is case sensitive.</p>
235 pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
236 self.inner.get_cluster_identifier()
237 }
238 /// <p>The number of seconds until the returned temporary password expires.</p>
239 /// <p>Constraint: minimum 900, maximum 3600.</p>
240 /// <p>Default: 900</p>
241 pub fn duration_seconds(mut self, input: i32) -> Self {
242 self.inner = self.inner.duration_seconds(input);
243 self
244 }
245 /// <p>The number of seconds until the returned temporary password expires.</p>
246 /// <p>Constraint: minimum 900, maximum 3600.</p>
247 /// <p>Default: 900</p>
248 pub fn set_duration_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
249 self.inner = self.inner.set_duration_seconds(input);
250 self
251 }
252 /// <p>The number of seconds until the returned temporary password expires.</p>
253 /// <p>Constraint: minimum 900, maximum 3600.</p>
254 /// <p>Default: 900</p>
255 pub fn get_duration_seconds(&self) -> &::std::option::Option<i32> {
256 self.inner.get_duration_seconds()
257 }
258 /// <p>Create a database user with the name specified for the user named in <code>DbUser</code> if one does not exist.</p>
259 pub fn auto_create(mut self, input: bool) -> Self {
260 self.inner = self.inner.auto_create(input);
261 self
262 }
263 /// <p>Create a database user with the name specified for the user named in <code>DbUser</code> if one does not exist.</p>
264 pub fn set_auto_create(mut self, input: ::std::option::Option<bool>) -> Self {
265 self.inner = self.inner.set_auto_create(input);
266 self
267 }
268 /// <p>Create a database user with the name specified for the user named in <code>DbUser</code> if one does not exist.</p>
269 pub fn get_auto_create(&self) -> &::std::option::Option<bool> {
270 self.inner.get_auto_create()
271 }
272 ///
273 /// Appends an item to `DbGroups`.
274 ///
275 /// To override the contents of this collection use [`set_db_groups`](Self::set_db_groups).
276 ///
277 /// <p>A list of the names of existing database groups that the user named in <code>DbUser</code> will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.</p>
278 /// <p>Database group name constraints</p>
279 /// <ul>
280 /// <li>
281 /// <p>Must be 1 to 64 alphanumeric characters or hyphens</p></li>
282 /// <li>
283 /// <p>Must contain only lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
284 /// <li>
285 /// <p>First character must be a letter.</p></li>
286 /// <li>
287 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
288 /// <li>
289 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
290 /// </ul>
291 pub fn db_groups(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
292 self.inner = self.inner.db_groups(input.into());
293 self
294 }
295 /// <p>A list of the names of existing database groups that the user named in <code>DbUser</code> will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.</p>
296 /// <p>Database group name constraints</p>
297 /// <ul>
298 /// <li>
299 /// <p>Must be 1 to 64 alphanumeric characters or hyphens</p></li>
300 /// <li>
301 /// <p>Must contain only lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
302 /// <li>
303 /// <p>First character must be a letter.</p></li>
304 /// <li>
305 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
306 /// <li>
307 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
308 /// </ul>
309 pub fn set_db_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
310 self.inner = self.inner.set_db_groups(input);
311 self
312 }
313 /// <p>A list of the names of existing database groups that the user named in <code>DbUser</code> will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.</p>
314 /// <p>Database group name constraints</p>
315 /// <ul>
316 /// <li>
317 /// <p>Must be 1 to 64 alphanumeric characters or hyphens</p></li>
318 /// <li>
319 /// <p>Must contain only lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.</p></li>
320 /// <li>
321 /// <p>First character must be a letter.</p></li>
322 /// <li>
323 /// <p>Must not contain a colon ( : ) or slash ( / ).</p></li>
324 /// <li>
325 /// <p>Cannot be a reserved word. A list of reserved words can be found in <a href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift Database Developer Guide.</p></li>
326 /// </ul>
327 pub fn get_db_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
328 self.inner.get_db_groups()
329 }
330 /// <p>The custom domain name for the cluster credentials.</p>
331 pub fn custom_domain_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
332 self.inner = self.inner.custom_domain_name(input.into());
333 self
334 }
335 /// <p>The custom domain name for the cluster credentials.</p>
336 pub fn set_custom_domain_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
337 self.inner = self.inner.set_custom_domain_name(input);
338 self
339 }
340 /// <p>The custom domain name for the cluster credentials.</p>
341 pub fn get_custom_domain_name(&self) -> &::std::option::Option<::std::string::String> {
342 self.inner.get_custom_domain_name()
343 }
344}