aws_sdk_codegurusecurity/operation/create_scan/
_create_scan_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 CreateScanInput {
6    /// <p>The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.</p>
7    pub client_token: ::std::option::Option<::std::string::String>,
8    /// <p>The identifier for the resource object to be scanned.</p>
9    pub resource_id: ::std::option::Option<crate::types::ResourceId>,
10    /// <p>The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a <code>STANDARD</code> scan type.</p>
11    pub scan_name: ::std::option::Option<::std::string::String>,
12    /// <p>The type of scan, either <code>Standard</code> or <code>Express</code>. Defaults to <code>Standard</code> type if missing.</p>
13    /// <p><code>Express</code> scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. <code>Standard</code> scans have standard resource limits and use the full set of detectors to analyze your code.</p>
14    pub scan_type: ::std::option::Option<crate::types::ScanType>,
15    /// <p>The type of analysis you want CodeGuru Security to perform 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. Defaults to <code>Security</code> type if missing.</p>
16    pub analysis_type: ::std::option::Option<crate::types::AnalysisType>,
17    /// <p>An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:</p>
18    /// <ul>
19    /// <li>
20    /// <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p></li>
21    /// <li>
22    /// <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p></li>
23    /// </ul>
24    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
25}
26impl CreateScanInput {
27    /// <p>The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.</p>
28    pub fn client_token(&self) -> ::std::option::Option<&str> {
29        self.client_token.as_deref()
30    }
31    /// <p>The identifier for the resource object to be scanned.</p>
32    pub fn resource_id(&self) -> ::std::option::Option<&crate::types::ResourceId> {
33        self.resource_id.as_ref()
34    }
35    /// <p>The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a <code>STANDARD</code> scan type.</p>
36    pub fn scan_name(&self) -> ::std::option::Option<&str> {
37        self.scan_name.as_deref()
38    }
39    /// <p>The type of scan, either <code>Standard</code> or <code>Express</code>. Defaults to <code>Standard</code> type if missing.</p>
40    /// <p><code>Express</code> scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. <code>Standard</code> scans have standard resource limits and use the full set of detectors to analyze your code.</p>
41    pub fn scan_type(&self) -> ::std::option::Option<&crate::types::ScanType> {
42        self.scan_type.as_ref()
43    }
44    /// <p>The type of analysis you want CodeGuru Security to perform 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. Defaults to <code>Security</code> type if missing.</p>
45    pub fn analysis_type(&self) -> ::std::option::Option<&crate::types::AnalysisType> {
46        self.analysis_type.as_ref()
47    }
48    /// <p>An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:</p>
49    /// <ul>
50    /// <li>
51    /// <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p></li>
52    /// <li>
53    /// <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p></li>
54    /// </ul>
55    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
56        self.tags.as_ref()
57    }
58}
59impl CreateScanInput {
60    /// Creates a new builder-style object to manufacture [`CreateScanInput`](crate::operation::create_scan::CreateScanInput).
61    pub fn builder() -> crate::operation::create_scan::builders::CreateScanInputBuilder {
62        crate::operation::create_scan::builders::CreateScanInputBuilder::default()
63    }
64}
65
66/// A builder for [`CreateScanInput`](crate::operation::create_scan::CreateScanInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct CreateScanInputBuilder {
70    pub(crate) client_token: ::std::option::Option<::std::string::String>,
71    pub(crate) resource_id: ::std::option::Option<crate::types::ResourceId>,
72    pub(crate) scan_name: ::std::option::Option<::std::string::String>,
73    pub(crate) scan_type: ::std::option::Option<crate::types::ScanType>,
74    pub(crate) analysis_type: ::std::option::Option<crate::types::AnalysisType>,
75    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
76}
77impl CreateScanInputBuilder {
78    /// <p>The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.</p>
79    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
80        self.client_token = ::std::option::Option::Some(input.into());
81        self
82    }
83    /// <p>The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.</p>
84    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
85        self.client_token = input;
86        self
87    }
88    /// <p>The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental creation of duplicate scans if there are failures and retries.</p>
89    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
90        &self.client_token
91    }
92    /// <p>The identifier for the resource object to be scanned.</p>
93    /// This field is required.
94    pub fn resource_id(mut self, input: crate::types::ResourceId) -> Self {
95        self.resource_id = ::std::option::Option::Some(input);
96        self
97    }
98    /// <p>The identifier for the resource object to be scanned.</p>
99    pub fn set_resource_id(mut self, input: ::std::option::Option<crate::types::ResourceId>) -> Self {
100        self.resource_id = input;
101        self
102    }
103    /// <p>The identifier for the resource object to be scanned.</p>
104    pub fn get_resource_id(&self) -> &::std::option::Option<crate::types::ResourceId> {
105        &self.resource_id
106    }
107    /// <p>The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a <code>STANDARD</code> scan type.</p>
108    /// This field is required.
109    pub fn scan_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.scan_name = ::std::option::Option::Some(input.into());
111        self
112    }
113    /// <p>The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a <code>STANDARD</code> scan type.</p>
114    pub fn set_scan_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115        self.scan_name = input;
116        self
117    }
118    /// <p>The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only allowed for a <code>STANDARD</code> scan type.</p>
119    pub fn get_scan_name(&self) -> &::std::option::Option<::std::string::String> {
120        &self.scan_name
121    }
122    /// <p>The type of scan, either <code>Standard</code> or <code>Express</code>. Defaults to <code>Standard</code> type if missing.</p>
123    /// <p><code>Express</code> scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. <code>Standard</code> scans have standard resource limits and use the full set of detectors to analyze your code.</p>
124    pub fn scan_type(mut self, input: crate::types::ScanType) -> Self {
125        self.scan_type = ::std::option::Option::Some(input);
126        self
127    }
128    /// <p>The type of scan, either <code>Standard</code> or <code>Express</code>. Defaults to <code>Standard</code> type if missing.</p>
129    /// <p><code>Express</code> scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. <code>Standard</code> scans have standard resource limits and use the full set of detectors to analyze your code.</p>
130    pub fn set_scan_type(mut self, input: ::std::option::Option<crate::types::ScanType>) -> Self {
131        self.scan_type = input;
132        self
133    }
134    /// <p>The type of scan, either <code>Standard</code> or <code>Express</code>. Defaults to <code>Standard</code> type if missing.</p>
135    /// <p><code>Express</code> scans run on limited resources and use a limited set of detectors to analyze your code in near-real time. <code>Standard</code> scans have standard resource limits and use the full set of detectors to analyze your code.</p>
136    pub fn get_scan_type(&self) -> &::std::option::Option<crate::types::ScanType> {
137        &self.scan_type
138    }
139    /// <p>The type of analysis you want CodeGuru Security to perform 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. Defaults to <code>Security</code> type if missing.</p>
140    pub fn analysis_type(mut self, input: crate::types::AnalysisType) -> Self {
141        self.analysis_type = ::std::option::Option::Some(input);
142        self
143    }
144    /// <p>The type of analysis you want CodeGuru Security to perform 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. Defaults to <code>Security</code> type if missing.</p>
145    pub fn set_analysis_type(mut self, input: ::std::option::Option<crate::types::AnalysisType>) -> Self {
146        self.analysis_type = input;
147        self
148    }
149    /// <p>The type of analysis you want CodeGuru Security to perform 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. Defaults to <code>Security</code> type if missing.</p>
150    pub fn get_analysis_type(&self) -> &::std::option::Option<crate::types::AnalysisType> {
151        &self.analysis_type
152    }
153    /// Adds a key-value pair to `tags`.
154    ///
155    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
156    ///
157    /// <p>An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:</p>
158    /// <ul>
159    /// <li>
160    /// <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p></li>
161    /// <li>
162    /// <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p></li>
163    /// </ul>
164    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
165        let mut hash_map = self.tags.unwrap_or_default();
166        hash_map.insert(k.into(), v.into());
167        self.tags = ::std::option::Option::Some(hash_map);
168        self
169    }
170    /// <p>An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:</p>
171    /// <ul>
172    /// <li>
173    /// <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p></li>
174    /// <li>
175    /// <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p></li>
176    /// </ul>
177    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
178        self.tags = input;
179        self
180    }
181    /// <p>An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:</p>
182    /// <ul>
183    /// <li>
184    /// <p>A tag key. For example, <code>CostCenter</code>, <code>Environment</code>, or <code>Secret</code>. Tag keys are case sensitive.</p></li>
185    /// <li>
186    /// <p>An optional tag value field. For example, <code>111122223333</code>, <code>Production</code>, or a team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.</p></li>
187    /// </ul>
188    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
189        &self.tags
190    }
191    /// Consumes the builder and constructs a [`CreateScanInput`](crate::operation::create_scan::CreateScanInput).
192    pub fn build(self) -> ::std::result::Result<crate::operation::create_scan::CreateScanInput, ::aws_smithy_types::error::operation::BuildError> {
193        ::std::result::Result::Ok(crate::operation::create_scan::CreateScanInput {
194            client_token: self.client_token,
195            resource_id: self.resource_id,
196            scan_name: self.scan_name,
197            scan_type: self.scan_type,
198            analysis_type: self.analysis_type,
199            tags: self.tags,
200        })
201    }
202}