Skip to main content

aws_sdk_location/operation/create_key/
_create_key_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)]
5pub struct CreateKeyInput {
6    /// <p>A custom name for the API key resource.</p>
7    /// <p>Requirements:</p>
8    /// <ul>
9    /// <li>
10    /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
11    /// <li>
12    /// <p>Must be a unique API key name.</p></li>
13    /// <li>
14    /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
15    /// </ul>
16    pub key_name: ::std::option::Option<::std::string::String>,
17    /// <p>The API key restrictions for the API key resource.</p>
18    pub restrictions: ::std::option::Option<crate::types::ApiKeyRestrictions>,
19    /// <p>An optional description for the API key resource.</p>
20    pub description: ::std::option::Option<::std::string::String>,
21    /// <p>The optional timestamp for when the API key resource will expire in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
22    pub expire_time: ::std::option::Option<::aws_smithy_types::DateTime>,
23    /// <p>Optionally set to <code>true</code> to set no expiration time for the API key. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
24    pub no_expiry: ::std::option::Option<bool>,
25    /// <p>Applies one or more tags to the map resource. A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.</p>
26    /// <p>Format: <code>"key" : "value"</code></p>
27    /// <p>Restrictions:</p>
28    /// <ul>
29    /// <li>
30    /// <p>Maximum 50 tags per resource</p></li>
31    /// <li>
32    /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
33    /// <li>
34    /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
35    /// <li>
36    /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
37    /// <li>
38    /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
39    /// <li>
40    /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
41    /// </ul>
42    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
43}
44impl CreateKeyInput {
45    /// <p>A custom name for the API key resource.</p>
46    /// <p>Requirements:</p>
47    /// <ul>
48    /// <li>
49    /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
50    /// <li>
51    /// <p>Must be a unique API key name.</p></li>
52    /// <li>
53    /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
54    /// </ul>
55    pub fn key_name(&self) -> ::std::option::Option<&str> {
56        self.key_name.as_deref()
57    }
58    /// <p>The API key restrictions for the API key resource.</p>
59    pub fn restrictions(&self) -> ::std::option::Option<&crate::types::ApiKeyRestrictions> {
60        self.restrictions.as_ref()
61    }
62    /// <p>An optional description for the API key resource.</p>
63    pub fn description(&self) -> ::std::option::Option<&str> {
64        self.description.as_deref()
65    }
66    /// <p>The optional timestamp for when the API key resource will expire in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
67    pub fn expire_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
68        self.expire_time.as_ref()
69    }
70    /// <p>Optionally set to <code>true</code> to set no expiration time for the API key. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
71    pub fn no_expiry(&self) -> ::std::option::Option<bool> {
72        self.no_expiry
73    }
74    /// <p>Applies one or more tags to the map resource. A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.</p>
75    /// <p>Format: <code>"key" : "value"</code></p>
76    /// <p>Restrictions:</p>
77    /// <ul>
78    /// <li>
79    /// <p>Maximum 50 tags per resource</p></li>
80    /// <li>
81    /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
82    /// <li>
83    /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
84    /// <li>
85    /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
86    /// <li>
87    /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
88    /// <li>
89    /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
90    /// </ul>
91    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
92        self.tags.as_ref()
93    }
94}
95impl ::std::fmt::Debug for CreateKeyInput {
96    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
97        let mut formatter = f.debug_struct("CreateKeyInput");
98        formatter.field("key_name", &self.key_name);
99        formatter.field("restrictions", &self.restrictions);
100        formatter.field("description", &self.description);
101        formatter.field("expire_time", &"*** Sensitive Data Redacted ***");
102        formatter.field("no_expiry", &self.no_expiry);
103        formatter.field("tags", &self.tags);
104        formatter.finish()
105    }
106}
107impl CreateKeyInput {
108    /// Creates a new builder-style object to manufacture [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
109    pub fn builder() -> crate::operation::create_key::builders::CreateKeyInputBuilder {
110        crate::operation::create_key::builders::CreateKeyInputBuilder::default()
111    }
112}
113
114/// A builder for [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
115#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
116#[non_exhaustive]
117pub struct CreateKeyInputBuilder {
118    pub(crate) key_name: ::std::option::Option<::std::string::String>,
119    pub(crate) restrictions: ::std::option::Option<crate::types::ApiKeyRestrictions>,
120    pub(crate) description: ::std::option::Option<::std::string::String>,
121    pub(crate) expire_time: ::std::option::Option<::aws_smithy_types::DateTime>,
122    pub(crate) no_expiry: ::std::option::Option<bool>,
123    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
124}
125impl CreateKeyInputBuilder {
126    /// <p>A custom name for the API key resource.</p>
127    /// <p>Requirements:</p>
128    /// <ul>
129    /// <li>
130    /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
131    /// <li>
132    /// <p>Must be a unique API key name.</p></li>
133    /// <li>
134    /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
135    /// </ul>
136    /// This field is required.
137    pub fn key_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.key_name = ::std::option::Option::Some(input.into());
139        self
140    }
141    /// <p>A custom name for the API key resource.</p>
142    /// <p>Requirements:</p>
143    /// <ul>
144    /// <li>
145    /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
146    /// <li>
147    /// <p>Must be a unique API key name.</p></li>
148    /// <li>
149    /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
150    /// </ul>
151    pub fn set_key_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.key_name = input;
153        self
154    }
155    /// <p>A custom name for the API key resource.</p>
156    /// <p>Requirements:</p>
157    /// <ul>
158    /// <li>
159    /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
160    /// <li>
161    /// <p>Must be a unique API key name.</p></li>
162    /// <li>
163    /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
164    /// </ul>
165    pub fn get_key_name(&self) -> &::std::option::Option<::std::string::String> {
166        &self.key_name
167    }
168    /// <p>The API key restrictions for the API key resource.</p>
169    /// This field is required.
170    pub fn restrictions(mut self, input: crate::types::ApiKeyRestrictions) -> Self {
171        self.restrictions = ::std::option::Option::Some(input);
172        self
173    }
174    /// <p>The API key restrictions for the API key resource.</p>
175    pub fn set_restrictions(mut self, input: ::std::option::Option<crate::types::ApiKeyRestrictions>) -> Self {
176        self.restrictions = input;
177        self
178    }
179    /// <p>The API key restrictions for the API key resource.</p>
180    pub fn get_restrictions(&self) -> &::std::option::Option<crate::types::ApiKeyRestrictions> {
181        &self.restrictions
182    }
183    /// <p>An optional description for the API key resource.</p>
184    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
185        self.description = ::std::option::Option::Some(input.into());
186        self
187    }
188    /// <p>An optional description for the API key resource.</p>
189    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
190        self.description = input;
191        self
192    }
193    /// <p>An optional description for the API key resource.</p>
194    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
195        &self.description
196    }
197    /// <p>The optional timestamp for when the API key resource will expire in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
198    pub fn expire_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
199        self.expire_time = ::std::option::Option::Some(input);
200        self
201    }
202    /// <p>The optional timestamp for when the API key resource will expire in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
203    pub fn set_expire_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
204        self.expire_time = input;
205        self
206    }
207    /// <p>The optional timestamp for when the API key resource will expire in <a href="https://www.iso.org/iso-8601-date-and-time-format.html"> ISO 8601</a> format: <code>YYYY-MM-DDThh:mm:ss.sssZ</code>. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
208    pub fn get_expire_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
209        &self.expire_time
210    }
211    /// <p>Optionally set to <code>true</code> to set no expiration time for the API key. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
212    pub fn no_expiry(mut self, input: bool) -> Self {
213        self.no_expiry = ::std::option::Option::Some(input);
214        self
215    }
216    /// <p>Optionally set to <code>true</code> to set no expiration time for the API key. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
217    pub fn set_no_expiry(mut self, input: ::std::option::Option<bool>) -> Self {
218        self.no_expiry = input;
219        self
220    }
221    /// <p>Optionally set to <code>true</code> to set no expiration time for the API key. One of <code>NoExpiry</code> or <code>ExpireTime</code> must be set.</p>
222    pub fn get_no_expiry(&self) -> &::std::option::Option<bool> {
223        &self.no_expiry
224    }
225    /// Adds a key-value pair to `tags`.
226    ///
227    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
228    ///
229    /// <p>Applies one or more tags to the map resource. A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.</p>
230    /// <p>Format: <code>"key" : "value"</code></p>
231    /// <p>Restrictions:</p>
232    /// <ul>
233    /// <li>
234    /// <p>Maximum 50 tags per resource</p></li>
235    /// <li>
236    /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
237    /// <li>
238    /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
239    /// <li>
240    /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
241    /// <li>
242    /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
243    /// <li>
244    /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
245    /// </ul>
246    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
247        let mut hash_map = self.tags.unwrap_or_default();
248        hash_map.insert(k.into(), v.into());
249        self.tags = ::std::option::Option::Some(hash_map);
250        self
251    }
252    /// <p>Applies one or more tags to the map resource. A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.</p>
253    /// <p>Format: <code>"key" : "value"</code></p>
254    /// <p>Restrictions:</p>
255    /// <ul>
256    /// <li>
257    /// <p>Maximum 50 tags per resource</p></li>
258    /// <li>
259    /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
260    /// <li>
261    /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
262    /// <li>
263    /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
264    /// <li>
265    /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
266    /// <li>
267    /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
268    /// </ul>
269    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
270        self.tags = input;
271        self
272    }
273    /// <p>Applies one or more tags to the map resource. A tag is a key-value pair that helps manage, identify, search, and filter your resources by labelling them.</p>
274    /// <p>Format: <code>"key" : "value"</code></p>
275    /// <p>Restrictions:</p>
276    /// <ul>
277    /// <li>
278    /// <p>Maximum 50 tags per resource</p></li>
279    /// <li>
280    /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
281    /// <li>
282    /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
283    /// <li>
284    /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
285    /// <li>
286    /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
287    /// <li>
288    /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
289    /// </ul>
290    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
291        &self.tags
292    }
293    /// Consumes the builder and constructs a [`CreateKeyInput`](crate::operation::create_key::CreateKeyInput).
294    pub fn build(self) -> ::std::result::Result<crate::operation::create_key::CreateKeyInput, ::aws_smithy_types::error::operation::BuildError> {
295        ::std::result::Result::Ok(crate::operation::create_key::CreateKeyInput {
296            key_name: self.key_name,
297            restrictions: self.restrictions,
298            description: self.description,
299            expire_time: self.expire_time,
300            no_expiry: self.no_expiry,
301            tags: self.tags,
302        })
303    }
304}
305impl ::std::fmt::Debug for CreateKeyInputBuilder {
306    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
307        let mut formatter = f.debug_struct("CreateKeyInputBuilder");
308        formatter.field("key_name", &self.key_name);
309        formatter.field("restrictions", &self.restrictions);
310        formatter.field("description", &self.description);
311        formatter.field("expire_time", &"*** Sensitive Data Redacted ***");
312        formatter.field("no_expiry", &self.no_expiry);
313        formatter.field("tags", &self.tags);
314        formatter.finish()
315    }
316}