aws_sdk_fsx/operation/create_backup/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_backup::_create_backup_output::CreateBackupOutputBuilder;
3
4pub use crate::operation::create_backup::_create_backup_input::CreateBackupInputBuilder;
5
6impl crate::operation::create_backup::builders::CreateBackupInputBuilder {
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_backup::CreateBackupOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_backup::CreateBackupError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_backup();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateBackup`.
24///
25/// <p>Creates a backup of an existing Amazon FSx for Windows File Server file system, Amazon FSx for Lustre file system, Amazon FSx for NetApp ONTAP volume, or Amazon FSx for OpenZFS file system. We recommend creating regular backups so that you can restore a file system or volume from a backup if an issue arises with the original file system or volume.</p>
26/// <p>For Amazon FSx for Lustre file systems, you can create a backup only for file systems that have the following configuration:</p>
27/// <ul>
28/// <li>
29/// <p>A Persistent deployment type</p></li>
30/// <li>
31/// <p>Are <i>not</i> linked to a data repository</p></li>
32/// </ul>
33/// <p>For more information about backups, see the following:</p>
34/// <ul>
35/// <li>
36/// <p>For Amazon FSx for Lustre, see <a href="https://docs.aws.amazon.com/fsx/latest/LustreGuide/using-backups-fsx.html">Working with FSx for Lustre backups</a>.</p></li>
37/// <li>
38/// <p>For Amazon FSx for Windows, see <a href="https://docs.aws.amazon.com/fsx/latest/WindowsGuide/using-backups.html">Working with FSx for Windows backups</a>.</p></li>
39/// <li>
40/// <p>For Amazon FSx for NetApp ONTAP, see <a href="https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/using-backups.html">Working with FSx for NetApp ONTAP backups</a>.</p></li>
41/// <li>
42/// <p>For Amazon FSx for OpenZFS, see <a href="https://docs.aws.amazon.com/fsx/latest/OpenZFSGuide/using-backups.html">Working with FSx for OpenZFS backups</a>.</p></li>
43/// </ul>
44/// <p>If a backup with the specified client request token exists and the parameters match, this operation returns the description of the existing backup. If a backup with the specified client request token exists and the parameters don't match, this operation returns <code>IncompatibleParameterError</code>. If a backup with the specified client request token doesn't exist, <code>CreateBackup</code> does the following:</p>
45/// <ul>
46/// <li>
47/// <p>Creates a new Amazon FSx backup with an assigned ID, and an initial lifecycle state of <code>CREATING</code>.</p></li>
48/// <li>
49/// <p>Returns the description of the backup.</p></li>
50/// </ul>
51/// <p>By using the idempotent operation, you can retry a <code>CreateBackup</code> operation without the risk of creating an extra backup. This approach can be useful when an initial call fails in a way that makes it unclear whether a backup was created. If you use the same client request token and the initial call created a backup, the operation returns a successful result because all the parameters are the same.</p>
52/// <p>The <code>CreateBackup</code> operation returns while the backup's lifecycle state is still <code>CREATING</code>. You can check the backup creation status by calling the <a href="https://docs.aws.amazon.com/fsx/latest/APIReference/API_DescribeBackups.html">DescribeBackups</a> operation, which returns the backup state along with other information.</p>
53#[derive(::std::clone::Clone, ::std::fmt::Debug)]
54pub struct CreateBackupFluentBuilder {
55 handle: ::std::sync::Arc<crate::client::Handle>,
56 inner: crate::operation::create_backup::builders::CreateBackupInputBuilder,
57 config_override: ::std::option::Option<crate::config::Builder>,
58}
59impl
60 crate::client::customize::internal::CustomizableSend<
61 crate::operation::create_backup::CreateBackupOutput,
62 crate::operation::create_backup::CreateBackupError,
63 > for CreateBackupFluentBuilder
64{
65 fn send(
66 self,
67 config_override: crate::config::Builder,
68 ) -> crate::client::customize::internal::BoxFuture<
69 crate::client::customize::internal::SendResult<
70 crate::operation::create_backup::CreateBackupOutput,
71 crate::operation::create_backup::CreateBackupError,
72 >,
73 > {
74 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
75 }
76}
77impl CreateBackupFluentBuilder {
78 /// Creates a new `CreateBackupFluentBuilder`.
79 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
80 Self {
81 handle,
82 inner: ::std::default::Default::default(),
83 config_override: ::std::option::Option::None,
84 }
85 }
86 /// Access the CreateBackup as a reference.
87 pub fn as_input(&self) -> &crate::operation::create_backup::builders::CreateBackupInputBuilder {
88 &self.inner
89 }
90 /// Sends the request and returns the response.
91 ///
92 /// If an error occurs, an `SdkError` will be returned with additional details that
93 /// can be matched against.
94 ///
95 /// By default, any retryable failures will be retried twice. Retry behavior
96 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
97 /// set when configuring the client.
98 pub async fn send(
99 self,
100 ) -> ::std::result::Result<
101 crate::operation::create_backup::CreateBackupOutput,
102 ::aws_smithy_runtime_api::client::result::SdkError<
103 crate::operation::create_backup::CreateBackupError,
104 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
105 >,
106 > {
107 let input = self
108 .inner
109 .build()
110 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
111 let runtime_plugins = crate::operation::create_backup::CreateBackup::operation_runtime_plugins(
112 self.handle.runtime_plugins.clone(),
113 &self.handle.conf,
114 self.config_override,
115 );
116 crate::operation::create_backup::CreateBackup::orchestrate(&runtime_plugins, input).await
117 }
118
119 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
120 pub fn customize(
121 self,
122 ) -> crate::client::customize::CustomizableOperation<
123 crate::operation::create_backup::CreateBackupOutput,
124 crate::operation::create_backup::CreateBackupError,
125 Self,
126 > {
127 crate::client::customize::CustomizableOperation::new(self)
128 }
129 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
130 self.set_config_override(::std::option::Option::Some(config_override.into()));
131 self
132 }
133
134 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
135 self.config_override = config_override;
136 self
137 }
138 /// <p>The ID of the file system to back up.</p>
139 pub fn file_system_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140 self.inner = self.inner.file_system_id(input.into());
141 self
142 }
143 /// <p>The ID of the file system to back up.</p>
144 pub fn set_file_system_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145 self.inner = self.inner.set_file_system_id(input);
146 self
147 }
148 /// <p>The ID of the file system to back up.</p>
149 pub fn get_file_system_id(&self) -> &::std::option::Option<::std::string::String> {
150 self.inner.get_file_system_id()
151 }
152 /// <p>(Optional) A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent creation. This string is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
153 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154 self.inner = self.inner.client_request_token(input.into());
155 self
156 }
157 /// <p>(Optional) A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent creation. This string is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
158 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159 self.inner = self.inner.set_client_request_token(input);
160 self
161 }
162 /// <p>(Optional) A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent creation. This string is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
163 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
164 self.inner.get_client_request_token()
165 }
166 ///
167 /// Appends an item to `Tags`.
168 ///
169 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
170 ///
171 /// <p>(Optional) The tags to apply to the backup at backup creation. The key value of the <code>Name</code> tag appears in the console as the backup name. If you have set <code>CopyTagsToBackups</code> to <code>true</code>, and you specify one or more tags using the <code>CreateBackup</code> operation, no existing file system tags are copied from the file system to the backup.</p>
172 pub fn tags(mut self, input: crate::types::Tag) -> Self {
173 self.inner = self.inner.tags(input);
174 self
175 }
176 /// <p>(Optional) The tags to apply to the backup at backup creation. The key value of the <code>Name</code> tag appears in the console as the backup name. If you have set <code>CopyTagsToBackups</code> to <code>true</code>, and you specify one or more tags using the <code>CreateBackup</code> operation, no existing file system tags are copied from the file system to the backup.</p>
177 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
178 self.inner = self.inner.set_tags(input);
179 self
180 }
181 /// <p>(Optional) The tags to apply to the backup at backup creation. The key value of the <code>Name</code> tag appears in the console as the backup name. If you have set <code>CopyTagsToBackups</code> to <code>true</code>, and you specify one or more tags using the <code>CreateBackup</code> operation, no existing file system tags are copied from the file system to the backup.</p>
182 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
183 self.inner.get_tags()
184 }
185 /// <p>(Optional) The ID of the FSx for ONTAP volume to back up.</p>
186 pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187 self.inner = self.inner.volume_id(input.into());
188 self
189 }
190 /// <p>(Optional) The ID of the FSx for ONTAP volume to back up.</p>
191 pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192 self.inner = self.inner.set_volume_id(input);
193 self
194 }
195 /// <p>(Optional) The ID of the FSx for ONTAP volume to back up.</p>
196 pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
197 self.inner.get_volume_id()
198 }
199}