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 clients and applications that are authenticated using IAM entities. 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>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateTokenWithIAMFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_token_with_iam::builders::CreateTokenWithIamInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
35        crate::operation::create_token_with_iam::CreateTokenWithIAMError,
36    > for CreateTokenWithIAMFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
44            crate::operation::create_token_with_iam::CreateTokenWithIAMError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateTokenWithIAMFluentBuilder {
51    /// Creates a new `CreateTokenWithIAMFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the CreateTokenWithIAM as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_token_with_iam::builders::CreateTokenWithIamInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_token_with_iam::CreateTokenWithIAMError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::create_token_with_iam::CreateTokenWithIAM::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_token_with_iam::CreateTokenWithIAM::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::create_token_with_iam::CreateTokenWithIamOutput,
97        crate::operation::create_token_with_iam::CreateTokenWithIAMError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
112    pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.client_id(input.into());
114        self
115    }
116    /// <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
117    pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_client_id(input);
119        self
120    }
121    /// <p>The unique identifier string for the client or application. This value is an application ARN that has OAuth grants configured.</p>
122    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_client_id()
124    }
125    /// <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>
126    /// <p>* Authorization Code - <code>authorization_code</code></p>
127    /// <p>* Refresh Token - <code>refresh_token</code></p>
128    /// <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code></p>
129    /// <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code></p>
130    pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.grant_type(input.into());
132        self
133    }
134    /// <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>
135    /// <p>* Authorization Code - <code>authorization_code</code></p>
136    /// <p>* Refresh Token - <code>refresh_token</code></p>
137    /// <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code></p>
138    /// <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code></p>
139    pub fn set_grant_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.inner = self.inner.set_grant_type(input);
141        self
142    }
143    /// <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>
144    /// <p>* Authorization Code - <code>authorization_code</code></p>
145    /// <p>* Refresh Token - <code>refresh_token</code></p>
146    /// <p>* JWT Bearer - <code>urn:ietf:params:oauth:grant-type:jwt-bearer</code></p>
147    /// <p>* Token Exchange - <code>urn:ietf:params:oauth:grant-type:token-exchange</code></p>
148    pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
149        self.inner.get_grant_type()
150    }
151    /// <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>
152    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.code(input.into());
154        self
155    }
156    /// <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>
157    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.inner = self.inner.set_code(input);
159        self
160    }
161    /// <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>
162    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
163        self.inner.get_code()
164    }
165    /// <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>
166    /// <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>
167    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168        self.inner = self.inner.refresh_token(input.into());
169        self
170    }
171    /// <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>
172    /// <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>
173    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
174        self.inner = self.inner.set_refresh_token(input);
175        self
176    }
177    /// <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>
178    /// <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>
179    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
180        self.inner.get_refresh_token()
181    }
182    /// <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>
183    pub fn assertion(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184        self.inner = self.inner.assertion(input.into());
185        self
186    }
187    /// <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>
188    pub fn set_assertion(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189        self.inner = self.inner.set_assertion(input);
190        self
191    }
192    /// <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>
193    pub fn get_assertion(&self) -> &::std::option::Option<::std::string::String> {
194        self.inner.get_assertion()
195    }
196    ///
197    /// Appends an item to `scope`.
198    ///
199    /// To override the contents of this collection use [`set_scope`](Self::set_scope).
200    ///
201    /// <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>
202    pub fn scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
203        self.inner = self.inner.scope(input.into());
204        self
205    }
206    /// <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>
207    pub fn set_scope(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
208        self.inner = self.inner.set_scope(input);
209        self
210    }
211    /// <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>
212    pub fn get_scope(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
213        self.inner.get_scope()
214    }
215    /// <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>
216    pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.inner = self.inner.redirect_uri(input.into());
218        self
219    }
220    /// <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>
221    pub fn set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222        self.inner = self.inner.set_redirect_uri(input);
223        self
224    }
225    /// <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>
226    pub fn get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
227        self.inner.get_redirect_uri()
228    }
229    /// <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>
230    pub fn subject_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
231        self.inner = self.inner.subject_token(input.into());
232        self
233    }
234    /// <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>
235    pub fn set_subject_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
236        self.inner = self.inner.set_subject_token(input);
237        self
238    }
239    /// <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>
240    pub fn get_subject_token(&self) -> &::std::option::Option<::std::string::String> {
241        self.inner.get_subject_token()
242    }
243    /// <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>
244    /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
245    pub fn subject_token_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246        self.inner = self.inner.subject_token_type(input.into());
247        self
248    }
249    /// <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>
250    /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
251    pub fn set_subject_token_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252        self.inner = self.inner.set_subject_token_type(input);
253        self
254    }
255    /// <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>
256    /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
257    pub fn get_subject_token_type(&self) -> &::std::option::Option<::std::string::String> {
258        self.inner.get_subject_token_type()
259    }
260    /// <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>
261    /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
262    /// <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code></p>
263    pub fn requested_token_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
264        self.inner = self.inner.requested_token_type(input.into());
265        self
266    }
267    /// <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>
268    /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
269    /// <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code></p>
270    pub fn set_requested_token_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
271        self.inner = self.inner.set_requested_token_type(input);
272        self
273    }
274    /// <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>
275    /// <p>* Access Token - <code>urn:ietf:params:oauth:token-type:access_token</code></p>
276    /// <p>* Refresh Token - <code>urn:ietf:params:oauth:token-type:refresh_token</code></p>
277    pub fn get_requested_token_type(&self) -> &::std::option::Option<::std::string::String> {
278        self.inner.get_requested_token_type()
279    }
280    /// <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>
281    pub fn code_verifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
282        self.inner = self.inner.code_verifier(input.into());
283        self
284    }
285    /// <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>
286    pub fn set_code_verifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
287        self.inner = self.inner.set_code_verifier(input);
288        self
289    }
290    /// <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>
291    pub fn get_code_verifier(&self) -> &::std::option::Option<::std::string::String> {
292        self.inner.get_code_verifier()
293    }
294}