aws_sdk_redshift/operation/create_cluster_snapshot/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_cluster_snapshot::_create_cluster_snapshot_output::CreateClusterSnapshotOutputBuilder;
3
4pub use crate::operation::create_cluster_snapshot::_create_cluster_snapshot_input::CreateClusterSnapshotInputBuilder;
5
6impl crate::operation::create_cluster_snapshot::builders::CreateClusterSnapshotInputBuilder {
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_snapshot::CreateClusterSnapshotOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_cluster_snapshot::CreateClusterSnapshotError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_cluster_snapshot();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateClusterSnapshot`.
24///
25/// <p>Creates a manual snapshot of the specified cluster. The cluster must be in the <code>available</code> state.</p>
26/// <p>For more information about working with snapshots, go to <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html">Amazon Redshift Snapshots</a> in the <i>Amazon Redshift Cluster Management Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateClusterSnapshotFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_cluster_snapshot::builders::CreateClusterSnapshotInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_cluster_snapshot::CreateClusterSnapshotOutput,
36        crate::operation::create_cluster_snapshot::CreateClusterSnapshotError,
37    > for CreateClusterSnapshotFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::create_cluster_snapshot::CreateClusterSnapshotOutput,
45            crate::operation::create_cluster_snapshot::CreateClusterSnapshotError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateClusterSnapshotFluentBuilder {
52    /// Creates a new `CreateClusterSnapshotFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the CreateClusterSnapshot as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_cluster_snapshot::builders::CreateClusterSnapshotInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::create_cluster_snapshot::CreateClusterSnapshotOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_cluster_snapshot::CreateClusterSnapshotError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::create_cluster_snapshot::CreateClusterSnapshot::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_cluster_snapshot::CreateClusterSnapshot::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::create_cluster_snapshot::CreateClusterSnapshotOutput,
98        crate::operation::create_cluster_snapshot::CreateClusterSnapshotError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>A unique identifier for the snapshot that you are requesting. This identifier must be unique for all snapshots within the Amazon Web Services account.</p>
113    /// <p>Constraints:</p>
114    /// <ul>
115    /// <li>
116    /// <p>Cannot be null, empty, or blank</p></li>
117    /// <li>
118    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens</p></li>
119    /// <li>
120    /// <p>First character must be a letter</p></li>
121    /// <li>
122    /// <p>Cannot end with a hyphen or contain two consecutive hyphens</p></li>
123    /// </ul>
124    /// <p>Example: <code>my-snapshot-id</code></p>
125    pub fn snapshot_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126        self.inner = self.inner.snapshot_identifier(input.into());
127        self
128    }
129    /// <p>A unique identifier for the snapshot that you are requesting. This identifier must be unique for all snapshots within the Amazon Web Services account.</p>
130    /// <p>Constraints:</p>
131    /// <ul>
132    /// <li>
133    /// <p>Cannot be null, empty, or blank</p></li>
134    /// <li>
135    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens</p></li>
136    /// <li>
137    /// <p>First character must be a letter</p></li>
138    /// <li>
139    /// <p>Cannot end with a hyphen or contain two consecutive hyphens</p></li>
140    /// </ul>
141    /// <p>Example: <code>my-snapshot-id</code></p>
142    pub fn set_snapshot_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_snapshot_identifier(input);
144        self
145    }
146    /// <p>A unique identifier for the snapshot that you are requesting. This identifier must be unique for all snapshots within the Amazon Web Services account.</p>
147    /// <p>Constraints:</p>
148    /// <ul>
149    /// <li>
150    /// <p>Cannot be null, empty, or blank</p></li>
151    /// <li>
152    /// <p>Must contain from 1 to 255 alphanumeric characters or hyphens</p></li>
153    /// <li>
154    /// <p>First character must be a letter</p></li>
155    /// <li>
156    /// <p>Cannot end with a hyphen or contain two consecutive hyphens</p></li>
157    /// </ul>
158    /// <p>Example: <code>my-snapshot-id</code></p>
159    pub fn get_snapshot_identifier(&self) -> &::std::option::Option<::std::string::String> {
160        self.inner.get_snapshot_identifier()
161    }
162    /// <p>The cluster identifier for which you want a snapshot.</p>
163    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.inner = self.inner.cluster_identifier(input.into());
165        self
166    }
167    /// <p>The cluster identifier for which you want a snapshot.</p>
168    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.inner = self.inner.set_cluster_identifier(input);
170        self
171    }
172    /// <p>The cluster identifier for which you want a snapshot.</p>
173    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_cluster_identifier()
175    }
176    /// <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p>
177    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
178    /// <p>The default value is -1.</p>
179    pub fn manual_snapshot_retention_period(mut self, input: i32) -> Self {
180        self.inner = self.inner.manual_snapshot_retention_period(input);
181        self
182    }
183    /// <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p>
184    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
185    /// <p>The default value is -1.</p>
186    pub fn set_manual_snapshot_retention_period(mut self, input: ::std::option::Option<i32>) -> Self {
187        self.inner = self.inner.set_manual_snapshot_retention_period(input);
188        self
189    }
190    /// <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.</p>
191    /// <p>The value must be either -1 or an integer between 1 and 3,653.</p>
192    /// <p>The default value is -1.</p>
193    pub fn get_manual_snapshot_retention_period(&self) -> &::std::option::Option<i32> {
194        self.inner.get_manual_snapshot_retention_period()
195    }
196    ///
197    /// Appends an item to `Tags`.
198    ///
199    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
200    ///
201    /// <p>A list of tag instances.</p>
202    pub fn tags(mut self, input: crate::types::Tag) -> Self {
203        self.inner = self.inner.tags(input);
204        self
205    }
206    /// <p>A list of tag instances.</p>
207    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
208        self.inner = self.inner.set_tags(input);
209        self
210    }
211    /// <p>A list of tag instances.</p>
212    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
213        self.inner.get_tags()
214    }
215}