aws_sdk_imagebuilder/operation/create_image/
_create_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 CreateImageInput {
6    /// <p>The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed.</p>
7    pub image_recipe_arn: ::std::option::Option<::std::string::String>,
8    /// <p>The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested.</p>
9    pub container_recipe_arn: ::std::option::Option<::std::string::String>,
10    /// <p>The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your pipeline.</p>
11    pub distribution_configuration_arn: ::std::option::Option<::std::string::String>,
12    /// <p>The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.</p>
13    pub infrastructure_configuration_arn: ::std::option::Option<::std::string::String>,
14    /// <p>The image tests configuration of the image.</p>
15    pub image_tests_configuration: ::std::option::Option<crate::types::ImageTestsConfiguration>,
16    /// <p>Collects additional information about the image being created, including the operating system (OS) version and package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by default.</p>
17    pub enhanced_image_metadata_enabled: ::std::option::Option<bool>,
18    /// <p>The tags of the image.</p>
19    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
20    /// <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>
21    pub client_token: ::std::option::Option<::std::string::String>,
22    /// <p>Contains settings for vulnerability scans.</p>
23    pub image_scanning_configuration: ::std::option::Option<crate::types::ImageScanningConfiguration>,
24    /// <p>Contains an array of workflow configuration objects.</p>
25    pub workflows: ::std::option::Option<::std::vec::Vec<crate::types::WorkflowConfiguration>>,
26    /// <p>The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.</p>
27    pub execution_role: ::std::option::Option<::std::string::String>,
28}
29impl CreateImageInput {
30    /// <p>The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed.</p>
31    pub fn image_recipe_arn(&self) -> ::std::option::Option<&str> {
32        self.image_recipe_arn.as_deref()
33    }
34    /// <p>The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested.</p>
35    pub fn container_recipe_arn(&self) -> ::std::option::Option<&str> {
36        self.container_recipe_arn.as_deref()
37    }
38    /// <p>The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your pipeline.</p>
39    pub fn distribution_configuration_arn(&self) -> ::std::option::Option<&str> {
40        self.distribution_configuration_arn.as_deref()
41    }
42    /// <p>The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.</p>
43    pub fn infrastructure_configuration_arn(&self) -> ::std::option::Option<&str> {
44        self.infrastructure_configuration_arn.as_deref()
45    }
46    /// <p>The image tests configuration of the image.</p>
47    pub fn image_tests_configuration(&self) -> ::std::option::Option<&crate::types::ImageTestsConfiguration> {
48        self.image_tests_configuration.as_ref()
49    }
50    /// <p>Collects additional information about the image being created, including the operating system (OS) version and package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by default.</p>
51    pub fn enhanced_image_metadata_enabled(&self) -> ::std::option::Option<bool> {
52        self.enhanced_image_metadata_enabled
53    }
54    /// <p>The tags of the image.</p>
55    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
56        self.tags.as_ref()
57    }
58    /// <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>
59    pub fn client_token(&self) -> ::std::option::Option<&str> {
60        self.client_token.as_deref()
61    }
62    /// <p>Contains settings for vulnerability scans.</p>
63    pub fn image_scanning_configuration(&self) -> ::std::option::Option<&crate::types::ImageScanningConfiguration> {
64        self.image_scanning_configuration.as_ref()
65    }
66    /// <p>Contains an array of workflow configuration objects.</p>
67    ///
68    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.workflows.is_none()`.
69    pub fn workflows(&self) -> &[crate::types::WorkflowConfiguration] {
70        self.workflows.as_deref().unwrap_or_default()
71    }
72    /// <p>The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.</p>
73    pub fn execution_role(&self) -> ::std::option::Option<&str> {
74        self.execution_role.as_deref()
75    }
76}
77impl CreateImageInput {
78    /// Creates a new builder-style object to manufacture [`CreateImageInput`](crate::operation::create_image::CreateImageInput).
79    pub fn builder() -> crate::operation::create_image::builders::CreateImageInputBuilder {
80        crate::operation::create_image::builders::CreateImageInputBuilder::default()
81    }
82}
83
84/// A builder for [`CreateImageInput`](crate::operation::create_image::CreateImageInput).
85#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
86#[non_exhaustive]
87pub struct CreateImageInputBuilder {
88    pub(crate) image_recipe_arn: ::std::option::Option<::std::string::String>,
89    pub(crate) container_recipe_arn: ::std::option::Option<::std::string::String>,
90    pub(crate) distribution_configuration_arn: ::std::option::Option<::std::string::String>,
91    pub(crate) infrastructure_configuration_arn: ::std::option::Option<::std::string::String>,
92    pub(crate) image_tests_configuration: ::std::option::Option<crate::types::ImageTestsConfiguration>,
93    pub(crate) enhanced_image_metadata_enabled: ::std::option::Option<bool>,
94    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
95    pub(crate) client_token: ::std::option::Option<::std::string::String>,
96    pub(crate) image_scanning_configuration: ::std::option::Option<crate::types::ImageScanningConfiguration>,
97    pub(crate) workflows: ::std::option::Option<::std::vec::Vec<crate::types::WorkflowConfiguration>>,
98    pub(crate) execution_role: ::std::option::Option<::std::string::String>,
99}
100impl CreateImageInputBuilder {
101    /// <p>The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed.</p>
102    pub fn image_recipe_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.image_recipe_arn = ::std::option::Option::Some(input.into());
104        self
105    }
106    /// <p>The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed.</p>
107    pub fn set_image_recipe_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
108        self.image_recipe_arn = input;
109        self
110    }
111    /// <p>The Amazon Resource Name (ARN) of the image recipe that defines how images are configured, tested, and assessed.</p>
112    pub fn get_image_recipe_arn(&self) -> &::std::option::Option<::std::string::String> {
113        &self.image_recipe_arn
114    }
115    /// <p>The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested.</p>
116    pub fn container_recipe_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.container_recipe_arn = ::std::option::Option::Some(input.into());
118        self
119    }
120    /// <p>The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested.</p>
121    pub fn set_container_recipe_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.container_recipe_arn = input;
123        self
124    }
125    /// <p>The Amazon Resource Name (ARN) of the container recipe that defines how images are configured and tested.</p>
126    pub fn get_container_recipe_arn(&self) -> &::std::option::Option<::std::string::String> {
127        &self.container_recipe_arn
128    }
129    /// <p>The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your pipeline.</p>
130    pub fn distribution_configuration_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.distribution_configuration_arn = ::std::option::Option::Some(input.into());
132        self
133    }
134    /// <p>The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your pipeline.</p>
135    pub fn set_distribution_configuration_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.distribution_configuration_arn = input;
137        self
138    }
139    /// <p>The Amazon Resource Name (ARN) of the distribution configuration that defines and configures the outputs of your pipeline.</p>
140    pub fn get_distribution_configuration_arn(&self) -> &::std::option::Option<::std::string::String> {
141        &self.distribution_configuration_arn
142    }
143    /// <p>The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.</p>
144    /// This field is required.
145    pub fn infrastructure_configuration_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.infrastructure_configuration_arn = ::std::option::Option::Some(input.into());
147        self
148    }
149    /// <p>The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.</p>
150    pub fn set_infrastructure_configuration_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.infrastructure_configuration_arn = input;
152        self
153    }
154    /// <p>The Amazon Resource Name (ARN) of the infrastructure configuration that defines the environment in which your image will be built and tested.</p>
155    pub fn get_infrastructure_configuration_arn(&self) -> &::std::option::Option<::std::string::String> {
156        &self.infrastructure_configuration_arn
157    }
158    /// <p>The image tests configuration of the image.</p>
159    pub fn image_tests_configuration(mut self, input: crate::types::ImageTestsConfiguration) -> Self {
160        self.image_tests_configuration = ::std::option::Option::Some(input);
161        self
162    }
163    /// <p>The image tests configuration of the image.</p>
164    pub fn set_image_tests_configuration(mut self, input: ::std::option::Option<crate::types::ImageTestsConfiguration>) -> Self {
165        self.image_tests_configuration = input;
166        self
167    }
168    /// <p>The image tests configuration of the image.</p>
169    pub fn get_image_tests_configuration(&self) -> &::std::option::Option<crate::types::ImageTestsConfiguration> {
170        &self.image_tests_configuration
171    }
172    /// <p>Collects additional information about the image being created, including the operating system (OS) version and package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by default.</p>
173    pub fn enhanced_image_metadata_enabled(mut self, input: bool) -> Self {
174        self.enhanced_image_metadata_enabled = ::std::option::Option::Some(input);
175        self
176    }
177    /// <p>Collects additional information about the image being created, including the operating system (OS) version and package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by default.</p>
178    pub fn set_enhanced_image_metadata_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
179        self.enhanced_image_metadata_enabled = input;
180        self
181    }
182    /// <p>Collects additional information about the image being created, including the operating system (OS) version and package list. This information is used to enhance the overall experience of using EC2 Image Builder. Enabled by default.</p>
183    pub fn get_enhanced_image_metadata_enabled(&self) -> &::std::option::Option<bool> {
184        &self.enhanced_image_metadata_enabled
185    }
186    /// Adds a key-value pair to `tags`.
187    ///
188    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
189    ///
190    /// <p>The tags of the image.</p>
191    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
192        let mut hash_map = self.tags.unwrap_or_default();
193        hash_map.insert(k.into(), v.into());
194        self.tags = ::std::option::Option::Some(hash_map);
195        self
196    }
197    /// <p>The tags of the image.</p>
198    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
199        self.tags = input;
200        self
201    }
202    /// <p>The tags of the image.</p>
203    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
204        &self.tags
205    }
206    /// <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>
207    /// This field is required.
208    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
209        self.client_token = ::std::option::Option::Some(input.into());
210        self
211    }
212    /// <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>
213    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
214        self.client_token = input;
215        self
216    }
217    /// <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>
218    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
219        &self.client_token
220    }
221    /// <p>Contains settings for vulnerability scans.</p>
222    pub fn image_scanning_configuration(mut self, input: crate::types::ImageScanningConfiguration) -> Self {
223        self.image_scanning_configuration = ::std::option::Option::Some(input);
224        self
225    }
226    /// <p>Contains settings for vulnerability scans.</p>
227    pub fn set_image_scanning_configuration(mut self, input: ::std::option::Option<crate::types::ImageScanningConfiguration>) -> Self {
228        self.image_scanning_configuration = input;
229        self
230    }
231    /// <p>Contains settings for vulnerability scans.</p>
232    pub fn get_image_scanning_configuration(&self) -> &::std::option::Option<crate::types::ImageScanningConfiguration> {
233        &self.image_scanning_configuration
234    }
235    /// Appends an item to `workflows`.
236    ///
237    /// To override the contents of this collection use [`set_workflows`](Self::set_workflows).
238    ///
239    /// <p>Contains an array of workflow configuration objects.</p>
240    pub fn workflows(mut self, input: crate::types::WorkflowConfiguration) -> Self {
241        let mut v = self.workflows.unwrap_or_default();
242        v.push(input);
243        self.workflows = ::std::option::Option::Some(v);
244        self
245    }
246    /// <p>Contains an array of workflow configuration objects.</p>
247    pub fn set_workflows(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::WorkflowConfiguration>>) -> Self {
248        self.workflows = input;
249        self
250    }
251    /// <p>Contains an array of workflow configuration objects.</p>
252    pub fn get_workflows(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::WorkflowConfiguration>> {
253        &self.workflows
254    }
255    /// <p>The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.</p>
256    pub fn execution_role(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
257        self.execution_role = ::std::option::Option::Some(input.into());
258        self
259    }
260    /// <p>The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.</p>
261    pub fn set_execution_role(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
262        self.execution_role = input;
263        self
264    }
265    /// <p>The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.</p>
266    pub fn get_execution_role(&self) -> &::std::option::Option<::std::string::String> {
267        &self.execution_role
268    }
269    /// Consumes the builder and constructs a [`CreateImageInput`](crate::operation::create_image::CreateImageInput).
270    pub fn build(self) -> ::std::result::Result<crate::operation::create_image::CreateImageInput, ::aws_smithy_types::error::operation::BuildError> {
271        ::std::result::Result::Ok(crate::operation::create_image::CreateImageInput {
272            image_recipe_arn: self.image_recipe_arn,
273            container_recipe_arn: self.container_recipe_arn,
274            distribution_configuration_arn: self.distribution_configuration_arn,
275            infrastructure_configuration_arn: self.infrastructure_configuration_arn,
276            image_tests_configuration: self.image_tests_configuration,
277            enhanced_image_metadata_enabled: self.enhanced_image_metadata_enabled,
278            tags: self.tags,
279            client_token: self.client_token,
280            image_scanning_configuration: self.image_scanning_configuration,
281            workflows: self.workflows,
282            execution_role: self.execution_role,
283        })
284    }
285}