aws_sdk_redshiftdata/operation/list_databases/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::list_databases::_list_databases_output::ListDatabasesOutputBuilder;
3
4pub use crate::operation::list_databases::_list_databases_input::ListDatabasesInputBuilder;
5
6impl crate::operation::list_databases::builders::ListDatabasesInputBuilder {
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::list_databases::ListDatabasesOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::list_databases::ListDatabasesError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.list_databases();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ListDatabases`.
24///
25/// <p>List the databases in a cluster. A token is returned to page through the database list. Depending on the authorization method, use one of the following combinations of request parameters:</p>
26/// <ul>
27/// <li>
28/// <p>Secrets Manager - when connecting to a cluster, provide the <code>secret-arn</code> of a secret stored in Secrets Manager which has <code>username</code> and <code>password</code>. The specified secret contains credentials to connect to the <code>database</code> you specify. When you are connecting to a cluster, you also supply the database name, If you provide a cluster identifier (<code>dbClusterIdentifier</code>), it must match the cluster identifier stored in the secret. When you are connecting to a serverless workgroup, you also supply the database name.</p></li>
29/// <li>
30/// <p>Temporary credentials - when connecting to your data warehouse, choose one of the following options:</p>
31/// <ul>
32/// <li>
33/// <p>When connecting to a serverless workgroup, specify the workgroup name and database name. The database user name is derived from the IAM identity. For example, <code>arn:iam::123456789012:user:foo</code> has the database user name <code>IAM:foo</code>. Also, permission to call the <code>redshift-serverless:GetCredentials</code> operation is required.</p></li>
34/// <li>
35/// <p>When connecting to a cluster as an IAM identity, specify the cluster identifier and the database name. The database user name is derived from the IAM identity. For example, <code>arn:iam::123456789012:user:foo</code> has the database user name <code>IAM:foo</code>. Also, permission to call the <code>redshift:GetClusterCredentialsWithIAM</code> operation is required.</p></li>
36/// <li>
37/// <p>When connecting to a cluster as a database user, specify the cluster identifier, the database name, and the database user name. Also, permission to call the <code>redshift:GetClusterCredentials</code> operation is required.</p></li>
38/// </ul></li>
39/// </ul>
40/// <p>For more information about the Amazon Redshift Data API and CLI usage examples, see <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html">Using the Amazon Redshift Data API</a> in the <i>Amazon Redshift Management Guide</i>.</p>
41#[derive(::std::clone::Clone, ::std::fmt::Debug)]
42pub struct ListDatabasesFluentBuilder {
43 handle: ::std::sync::Arc<crate::client::Handle>,
44 inner: crate::operation::list_databases::builders::ListDatabasesInputBuilder,
45 config_override: ::std::option::Option<crate::config::Builder>,
46}
47impl
48 crate::client::customize::internal::CustomizableSend<
49 crate::operation::list_databases::ListDatabasesOutput,
50 crate::operation::list_databases::ListDatabasesError,
51 > for ListDatabasesFluentBuilder
52{
53 fn send(
54 self,
55 config_override: crate::config::Builder,
56 ) -> crate::client::customize::internal::BoxFuture<
57 crate::client::customize::internal::SendResult<
58 crate::operation::list_databases::ListDatabasesOutput,
59 crate::operation::list_databases::ListDatabasesError,
60 >,
61 > {
62 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
63 }
64}
65impl ListDatabasesFluentBuilder {
66 /// Creates a new `ListDatabasesFluentBuilder`.
67 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
68 Self {
69 handle,
70 inner: ::std::default::Default::default(),
71 config_override: ::std::option::Option::None,
72 }
73 }
74 /// Access the ListDatabases as a reference.
75 pub fn as_input(&self) -> &crate::operation::list_databases::builders::ListDatabasesInputBuilder {
76 &self.inner
77 }
78 /// Sends the request and returns the response.
79 ///
80 /// If an error occurs, an `SdkError` will be returned with additional details that
81 /// can be matched against.
82 ///
83 /// By default, any retryable failures will be retried twice. Retry behavior
84 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
85 /// set when configuring the client.
86 pub async fn send(
87 self,
88 ) -> ::std::result::Result<
89 crate::operation::list_databases::ListDatabasesOutput,
90 ::aws_smithy_runtime_api::client::result::SdkError<
91 crate::operation::list_databases::ListDatabasesError,
92 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
93 >,
94 > {
95 let input = self
96 .inner
97 .build()
98 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
99 let runtime_plugins = crate::operation::list_databases::ListDatabases::operation_runtime_plugins(
100 self.handle.runtime_plugins.clone(),
101 &self.handle.conf,
102 self.config_override,
103 );
104 crate::operation::list_databases::ListDatabases::orchestrate(&runtime_plugins, input).await
105 }
106
107 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
108 pub fn customize(
109 self,
110 ) -> crate::client::customize::CustomizableOperation<
111 crate::operation::list_databases::ListDatabasesOutput,
112 crate::operation::list_databases::ListDatabasesError,
113 Self,
114 > {
115 crate::client::customize::CustomizableOperation::new(self)
116 }
117 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
118 self.set_config_override(::std::option::Option::Some(config_override.into()));
119 self
120 }
121
122 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
123 self.config_override = config_override;
124 self
125 }
126 /// Create a paginator for this request
127 ///
128 /// Paginators are used by calling [`send().await`](crate::operation::list_databases::paginator::ListDatabasesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
129 pub fn into_paginator(self) -> crate::operation::list_databases::paginator::ListDatabasesPaginator {
130 crate::operation::list_databases::paginator::ListDatabasesPaginator::new(self.handle, self.inner)
131 }
132 /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
133 pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.cluster_identifier(input.into());
135 self
136 }
137 /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
138 pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_cluster_identifier(input);
140 self
141 }
142 /// <p>The cluster identifier. This parameter is required when connecting to a cluster and authenticating using either Secrets Manager or temporary credentials.</p>
143 pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_cluster_identifier()
145 }
146 /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
147 pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.database(input.into());
149 self
150 }
151 /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
152 pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153 self.inner = self.inner.set_database(input);
154 self
155 }
156 /// <p>The name of the database. This parameter is required when authenticating using either Secrets Manager or temporary credentials.</p>
157 pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
158 self.inner.get_database()
159 }
160 /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
161 pub fn secret_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162 self.inner = self.inner.secret_arn(input.into());
163 self
164 }
165 /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
166 pub fn set_secret_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167 self.inner = self.inner.set_secret_arn(input);
168 self
169 }
170 /// <p>The name or ARN of the secret that enables access to the database. This parameter is required when authenticating using Secrets Manager.</p>
171 pub fn get_secret_arn(&self) -> &::std::option::Option<::std::string::String> {
172 self.inner.get_secret_arn()
173 }
174 /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
175 pub fn db_user(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176 self.inner = self.inner.db_user(input.into());
177 self
178 }
179 /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
180 pub fn set_db_user(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181 self.inner = self.inner.set_db_user(input);
182 self
183 }
184 /// <p>The database user name. This parameter is required when connecting to a cluster as a database user and authenticating using temporary credentials.</p>
185 pub fn get_db_user(&self) -> &::std::option::Option<::std::string::String> {
186 self.inner.get_db_user()
187 }
188 /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
189 pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
190 self.inner = self.inner.next_token(input.into());
191 self
192 }
193 /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
194 pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195 self.inner = self.inner.set_next_token(input);
196 self
197 }
198 /// <p>A value that indicates the starting point for the next set of response records in a subsequent request. If a value is returned in a response, you can retrieve the next set of records by providing this returned NextToken value in the next NextToken parameter and retrying the command. If the NextToken field is empty, all response records have been retrieved for the request.</p>
199 pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
200 self.inner.get_next_token()
201 }
202 /// <p>The maximum number of databases to return in the response. If more databases exist than fit in one response, then <code>NextToken</code> is returned to page through the results.</p>
203 pub fn max_results(mut self, input: i32) -> Self {
204 self.inner = self.inner.max_results(input);
205 self
206 }
207 /// <p>The maximum number of databases to return in the response. If more databases exist than fit in one response, then <code>NextToken</code> is returned to page through the results.</p>
208 pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
209 self.inner = self.inner.set_max_results(input);
210 self
211 }
212 /// <p>The maximum number of databases to return in the response. If more databases exist than fit in one response, then <code>NextToken</code> is returned to page through the results.</p>
213 pub fn get_max_results(&self) -> &::std::option::Option<i32> {
214 self.inner.get_max_results()
215 }
216 /// <p>The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.</p>
217 pub fn workgroup_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218 self.inner = self.inner.workgroup_name(input.into());
219 self
220 }
221 /// <p>The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.</p>
222 pub fn set_workgroup_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223 self.inner = self.inner.set_workgroup_name(input);
224 self
225 }
226 /// <p>The serverless workgroup name or Amazon Resource Name (ARN). This parameter is required when connecting to a serverless workgroup and authenticating using either Secrets Manager or temporary credentials.</p>
227 pub fn get_workgroup_name(&self) -> &::std::option::Option<::std::string::String> {
228 self.inner.get_workgroup_name()
229 }
230}