aws_sdk_ec2/operation/import_snapshot/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::import_snapshot::_import_snapshot_output::ImportSnapshotOutputBuilder;
3
4pub use crate::operation::import_snapshot::_import_snapshot_input::ImportSnapshotInputBuilder;
5
6impl crate::operation::import_snapshot::builders::ImportSnapshotInputBuilder {
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::import_snapshot::ImportSnapshotOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::import_snapshot::ImportSnapshotError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.import_snapshot();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ImportSnapshot`.
24///
25/// <p>Imports a disk into an EBS snapshot.</p>
26/// <p>For more information, see <a href="https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-import-snapshot.html">Importing a disk as a snapshot using VM Import/Export</a> in the <i>VM Import/Export User Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct ImportSnapshotFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::import_snapshot::builders::ImportSnapshotInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::import_snapshot::ImportSnapshotOutput,
36        crate::operation::import_snapshot::ImportSnapshotError,
37    > for ImportSnapshotFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::import_snapshot::ImportSnapshotOutput,
45            crate::operation::import_snapshot::ImportSnapshotError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl ImportSnapshotFluentBuilder {
52    /// Creates a new `ImportSnapshotFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the ImportSnapshot as a reference.
61    pub fn as_input(&self) -> &crate::operation::import_snapshot::builders::ImportSnapshotInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::import_snapshot::ImportSnapshotOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::import_snapshot::ImportSnapshotError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::import_snapshot::ImportSnapshot::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::import_snapshot::ImportSnapshot::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::import_snapshot::ImportSnapshotOutput,
98        crate::operation::import_snapshot::ImportSnapshotError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The client-specific data.</p>
113    pub fn client_data(mut self, input: crate::types::ClientData) -> Self {
114        self.inner = self.inner.client_data(input);
115        self
116    }
117    /// <p>The client-specific data.</p>
118    pub fn set_client_data(mut self, input: ::std::option::Option<crate::types::ClientData>) -> Self {
119        self.inner = self.inner.set_client_data(input);
120        self
121    }
122    /// <p>The client-specific data.</p>
123    pub fn get_client_data(&self) -> &::std::option::Option<crate::types::ClientData> {
124        self.inner.get_client_data()
125    }
126    /// <p>Token to enable idempotency for VM import requests.</p>
127    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.client_token(input.into());
129        self
130    }
131    /// <p>Token to enable idempotency for VM import requests.</p>
132    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_client_token(input);
134        self
135    }
136    /// <p>Token to enable idempotency for VM import requests.</p>
137    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_client_token()
139    }
140    /// <p>The description string for the import snapshot task.</p>
141    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.description(input.into());
143        self
144    }
145    /// <p>The description string for the import snapshot task.</p>
146    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_description(input);
148        self
149    }
150    /// <p>The description string for the import snapshot task.</p>
151    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_description()
153    }
154    /// <p>Information about the disk container.</p>
155    pub fn disk_container(mut self, input: crate::types::SnapshotDiskContainer) -> Self {
156        self.inner = self.inner.disk_container(input);
157        self
158    }
159    /// <p>Information about the disk container.</p>
160    pub fn set_disk_container(mut self, input: ::std::option::Option<crate::types::SnapshotDiskContainer>) -> Self {
161        self.inner = self.inner.set_disk_container(input);
162        self
163    }
164    /// <p>Information about the disk container.</p>
165    pub fn get_disk_container(&self) -> &::std::option::Option<crate::types::SnapshotDiskContainer> {
166        self.inner.get_disk_container()
167    }
168    /// <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>
169    pub fn dry_run(mut self, input: bool) -> Self {
170        self.inner = self.inner.dry_run(input);
171        self
172    }
173    /// <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>
174    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
175        self.inner = self.inner.set_dry_run(input);
176        self
177    }
178    /// <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>
179    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
180        self.inner.get_dry_run()
181    }
182    /// <p>Specifies whether the destination snapshot of the imported image should be encrypted. The default KMS key for EBS is used unless you specify a non-default KMS key using <code>KmsKeyId</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html">Amazon EBS Encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
183    pub fn encrypted(mut self, input: bool) -> Self {
184        self.inner = self.inner.encrypted(input);
185        self
186    }
187    /// <p>Specifies whether the destination snapshot of the imported image should be encrypted. The default KMS key for EBS is used unless you specify a non-default KMS key using <code>KmsKeyId</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html">Amazon EBS Encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
188    pub fn set_encrypted(mut self, input: ::std::option::Option<bool>) -> Self {
189        self.inner = self.inner.set_encrypted(input);
190        self
191    }
192    /// <p>Specifies whether the destination snapshot of the imported image should be encrypted. The default KMS key for EBS is used unless you specify a non-default KMS key using <code>KmsKeyId</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html">Amazon EBS Encryption</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
193    pub fn get_encrypted(&self) -> &::std::option::Option<bool> {
194        self.inner.get_encrypted()
195    }
196    /// <p>An identifier for the symmetric KMS key to use when creating the encrypted snapshot. This parameter is only required if you want to use a non-default KMS key; if this parameter is not specified, the default KMS key for EBS is used. If a <code>KmsKeyId</code> is specified, the <code>Encrypted</code> flag must also be set.</p>
197    /// <p>The KMS key identifier may be provided in any of the following formats:</p>
198    /// <ul>
199    /// <li>
200    /// <p>Key ID</p></li>
201    /// <li>
202    /// <p>Key alias</p></li>
203    /// <li>
204    /// <p>ARN using key ID. The ID ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the key, the Amazon Web Services account ID of the key owner, the <code>key</code> namespace, and then the key ID. For example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.</p></li>
205    /// <li>
206    /// <p>ARN using key alias. The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the key, the Amazon Web Services account ID of the key owner, the <code>alias</code> namespace, and then the key alias. For example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>.</p></li>
207    /// </ul>
208    /// <p>Amazon Web Services parses <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete even though you provided an invalid identifier. This action will eventually report failure.</p>
209    /// <p>The specified KMS key must exist in the Region that the snapshot is being copied to.</p>
210    /// <p>Amazon EBS does not support asymmetric KMS keys.</p>
211    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
212        self.inner = self.inner.kms_key_id(input.into());
213        self
214    }
215    /// <p>An identifier for the symmetric KMS key to use when creating the encrypted snapshot. This parameter is only required if you want to use a non-default KMS key; if this parameter is not specified, the default KMS key for EBS is used. If a <code>KmsKeyId</code> is specified, the <code>Encrypted</code> flag must also be set.</p>
216    /// <p>The KMS key identifier may be provided in any of the following formats:</p>
217    /// <ul>
218    /// <li>
219    /// <p>Key ID</p></li>
220    /// <li>
221    /// <p>Key alias</p></li>
222    /// <li>
223    /// <p>ARN using key ID. The ID ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the key, the Amazon Web Services account ID of the key owner, the <code>key</code> namespace, and then the key ID. For example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.</p></li>
224    /// <li>
225    /// <p>ARN using key alias. The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the key, the Amazon Web Services account ID of the key owner, the <code>alias</code> namespace, and then the key alias. For example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>.</p></li>
226    /// </ul>
227    /// <p>Amazon Web Services parses <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete even though you provided an invalid identifier. This action will eventually report failure.</p>
228    /// <p>The specified KMS key must exist in the Region that the snapshot is being copied to.</p>
229    /// <p>Amazon EBS does not support asymmetric KMS keys.</p>
230    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
231        self.inner = self.inner.set_kms_key_id(input);
232        self
233    }
234    /// <p>An identifier for the symmetric KMS key to use when creating the encrypted snapshot. This parameter is only required if you want to use a non-default KMS key; if this parameter is not specified, the default KMS key for EBS is used. If a <code>KmsKeyId</code> is specified, the <code>Encrypted</code> flag must also be set.</p>
235    /// <p>The KMS key identifier may be provided in any of the following formats:</p>
236    /// <ul>
237    /// <li>
238    /// <p>Key ID</p></li>
239    /// <li>
240    /// <p>Key alias</p></li>
241    /// <li>
242    /// <p>ARN using key ID. The ID ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the key, the Amazon Web Services account ID of the key owner, the <code>key</code> namespace, and then the key ID. For example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:key/<i>abcd1234-a123-456a-a12b-a123b4cd56ef</i>.</p></li>
243    /// <li>
244    /// <p>ARN using key alias. The alias ARN contains the <code>arn:aws:kms</code> namespace, followed by the Region of the key, the Amazon Web Services account ID of the key owner, the <code>alias</code> namespace, and then the key alias. For example, arn:aws:kms:<i>us-east-1</i>:<i>012345678910</i>:alias/<i>ExampleAlias</i>.</p></li>
245    /// </ul>
246    /// <p>Amazon Web Services parses <code>KmsKeyId</code> asynchronously, meaning that the action you call may appear to complete even though you provided an invalid identifier. This action will eventually report failure.</p>
247    /// <p>The specified KMS key must exist in the Region that the snapshot is being copied to.</p>
248    /// <p>Amazon EBS does not support asymmetric KMS keys.</p>
249    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
250        self.inner.get_kms_key_id()
251    }
252    /// <p>The name of the role to use when not using the default role, 'vmimport'.</p>
253    pub fn role_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
254        self.inner = self.inner.role_name(input.into());
255        self
256    }
257    /// <p>The name of the role to use when not using the default role, 'vmimport'.</p>
258    pub fn set_role_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
259        self.inner = self.inner.set_role_name(input);
260        self
261    }
262    /// <p>The name of the role to use when not using the default role, 'vmimport'.</p>
263    pub fn get_role_name(&self) -> &::std::option::Option<::std::string::String> {
264        self.inner.get_role_name()
265    }
266    ///
267    /// Appends an item to `TagSpecifications`.
268    ///
269    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
270    ///
271    /// <p>The tags to apply to the import snapshot task during creation.</p>
272    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
273        self.inner = self.inner.tag_specifications(input);
274        self
275    }
276    /// <p>The tags to apply to the import snapshot task during creation.</p>
277    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
278        self.inner = self.inner.set_tag_specifications(input);
279        self
280    }
281    /// <p>The tags to apply to the import snapshot task during creation.</p>
282    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
283        self.inner.get_tag_specifications()
284    }
285}