aws_sdk_codegurusecurity/operation/get_scan/
_get_scan_output.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 GetScanOutput {
6    /// <p>The name of the scan.</p>
7    pub scan_name: ::std::string::String,
8    /// <p>UUID that identifies the individual scan run.</p>
9    pub run_id: ::std::string::String,
10    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
11    pub scan_state: crate::types::ScanState,
12    /// <p>The time the scan was created.</p>
13    pub created_at: ::aws_smithy_types::DateTime,
14    /// <p>The type of analysis CodeGuru Security performed in the scan, either <code>Security</code> or <code>All</code>. The <code>Security</code> type only generates findings related to security. The <code>All</code> type generates both security findings and quality findings.</p>
15    pub analysis_type: crate::types::AnalysisType,
16    /// <p>The time when the scan was last updated. Only available for <code>STANDARD</code> scan types.</p>
17    pub updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
18    /// <p>The number of times a scan has been re-run on a revised resource.</p>
19    pub number_of_revisions: ::std::option::Option<i64>,
20    /// <p>The ARN for the scan name.</p>
21    pub scan_name_arn: ::std::option::Option<::std::string::String>,
22    /// <p>Details about the error that causes a scan to fail to be retrieved.</p>
23    pub error_message: ::std::option::Option<::std::string::String>,
24    _request_id: Option<String>,
25}
26impl GetScanOutput {
27    /// <p>The name of the scan.</p>
28    pub fn scan_name(&self) -> &str {
29        use std::ops::Deref;
30        self.scan_name.deref()
31    }
32    /// <p>UUID that identifies the individual scan run.</p>
33    pub fn run_id(&self) -> &str {
34        use std::ops::Deref;
35        self.run_id.deref()
36    }
37    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
38    pub fn scan_state(&self) -> &crate::types::ScanState {
39        &self.scan_state
40    }
41    /// <p>The time the scan was created.</p>
42    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
43        &self.created_at
44    }
45    /// <p>The type of analysis CodeGuru Security performed in the scan, either <code>Security</code> or <code>All</code>. The <code>Security</code> type only generates findings related to security. The <code>All</code> type generates both security findings and quality findings.</p>
46    pub fn analysis_type(&self) -> &crate::types::AnalysisType {
47        &self.analysis_type
48    }
49    /// <p>The time when the scan was last updated. Only available for <code>STANDARD</code> scan types.</p>
50    pub fn updated_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
51        self.updated_at.as_ref()
52    }
53    /// <p>The number of times a scan has been re-run on a revised resource.</p>
54    pub fn number_of_revisions(&self) -> ::std::option::Option<i64> {
55        self.number_of_revisions
56    }
57    /// <p>The ARN for the scan name.</p>
58    pub fn scan_name_arn(&self) -> ::std::option::Option<&str> {
59        self.scan_name_arn.as_deref()
60    }
61    /// <p>Details about the error that causes a scan to fail to be retrieved.</p>
62    pub fn error_message(&self) -> ::std::option::Option<&str> {
63        self.error_message.as_deref()
64    }
65}
66impl ::aws_types::request_id::RequestId for GetScanOutput {
67    fn request_id(&self) -> Option<&str> {
68        self._request_id.as_deref()
69    }
70}
71impl GetScanOutput {
72    /// Creates a new builder-style object to manufacture [`GetScanOutput`](crate::operation::get_scan::GetScanOutput).
73    pub fn builder() -> crate::operation::get_scan::builders::GetScanOutputBuilder {
74        crate::operation::get_scan::builders::GetScanOutputBuilder::default()
75    }
76}
77
78/// A builder for [`GetScanOutput`](crate::operation::get_scan::GetScanOutput).
79#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
80#[non_exhaustive]
81pub struct GetScanOutputBuilder {
82    pub(crate) scan_name: ::std::option::Option<::std::string::String>,
83    pub(crate) run_id: ::std::option::Option<::std::string::String>,
84    pub(crate) scan_state: ::std::option::Option<crate::types::ScanState>,
85    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
86    pub(crate) analysis_type: ::std::option::Option<crate::types::AnalysisType>,
87    pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
88    pub(crate) number_of_revisions: ::std::option::Option<i64>,
89    pub(crate) scan_name_arn: ::std::option::Option<::std::string::String>,
90    pub(crate) error_message: ::std::option::Option<::std::string::String>,
91    _request_id: Option<String>,
92}
93impl GetScanOutputBuilder {
94    /// <p>The name of the scan.</p>
95    /// This field is required.
96    pub fn scan_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.scan_name = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// <p>The name of the scan.</p>
101    pub fn set_scan_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.scan_name = input;
103        self
104    }
105    /// <p>The name of the scan.</p>
106    pub fn get_scan_name(&self) -> &::std::option::Option<::std::string::String> {
107        &self.scan_name
108    }
109    /// <p>UUID that identifies the individual scan run.</p>
110    /// This field is required.
111    pub fn run_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112        self.run_id = ::std::option::Option::Some(input.into());
113        self
114    }
115    /// <p>UUID that identifies the individual scan run.</p>
116    pub fn set_run_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
117        self.run_id = input;
118        self
119    }
120    /// <p>UUID that identifies the individual scan run.</p>
121    pub fn get_run_id(&self) -> &::std::option::Option<::std::string::String> {
122        &self.run_id
123    }
124    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
125    /// This field is required.
126    pub fn scan_state(mut self, input: crate::types::ScanState) -> Self {
127        self.scan_state = ::std::option::Option::Some(input);
128        self
129    }
130    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
131    pub fn set_scan_state(mut self, input: ::std::option::Option<crate::types::ScanState>) -> Self {
132        self.scan_state = input;
133        self
134    }
135    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
136    pub fn get_scan_state(&self) -> &::std::option::Option<crate::types::ScanState> {
137        &self.scan_state
138    }
139    /// <p>The time the scan was created.</p>
140    /// This field is required.
141    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
142        self.created_at = ::std::option::Option::Some(input);
143        self
144    }
145    /// <p>The time the scan was created.</p>
146    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
147        self.created_at = input;
148        self
149    }
150    /// <p>The time the scan was created.</p>
151    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
152        &self.created_at
153    }
154    /// <p>The type of analysis CodeGuru Security performed in the scan, either <code>Security</code> or <code>All</code>. The <code>Security</code> type only generates findings related to security. The <code>All</code> type generates both security findings and quality findings.</p>
155    /// This field is required.
156    pub fn analysis_type(mut self, input: crate::types::AnalysisType) -> Self {
157        self.analysis_type = ::std::option::Option::Some(input);
158        self
159    }
160    /// <p>The type of analysis CodeGuru Security performed in the scan, either <code>Security</code> or <code>All</code>. The <code>Security</code> type only generates findings related to security. The <code>All</code> type generates both security findings and quality findings.</p>
161    pub fn set_analysis_type(mut self, input: ::std::option::Option<crate::types::AnalysisType>) -> Self {
162        self.analysis_type = input;
163        self
164    }
165    /// <p>The type of analysis CodeGuru Security performed in the scan, either <code>Security</code> or <code>All</code>. The <code>Security</code> type only generates findings related to security. The <code>All</code> type generates both security findings and quality findings.</p>
166    pub fn get_analysis_type(&self) -> &::std::option::Option<crate::types::AnalysisType> {
167        &self.analysis_type
168    }
169    /// <p>The time when the scan was last updated. Only available for <code>STANDARD</code> scan types.</p>
170    pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
171        self.updated_at = ::std::option::Option::Some(input);
172        self
173    }
174    /// <p>The time when the scan was last updated. Only available for <code>STANDARD</code> scan types.</p>
175    pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
176        self.updated_at = input;
177        self
178    }
179    /// <p>The time when the scan was last updated. Only available for <code>STANDARD</code> scan types.</p>
180    pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
181        &self.updated_at
182    }
183    /// <p>The number of times a scan has been re-run on a revised resource.</p>
184    pub fn number_of_revisions(mut self, input: i64) -> Self {
185        self.number_of_revisions = ::std::option::Option::Some(input);
186        self
187    }
188    /// <p>The number of times a scan has been re-run on a revised resource.</p>
189    pub fn set_number_of_revisions(mut self, input: ::std::option::Option<i64>) -> Self {
190        self.number_of_revisions = input;
191        self
192    }
193    /// <p>The number of times a scan has been re-run on a revised resource.</p>
194    pub fn get_number_of_revisions(&self) -> &::std::option::Option<i64> {
195        &self.number_of_revisions
196    }
197    /// <p>The ARN for the scan name.</p>
198    pub fn scan_name_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
199        self.scan_name_arn = ::std::option::Option::Some(input.into());
200        self
201    }
202    /// <p>The ARN for the scan name.</p>
203    pub fn set_scan_name_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204        self.scan_name_arn = input;
205        self
206    }
207    /// <p>The ARN for the scan name.</p>
208    pub fn get_scan_name_arn(&self) -> &::std::option::Option<::std::string::String> {
209        &self.scan_name_arn
210    }
211    /// <p>Details about the error that causes a scan to fail to be retrieved.</p>
212    pub fn error_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213        self.error_message = ::std::option::Option::Some(input.into());
214        self
215    }
216    /// <p>Details about the error that causes a scan to fail to be retrieved.</p>
217    pub fn set_error_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
218        self.error_message = input;
219        self
220    }
221    /// <p>Details about the error that causes a scan to fail to be retrieved.</p>
222    pub fn get_error_message(&self) -> &::std::option::Option<::std::string::String> {
223        &self.error_message
224    }
225    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
226        self._request_id = Some(request_id.into());
227        self
228    }
229
230    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
231        self._request_id = request_id;
232        self
233    }
234    /// Consumes the builder and constructs a [`GetScanOutput`](crate::operation::get_scan::GetScanOutput).
235    /// This method will fail if any of the following fields are not set:
236    /// - [`scan_name`](crate::operation::get_scan::builders::GetScanOutputBuilder::scan_name)
237    /// - [`run_id`](crate::operation::get_scan::builders::GetScanOutputBuilder::run_id)
238    /// - [`scan_state`](crate::operation::get_scan::builders::GetScanOutputBuilder::scan_state)
239    /// - [`created_at`](crate::operation::get_scan::builders::GetScanOutputBuilder::created_at)
240    /// - [`analysis_type`](crate::operation::get_scan::builders::GetScanOutputBuilder::analysis_type)
241    pub fn build(self) -> ::std::result::Result<crate::operation::get_scan::GetScanOutput, ::aws_smithy_types::error::operation::BuildError> {
242        ::std::result::Result::Ok(crate::operation::get_scan::GetScanOutput {
243            scan_name: self.scan_name.ok_or_else(|| {
244                ::aws_smithy_types::error::operation::BuildError::missing_field(
245                    "scan_name",
246                    "scan_name was not specified but it is required when building GetScanOutput",
247                )
248            })?,
249            run_id: self.run_id.ok_or_else(|| {
250                ::aws_smithy_types::error::operation::BuildError::missing_field(
251                    "run_id",
252                    "run_id was not specified but it is required when building GetScanOutput",
253                )
254            })?,
255            scan_state: self.scan_state.ok_or_else(|| {
256                ::aws_smithy_types::error::operation::BuildError::missing_field(
257                    "scan_state",
258                    "scan_state was not specified but it is required when building GetScanOutput",
259                )
260            })?,
261            created_at: self.created_at.ok_or_else(|| {
262                ::aws_smithy_types::error::operation::BuildError::missing_field(
263                    "created_at",
264                    "created_at was not specified but it is required when building GetScanOutput",
265                )
266            })?,
267            analysis_type: self.analysis_type.ok_or_else(|| {
268                ::aws_smithy_types::error::operation::BuildError::missing_field(
269                    "analysis_type",
270                    "analysis_type was not specified but it is required when building GetScanOutput",
271                )
272            })?,
273            updated_at: self.updated_at,
274            number_of_revisions: self.number_of_revisions,
275            scan_name_arn: self.scan_name_arn,
276            error_message: self.error_message,
277            _request_id: self._request_id,
278        })
279    }
280}