aws_sdk_accessanalyzer/operation/create_analyzer/
_create_analyzer_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Creates an analyzer.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateAnalyzerInput {
7    /// <p>The name of the analyzer to create.</p>
8    pub analyzer_name: ::std::option::Option<::std::string::String>,
9    /// <p>The type of analyzer to create. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization per Region.</p>
10    pub r#type: ::std::option::Option<crate::types::Type>,
11    /// <p>Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.</p>
12    pub archive_rules: ::std::option::Option<::std::vec::Vec<crate::types::InlineArchiveRule>>,
13    /// <p>An array of key-value pairs to apply to the analyzer. You can use the set of Unicode letters, digits, whitespace, <code>_</code>, <code>.</code>, <code>/</code>, <code>=</code>, <code>+</code>, and <code>-</code>.</p>
14    /// <p>For the tag key, you can specify a value that is 1 to 128 characters in length and cannot be prefixed with <code>aws:</code>.</p>
15    /// <p>For the tag value, you can specify a value that is 0 to 256 characters in length.</p>
16    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
17    /// <p>A client token.</p>
18    pub client_token: ::std::option::Option<::std::string::String>,
19    /// <p>Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an internal access analyzer, the specified internal access analysis rules are used for the configuration.</p>
20    pub configuration: ::std::option::Option<crate::types::AnalyzerConfiguration>,
21}
22impl CreateAnalyzerInput {
23    /// <p>The name of the analyzer to create.</p>
24    pub fn analyzer_name(&self) -> ::std::option::Option<&str> {
25        self.analyzer_name.as_deref()
26    }
27    /// <p>The type of analyzer to create. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization per Region.</p>
28    pub fn r#type(&self) -> ::std::option::Option<&crate::types::Type> {
29        self.r#type.as_ref()
30    }
31    /// <p>Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.</p>
32    ///
33    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.archive_rules.is_none()`.
34    pub fn archive_rules(&self) -> &[crate::types::InlineArchiveRule] {
35        self.archive_rules.as_deref().unwrap_or_default()
36    }
37    /// <p>An array of key-value pairs to apply to the analyzer. You can use the set of Unicode letters, digits, whitespace, <code>_</code>, <code>.</code>, <code>/</code>, <code>=</code>, <code>+</code>, and <code>-</code>.</p>
38    /// <p>For the tag key, you can specify a value that is 1 to 128 characters in length and cannot be prefixed with <code>aws:</code>.</p>
39    /// <p>For the tag value, you can specify a value that is 0 to 256 characters in length.</p>
40    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
41        self.tags.as_ref()
42    }
43    /// <p>A client token.</p>
44    pub fn client_token(&self) -> ::std::option::Option<&str> {
45        self.client_token.as_deref()
46    }
47    /// <p>Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an internal access analyzer, the specified internal access analysis rules are used for the configuration.</p>
48    pub fn configuration(&self) -> ::std::option::Option<&crate::types::AnalyzerConfiguration> {
49        self.configuration.as_ref()
50    }
51}
52impl CreateAnalyzerInput {
53    /// Creates a new builder-style object to manufacture [`CreateAnalyzerInput`](crate::operation::create_analyzer::CreateAnalyzerInput).
54    pub fn builder() -> crate::operation::create_analyzer::builders::CreateAnalyzerInputBuilder {
55        crate::operation::create_analyzer::builders::CreateAnalyzerInputBuilder::default()
56    }
57}
58
59/// A builder for [`CreateAnalyzerInput`](crate::operation::create_analyzer::CreateAnalyzerInput).
60#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
61#[non_exhaustive]
62pub struct CreateAnalyzerInputBuilder {
63    pub(crate) analyzer_name: ::std::option::Option<::std::string::String>,
64    pub(crate) r#type: ::std::option::Option<crate::types::Type>,
65    pub(crate) archive_rules: ::std::option::Option<::std::vec::Vec<crate::types::InlineArchiveRule>>,
66    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
67    pub(crate) client_token: ::std::option::Option<::std::string::String>,
68    pub(crate) configuration: ::std::option::Option<crate::types::AnalyzerConfiguration>,
69}
70impl CreateAnalyzerInputBuilder {
71    /// <p>The name of the analyzer to create.</p>
72    /// This field is required.
73    pub fn analyzer_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.analyzer_name = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>The name of the analyzer to create.</p>
78    pub fn set_analyzer_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.analyzer_name = input;
80        self
81    }
82    /// <p>The name of the analyzer to create.</p>
83    pub fn get_analyzer_name(&self) -> &::std::option::Option<::std::string::String> {
84        &self.analyzer_name
85    }
86    /// <p>The type of analyzer to create. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization per Region.</p>
87    /// This field is required.
88    pub fn r#type(mut self, input: crate::types::Type) -> Self {
89        self.r#type = ::std::option::Option::Some(input);
90        self
91    }
92    /// <p>The type of analyzer to create. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization per Region.</p>
93    pub fn set_type(mut self, input: ::std::option::Option<crate::types::Type>) -> Self {
94        self.r#type = input;
95        self
96    }
97    /// <p>The type of analyzer to create. You can create only one analyzer per account per Region. You can create up to 5 analyzers per organization per Region.</p>
98    pub fn get_type(&self) -> &::std::option::Option<crate::types::Type> {
99        &self.r#type
100    }
101    /// Appends an item to `archive_rules`.
102    ///
103    /// To override the contents of this collection use [`set_archive_rules`](Self::set_archive_rules).
104    ///
105    /// <p>Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.</p>
106    pub fn archive_rules(mut self, input: crate::types::InlineArchiveRule) -> Self {
107        let mut v = self.archive_rules.unwrap_or_default();
108        v.push(input);
109        self.archive_rules = ::std::option::Option::Some(v);
110        self
111    }
112    /// <p>Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.</p>
113    pub fn set_archive_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::InlineArchiveRule>>) -> Self {
114        self.archive_rules = input;
115        self
116    }
117    /// <p>Specifies the archive rules to add for the analyzer. Archive rules automatically archive findings that meet the criteria you define for the rule.</p>
118    pub fn get_archive_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::InlineArchiveRule>> {
119        &self.archive_rules
120    }
121    /// Adds a key-value pair to `tags`.
122    ///
123    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
124    ///
125    /// <p>An array of key-value pairs to apply to the analyzer. You can use the set of Unicode letters, digits, whitespace, <code>_</code>, <code>.</code>, <code>/</code>, <code>=</code>, <code>+</code>, and <code>-</code>.</p>
126    /// <p>For the tag key, you can specify a value that is 1 to 128 characters in length and cannot be prefixed with <code>aws:</code>.</p>
127    /// <p>For the tag value, you can specify a value that is 0 to 256 characters in length.</p>
128    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
129        let mut hash_map = self.tags.unwrap_or_default();
130        hash_map.insert(k.into(), v.into());
131        self.tags = ::std::option::Option::Some(hash_map);
132        self
133    }
134    /// <p>An array of key-value pairs to apply to the analyzer. You can use the set of Unicode letters, digits, whitespace, <code>_</code>, <code>.</code>, <code>/</code>, <code>=</code>, <code>+</code>, and <code>-</code>.</p>
135    /// <p>For the tag key, you can specify a value that is 1 to 128 characters in length and cannot be prefixed with <code>aws:</code>.</p>
136    /// <p>For the tag value, you can specify a value that is 0 to 256 characters in length.</p>
137    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
138        self.tags = input;
139        self
140    }
141    /// <p>An array of key-value pairs to apply to the analyzer. You can use the set of Unicode letters, digits, whitespace, <code>_</code>, <code>.</code>, <code>/</code>, <code>=</code>, <code>+</code>, and <code>-</code>.</p>
142    /// <p>For the tag key, you can specify a value that is 1 to 128 characters in length and cannot be prefixed with <code>aws:</code>.</p>
143    /// <p>For the tag value, you can specify a value that is 0 to 256 characters in length.</p>
144    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
145        &self.tags
146    }
147    /// <p>A client token.</p>
148    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149        self.client_token = ::std::option::Option::Some(input.into());
150        self
151    }
152    /// <p>A client token.</p>
153    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.client_token = input;
155        self
156    }
157    /// <p>A client token.</p>
158    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
159        &self.client_token
160    }
161    /// <p>Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an internal access analyzer, the specified internal access analysis rules are used for the configuration.</p>
162    pub fn configuration(mut self, input: crate::types::AnalyzerConfiguration) -> Self {
163        self.configuration = ::std::option::Option::Some(input);
164        self
165    }
166    /// <p>Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an internal access analyzer, the specified internal access analysis rules are used for the configuration.</p>
167    pub fn set_configuration(mut self, input: ::std::option::Option<crate::types::AnalyzerConfiguration>) -> Self {
168        self.configuration = input;
169        self
170    }
171    /// <p>Specifies the configuration of the analyzer. If the analyzer is an unused access analyzer, the specified scope of unused access is used for the configuration. If the analyzer is an internal access analyzer, the specified internal access analysis rules are used for the configuration.</p>
172    pub fn get_configuration(&self) -> &::std::option::Option<crate::types::AnalyzerConfiguration> {
173        &self.configuration
174    }
175    /// Consumes the builder and constructs a [`CreateAnalyzerInput`](crate::operation::create_analyzer::CreateAnalyzerInput).
176    pub fn build(
177        self,
178    ) -> ::std::result::Result<crate::operation::create_analyzer::CreateAnalyzerInput, ::aws_smithy_types::error::operation::BuildError> {
179        ::std::result::Result::Ok(crate::operation::create_analyzer::CreateAnalyzerInput {
180            analyzer_name: self.analyzer_name,
181            r#type: self.r#type,
182            archive_rules: self.archive_rules,
183            tags: self.tags,
184            client_token: self.client_token,
185            configuration: self.configuration,
186        })
187    }
188}