aws_sdk_ssooidc/operation/create_token_with_iam/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_token_with_iam::_create_token_with_iam_output::CreateTokenWithIamOutputBuilder;
3
4pub use crate::operation::create_token_with_iam::_create_token_with_iam_input::CreateTokenWithIamInputBuilder;
5
6impl crate::operation::create_token_with_iam::builders::CreateTokenWithIamInputBuilder {
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_token_with_iam::CreateTokenWithIamOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_token_with_iam::CreateTokenWithIAMError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_token_with_iam();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateTokenWithIAM`.
24///
25/// <p>Creates and returns access and refresh tokens for authorized client applications that are authenticated using any IAM entity, such as a service role or user. These tokens might contain defined scopes that specify permissions such as <code>read:profile</code> or <code>write:data</code>. Through downscoping, you can use the scopes parameter to request tokens with reduced permissions compared to the original client application's permissions or, if applicable, the refresh token's scopes. The access token can be used to fetch short-lived credentials for the assigned Amazon Web Services accounts or to access application APIs using <code>bearer</code> authentication.</p><note>
26/// <p>This API is used with Signature Version 4. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html">Amazon Web Services Signature Version 4 for API Requests</a>.</p>
27/// </note>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateTokenWithIAMFluentBuilder {
30 handle: ::std::sync::Arc<crate::client::Handle>,
31 inner: crate::operation::create_token_with_iam::builders::CreateTokenWithIamInputBuilder,
32 config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35 crate::client::customize::internal::CustomizableSend<
36 crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
37 crate::operation::create_token_with_iam::CreateTokenWithIAMError,
38 > for CreateTokenWithIAMFluentBuilder
39{
40 fn send(
41 self,
42 config_override: crate::config::Builder,
43 ) -> crate::client::customize::internal::BoxFuture<
44 crate::client::customize::internal::SendResult<
45 crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
46 crate::operation::create_token_with_iam::CreateTokenWithIAMError,
47 >,
48 > {
49 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50 }
51}
52impl CreateTokenWithIAMFluentBuilder {
53 /// Creates a new `CreateTokenWithIAMFluentBuilder`.
54 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55 Self {
56 handle,
57 inner: ::std::default::Default::default(),
58 config_override: ::std::option::Option::None,
59 }
60 }
61 /// Access the CreateTokenWithIAM as a reference.
62 pub fn as_input(&self) -> &crate::operation::create_token_with_iam::builders::CreateTokenWithIamInputBuilder {
63 &self.inner
64 }
65 /// Sends the request and returns the response.
66 ///
67 /// If an error occurs, an `SdkError` will be returned with additional details that
68 /// can be matched against.
69 ///
70 /// By default, any retryable failures will be retried twice. Retry behavior
71 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72 /// set when configuring the client.
73 pub async fn send(
74 self,
75 ) -> ::std::result::Result<
76 crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
77 ::aws_smithy_runtime_api::client::result::SdkError<
78 crate::operation::create_token_with_iam::CreateTokenWithIAMError,
79 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80 >,
81 > {
82 let input = self
83 .inner
84 .build()
85 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86 let runtime_plugins = crate::operation::create_token_with_iam::CreateTokenWithIAM::operation_runtime_plugins(
87 self.handle.runtime_plugins.clone(),
88 &self.handle.conf,
89 self.config_override,
90 );
91 crate::operation::create_token_with_iam::CreateTokenWithIAM::orchestrate(&runtime_plugins, input).await
92 }
93
94 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95 pub fn customize(
96 self,
97 ) -> crate::client::customize::CustomizableOperation<
98 crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
99 crate::operation::create_token_with_iam::CreateTokenWithIAMError,
100 Self,
101 > {
102 crate::client::customize::CustomizableOperation::new(self)
103 }
104 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105 self.set_config_override(::std::option::Option::Some(config_override.into()));
106 self
107 }
108
109 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110 self.config_override = config_override;
111 self
112 }
113 /// <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
114 pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.inner = self.inner.client_id(input.into());
116 self
117 }
118 /// <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
119 pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120 self.inner = self.inner.set_client_id(input);
121 self
122 }
123 /// <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
124 pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
125 self.inner.get_client_id()
126 }
127 /// <p>Supports the following OAuth grant types: Authorization Code, Refresh Token, JWT Bearer, and Token Exchange. Specify one of the following values, depending on the grant type that you want:</p>
128 /// <p>* Authorization Code - <code>authorization_code</code></p>
129 /// <p>* Refresh Token - <code>refresh_token</code></p>
130 /// <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code></p>
131 /// <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code></p>
132 pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133 self.inner = self.inner.grant_type(input.into());
134 self
135 }
136 /// <p>Supports the following OAuth grant types: Authorization Code, Refresh Token, JWT Bearer, and Token Exchange. Specify one of the following values, depending on the grant type that you want:</p>
137 /// <p>* Authorization Code - <code>authorization_code</code></p>
138 /// <p>* Refresh Token - <code>refresh_token</code></p>
139 /// <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code></p>
140 /// <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code></p>
141 pub fn set_grant_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142 self.inner = self.inner.set_grant_type(input);
143 self
144 }
145 /// <p>Supports the following OAuth grant types: Authorization Code, Refresh Token, JWT Bearer, and Token Exchange. Specify one of the following values, depending on the grant type that you want:</p>
146 /// <p>* Authorization Code - <code>authorization_code</code></p>
147 /// <p>* Refresh Token - <code>refresh_token</code></p>
148 /// <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code></p>
149 /// <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code></p>
150 pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
151 self.inner.get_grant_type()
152 }
153 /// <p>Used only when calling this API for the Authorization Code grant type. This short-lived code is used to identify this authorization request. The code is obtained through a redirect from IAM Identity Center to a redirect URI persisted in the Authorization Code GrantOptions for the application.</p>
154 pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155 self.inner = self.inner.code(input.into());
156 self
157 }
158 /// <p>Used only when calling this API for the Authorization Code grant type. This short-lived code is used to identify this authorization request. The code is obtained through a redirect from IAM Identity Center to a redirect URI persisted in the Authorization Code GrantOptions for the application.</p>
159 pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160 self.inner = self.inner.set_code(input);
161 self
162 }
163 /// <p>Used only when calling this API for the Authorization Code grant type. This short-lived code is used to identify this authorization request. The code is obtained through a redirect from IAM Identity Center to a redirect URI persisted in the Authorization Code GrantOptions for the application.</p>
164 pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
165 self.inner.get_code()
166 }
167 /// <p>Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire.</p>
168 /// <p>For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see <i>Considerations for Using this Guide</i> in the <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html">IAM Identity Center OIDC API Reference</a>.</p>
169 pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.refresh_token(input.into());
171 self
172 }
173 /// <p>Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire.</p>
174 /// <p>For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see <i>Considerations for Using this Guide</i> in the <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html">IAM Identity Center OIDC API Reference</a>.</p>
175 pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
176 self.inner = self.inner.set_refresh_token(input);
177 self
178 }
179 /// <p>Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire.</p>
180 /// <p>For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see <i>Considerations for Using this Guide</i> in the <a href="https://docs.aws.amazon.com/singlesignon/latest/OIDCAPIReference/Welcome.html">IAM Identity Center OIDC API Reference</a>.</p>
181 pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
182 self.inner.get_refresh_token()
183 }
184 /// <p>Used only when calling this API for the JWT Bearer grant type. This value specifies the JSON Web Token (JWT) issued by a trusted token issuer. To authorize a trusted token issuer, configure the JWT Bearer GrantOptions for the application.</p>
185 pub fn assertion(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186 self.inner = self.inner.assertion(input.into());
187 self
188 }
189 /// <p>Used only when calling this API for the JWT Bearer grant type. This value specifies the JSON Web Token (JWT) issued by a trusted token issuer. To authorize a trusted token issuer, configure the JWT Bearer GrantOptions for the application.</p>
190 pub fn set_assertion(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
191 self.inner = self.inner.set_assertion(input);
192 self
193 }
194 /// <p>Used only when calling this API for the JWT Bearer grant type. This value specifies the JSON Web Token (JWT) issued by a trusted token issuer. To authorize a trusted token issuer, configure the JWT Bearer GrantOptions for the application.</p>
195 pub fn get_assertion(&self) -> &::std::option::Option<::std::string::String> {
196 self.inner.get_assertion()
197 }
198 ///
199 /// Appends an item to `scope`.
200 ///
201 /// To override the contents of this collection use [`set_scope`](Self::set_scope).
202 ///
203 /// <p>The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If the value is not specified, IAM Identity Center authorizes all scopes configured for the application, including the following default scopes: <code>openid</code>, <code>aws</code>, <code>sts:identity_context</code>.</p>
204 pub fn scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205 self.inner = self.inner.scope(input.into());
206 self
207 }
208 /// <p>The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If the value is not specified, IAM Identity Center authorizes all scopes configured for the application, including the following default scopes: <code>openid</code>, <code>aws</code>, <code>sts:identity_context</code>.</p>
209 pub fn set_scope(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
210 self.inner = self.inner.set_scope(input);
211 self
212 }
213 /// <p>The list of scopes for which authorization is requested. The access token that is issued is limited to the scopes that are granted. If the value is not specified, IAM Identity Center authorizes all scopes configured for the application, including the following default scopes: <code>openid</code>, <code>aws</code>, <code>sts:identity_context</code>.</p>
214 pub fn get_scope(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
215 self.inner.get_scope()
216 }
217 /// <p>Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code.</p>
218 pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
219 self.inner = self.inner.redirect_uri(input.into());
220 self
221 }
222 /// <p>Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code.</p>
223 pub fn set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224 self.inner = self.inner.set_redirect_uri(input);
225 self
226 }
227 /// <p>Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code.</p>
228 pub fn get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
229 self.inner.get_redirect_uri()
230 }
231 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the subject of the exchange. The value of the subject token must be an access token issued by IAM Identity Center to a different client or application. The access token must have authorized scopes that indicate the requested application as a target audience.</p>
232 pub fn subject_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
233 self.inner = self.inner.subject_token(input.into());
234 self
235 }
236 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the subject of the exchange. The value of the subject token must be an access token issued by IAM Identity Center to a different client or application. The access token must have authorized scopes that indicate the requested application as a target audience.</p>
237 pub fn set_subject_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
238 self.inner = self.inner.set_subject_token(input);
239 self
240 }
241 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the subject of the exchange. The value of the subject token must be an access token issued by IAM Identity Center to a different client or application. The access token must have authorized scopes that indicate the requested application as a target audience.</p>
242 pub fn get_subject_token(&self) -> &::std::option::Option<::std::string::String> {
243 self.inner.get_subject_token()
244 }
245 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that is passed as the subject of the exchange. The following value is supported:</p>
246 /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
247 pub fn subject_token_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
248 self.inner = self.inner.subject_token_type(input.into());
249 self
250 }
251 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that is passed as the subject of the exchange. The following value is supported:</p>
252 /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
253 pub fn set_subject_token_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
254 self.inner = self.inner.set_subject_token_type(input);
255 self
256 }
257 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that is passed as the subject of the exchange. The following value is supported:</p>
258 /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
259 pub fn get_subject_token_type(&self) -> &::std::option::Option<::std::string::String> {
260 self.inner.get_subject_token_type()
261 }
262 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that the requester can receive. The following values are supported:</p>
263 /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
264 /// <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code></p>
265 pub fn requested_token_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
266 self.inner = self.inner.requested_token_type(input.into());
267 self
268 }
269 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that the requester can receive. The following values are supported:</p>
270 /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
271 /// <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code></p>
272 pub fn set_requested_token_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
273 self.inner = self.inner.set_requested_token_type(input);
274 self
275 }
276 /// <p>Used only when calling this API for the Token Exchange grant type. This value specifies the type of token that the requester can receive. The following values are supported:</p>
277 /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
278 /// <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code></p>
279 pub fn get_requested_token_type(&self) -> &::std::option::Option<::std::string::String> {
280 self.inner.get_requested_token_type()
281 }
282 /// <p>Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time.</p>
283 pub fn code_verifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
284 self.inner = self.inner.code_verifier(input.into());
285 self
286 }
287 /// <p>Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time.</p>
288 pub fn set_code_verifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
289 self.inner = self.inner.set_code_verifier(input);
290 self
291 }
292 /// <p>Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time.</p>
293 pub fn get_code_verifier(&self) -> &::std::option::Option<::std::string::String> {
294 self.inner.get_code_verifier()
295 }
296}