aws_sdk_ec2/operation/create_snapshots/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_snapshots::_create_snapshots_output::CreateSnapshotsOutputBuilder;
3
4pub use crate::operation::create_snapshots::_create_snapshots_input::CreateSnapshotsInputBuilder;
5
6impl crate::operation::create_snapshots::builders::CreateSnapshotsInputBuilder {
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_snapshots::CreateSnapshotsOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_snapshots::CreateSnapshotsError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_snapshots();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateSnapshots`.
24///
25/// <p>Creates crash-consistent snapshots of multiple EBS volumes attached to an Amazon EC2 instance. Volumes are chosen by specifying an instance. Each volume attached to the specified instance will produce one snapshot that is crash-consistent across the instance. You can include all of the volumes currently attached to the instance, or you can exclude the root volume or specific data (non-root) volumes from the multi-volume snapshot set.</p>
26/// <p>The location of the source instance determines where you can create the snapshots.</p>
27/// <ul>
28/// <li>
29/// <p>If the source instance is in a Region, you must create the snapshots in the same Region as the instance.</p></li>
30/// <li>
31/// <p>If the source instance is in a Local Zone, you can create the snapshots in the same Local Zone or in its parent Amazon Web Services Region.</p></li>
32/// <li>
33/// <p>If the source instance is on an Outpost, you can create the snapshots on the same Outpost or in its parent Amazon Web Services Region.</p></li>
34/// </ul>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct CreateSnapshotsFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::create_snapshots::builders::CreateSnapshotsInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::create_snapshots::CreateSnapshotsOutput,
44        crate::operation::create_snapshots::CreateSnapshotsError,
45    > for CreateSnapshotsFluentBuilder
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_snapshots::CreateSnapshotsOutput,
53            crate::operation::create_snapshots::CreateSnapshotsError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl CreateSnapshotsFluentBuilder {
60    /// Creates a new `CreateSnapshotsFluentBuilder`.
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 CreateSnapshots as a reference.
69    pub fn as_input(&self) -> &crate::operation::create_snapshots::builders::CreateSnapshotsInputBuilder {
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_snapshots::CreateSnapshotsOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::create_snapshots::CreateSnapshotsError,
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_snapshots::CreateSnapshots::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::create_snapshots::CreateSnapshots::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_snapshots::CreateSnapshotsOutput,
106        crate::operation::create_snapshots::CreateSnapshotsError,
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>A description propagated to every snapshot specified by the instance.</p>
121    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.inner = self.inner.description(input.into());
123        self
124    }
125    /// <p>A description propagated to every snapshot specified by the instance.</p>
126    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.inner = self.inner.set_description(input);
128        self
129    }
130    /// <p>A description propagated to every snapshot specified by the instance.</p>
131    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
132        self.inner.get_description()
133    }
134    /// <p>The instance to specify which volumes should be included in the snapshots.</p>
135    pub fn instance_specification(mut self, input: crate::types::InstanceSpecification) -> Self {
136        self.inner = self.inner.instance_specification(input);
137        self
138    }
139    /// <p>The instance to specify which volumes should be included in the snapshots.</p>
140    pub fn set_instance_specification(mut self, input: ::std::option::Option<crate::types::InstanceSpecification>) -> Self {
141        self.inner = self.inner.set_instance_specification(input);
142        self
143    }
144    /// <p>The instance to specify which volumes should be included in the snapshots.</p>
145    pub fn get_instance_specification(&self) -> &::std::option::Option<crate::types::InstanceSpecification> {
146        self.inner.get_instance_specification()
147    }
148    /// <note>
149    /// <p>Only supported for instances on Outposts. If the source instance is not on an Outpost, omit this parameter.</p>
150    /// </note>
151    /// <ul>
152    /// <li>
153    /// <p>To create the snapshots on the same Outpost as the source instance, specify the ARN of that Outpost. The snapshots must be created on the same Outpost as the instance.</p></li>
154    /// <li>
155    /// <p>To create the snapshots in the parent Region of the Outpost, omit this parameter.</p></li>
156    /// </ul>
157    /// <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>
158    pub fn outpost_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
159        self.inner = self.inner.outpost_arn(input.into());
160        self
161    }
162    /// <note>
163    /// <p>Only supported for instances on Outposts. If the source instance is not on an Outpost, omit this parameter.</p>
164    /// </note>
165    /// <ul>
166    /// <li>
167    /// <p>To create the snapshots on the same Outpost as the source instance, specify the ARN of that Outpost. The snapshots must be created on the same Outpost as the instance.</p></li>
168    /// <li>
169    /// <p>To create the snapshots in the parent Region of the Outpost, omit this parameter.</p></li>
170    /// </ul>
171    /// <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>
172    pub fn set_outpost_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173        self.inner = self.inner.set_outpost_arn(input);
174        self
175    }
176    /// <note>
177    /// <p>Only supported for instances on Outposts. If the source instance is not on an Outpost, omit this parameter.</p>
178    /// </note>
179    /// <ul>
180    /// <li>
181    /// <p>To create the snapshots on the same Outpost as the source instance, specify the ARN of that Outpost. The snapshots must be created on the same Outpost as the instance.</p></li>
182    /// <li>
183    /// <p>To create the snapshots in the parent Region of the Outpost, omit this parameter.</p></li>
184    /// </ul>
185    /// <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>
186    pub fn get_outpost_arn(&self) -> &::std::option::Option<::std::string::String> {
187        self.inner.get_outpost_arn()
188    }
189    ///
190    /// Appends an item to `TagSpecifications`.
191    ///
192    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
193    ///
194    /// <p>Tags to apply to every snapshot specified by the instance.</p>
195    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
196        self.inner = self.inner.tag_specifications(input);
197        self
198    }
199    /// <p>Tags to apply to every snapshot specified by the instance.</p>
200    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
201        self.inner = self.inner.set_tag_specifications(input);
202        self
203    }
204    /// <p>Tags to apply to every snapshot specified by the instance.</p>
205    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
206        self.inner.get_tag_specifications()
207    }
208    /// <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>
209    pub fn dry_run(mut self, input: bool) -> Self {
210        self.inner = self.inner.dry_run(input);
211        self
212    }
213    /// <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>
214    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
215        self.inner = self.inner.set_dry_run(input);
216        self
217    }
218    /// <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>
219    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
220        self.inner.get_dry_run()
221    }
222    /// <p>Copies the tags from the specified volume to corresponding snapshot.</p>
223    pub fn copy_tags_from_source(mut self, input: crate::types::CopyTagsFromSource) -> Self {
224        self.inner = self.inner.copy_tags_from_source(input);
225        self
226    }
227    /// <p>Copies the tags from the specified volume to corresponding snapshot.</p>
228    pub fn set_copy_tags_from_source(mut self, input: ::std::option::Option<crate::types::CopyTagsFromSource>) -> Self {
229        self.inner = self.inner.set_copy_tags_from_source(input);
230        self
231    }
232    /// <p>Copies the tags from the specified volume to corresponding snapshot.</p>
233    pub fn get_copy_tags_from_source(&self) -> &::std::option::Option<crate::types::CopyTagsFromSource> {
234        self.inner.get_copy_tags_from_source()
235    }
236    /// <note>
237    /// <p>Only supported for instances in Local Zones. If the source instance is not in a Local Zone, omit this parameter.</p>
238    /// </note>
239    /// <ul>
240    /// <li>
241    /// <p>To create local snapshots in the same Local Zone as the source instance, specify <code>local</code>.</p></li>
242    /// <li>
243    /// <p>To create a regional snapshots in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
244    /// </ul>
245    /// <p>Default value: <code>regional</code></p>
246    pub fn location(mut self, input: crate::types::SnapshotLocationEnum) -> Self {
247        self.inner = self.inner.location(input);
248        self
249    }
250    /// <note>
251    /// <p>Only supported for instances in Local Zones. If the source instance is not in a Local Zone, omit this parameter.</p>
252    /// </note>
253    /// <ul>
254    /// <li>
255    /// <p>To create local snapshots in the same Local Zone as the source instance, specify <code>local</code>.</p></li>
256    /// <li>
257    /// <p>To create a regional snapshots in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
258    /// </ul>
259    /// <p>Default value: <code>regional</code></p>
260    pub fn set_location(mut self, input: ::std::option::Option<crate::types::SnapshotLocationEnum>) -> Self {
261        self.inner = self.inner.set_location(input);
262        self
263    }
264    /// <note>
265    /// <p>Only supported for instances in Local Zones. If the source instance is not in a Local Zone, omit this parameter.</p>
266    /// </note>
267    /// <ul>
268    /// <li>
269    /// <p>To create local snapshots in the same Local Zone as the source instance, specify <code>local</code>.</p></li>
270    /// <li>
271    /// <p>To create a regional snapshots in the parent Region of the Local Zone, specify <code>regional</code> or omit this parameter.</p></li>
272    /// </ul>
273    /// <p>Default value: <code>regional</code></p>
274    pub fn get_location(&self) -> &::std::option::Option<crate::types::SnapshotLocationEnum> {
275        self.inner.get_location()
276    }
277}