aws_sdk_imagebuilder/operation/import_vm_image/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::import_vm_image::_import_vm_image_output::ImportVmImageOutputBuilder;
3
4pub use crate::operation::import_vm_image::_import_vm_image_input::ImportVmImageInputBuilder;
5
6impl crate::operation::import_vm_image::builders::ImportVmImageInputBuilder {
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_vm_image::ImportVmImageOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::import_vm_image::ImportVmImageError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.import_vm_image();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ImportVmImage`.
24///
25/// <p>When you export your virtual machine (VM) from its virtualization environment, that process creates a set of one or more disk container files that act as snapshots of your VM’s environment, settings, and data. The Amazon EC2 API <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportImage.html">ImportImage</a> action uses those files to import your VM and create an AMI. To import using the CLI command, see <a href="https://docs.aws.amazon.com/cli/latest/reference/ec2/import-image.html">import-image</a></p>
26/// <p>You can reference the task ID from the VM import to pull in the AMI that the import created as the base image for your Image Builder recipe.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct ImportVmImageFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::import_vm_image::builders::ImportVmImageInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::import_vm_image::ImportVmImageOutput,
36        crate::operation::import_vm_image::ImportVmImageError,
37    > for ImportVmImageFluentBuilder
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_vm_image::ImportVmImageOutput,
45            crate::operation::import_vm_image::ImportVmImageError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl ImportVmImageFluentBuilder {
52    /// Creates a new `ImportVmImageFluentBuilder`.
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 ImportVmImage as a reference.
61    pub fn as_input(&self) -> &crate::operation::import_vm_image::builders::ImportVmImageInputBuilder {
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_vm_image::ImportVmImageOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::import_vm_image::ImportVmImageError,
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_vm_image::ImportVmImage::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::import_vm_image::ImportVmImage::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_vm_image::ImportVmImageOutput,
98        crate::operation::import_vm_image::ImportVmImageError,
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 name of the base image that is created by the import process.</p>
113    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.name(input.into());
115        self
116    }
117    /// <p>The name of the base image that is created by the import process.</p>
118    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_name(input);
120        self
121    }
122    /// <p>The name of the base image that is created by the import process.</p>
123    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_name()
125    }
126    /// <p>The semantic version to attach to the base image that was created during the import process. This version follows the semantic version syntax.</p><note>
127    /// <p>The semantic version has four nodes: <major>
128    /// .
129    /// <minor>
130    /// .
131    /// <patch>
132    /// /
133    /// <build>
134    /// . You can assign values for the first three, and can filter on all of them.
135    /// </build>
136    /// </patch>
137    /// </minor>
138    /// </major></p>
139    /// <p><b>Assignment:</b> For the first three nodes you can assign any positive integer value, including zero, with an upper limit of 2^30-1, or 1073741823 for each node. Image Builder automatically assigns the build number to the fourth node.</p>
140    /// <p><b>Patterns:</b> You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.</p>
141    /// </note>
142    pub fn semantic_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
143        self.inner = self.inner.semantic_version(input.into());
144        self
145    }
146    /// <p>The semantic version to attach to the base image that was created during the import process. This version follows the semantic version syntax.</p><note>
147    /// <p>The semantic version has four nodes: <major>
148    /// .
149    /// <minor>
150    /// .
151    /// <patch>
152    /// /
153    /// <build>
154    /// . You can assign values for the first three, and can filter on all of them.
155    /// </build>
156    /// </patch>
157    /// </minor>
158    /// </major></p>
159    /// <p><b>Assignment:</b> For the first three nodes you can assign any positive integer value, including zero, with an upper limit of 2^30-1, or 1073741823 for each node. Image Builder automatically assigns the build number to the fourth node.</p>
160    /// <p><b>Patterns:</b> You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.</p>
161    /// </note>
162    pub fn set_semantic_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.inner = self.inner.set_semantic_version(input);
164        self
165    }
166    /// <p>The semantic version to attach to the base image that was created during the import process. This version follows the semantic version syntax.</p><note>
167    /// <p>The semantic version has four nodes: <major>
168    /// .
169    /// <minor>
170    /// .
171    /// <patch>
172    /// /
173    /// <build>
174    /// . You can assign values for the first three, and can filter on all of them.
175    /// </build>
176    /// </patch>
177    /// </minor>
178    /// </major></p>
179    /// <p><b>Assignment:</b> For the first three nodes you can assign any positive integer value, including zero, with an upper limit of 2^30-1, or 1073741823 for each node. Image Builder automatically assigns the build number to the fourth node.</p>
180    /// <p><b>Patterns:</b> You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.</p>
181    /// </note>
182    pub fn get_semantic_version(&self) -> &::std::option::Option<::std::string::String> {
183        self.inner.get_semantic_version()
184    }
185    /// <p>The description for the base image that is created by the import process.</p>
186    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187        self.inner = self.inner.description(input.into());
188        self
189    }
190    /// <p>The description for the base image that is created by the import process.</p>
191    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
192        self.inner = self.inner.set_description(input);
193        self
194    }
195    /// <p>The description for the base image that is created by the import process.</p>
196    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
197        self.inner.get_description()
198    }
199    /// <p>The operating system platform for the imported VM.</p>
200    pub fn platform(mut self, input: crate::types::Platform) -> Self {
201        self.inner = self.inner.platform(input);
202        self
203    }
204    /// <p>The operating system platform for the imported VM.</p>
205    pub fn set_platform(mut self, input: ::std::option::Option<crate::types::Platform>) -> Self {
206        self.inner = self.inner.set_platform(input);
207        self
208    }
209    /// <p>The operating system platform for the imported VM.</p>
210    pub fn get_platform(&self) -> &::std::option::Option<crate::types::Platform> {
211        self.inner.get_platform()
212    }
213    /// <p>The operating system version for the imported VM.</p>
214    pub fn os_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
215        self.inner = self.inner.os_version(input.into());
216        self
217    }
218    /// <p>The operating system version for the imported VM.</p>
219    pub fn set_os_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
220        self.inner = self.inner.set_os_version(input);
221        self
222    }
223    /// <p>The operating system version for the imported VM.</p>
224    pub fn get_os_version(&self) -> &::std::option::Option<::std::string::String> {
225        self.inner.get_os_version()
226    }
227    /// <p>The <code>importTaskId</code> (API) or <code>ImportTaskId</code> (CLI) from the Amazon EC2 VM import process. Image Builder retrieves information from the import process to pull in the AMI that is created from the VM source as the base image for your recipe.</p>
228    pub fn vm_import_task_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
229        self.inner = self.inner.vm_import_task_id(input.into());
230        self
231    }
232    /// <p>The <code>importTaskId</code> (API) or <code>ImportTaskId</code> (CLI) from the Amazon EC2 VM import process. Image Builder retrieves information from the import process to pull in the AMI that is created from the VM source as the base image for your recipe.</p>
233    pub fn set_vm_import_task_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
234        self.inner = self.inner.set_vm_import_task_id(input);
235        self
236    }
237    /// <p>The <code>importTaskId</code> (API) or <code>ImportTaskId</code> (CLI) from the Amazon EC2 VM import process. Image Builder retrieves information from the import process to pull in the AMI that is created from the VM source as the base image for your recipe.</p>
238    pub fn get_vm_import_task_id(&self) -> &::std::option::Option<::std::string::String> {
239        self.inner.get_vm_import_task_id()
240    }
241    ///
242    /// Adds a key-value pair to `tags`.
243    ///
244    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
245    ///
246    /// <p>Tags that are attached to the import resources.</p>
247    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
248        self.inner = self.inner.tags(k.into(), v.into());
249        self
250    }
251    /// <p>Tags that are attached to the import resources.</p>
252    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
253        self.inner = self.inner.set_tags(input);
254        self
255    }
256    /// <p>Tags that are attached to the import resources.</p>
257    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
258        self.inner.get_tags()
259    }
260    /// <p>Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a> in the <i>Amazon EC2 API Reference</i>.</p>
261    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
262        self.inner = self.inner.client_token(input.into());
263        self
264    }
265    /// <p>Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a> in the <i>Amazon EC2 API Reference</i>.</p>
266    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
267        self.inner = self.inner.set_client_token(input);
268        self
269    }
270    /// <p>Unique, case-sensitive identifier you provide to ensure idempotency of the request. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a> in the <i>Amazon EC2 API Reference</i>.</p>
271    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
272        self.inner.get_client_token()
273    }
274}