aws_sdk_location/operation/create_key/_create_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 CreateKeyOutput {
6 /// <p>The key value/string of an API key. This value is used when making API calls to authorize the call. For example, see <a href="https://docs.aws.amazon.com/location/previous/APIReference/API_GetMapGlyphs.html">GetMapGlyphs</a>.</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>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>
17 pub create_time: ::aws_smithy_types::DateTime,
18 _request_id: Option<String>,
19}
20impl CreateKeyOutput {
21 /// <p>The key value/string of an API key. This value is used when making API calls to authorize the call. For example, see <a href="https://docs.aws.amazon.com/location/previous/APIReference/API_GetMapGlyphs.html">GetMapGlyphs</a>.</p>
22 pub fn key(&self) -> &str {
23 use std::ops::Deref;
24 self.key.deref()
25 }
26 /// <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>
27 /// <ul>
28 /// <li>
29 /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
30 /// </ul>
31 pub fn key_arn(&self) -> &str {
32 use std::ops::Deref;
33 self.key_arn.deref()
34 }
35 /// <p>The name of the API key resource.</p>
36 pub fn key_name(&self) -> &str {
37 use std::ops::Deref;
38 self.key_name.deref()
39 }
40 /// <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>
41 pub fn create_time(&self) -> &::aws_smithy_types::DateTime {
42 &self.create_time
43 }
44}
45impl ::std::fmt::Debug for CreateKeyOutput {
46 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
47 let mut formatter = f.debug_struct("CreateKeyOutput");
48 formatter.field("key", &"*** Sensitive Data Redacted ***");
49 formatter.field("key_arn", &self.key_arn);
50 formatter.field("key_name", &self.key_name);
51 formatter.field("create_time", &"*** Sensitive Data Redacted ***");
52 formatter.field("_request_id", &self._request_id);
53 formatter.finish()
54 }
55}
56impl ::aws_types::request_id::RequestId for CreateKeyOutput {
57 fn request_id(&self) -> Option<&str> {
58 self._request_id.as_deref()
59 }
60}
61impl CreateKeyOutput {
62 /// Creates a new builder-style object to manufacture [`CreateKeyOutput`](crate::operation::create_key::CreateKeyOutput).
63 pub fn builder() -> crate::operation::create_key::builders::CreateKeyOutputBuilder {
64 crate::operation::create_key::builders::CreateKeyOutputBuilder::default()
65 }
66}
67
68/// A builder for [`CreateKeyOutput`](crate::operation::create_key::CreateKeyOutput).
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
70#[non_exhaustive]
71pub struct CreateKeyOutputBuilder {
72 pub(crate) key: ::std::option::Option<::std::string::String>,
73 pub(crate) key_arn: ::std::option::Option<::std::string::String>,
74 pub(crate) key_name: ::std::option::Option<::std::string::String>,
75 pub(crate) create_time: ::std::option::Option<::aws_smithy_types::DateTime>,
76 _request_id: Option<String>,
77}
78impl CreateKeyOutputBuilder {
79 /// <p>The key value/string of an API key. This value is used when making API calls to authorize the call. For example, see <a href="https://docs.aws.amazon.com/location/previous/APIReference/API_GetMapGlyphs.html">GetMapGlyphs</a>.</p>
80 /// This field is required.
81 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82 self.key = ::std::option::Option::Some(input.into());
83 self
84 }
85 /// <p>The key value/string of an API key. This value is used when making API calls to authorize the call. For example, see <a href="https://docs.aws.amazon.com/location/previous/APIReference/API_GetMapGlyphs.html">GetMapGlyphs</a>.</p>
86 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87 self.key = input;
88 self
89 }
90 /// <p>The key value/string of an API key. This value is used when making API calls to authorize the call. For example, see <a href="https://docs.aws.amazon.com/location/previous/APIReference/API_GetMapGlyphs.html">GetMapGlyphs</a>.</p>
91 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
92 &self.key
93 }
94 /// <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>
95 /// <ul>
96 /// <li>
97 /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
98 /// </ul>
99 /// This field is required.
100 pub fn key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
101 self.key_arn = ::std::option::Option::Some(input.into());
102 self
103 }
104 /// <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>
105 /// <ul>
106 /// <li>
107 /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
108 /// </ul>
109 pub fn set_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110 self.key_arn = input;
111 self
112 }
113 /// <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>
114 /// <ul>
115 /// <li>
116 /// <p>Format example: <code>arn:aws:geo:region:account-id:key/ExampleKey</code></p></li>
117 /// </ul>
118 pub fn get_key_arn(&self) -> &::std::option::Option<::std::string::String> {
119 &self.key_arn
120 }
121 /// <p>The name of the API key resource.</p>
122 /// This field is required.
123 pub fn key_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124 self.key_name = ::std::option::Option::Some(input.into());
125 self
126 }
127 /// <p>The name of the API key resource.</p>
128 pub fn set_key_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129 self.key_name = input;
130 self
131 }
132 /// <p>The name of the API key resource.</p>
133 pub fn get_key_name(&self) -> &::std::option::Option<::std::string::String> {
134 &self.key_name
135 }
136 /// <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>
137 /// This field is required.
138 pub fn create_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
139 self.create_time = ::std::option::Option::Some(input);
140 self
141 }
142 /// <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>
143 pub fn set_create_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
144 self.create_time = input;
145 self
146 }
147 /// <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>
148 pub fn get_create_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
149 &self.create_time
150 }
151 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
152 self._request_id = Some(request_id.into());
153 self
154 }
155
156 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
157 self._request_id = request_id;
158 self
159 }
160 /// Consumes the builder and constructs a [`CreateKeyOutput`](crate::operation::create_key::CreateKeyOutput).
161 /// This method will fail if any of the following fields are not set:
162 /// - [`key`](crate::operation::create_key::builders::CreateKeyOutputBuilder::key)
163 /// - [`key_arn`](crate::operation::create_key::builders::CreateKeyOutputBuilder::key_arn)
164 /// - [`key_name`](crate::operation::create_key::builders::CreateKeyOutputBuilder::key_name)
165 /// - [`create_time`](crate::operation::create_key::builders::CreateKeyOutputBuilder::create_time)
166 pub fn build(self) -> ::std::result::Result<crate::operation::create_key::CreateKeyOutput, ::aws_smithy_types::error::operation::BuildError> {
167 ::std::result::Result::Ok(crate::operation::create_key::CreateKeyOutput {
168 key: self.key.ok_or_else(|| {
169 ::aws_smithy_types::error::operation::BuildError::missing_field(
170 "key",
171 "key was not specified but it is required when building CreateKeyOutput",
172 )
173 })?,
174 key_arn: self.key_arn.ok_or_else(|| {
175 ::aws_smithy_types::error::operation::BuildError::missing_field(
176 "key_arn",
177 "key_arn was not specified but it is required when building CreateKeyOutput",
178 )
179 })?,
180 key_name: self.key_name.ok_or_else(|| {
181 ::aws_smithy_types::error::operation::BuildError::missing_field(
182 "key_name",
183 "key_name was not specified but it is required when building CreateKeyOutput",
184 )
185 })?,
186 create_time: self.create_time.ok_or_else(|| {
187 ::aws_smithy_types::error::operation::BuildError::missing_field(
188 "create_time",
189 "create_time was not specified but it is required when building CreateKeyOutput",
190 )
191 })?,
192 _request_id: self._request_id,
193 })
194 }
195}
196impl ::std::fmt::Debug for CreateKeyOutputBuilder {
197 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
198 let mut formatter = f.debug_struct("CreateKeyOutputBuilder");
199 formatter.field("key", &"*** Sensitive Data Redacted ***");
200 formatter.field("key_arn", &self.key_arn);
201 formatter.field("key_name", &self.key_name);
202 formatter.field("create_time", &"*** Sensitive Data Redacted ***");
203 formatter.field("_request_id", &self._request_id);
204 formatter.finish()
205 }
206}