aws_sdk_rds/operation/create_db_snapshot/
builders.rs

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