aws_sdk_inspector2/types/
_aws_ecr_container_aggregation_response.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An aggregation of information about Amazon ECR containers.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AwsEcrContainerAggregationResponse {
7    /// <p>The resource ID of the container.</p>
8    pub resource_id: ::std::string::String,
9    /// <p>The SHA value of the container image.</p>
10    pub image_sha: ::std::option::Option<::std::string::String>,
11    /// <p>The container repository.</p>
12    pub repository: ::std::option::Option<::std::string::String>,
13    /// <p>The architecture of the container.</p>
14    pub architecture: ::std::option::Option<::std::string::String>,
15    /// <p>The container image stags.</p>
16    pub image_tags: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
17    /// <p>The Amazon Web Services account ID of the account that owns the container.</p>
18    pub account_id: ::std::option::Option<::std::string::String>,
19    /// <p>The number of finding by severity.</p>
20    pub severity_counts: ::std::option::Option<crate::types::SeverityCounts>,
21    /// <p>The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.</p>
22    pub last_in_use_at: ::std::option::Option<::aws_smithy_types::DateTime>,
23    /// <p>The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container image is in use.</p>
24    pub in_use_count: ::std::option::Option<i64>,
25}
26impl AwsEcrContainerAggregationResponse {
27    /// <p>The resource ID of the container.</p>
28    pub fn resource_id(&self) -> &str {
29        use std::ops::Deref;
30        self.resource_id.deref()
31    }
32    /// <p>The SHA value of the container image.</p>
33    pub fn image_sha(&self) -> ::std::option::Option<&str> {
34        self.image_sha.as_deref()
35    }
36    /// <p>The container repository.</p>
37    pub fn repository(&self) -> ::std::option::Option<&str> {
38        self.repository.as_deref()
39    }
40    /// <p>The architecture of the container.</p>
41    pub fn architecture(&self) -> ::std::option::Option<&str> {
42        self.architecture.as_deref()
43    }
44    /// <p>The container image stags.</p>
45    ///
46    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.image_tags.is_none()`.
47    pub fn image_tags(&self) -> &[::std::string::String] {
48        self.image_tags.as_deref().unwrap_or_default()
49    }
50    /// <p>The Amazon Web Services account ID of the account that owns the container.</p>
51    pub fn account_id(&self) -> ::std::option::Option<&str> {
52        self.account_id.as_deref()
53    }
54    /// <p>The number of finding by severity.</p>
55    pub fn severity_counts(&self) -> ::std::option::Option<&crate::types::SeverityCounts> {
56        self.severity_counts.as_ref()
57    }
58    /// <p>The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.</p>
59    pub fn last_in_use_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
60        self.last_in_use_at.as_ref()
61    }
62    /// <p>The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container image is in use.</p>
63    pub fn in_use_count(&self) -> ::std::option::Option<i64> {
64        self.in_use_count
65    }
66}
67impl AwsEcrContainerAggregationResponse {
68    /// Creates a new builder-style object to manufacture [`AwsEcrContainerAggregationResponse`](crate::types::AwsEcrContainerAggregationResponse).
69    pub fn builder() -> crate::types::builders::AwsEcrContainerAggregationResponseBuilder {
70        crate::types::builders::AwsEcrContainerAggregationResponseBuilder::default()
71    }
72}
73
74/// A builder for [`AwsEcrContainerAggregationResponse`](crate::types::AwsEcrContainerAggregationResponse).
75#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
76#[non_exhaustive]
77pub struct AwsEcrContainerAggregationResponseBuilder {
78    pub(crate) resource_id: ::std::option::Option<::std::string::String>,
79    pub(crate) image_sha: ::std::option::Option<::std::string::String>,
80    pub(crate) repository: ::std::option::Option<::std::string::String>,
81    pub(crate) architecture: ::std::option::Option<::std::string::String>,
82    pub(crate) image_tags: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
83    pub(crate) account_id: ::std::option::Option<::std::string::String>,
84    pub(crate) severity_counts: ::std::option::Option<crate::types::SeverityCounts>,
85    pub(crate) last_in_use_at: ::std::option::Option<::aws_smithy_types::DateTime>,
86    pub(crate) in_use_count: ::std::option::Option<i64>,
87}
88impl AwsEcrContainerAggregationResponseBuilder {
89    /// <p>The resource ID of the container.</p>
90    /// This field is required.
91    pub fn resource_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
92        self.resource_id = ::std::option::Option::Some(input.into());
93        self
94    }
95    /// <p>The resource ID of the container.</p>
96    pub fn set_resource_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
97        self.resource_id = input;
98        self
99    }
100    /// <p>The resource ID of the container.</p>
101    pub fn get_resource_id(&self) -> &::std::option::Option<::std::string::String> {
102        &self.resource_id
103    }
104    /// <p>The SHA value of the container image.</p>
105    pub fn image_sha(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106        self.image_sha = ::std::option::Option::Some(input.into());
107        self
108    }
109    /// <p>The SHA value of the container image.</p>
110    pub fn set_image_sha(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111        self.image_sha = input;
112        self
113    }
114    /// <p>The SHA value of the container image.</p>
115    pub fn get_image_sha(&self) -> &::std::option::Option<::std::string::String> {
116        &self.image_sha
117    }
118    /// <p>The container repository.</p>
119    pub fn repository(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.repository = ::std::option::Option::Some(input.into());
121        self
122    }
123    /// <p>The container repository.</p>
124    pub fn set_repository(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.repository = input;
126        self
127    }
128    /// <p>The container repository.</p>
129    pub fn get_repository(&self) -> &::std::option::Option<::std::string::String> {
130        &self.repository
131    }
132    /// <p>The architecture of the container.</p>
133    pub fn architecture(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134        self.architecture = ::std::option::Option::Some(input.into());
135        self
136    }
137    /// <p>The architecture of the container.</p>
138    pub fn set_architecture(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.architecture = input;
140        self
141    }
142    /// <p>The architecture of the container.</p>
143    pub fn get_architecture(&self) -> &::std::option::Option<::std::string::String> {
144        &self.architecture
145    }
146    /// Appends an item to `image_tags`.
147    ///
148    /// To override the contents of this collection use [`set_image_tags`](Self::set_image_tags).
149    ///
150    /// <p>The container image stags.</p>
151    pub fn image_tags(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152        let mut v = self.image_tags.unwrap_or_default();
153        v.push(input.into());
154        self.image_tags = ::std::option::Option::Some(v);
155        self
156    }
157    /// <p>The container image stags.</p>
158    pub fn set_image_tags(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
159        self.image_tags = input;
160        self
161    }
162    /// <p>The container image stags.</p>
163    pub fn get_image_tags(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
164        &self.image_tags
165    }
166    /// <p>The Amazon Web Services account ID of the account that owns the container.</p>
167    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168        self.account_id = ::std::option::Option::Some(input.into());
169        self
170    }
171    /// <p>The Amazon Web Services account ID of the account that owns the container.</p>
172    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173        self.account_id = input;
174        self
175    }
176    /// <p>The Amazon Web Services account ID of the account that owns the container.</p>
177    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
178        &self.account_id
179    }
180    /// <p>The number of finding by severity.</p>
181    pub fn severity_counts(mut self, input: crate::types::SeverityCounts) -> Self {
182        self.severity_counts = ::std::option::Option::Some(input);
183        self
184    }
185    /// <p>The number of finding by severity.</p>
186    pub fn set_severity_counts(mut self, input: ::std::option::Option<crate::types::SeverityCounts>) -> Self {
187        self.severity_counts = input;
188        self
189    }
190    /// <p>The number of finding by severity.</p>
191    pub fn get_severity_counts(&self) -> &::std::option::Option<crate::types::SeverityCounts> {
192        &self.severity_counts
193    }
194    /// <p>The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.</p>
195    pub fn last_in_use_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
196        self.last_in_use_at = ::std::option::Option::Some(input);
197        self
198    }
199    /// <p>The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.</p>
200    pub fn set_last_in_use_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
201        self.last_in_use_at = input;
202        self
203    }
204    /// <p>The last time an Amazon ECR image was used in an Amazon ECS task or Amazon EKS pod.</p>
205    pub fn get_last_in_use_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
206        &self.last_in_use_at
207    }
208    /// <p>The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container image is in use.</p>
209    pub fn in_use_count(mut self, input: i64) -> Self {
210        self.in_use_count = ::std::option::Option::Some(input);
211        self
212    }
213    /// <p>The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container image is in use.</p>
214    pub fn set_in_use_count(mut self, input: ::std::option::Option<i64>) -> Self {
215        self.in_use_count = input;
216        self
217    }
218    /// <p>The number of Amazon ECS tasks or Amazon EKS pods where the Amazon ECR container image is in use.</p>
219    pub fn get_in_use_count(&self) -> &::std::option::Option<i64> {
220        &self.in_use_count
221    }
222    /// Consumes the builder and constructs a [`AwsEcrContainerAggregationResponse`](crate::types::AwsEcrContainerAggregationResponse).
223    /// This method will fail if any of the following fields are not set:
224    /// - [`resource_id`](crate::types::builders::AwsEcrContainerAggregationResponseBuilder::resource_id)
225    pub fn build(self) -> ::std::result::Result<crate::types::AwsEcrContainerAggregationResponse, ::aws_smithy_types::error::operation::BuildError> {
226        ::std::result::Result::Ok(crate::types::AwsEcrContainerAggregationResponse {
227            resource_id: self.resource_id.ok_or_else(|| {
228                ::aws_smithy_types::error::operation::BuildError::missing_field(
229                    "resource_id",
230                    "resource_id was not specified but it is required when building AwsEcrContainerAggregationResponse",
231                )
232            })?,
233            image_sha: self.image_sha,
234            repository: self.repository,
235            architecture: self.architecture,
236            image_tags: self.image_tags,
237            account_id: self.account_id,
238            severity_counts: self.severity_counts,
239            last_in_use_at: self.last_in_use_at,
240            in_use_count: self.in_use_count,
241        })
242    }
243}