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