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