aws_sdk_dsql/operation/create_cluster/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_cluster::_create_cluster_output::CreateClusterOutputBuilder;
3
4pub use crate::operation::create_cluster::_create_cluster_input::CreateClusterInputBuilder;
5
6impl crate::operation::create_cluster::builders::CreateClusterInputBuilder {
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::create_cluster::CreateClusterOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_cluster::CreateClusterError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_cluster();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCluster`.
24///
25/// <p>The CreateCluster API allows you to create both single-region clusters and multi-Region clusters. With the addition of the <i>multiRegionProperties</i> parameter, you can create a cluster with witness Region support and establish peer relationships with clusters in other Regions during creation.</p><note>
26/// <p>Creating multi-Region clusters requires additional IAM permissions beyond those needed for single-Region clusters, as detailed in the <b>Required permissions</b> section below.</p>
27/// </note>
28/// <p><b>Required permissions</b></p>
29/// <dl>
30/// <dt>
31/// dsql:CreateCluster
32/// </dt>
33/// <dd>
34/// <p>Required to create a cluster.</p>
35/// <p>Resources: <code>arn:aws:dsql:region:account-id:cluster/*</code></p>
36/// </dd>
37/// <dt>
38/// dsql:TagResource
39/// </dt>
40/// <dd>
41/// <p>Permission to add tags to a resource.</p>
42/// <p>Resources: <code>arn:aws:dsql:region:account-id:cluster/*</code></p>
43/// </dd>
44/// <dt>
45/// dsql:PutMultiRegionProperties
46/// </dt>
47/// <dd>
48/// <p>Permission to configure multi-region properties for a cluster.</p>
49/// <p>Resources: <code>arn:aws:dsql:region:account-id:cluster/*</code></p>
50/// </dd>
51/// <dt>
52/// dsql:AddPeerCluster
53/// </dt>
54/// <dd>
55/// <p>When specifying <code>multiRegionProperties.clusters</code>, permission to add peer clusters.</p>
56/// <p>Resources:</p>
57/// <ul>
58/// <li>
59/// <p>Local cluster: <code>arn:aws:dsql:region:account-id:cluster/*</code></p></li>
60/// <li>
61/// <p>Each peer cluster: exact ARN of each specified peer cluster</p></li>
62/// </ul>
63/// </dd>
64/// <dt>
65/// dsql:PutWitnessRegion
66/// </dt>
67/// <dd>
68/// <p>When specifying <code>multiRegionProperties.witnessRegion</code>, permission to set a witness Region. This permission is checked both in the cluster Region and in the witness Region.</p>
69/// <p>Resources: <code>arn:aws:dsql:region:account-id:cluster/*</code></p>
70/// <p>Condition Keys: <code>dsql:WitnessRegion</code> (matching the specified witness region)</p>
71/// </dd>
72/// </dl><important>
73/// <ul>
74/// <li>
75/// <p>The witness Region specified in <code>multiRegionProperties.witnessRegion</code> cannot be the same as the cluster's Region.</p></li>
76/// </ul>
77/// </important>
78#[derive(::std::clone::Clone, ::std::fmt::Debug)]
79pub struct CreateClusterFluentBuilder {
80    handle: ::std::sync::Arc<crate::client::Handle>,
81    inner: crate::operation::create_cluster::builders::CreateClusterInputBuilder,
82    config_override: ::std::option::Option<crate::config::Builder>,
83}
84impl
85    crate::client::customize::internal::CustomizableSend<
86        crate::operation::create_cluster::CreateClusterOutput,
87        crate::operation::create_cluster::CreateClusterError,
88    > for CreateClusterFluentBuilder
89{
90    fn send(
91        self,
92        config_override: crate::config::Builder,
93    ) -> crate::client::customize::internal::BoxFuture<
94        crate::client::customize::internal::SendResult<
95            crate::operation::create_cluster::CreateClusterOutput,
96            crate::operation::create_cluster::CreateClusterError,
97        >,
98    > {
99        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
100    }
101}
102impl CreateClusterFluentBuilder {
103    /// Creates a new `CreateClusterFluentBuilder`.
104    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
105        Self {
106            handle,
107            inner: ::std::default::Default::default(),
108            config_override: ::std::option::Option::None,
109        }
110    }
111    /// Access the CreateCluster as a reference.
112    pub fn as_input(&self) -> &crate::operation::create_cluster::builders::CreateClusterInputBuilder {
113        &self.inner
114    }
115    /// Sends the request and returns the response.
116    ///
117    /// If an error occurs, an `SdkError` will be returned with additional details that
118    /// can be matched against.
119    ///
120    /// By default, any retryable failures will be retried twice. Retry behavior
121    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
122    /// set when configuring the client.
123    pub async fn send(
124        self,
125    ) -> ::std::result::Result<
126        crate::operation::create_cluster::CreateClusterOutput,
127        ::aws_smithy_runtime_api::client::result::SdkError<
128            crate::operation::create_cluster::CreateClusterError,
129            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
130        >,
131    > {
132        let input = self
133            .inner
134            .build()
135            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
136        let runtime_plugins = crate::operation::create_cluster::CreateCluster::operation_runtime_plugins(
137            self.handle.runtime_plugins.clone(),
138            &self.handle.conf,
139            self.config_override,
140        );
141        crate::operation::create_cluster::CreateCluster::orchestrate(&runtime_plugins, input).await
142    }
143
144    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
145    pub fn customize(
146        self,
147    ) -> crate::client::customize::CustomizableOperation<
148        crate::operation::create_cluster::CreateClusterOutput,
149        crate::operation::create_cluster::CreateClusterError,
150        Self,
151    > {
152        crate::client::customize::CustomizableOperation::new(self)
153    }
154    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
155        self.set_config_override(::std::option::Option::Some(config_override.into()));
156        self
157    }
158
159    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
160        self.config_override = config_override;
161        self
162    }
163    /// <p>If enabled, you can't delete your cluster. You must first disable this property before you can delete your cluster.</p>
164    pub fn deletion_protection_enabled(mut self, input: bool) -> Self {
165        self.inner = self.inner.deletion_protection_enabled(input);
166        self
167    }
168    /// <p>If enabled, you can't delete your cluster. You must first disable this property before you can delete your cluster.</p>
169    pub fn set_deletion_protection_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
170        self.inner = self.inner.set_deletion_protection_enabled(input);
171        self
172    }
173    /// <p>If enabled, you can't delete your cluster. You must first disable this property before you can delete your cluster.</p>
174    pub fn get_deletion_protection_enabled(&self) -> &::std::option::Option<bool> {
175        self.inner.get_deletion_protection_enabled()
176    }
177    /// <p>The KMS key that encrypts and protects the data on your cluster. You can specify the ARN, ID, or alias of an existing key or have Amazon Web Services create a default key for you.</p>
178    pub fn kms_encryption_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179        self.inner = self.inner.kms_encryption_key(input.into());
180        self
181    }
182    /// <p>The KMS key that encrypts and protects the data on your cluster. You can specify the ARN, ID, or alias of an existing key or have Amazon Web Services create a default key for you.</p>
183    pub fn set_kms_encryption_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184        self.inner = self.inner.set_kms_encryption_key(input);
185        self
186    }
187    /// <p>The KMS key that encrypts and protects the data on your cluster. You can specify the ARN, ID, or alias of an existing key or have Amazon Web Services create a default key for you.</p>
188    pub fn get_kms_encryption_key(&self) -> &::std::option::Option<::std::string::String> {
189        self.inner.get_kms_encryption_key()
190    }
191    ///
192    /// Adds a key-value pair to `tags`.
193    ///
194    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
195    ///
196    /// <p>A map of key and value pairs to use to tag your cluster.</p>
197    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
198        self.inner = self.inner.tags(k.into(), v.into());
199        self
200    }
201    /// <p>A map of key and value pairs to use to tag your cluster.</p>
202    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
203        self.inner = self.inner.set_tags(input);
204        self
205    }
206    /// <p>A map of key and value pairs to use to tag your cluster.</p>
207    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
208        self.inner.get_tags()
209    }
210    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
211    /// <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>
212    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213        self.inner = self.inner.client_token(input.into());
214        self
215    }
216    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
217    /// <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>
218    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
219        self.inner = self.inner.set_client_token(input);
220        self
221    }
222    /// <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect.</p>
223    /// <p>If you don't specify a client token, the Amazon Web Services SDK automatically generates one.</p>
224    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
225        self.inner.get_client_token()
226    }
227    /// <p>The configuration settings when creating a multi-Region cluster, including the witness region and linked cluster properties.</p>
228    pub fn multi_region_properties(mut self, input: crate::types::MultiRegionProperties) -> Self {
229        self.inner = self.inner.multi_region_properties(input);
230        self
231    }
232    /// <p>The configuration settings when creating a multi-Region cluster, including the witness region and linked cluster properties.</p>
233    pub fn set_multi_region_properties(mut self, input: ::std::option::Option<crate::types::MultiRegionProperties>) -> Self {
234        self.inner = self.inner.set_multi_region_properties(input);
235        self
236    }
237    /// <p>The configuration settings when creating a multi-Region cluster, including the witness region and linked cluster properties.</p>
238    pub fn get_multi_region_properties(&self) -> &::std::option::Option<crate::types::MultiRegionProperties> {
239        self.inner.get_multi_region_properties()
240    }
241}