aws_sdk_fsx/operation/create_snapshot/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_snapshot::_create_snapshot_output::CreateSnapshotOutputBuilder;
3
4pub use crate::operation::create_snapshot::_create_snapshot_input::CreateSnapshotInputBuilder;
5
6impl crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder {
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_snapshot::CreateSnapshotOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_snapshot::CreateSnapshotError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_snapshot();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateSnapshot`.
24///
25/// <p>Creates a snapshot of an existing Amazon FSx for OpenZFS volume. With snapshots, you can easily undo file changes and compare file versions by restoring the volume to a previous version.</p>
26/// <p>If a snapshot with the specified client request token exists, and the parameters match, this operation returns the description of the existing snapshot. If a snapshot with the specified client request token exists, and the parameters don't match, this operation returns <code>IncompatibleParameterError</code>. If a snapshot with the specified client request token doesn't exist, <code>CreateSnapshot</code> does the following:</p>
27/// <ul>
28/// <li>
29/// <p>Creates a new OpenZFS snapshot with an assigned ID, and an initial lifecycle state of <code>CREATING</code>.</p></li>
30/// <li>
31/// <p>Returns the description of the snapshot.</p></li>
32/// </ul>
33/// <p>By using the idempotent operation, you can retry a <code>CreateSnapshot</code> operation without the risk of creating an extra snapshot. This approach can be useful when an initial call fails in a way that makes it unclear whether a snapshot was created. If you use the same client request token and the initial call created a snapshot, the operation returns a successful result because all the parameters are the same.</p>
34/// <p>The <code>CreateSnapshot</code> operation returns while the snapshot's lifecycle state is still <code>CREATING</code>. You can check the snapshot creation status by calling the <a href="https://docs.aws.amazon.com/fsx/latest/APIReference/API_DescribeSnapshots.html">DescribeSnapshots</a> operation, which returns the snapshot state along with other information.</p>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct CreateSnapshotFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::create_snapshot::CreateSnapshotOutput,
44        crate::operation::create_snapshot::CreateSnapshotError,
45    > for CreateSnapshotFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::create_snapshot::CreateSnapshotOutput,
53            crate::operation::create_snapshot::CreateSnapshotError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl CreateSnapshotFluentBuilder {
60    /// Creates a new `CreateSnapshotFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the CreateSnapshot as a reference.
69    pub fn as_input(&self) -> &crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::create_snapshot::CreateSnapshotOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::create_snapshot::CreateSnapshotError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::create_snapshot::CreateSnapshot::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::create_snapshot::CreateSnapshot::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::create_snapshot::CreateSnapshotOutput,
106        crate::operation::create_snapshot::CreateSnapshotError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
121    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.client_request_token(input.into());
123        self
124    }
125    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
126    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_client_request_token(input);
128        self
129    }
130    /// <p>(Optional) An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
131    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
132        self.inner.get_client_request_token()
133    }
134    /// <p>The name of the snapshot.</p>
135    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
136        self.inner = self.inner.name(input.into());
137        self
138    }
139    /// <p>The name of the snapshot.</p>
140    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
141        self.inner = self.inner.set_name(input);
142        self
143    }
144    /// <p>The name of the snapshot.</p>
145    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
146        self.inner.get_name()
147    }
148    /// <p>The ID of the volume that you are taking a snapshot of.</p>
149    pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.inner = self.inner.volume_id(input.into());
151        self
152    }
153    /// <p>The ID of the volume that you are taking a snapshot of.</p>
154    pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
155        self.inner = self.inner.set_volume_id(input);
156        self
157    }
158    /// <p>The ID of the volume that you are taking a snapshot of.</p>
159    pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
160        self.inner.get_volume_id()
161    }
162    ///
163    /// Appends an item to `Tags`.
164    ///
165    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
166    ///
167    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
168    pub fn tags(mut self, input: crate::types::Tag) -> Self {
169        self.inner = self.inner.tags(input);
170        self
171    }
172    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
173    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
174        self.inner = self.inner.set_tags(input);
175        self
176    }
177    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
178    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
179        self.inner.get_tags()
180    }
181}