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