aws_sdk_location/operation/create_key/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_key::_create_key_input::CreateKeyInputBuilder;
3
4pub use crate::operation::create_key::_create_key_output::CreateKeyOutputBuilder;
5
6impl crate::operation::create_key::builders::CreateKeyInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::create_key::CreateKeyOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_key::CreateKeyError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_key();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateKey`.
24///
25/// <p>Creates an API key resource in your Amazon Web Services account, which lets you grant actions for Amazon Location resources to the API key bearer.</p>
26/// <p>For more information, see <a href="https://docs.aws.amazon.com/location/latest/developerguide/using-apikeys.html">Use API keys to authenticate</a> in the <i>Amazon Location Service Developer Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateKeyFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::create_key::builders::CreateKeyInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl crate::client::customize::internal::CustomizableSend<crate::operation::create_key::CreateKeyOutput, crate::operation::create_key::CreateKeyError>
34 for CreateKeyFluentBuilder
35{
36 fn send(
37 self,
38 config_override: crate::config::Builder,
39 ) -> crate::client::customize::internal::BoxFuture<
40 crate::client::customize::internal::SendResult<crate::operation::create_key::CreateKeyOutput, crate::operation::create_key::CreateKeyError>,
41 > {
42 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
43 }
44}
45impl CreateKeyFluentBuilder {
46 /// Creates a new `CreateKeyFluentBuilder`.
47 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
48 Self {
49 handle,
50 inner: ::std::default::Default::default(),
51 config_override: ::std::option::Option::None,
52 }
53 }
54 /// Access the CreateKey as a reference.
55 pub fn as_input(&self) -> &crate::operation::create_key::builders::CreateKeyInputBuilder {
56 &self.inner
57 }
58 /// Sends the request and returns the response.
59 ///
60 /// If an error occurs, an `SdkError` will be returned with additional details that
61 /// can be matched against.
62 ///
63 /// By default, any retryable failures will be retried twice. Retry behavior
64 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
65 /// set when configuring the client.
66 pub async fn send(
67 self,
68 ) -> ::std::result::Result<
69 crate::operation::create_key::CreateKeyOutput,
70 ::aws_smithy_runtime_api::client::result::SdkError<
71 crate::operation::create_key::CreateKeyError,
72 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
73 >,
74 > {
75 let input = self
76 .inner
77 .build()
78 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
79 let runtime_plugins = crate::operation::create_key::CreateKey::operation_runtime_plugins(
80 self.handle.runtime_plugins.clone(),
81 &self.handle.conf,
82 self.config_override,
83 );
84 crate::operation::create_key::CreateKey::orchestrate(&runtime_plugins, input).await
85 }
86
87 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
88 pub fn customize(
89 self,
90 ) -> crate::client::customize::CustomizableOperation<
91 crate::operation::create_key::CreateKeyOutput,
92 crate::operation::create_key::CreateKeyError,
93 Self,
94 > {
95 crate::client::customize::CustomizableOperation::new(self)
96 }
97 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
98 self.set_config_override(::std::option::Option::Some(config_override.into()));
99 self
100 }
101
102 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
103 self.config_override = config_override;
104 self
105 }
106 /// <p>A custom name for the API key resource.</p>
107 /// <p>Requirements:</p>
108 /// <ul>
109 /// <li>
110 /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
111 /// <li>
112 /// <p>Must be a unique API key name.</p></li>
113 /// <li>
114 /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
115 /// </ul>
116 pub fn key_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.key_name(input.into());
118 self
119 }
120 /// <p>A custom name for the API key resource.</p>
121 /// <p>Requirements:</p>
122 /// <ul>
123 /// <li>
124 /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
125 /// <li>
126 /// <p>Must be a unique API key name.</p></li>
127 /// <li>
128 /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
129 /// </ul>
130 pub fn set_key_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131 self.inner = self.inner.set_key_name(input);
132 self
133 }
134 /// <p>A custom name for the API key resource.</p>
135 /// <p>Requirements:</p>
136 /// <ul>
137 /// <li>
138 /// <p>Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-), periods (.), and underscores (_).</p></li>
139 /// <li>
140 /// <p>Must be a unique API key name.</p></li>
141 /// <li>
142 /// <p>No spaces allowed. For example, <code>ExampleAPIKey</code>.</p></li>
143 /// </ul>
144 pub fn get_key_name(&self) -> &::std::option::Option<::std::string::String> {
145 self.inner.get_key_name()
146 }
147 /// <p>The API key restrictions for the API key resource.</p>
148 pub fn restrictions(mut self, input: crate::types::ApiKeyRestrictions) -> Self {
149 self.inner = self.inner.restrictions(input);
150 self
151 }
152 /// <p>The API key restrictions for the API key resource.</p>
153 pub fn set_restrictions(mut self, input: ::std::option::Option<crate::types::ApiKeyRestrictions>) -> Self {
154 self.inner = self.inner.set_restrictions(input);
155 self
156 }
157 /// <p>The API key restrictions for the API key resource.</p>
158 pub fn get_restrictions(&self) -> &::std::option::Option<crate::types::ApiKeyRestrictions> {
159 self.inner.get_restrictions()
160 }
161 /// <p>An optional description for the API key resource.</p>
162 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.description(input.into());
164 self
165 }
166 /// <p>An optional description for the API key resource.</p>
167 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
168 self.inner = self.inner.set_description(input);
169 self
170 }
171 /// <p>An optional description for the API key resource.</p>
172 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
173 self.inner.get_description()
174 }
175 /// <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>
176 pub fn expire_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
177 self.inner = self.inner.expire_time(input);
178 self
179 }
180 /// <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>
181 pub fn set_expire_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
182 self.inner = self.inner.set_expire_time(input);
183 self
184 }
185 /// <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>
186 pub fn get_expire_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
187 self.inner.get_expire_time()
188 }
189 /// <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>
190 pub fn no_expiry(mut self, input: bool) -> Self {
191 self.inner = self.inner.no_expiry(input);
192 self
193 }
194 /// <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>
195 pub fn set_no_expiry(mut self, input: ::std::option::Option<bool>) -> Self {
196 self.inner = self.inner.set_no_expiry(input);
197 self
198 }
199 /// <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>
200 pub fn get_no_expiry(&self) -> &::std::option::Option<bool> {
201 self.inner.get_no_expiry()
202 }
203 ///
204 /// Adds a key-value pair to `Tags`.
205 ///
206 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
207 ///
208 /// <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>
209 /// <p>Format: <code>"key" : "value"</code></p>
210 /// <p>Restrictions:</p>
211 /// <ul>
212 /// <li>
213 /// <p>Maximum 50 tags per resource</p></li>
214 /// <li>
215 /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
216 /// <li>
217 /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
218 /// <li>
219 /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
220 /// <li>
221 /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
222 /// <li>
223 /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
224 /// </ul>
225 pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
226 self.inner = self.inner.tags(k.into(), v.into());
227 self
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 set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
247 self.inner = self.inner.set_tags(input);
248 self
249 }
250 /// <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>
251 /// <p>Format: <code>"key" : "value"</code></p>
252 /// <p>Restrictions:</p>
253 /// <ul>
254 /// <li>
255 /// <p>Maximum 50 tags per resource</p></li>
256 /// <li>
257 /// <p>Each resource tag must be unique with a maximum of one value.</p></li>
258 /// <li>
259 /// <p>Maximum key length: 128 Unicode characters in UTF-8</p></li>
260 /// <li>
261 /// <p>Maximum value length: 256 Unicode characters in UTF-8</p></li>
262 /// <li>
263 /// <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.</p></li>
264 /// <li>
265 /// <p>Cannot use "aws:" as a prefix for a key.</p></li>
266 /// </ul>
267 pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
268 self.inner.get_tags()
269 }
270}