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