aws_sdk_codegurusecurity/operation/create_scan/
_create_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 CreateScanOutput {
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 identifier for the resource object that contains resources that were scanned.</p>
11    pub resource_id: ::std::option::Option<crate::types::ResourceId>,
12    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
13    pub scan_state: crate::types::ScanState,
14    /// <p>The ARN for the scan name.</p>
15    pub scan_name_arn: ::std::option::Option<::std::string::String>,
16    _request_id: Option<String>,
17}
18impl CreateScanOutput {
19    /// <p>The name of the scan.</p>
20    pub fn scan_name(&self) -> &str {
21        use std::ops::Deref;
22        self.scan_name.deref()
23    }
24    /// <p>UUID that identifies the individual scan run.</p>
25    pub fn run_id(&self) -> &str {
26        use std::ops::Deref;
27        self.run_id.deref()
28    }
29    /// <p>The identifier for the resource object that contains resources that were scanned.</p>
30    pub fn resource_id(&self) -> ::std::option::Option<&crate::types::ResourceId> {
31        self.resource_id.as_ref()
32    }
33    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
34    pub fn scan_state(&self) -> &crate::types::ScanState {
35        &self.scan_state
36    }
37    /// <p>The ARN for the scan name.</p>
38    pub fn scan_name_arn(&self) -> ::std::option::Option<&str> {
39        self.scan_name_arn.as_deref()
40    }
41}
42impl ::aws_types::request_id::RequestId for CreateScanOutput {
43    fn request_id(&self) -> Option<&str> {
44        self._request_id.as_deref()
45    }
46}
47impl CreateScanOutput {
48    /// Creates a new builder-style object to manufacture [`CreateScanOutput`](crate::operation::create_scan::CreateScanOutput).
49    pub fn builder() -> crate::operation::create_scan::builders::CreateScanOutputBuilder {
50        crate::operation::create_scan::builders::CreateScanOutputBuilder::default()
51    }
52}
53
54/// A builder for [`CreateScanOutput`](crate::operation::create_scan::CreateScanOutput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct CreateScanOutputBuilder {
58    pub(crate) scan_name: ::std::option::Option<::std::string::String>,
59    pub(crate) run_id: ::std::option::Option<::std::string::String>,
60    pub(crate) resource_id: ::std::option::Option<crate::types::ResourceId>,
61    pub(crate) scan_state: ::std::option::Option<crate::types::ScanState>,
62    pub(crate) scan_name_arn: ::std::option::Option<::std::string::String>,
63    _request_id: Option<String>,
64}
65impl CreateScanOutputBuilder {
66    /// <p>The name of the scan.</p>
67    /// This field is required.
68    pub fn scan_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
69        self.scan_name = ::std::option::Option::Some(input.into());
70        self
71    }
72    /// <p>The name of the scan.</p>
73    pub fn set_scan_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
74        self.scan_name = input;
75        self
76    }
77    /// <p>The name of the scan.</p>
78    pub fn get_scan_name(&self) -> &::std::option::Option<::std::string::String> {
79        &self.scan_name
80    }
81    /// <p>UUID that identifies the individual scan run.</p>
82    /// This field is required.
83    pub fn run_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.run_id = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>UUID that identifies the individual scan run.</p>
88    pub fn set_run_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.run_id = input;
90        self
91    }
92    /// <p>UUID that identifies the individual scan run.</p>
93    pub fn get_run_id(&self) -> &::std::option::Option<::std::string::String> {
94        &self.run_id
95    }
96    /// <p>The identifier for the resource object that contains resources that were scanned.</p>
97    /// This field is required.
98    pub fn resource_id(mut self, input: crate::types::ResourceId) -> Self {
99        self.resource_id = ::std::option::Option::Some(input);
100        self
101    }
102    /// <p>The identifier for the resource object that contains resources that were scanned.</p>
103    pub fn set_resource_id(mut self, input: ::std::option::Option<crate::types::ResourceId>) -> Self {
104        self.resource_id = input;
105        self
106    }
107    /// <p>The identifier for the resource object that contains resources that were scanned.</p>
108    pub fn get_resource_id(&self) -> &::std::option::Option<crate::types::ResourceId> {
109        &self.resource_id
110    }
111    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
112    /// This field is required.
113    pub fn scan_state(mut self, input: crate::types::ScanState) -> Self {
114        self.scan_state = ::std::option::Option::Some(input);
115        self
116    }
117    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
118    pub fn set_scan_state(mut self, input: ::std::option::Option<crate::types::ScanState>) -> Self {
119        self.scan_state = input;
120        self
121    }
122    /// <p>The current state of the scan. Returns either <code>InProgress</code>, <code>Successful</code>, or <code>Failed</code>.</p>
123    pub fn get_scan_state(&self) -> &::std::option::Option<crate::types::ScanState> {
124        &self.scan_state
125    }
126    /// <p>The ARN for the scan name.</p>
127    pub fn scan_name_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.scan_name_arn = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>The ARN for the scan name.</p>
132    pub fn set_scan_name_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.scan_name_arn = input;
134        self
135    }
136    /// <p>The ARN for the scan name.</p>
137    pub fn get_scan_name_arn(&self) -> &::std::option::Option<::std::string::String> {
138        &self.scan_name_arn
139    }
140    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
141        self._request_id = Some(request_id.into());
142        self
143    }
144
145    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
146        self._request_id = request_id;
147        self
148    }
149    /// Consumes the builder and constructs a [`CreateScanOutput`](crate::operation::create_scan::CreateScanOutput).
150    /// This method will fail if any of the following fields are not set:
151    /// - [`scan_name`](crate::operation::create_scan::builders::CreateScanOutputBuilder::scan_name)
152    /// - [`run_id`](crate::operation::create_scan::builders::CreateScanOutputBuilder::run_id)
153    /// - [`scan_state`](crate::operation::create_scan::builders::CreateScanOutputBuilder::scan_state)
154    pub fn build(self) -> ::std::result::Result<crate::operation::create_scan::CreateScanOutput, ::aws_smithy_types::error::operation::BuildError> {
155        ::std::result::Result::Ok(crate::operation::create_scan::CreateScanOutput {
156            scan_name: self.scan_name.ok_or_else(|| {
157                ::aws_smithy_types::error::operation::BuildError::missing_field(
158                    "scan_name",
159                    "scan_name was not specified but it is required when building CreateScanOutput",
160                )
161            })?,
162            run_id: self.run_id.ok_or_else(|| {
163                ::aws_smithy_types::error::operation::BuildError::missing_field(
164                    "run_id",
165                    "run_id was not specified but it is required when building CreateScanOutput",
166                )
167            })?,
168            resource_id: self.resource_id,
169            scan_state: self.scan_state.ok_or_else(|| {
170                ::aws_smithy_types::error::operation::BuildError::missing_field(
171                    "scan_state",
172                    "scan_state was not specified but it is required when building CreateScanOutput",
173                )
174            })?,
175            scan_name_arn: self.scan_name_arn,
176            _request_id: self._request_id,
177        })
178    }
179}