aws_sdk_ec2/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 EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make copies of EBS volumes, and to save data before shutting down an instance.</p>
26/// <p>The location of the source EBS volume determines where you can create the snapshot.</p>
27/// <ul>
28/// <li>
29/// <p>If the source volume is in a Region, you must create the snapshot in the same Region as the volume.</p></li>
30/// <li>
31/// <p>If the source volume is in a Local Zone, you can create the snapshot in the same Local Zone or in its parent Amazon Web Services Region.</p></li>
32/// <li>
33/// <p>If the source volume is on an Outpost, you can create the snapshot on the same Outpost or in its parent Amazon Web Services Region.</p></li>
34/// </ul>
35/// <p>When a snapshot is created, any Amazon Web Services Marketplace product codes that are associated with the source volume are propagated to the snapshot.</p>
36/// <p>You can take a snapshot of an attached volume that is in use. However, snapshots only capture data that has been written to your Amazon EBS volume at the time the snapshot command is issued; this might exclude any data that has been cached by any applications or the operating system. If you can pause any file systems on the volume long enough to take a snapshot, your snapshot should be complete. However, if you cannot pause all file writes to the volume, you should unmount the volume from within the instance, issue the snapshot command, and then remount the volume to ensure a consistent and complete snapshot. You may remount and use your volume while the snapshot status is <code>pending</code>.</p>
37/// <p>When you create a snapshot for an EBS volume that serves as a root device, we recommend that you stop the instance before taking the snapshot.</p>
38/// <p>Snapshots that are taken from encrypted volumes are automatically encrypted. Volumes that are created from encrypted snapshots are also automatically encrypted. Your encrypted volumes and any associated snapshots always remain protected. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption.html">Amazon EBS encryption</a> in the <i>Amazon EBS User Guide</i>.</p>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct CreateSnapshotFluentBuilder {
41 handle: ::std::sync::Arc<crate::client::Handle>,
42 inner: crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder,
43 config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46 crate::client::customize::internal::CustomizableSend<
47 crate::operation::create_snapshot::CreateSnapshotOutput,
48 crate::operation::create_snapshot::CreateSnapshotError,
49 > for CreateSnapshotFluentBuilder
50{
51 fn send(
52 self,
53 config_override: crate::config::Builder,
54 ) -> crate::client::customize::internal::BoxFuture<
55 crate::client::customize::internal::SendResult<
56 crate::operation::create_snapshot::CreateSnapshotOutput,
57 crate::operation::create_snapshot::CreateSnapshotError,
58 >,
59 > {
60 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61 }
62}
63impl CreateSnapshotFluentBuilder {
64 /// Creates a new `CreateSnapshotFluentBuilder`.
65 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66 Self {
67 handle,
68 inner: ::std::default::Default::default(),
69 config_override: ::std::option::Option::None,
70 }
71 }
72 /// Access the CreateSnapshot as a reference.
73 pub fn as_input(&self) -> &crate::operation::create_snapshot::builders::CreateSnapshotInputBuilder {
74 &self.inner
75 }
76 /// Sends the request and returns the response.
77 ///
78 /// If an error occurs, an `SdkError` will be returned with additional details that
79 /// can be matched against.
80 ///
81 /// By default, any retryable failures will be retried twice. Retry behavior
82 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83 /// set when configuring the client.
84 pub async fn send(
85 self,
86 ) -> ::std::result::Result<
87 crate::operation::create_snapshot::CreateSnapshotOutput,
88 ::aws_smithy_runtime_api::client::result::SdkError<
89 crate::operation::create_snapshot::CreateSnapshotError,
90 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91 >,
92 > {
93 let input = self
94 .inner
95 .build()
96 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97 let runtime_plugins = crate::operation::create_snapshot::CreateSnapshot::operation_runtime_plugins(
98 self.handle.runtime_plugins.clone(),
99 &self.handle.conf,
100 self.config_override,
101 );
102 crate::operation::create_snapshot::CreateSnapshot::orchestrate(&runtime_plugins, input).await
103 }
104
105 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106 pub fn customize(
107 self,
108 ) -> crate::client::customize::CustomizableOperation<
109 crate::operation::create_snapshot::CreateSnapshotOutput,
110 crate::operation::create_snapshot::CreateSnapshotError,
111 Self,
112 > {
113 crate::client::customize::CustomizableOperation::new(self)
114 }
115 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116 self.set_config_override(::std::option::Option::Some(config_override.into()));
117 self
118 }
119
120 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121 self.config_override = config_override;
122 self
123 }
124 /// <p>A description for the snapshot.</p>
125 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126 self.inner = self.inner.description(input.into());
127 self
128 }
129 /// <p>A description for the snapshot.</p>
130 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131 self.inner = self.inner.set_description(input);
132 self
133 }
134 /// <p>A description for the snapshot.</p>
135 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_description()
137 }
138 /// <note>
139 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
140 /// </note>
141 /// <ul>
142 /// <li>
143 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
144 /// <li>
145 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
146 /// </ul>
147 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
148 pub fn outpost_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149 self.inner = self.inner.outpost_arn(input.into());
150 self
151 }
152 /// <note>
153 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
154 /// </note>
155 /// <ul>
156 /// <li>
157 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
158 /// <li>
159 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
160 /// </ul>
161 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
162 pub fn set_outpost_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163 self.inner = self.inner.set_outpost_arn(input);
164 self
165 }
166 /// <note>
167 /// <p>Only supported for volumes on Outposts. If the source volume is not on an Outpost, omit this parameter.</p>
168 /// </note>
169 /// <ul>
170 /// <li>
171 /// <p>To create the snapshot on the same Outpost as the source volume, specify the ARN of that Outpost. The snapshot must be created on the same Outpost as the volume.</p></li>
172 /// <li>
173 /// <p>To create the snapshot in the parent Region of the Outpost, omit this parameter.</p></li>
174 /// </ul>
175 /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/snapshots-outposts.html#create-snapshot">Create local snapshots from volumes on an Outpost</a> in the <i>Amazon EBS User Guide</i>.</p>
176 pub fn get_outpost_arn(&self) -> &::std::option::Option<::std::string::String> {
177 self.inner.get_outpost_arn()
178 }
179 /// <p>The ID of the Amazon EBS volume.</p>
180 pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181 self.inner = self.inner.volume_id(input.into());
182 self
183 }
184 /// <p>The ID of the Amazon EBS volume.</p>
185 pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
186 self.inner = self.inner.set_volume_id(input);
187 self
188 }
189 /// <p>The ID of the Amazon EBS volume.</p>
190 pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
191 self.inner.get_volume_id()
192 }
193 ///
194 /// Appends an item to `TagSpecifications`.
195 ///
196 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
197 ///
198 /// <p>The tags to apply to the snapshot during creation.</p>
199 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
200 self.inner = self.inner.tag_specifications(input);
201 self
202 }
203 /// <p>The tags to apply to the snapshot during creation.</p>
204 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
205 self.inner = self.inner.set_tag_specifications(input);
206 self
207 }
208 /// <p>The tags to apply to the snapshot during creation.</p>
209 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
210 self.inner.get_tag_specifications()
211 }
212 /// <note>
213 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
214 /// </note>
215 /// <ul>
216 /// <li>
217 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
218 /// <li>
219 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
220 /// </ul>
221 /// <p>Default value: <code>regional</code></p>
222 pub fn location(mut self, input: crate::types::SnapshotLocationEnum) -> Self {
223 self.inner = self.inner.location(input);
224 self
225 }
226 /// <note>
227 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
228 /// </note>
229 /// <ul>
230 /// <li>
231 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
232 /// <li>
233 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
234 /// </ul>
235 /// <p>Default value: <code>regional</code></p>
236 pub fn set_location(mut self, input: ::std::option::Option<crate::types::SnapshotLocationEnum>) -> Self {
237 self.inner = self.inner.set_location(input);
238 self
239 }
240 /// <note>
241 /// <p>Only supported for volumes in Local Zones. If the source volume is not in a Local Zone, omit this parameter.</p>
242 /// </note>
243 /// <ul>
244 /// <li>
245 /// <p>To create a local snapshot in the same Local Zone as the source volume, specify <code>local</code>.</p></li>
246 /// <li>
247 /// <p>To create a regional snapshot in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
248 /// </ul>
249 /// <p>Default value: <code>regional</code></p>
250 pub fn get_location(&self) -> &::std::option::Option<crate::types::SnapshotLocationEnum> {
251 self.inner.get_location()
252 }
253 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
254 pub fn dry_run(mut self, input: bool) -> Self {
255 self.inner = self.inner.dry_run(input);
256 self
257 }
258 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
259 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
260 self.inner = self.inner.set_dry_run(input);
261 self
262 }
263 /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
264 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
265 self.inner.get_dry_run()
266 }
267}