aws_sdk_location/operation/describe_key/
_describe_key_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)]
5pub struct DescribeKeyOutput {
6    /// <p>The key value/string of an API key.</p>
7    pub key: ::std::string::String,
8    /// <p>The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.</p>
9    /// <ul>
10    /// <li>
11    /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
12    /// </ul>
13    pub key_arn: ::std::string::String,
14    /// <p>The name of the API key resource.</p>
15    pub key_name: ::std::string::String,
16    /// <p>API Restrictions on the allowed actions, resources, and referers for an API key resource.</p>
17    pub restrictions: ::std::option::Option<crate::types::ApiKeyRestrictions>,
18    /// <p>The timestamp for when the API key resource was created 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>.</p>
19    pub create_time: ::aws_smithy_types::DateTime,
20    /// <p>The 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>.</p>
21    pub expire_time: ::aws_smithy_types::DateTime,
22    /// <p>The timestamp for when the API key resource was last updated 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>.</p>
23    pub update_time: ::aws_smithy_types::DateTime,
24    /// <p>The optional description for the API key resource.</p>
25    pub description: ::std::option::Option<::std::string::String>,
26    /// <p>Tags associated with the API key resource.</p>
27    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
28    _request_id: Option<String>,
29}
30impl DescribeKeyOutput {
31    /// <p>The key value/string of an API key.</p>
32    pub fn key(&self) -> &str {
33        use std::ops::Deref;
34        self.key.deref()
35    }
36    /// <p>The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.</p>
37    /// <ul>
38    /// <li>
39    /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
40    /// </ul>
41    pub fn key_arn(&self) -> &str {
42        use std::ops::Deref;
43        self.key_arn.deref()
44    }
45    /// <p>The name of the API key resource.</p>
46    pub fn key_name(&self) -> &str {
47        use std::ops::Deref;
48        self.key_name.deref()
49    }
50    /// <p>API Restrictions on the allowed actions, resources, and referers for an API key resource.</p>
51    pub fn restrictions(&self) -> ::std::option::Option<&crate::types::ApiKeyRestrictions> {
52        self.restrictions.as_ref()
53    }
54    /// <p>The timestamp for when the API key resource was created 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>.</p>
55    pub fn create_time(&self) -> &::aws_smithy_types::DateTime {
56        &self.create_time
57    }
58    /// <p>The 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>.</p>
59    pub fn expire_time(&self) -> &::aws_smithy_types::DateTime {
60        &self.expire_time
61    }
62    /// <p>The timestamp for when the API key resource was last updated 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>.</p>
63    pub fn update_time(&self) -> &::aws_smithy_types::DateTime {
64        &self.update_time
65    }
66    /// <p>The optional description for the API key resource.</p>
67    pub fn description(&self) -> ::std::option::Option<&str> {
68        self.description.as_deref()
69    }
70    /// <p>Tags associated with the API key resource.</p>
71    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
72        self.tags.as_ref()
73    }
74}
75impl ::std::fmt::Debug for DescribeKeyOutput {
76    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
77        let mut formatter = f.debug_struct("DescribeKeyOutput");
78        formatter.field("key", &"*** Sensitive Data Redacted ***");
79        formatter.field("key_arn", &self.key_arn);
80        formatter.field("key_name", &self.key_name);
81        formatter.field("restrictions", &self.restrictions);
82        formatter.field("create_time", &"*** Sensitive Data Redacted ***");
83        formatter.field("expire_time", &"*** Sensitive Data Redacted ***");
84        formatter.field("update_time", &"*** Sensitive Data Redacted ***");
85        formatter.field("description", &self.description);
86        formatter.field("tags", &self.tags);
87        formatter.field("_request_id", &self._request_id);
88        formatter.finish()
89    }
90}
91impl ::aws_types::request_id::RequestId for DescribeKeyOutput {
92    fn request_id(&self) -> Option<&str> {
93        self._request_id.as_deref()
94    }
95}
96impl DescribeKeyOutput {
97    /// Creates a new builder-style object to manufacture [`DescribeKeyOutput`](crate::operation::describe_key::DescribeKeyOutput).
98    pub fn builder() -> crate::operation::describe_key::builders::DescribeKeyOutputBuilder {
99        crate::operation::describe_key::builders::DescribeKeyOutputBuilder::default()
100    }
101}
102
103/// A builder for [`DescribeKeyOutput`](crate::operation::describe_key::DescribeKeyOutput).
104#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
105#[non_exhaustive]
106pub struct DescribeKeyOutputBuilder {
107    pub(crate) key: ::std::option::Option<::std::string::String>,
108    pub(crate) key_arn: ::std::option::Option<::std::string::String>,
109    pub(crate) key_name: ::std::option::Option<::std::string::String>,
110    pub(crate) restrictions: ::std::option::Option<crate::types::ApiKeyRestrictions>,
111    pub(crate) create_time: ::std::option::Option<::aws_smithy_types::DateTime>,
112    pub(crate) expire_time: ::std::option::Option<::aws_smithy_types::DateTime>,
113    pub(crate) update_time: ::std::option::Option<::aws_smithy_types::DateTime>,
114    pub(crate) description: ::std::option::Option<::std::string::String>,
115    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
116    _request_id: Option<String>,
117}
118impl DescribeKeyOutputBuilder {
119    /// <p>The key value/string of an API key.</p>
120    /// This field is required.
121    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
122        self.key = ::std::option::Option::Some(input.into());
123        self
124    }
125    /// <p>The key value/string of an API key.</p>
126    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
127        self.key = input;
128        self
129    }
130    /// <p>The key value/string of an API key.</p>
131    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
132        &self.key
133    }
134    /// <p>The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.</p>
135    /// <ul>
136    /// <li>
137    /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
138    /// </ul>
139    /// This field is required.
140    pub fn key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.key_arn = ::std::option::Option::Some(input.into());
142        self
143    }
144    /// <p>The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.</p>
145    /// <ul>
146    /// <li>
147    /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
148    /// </ul>
149    pub fn set_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.key_arn = input;
151        self
152    }
153    /// <p>The Amazon Resource Name (ARN) for the API key resource. Used when you need to specify a resource across all Amazon Web Services.</p>
154    /// <ul>
155    /// <li>
156    /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
157    /// </ul>
158    pub fn get_key_arn(&self) -> &::std::option::Option<::std::string::String> {
159        &self.key_arn
160    }
161    /// <p>The name of the API key resource.</p>
162    /// This field is required.
163    pub fn key_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.key_name = ::std::option::Option::Some(input.into());
165        self
166    }
167    /// <p>The name of the API key resource.</p>
168    pub fn set_key_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.key_name = input;
170        self
171    }
172    /// <p>The name of the API key resource.</p>
173    pub fn get_key_name(&self) -> &::std::option::Option<::std::string::String> {
174        &self.key_name
175    }
176    /// <p>API Restrictions on the allowed actions, resources, and referers for an API key resource.</p>
177    /// This field is required.
178    pub fn restrictions(mut self, input: crate::types::ApiKeyRestrictions) -> Self {
179        self.restrictions = ::std::option::Option::Some(input);
180        self
181    }
182    /// <p>API Restrictions on the allowed actions, resources, and referers for an API key resource.</p>
183    pub fn set_restrictions(mut self, input: ::std::option::Option<crate::types::ApiKeyRestrictions>) -> Self {
184        self.restrictions = input;
185        self
186    }
187    /// <p>API Restrictions on the allowed actions, resources, and referers for an API key resource.</p>
188    pub fn get_restrictions(&self) -> &::std::option::Option<crate::types::ApiKeyRestrictions> {
189        &self.restrictions
190    }
191    /// <p>The timestamp for when the API key resource was created 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>.</p>
192    /// This field is required.
193    pub fn create_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
194        self.create_time = ::std::option::Option::Some(input);
195        self
196    }
197    /// <p>The timestamp for when the API key resource was created 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>.</p>
198    pub fn set_create_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
199        self.create_time = input;
200        self
201    }
202    /// <p>The timestamp for when the API key resource was created 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>.</p>
203    pub fn get_create_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
204        &self.create_time
205    }
206    /// <p>The 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>.</p>
207    /// This field is required.
208    pub fn expire_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
209        self.expire_time = ::std::option::Option::Some(input);
210        self
211    }
212    /// <p>The 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>.</p>
213    pub fn set_expire_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
214        self.expire_time = input;
215        self
216    }
217    /// <p>The 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>.</p>
218    pub fn get_expire_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
219        &self.expire_time
220    }
221    /// <p>The timestamp for when the API key resource was last updated 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>.</p>
222    /// This field is required.
223    pub fn update_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
224        self.update_time = ::std::option::Option::Some(input);
225        self
226    }
227    /// <p>The timestamp for when the API key resource was last updated 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>.</p>
228    pub fn set_update_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
229        self.update_time = input;
230        self
231    }
232    /// <p>The timestamp for when the API key resource was last updated 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>.</p>
233    pub fn get_update_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
234        &self.update_time
235    }
236    /// <p>The optional description for the API key resource.</p>
237    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
238        self.description = ::std::option::Option::Some(input.into());
239        self
240    }
241    /// <p>The optional description for the API key resource.</p>
242    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
243        self.description = input;
244        self
245    }
246    /// <p>The optional description for the API key resource.</p>
247    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
248        &self.description
249    }
250    /// Adds a key-value pair to `tags`.
251    ///
252    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
253    ///
254    /// <p>Tags associated with the API key resource.</p>
255    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
256        let mut hash_map = self.tags.unwrap_or_default();
257        hash_map.insert(k.into(), v.into());
258        self.tags = ::std::option::Option::Some(hash_map);
259        self
260    }
261    /// <p>Tags associated with the API key resource.</p>
262    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
263        self.tags = input;
264        self
265    }
266    /// <p>Tags associated with the API key resource.</p>
267    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
268        &self.tags
269    }
270    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
271        self._request_id = Some(request_id.into());
272        self
273    }
274
275    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
276        self._request_id = request_id;
277        self
278    }
279    /// Consumes the builder and constructs a [`DescribeKeyOutput`](crate::operation::describe_key::DescribeKeyOutput).
280    /// This method will fail if any of the following fields are not set:
281    /// - [`key`](crate::operation::describe_key::builders::DescribeKeyOutputBuilder::key)
282    /// - [`key_arn`](crate::operation::describe_key::builders::DescribeKeyOutputBuilder::key_arn)
283    /// - [`key_name`](crate::operation::describe_key::builders::DescribeKeyOutputBuilder::key_name)
284    /// - [`create_time`](crate::operation::describe_key::builders::DescribeKeyOutputBuilder::create_time)
285    /// - [`expire_time`](crate::operation::describe_key::builders::DescribeKeyOutputBuilder::expire_time)
286    /// - [`update_time`](crate::operation::describe_key::builders::DescribeKeyOutputBuilder::update_time)
287    pub fn build(self) -> ::std::result::Result<crate::operation::describe_key::DescribeKeyOutput, ::aws_smithy_types::error::operation::BuildError> {
288        ::std::result::Result::Ok(crate::operation::describe_key::DescribeKeyOutput {
289            key: self.key.ok_or_else(|| {
290                ::aws_smithy_types::error::operation::BuildError::missing_field(
291                    "key",
292                    "key was not specified but it is required when building DescribeKeyOutput",
293                )
294            })?,
295            key_arn: self.key_arn.ok_or_else(|| {
296                ::aws_smithy_types::error::operation::BuildError::missing_field(
297                    "key_arn",
298                    "key_arn was not specified but it is required when building DescribeKeyOutput",
299                )
300            })?,
301            key_name: self.key_name.ok_or_else(|| {
302                ::aws_smithy_types::error::operation::BuildError::missing_field(
303                    "key_name",
304                    "key_name was not specified but it is required when building DescribeKeyOutput",
305                )
306            })?,
307            restrictions: self.restrictions,
308            create_time: self.create_time.ok_or_else(|| {
309                ::aws_smithy_types::error::operation::BuildError::missing_field(
310                    "create_time",
311                    "create_time was not specified but it is required when building DescribeKeyOutput",
312                )
313            })?,
314            expire_time: self.expire_time.ok_or_else(|| {
315                ::aws_smithy_types::error::operation::BuildError::missing_field(
316                    "expire_time",
317                    "expire_time was not specified but it is required when building DescribeKeyOutput",
318                )
319            })?,
320            update_time: self.update_time.ok_or_else(|| {
321                ::aws_smithy_types::error::operation::BuildError::missing_field(
322                    "update_time",
323                    "update_time was not specified but it is required when building DescribeKeyOutput",
324                )
325            })?,
326            description: self.description,
327            tags: self.tags,
328            _request_id: self._request_id,
329        })
330    }
331}
332impl ::std::fmt::Debug for DescribeKeyOutputBuilder {
333    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
334        let mut formatter = f.debug_struct("DescribeKeyOutputBuilder");
335        formatter.field("key", &"*** Sensitive Data Redacted ***");
336        formatter.field("key_arn", &self.key_arn);
337        formatter.field("key_name", &self.key_name);
338        formatter.field("restrictions", &self.restrictions);
339        formatter.field("create_time", &"*** Sensitive Data Redacted ***");
340        formatter.field("expire_time", &"*** Sensitive Data Redacted ***");
341        formatter.field("update_time", &"*** Sensitive Data Redacted ***");
342        formatter.field("description", &self.description);
343        formatter.field("tags", &self.tags);
344        formatter.field("_request_id", &self._request_id);
345        formatter.finish()
346    }
347}