aws_sdk_ec2/operation/export_image/
_export_image_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ExportImageInput {
6    /// <p>Token to enable idempotency for export image requests.</p>
7    pub client_token: ::std::option::Option<::std::string::String>,
8    /// <p>A description of the image being exported. The maximum length is 255 characters.</p>
9    pub description: ::std::option::Option<::std::string::String>,
10    /// <p>The disk image format.</p>
11    pub disk_image_format: ::std::option::Option<crate::types::DiskImageFormat>,
12    /// <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>
13    pub dry_run: ::std::option::Option<bool>,
14    /// <p>The ID of the image.</p>
15    pub image_id: ::std::option::Option<::std::string::String>,
16    /// <p>The Amazon S3 bucket for the destination image. The destination bucket must exist.</p>
17    pub s3_export_location: ::std::option::Option<crate::types::ExportTaskS3LocationRequest>,
18    /// <p>The name of the role that grants VM Import/Export permission to export images to your Amazon S3 bucket. If this parameter is not specified, the default role is named 'vmimport'.</p>
19    pub role_name: ::std::option::Option<::std::string::String>,
20    /// <p>The tags to apply to the export image task during creation.</p>
21    pub tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
22}
23impl ExportImageInput {
24    /// <p>Token to enable idempotency for export image requests.</p>
25    pub fn client_token(&self) -> ::std::option::Option<&str> {
26        self.client_token.as_deref()
27    }
28    /// <p>A description of the image being exported. The maximum length is 255 characters.</p>
29    pub fn description(&self) -> ::std::option::Option<&str> {
30        self.description.as_deref()
31    }
32    /// <p>The disk image format.</p>
33    pub fn disk_image_format(&self) -> ::std::option::Option<&crate::types::DiskImageFormat> {
34        self.disk_image_format.as_ref()
35    }
36    /// <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>
37    pub fn dry_run(&self) -> ::std::option::Option<bool> {
38        self.dry_run
39    }
40    /// <p>The ID of the image.</p>
41    pub fn image_id(&self) -> ::std::option::Option<&str> {
42        self.image_id.as_deref()
43    }
44    /// <p>The Amazon S3 bucket for the destination image. The destination bucket must exist.</p>
45    pub fn s3_export_location(&self) -> ::std::option::Option<&crate::types::ExportTaskS3LocationRequest> {
46        self.s3_export_location.as_ref()
47    }
48    /// <p>The name of the role that grants VM Import/Export permission to export images to your Amazon S3 bucket. If this parameter is not specified, the default role is named 'vmimport'.</p>
49    pub fn role_name(&self) -> ::std::option::Option<&str> {
50        self.role_name.as_deref()
51    }
52    /// <p>The tags to apply to the export image task during creation.</p>
53    ///
54    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tag_specifications.is_none()`.
55    pub fn tag_specifications(&self) -> &[crate::types::TagSpecification] {
56        self.tag_specifications.as_deref().unwrap_or_default()
57    }
58}
59impl ExportImageInput {
60    /// Creates a new builder-style object to manufacture [`ExportImageInput`](crate::operation::export_image::ExportImageInput).
61    pub fn builder() -> crate::operation::export_image::builders::ExportImageInputBuilder {
62        crate::operation::export_image::builders::ExportImageInputBuilder::default()
63    }
64}
65
66/// A builder for [`ExportImageInput`](crate::operation::export_image::ExportImageInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct ExportImageInputBuilder {
70    pub(crate) client_token: ::std::option::Option<::std::string::String>,
71    pub(crate) description: ::std::option::Option<::std::string::String>,
72    pub(crate) disk_image_format: ::std::option::Option<crate::types::DiskImageFormat>,
73    pub(crate) dry_run: ::std::option::Option<bool>,
74    pub(crate) image_id: ::std::option::Option<::std::string::String>,
75    pub(crate) s3_export_location: ::std::option::Option<crate::types::ExportTaskS3LocationRequest>,
76    pub(crate) role_name: ::std::option::Option<::std::string::String>,
77    pub(crate) tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
78}
79impl ExportImageInputBuilder {
80    /// <p>Token to enable idempotency for export image requests.</p>
81    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        self.client_token = ::std::option::Option::Some(input.into());
83        self
84    }
85    /// <p>Token to enable idempotency for export image requests.</p>
86    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87        self.client_token = input;
88        self
89    }
90    /// <p>Token to enable idempotency for export image requests.</p>
91    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
92        &self.client_token
93    }
94    /// <p>A description of the image being exported. The maximum length is 255 characters.</p>
95    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
96        self.description = ::std::option::Option::Some(input.into());
97        self
98    }
99    /// <p>A description of the image being exported. The maximum length is 255 characters.</p>
100    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
101        self.description = input;
102        self
103    }
104    /// <p>A description of the image being exported. The maximum length is 255 characters.</p>
105    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
106        &self.description
107    }
108    /// <p>The disk image format.</p>
109    /// This field is required.
110    pub fn disk_image_format(mut self, input: crate::types::DiskImageFormat) -> Self {
111        self.disk_image_format = ::std::option::Option::Some(input);
112        self
113    }
114    /// <p>The disk image format.</p>
115    pub fn set_disk_image_format(mut self, input: ::std::option::Option<crate::types::DiskImageFormat>) -> Self {
116        self.disk_image_format = input;
117        self
118    }
119    /// <p>The disk image format.</p>
120    pub fn get_disk_image_format(&self) -> &::std::option::Option<crate::types::DiskImageFormat> {
121        &self.disk_image_format
122    }
123    /// <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>
124    pub fn dry_run(mut self, input: bool) -> Self {
125        self.dry_run = ::std::option::Option::Some(input);
126        self
127    }
128    /// <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>
129    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
130        self.dry_run = input;
131        self
132    }
133    /// <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>
134    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
135        &self.dry_run
136    }
137    /// <p>The ID of the image.</p>
138    /// This field is required.
139    pub fn image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.image_id = ::std::option::Option::Some(input.into());
141        self
142    }
143    /// <p>The ID of the image.</p>
144    pub fn set_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.image_id = input;
146        self
147    }
148    /// <p>The ID of the image.</p>
149    pub fn get_image_id(&self) -> &::std::option::Option<::std::string::String> {
150        &self.image_id
151    }
152    /// <p>The Amazon S3 bucket for the destination image. The destination bucket must exist.</p>
153    /// This field is required.
154    pub fn s3_export_location(mut self, input: crate::types::ExportTaskS3LocationRequest) -> Self {
155        self.s3_export_location = ::std::option::Option::Some(input);
156        self
157    }
158    /// <p>The Amazon S3 bucket for the destination image. The destination bucket must exist.</p>
159    pub fn set_s3_export_location(mut self, input: ::std::option::Option<crate::types::ExportTaskS3LocationRequest>) -> Self {
160        self.s3_export_location = input;
161        self
162    }
163    /// <p>The Amazon S3 bucket for the destination image. The destination bucket must exist.</p>
164    pub fn get_s3_export_location(&self) -> &::std::option::Option<crate::types::ExportTaskS3LocationRequest> {
165        &self.s3_export_location
166    }
167    /// <p>The name of the role that grants VM Import/Export permission to export images to your Amazon S3 bucket. If this parameter is not specified, the default role is named 'vmimport'.</p>
168    pub fn role_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
169        self.role_name = ::std::option::Option::Some(input.into());
170        self
171    }
172    /// <p>The name of the role that grants VM Import/Export permission to export images to your Amazon S3 bucket. If this parameter is not specified, the default role is named 'vmimport'.</p>
173    pub fn set_role_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
174        self.role_name = input;
175        self
176    }
177    /// <p>The name of the role that grants VM Import/Export permission to export images to your Amazon S3 bucket. If this parameter is not specified, the default role is named 'vmimport'.</p>
178    pub fn get_role_name(&self) -> &::std::option::Option<::std::string::String> {
179        &self.role_name
180    }
181    /// Appends an item to `tag_specifications`.
182    ///
183    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
184    ///
185    /// <p>The tags to apply to the export image task during creation.</p>
186    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
187        let mut v = self.tag_specifications.unwrap_or_default();
188        v.push(input);
189        self.tag_specifications = ::std::option::Option::Some(v);
190        self
191    }
192    /// <p>The tags to apply to the export image task during creation.</p>
193    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
194        self.tag_specifications = input;
195        self
196    }
197    /// <p>The tags to apply to the export image task during creation.</p>
198    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
199        &self.tag_specifications
200    }
201    /// Consumes the builder and constructs a [`ExportImageInput`](crate::operation::export_image::ExportImageInput).
202    pub fn build(self) -> ::std::result::Result<crate::operation::export_image::ExportImageInput, ::aws_smithy_types::error::operation::BuildError> {
203        ::std::result::Result::Ok(crate::operation::export_image::ExportImageInput {
204            client_token: self.client_token,
205            description: self.description,
206            disk_image_format: self.disk_image_format,
207            dry_run: self.dry_run,
208            image_id: self.image_id,
209            s3_export_location: self.s3_export_location,
210            role_name: self.role_name,
211            tag_specifications: self.tag_specifications,
212        })
213    }
214}