aws_sdk_ssooidc/operation/create_token/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_token::_create_token_output::CreateTokenOutputBuilder;
3
4pub use crate::operation::create_token::_create_token_input::CreateTokenInputBuilder;
5
6impl crate::operation::create_token::builders::CreateTokenInputBuilder {
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::CreateTokenOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_token::CreateTokenError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_token();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateToken`.
24///
25/// <p>Creates and returns access and refresh tokens for clients that are authenticated using client secrets. The access token can be used to fetch short-lived credentials for the assigned AWS accounts or to access application APIs using <code>bearer</code> authentication.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateTokenFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_token::builders::CreateTokenInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_token::CreateTokenOutput,
35        crate::operation::create_token::CreateTokenError,
36    > for CreateTokenFluentBuilder
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::CreateTokenOutput,
44            crate::operation::create_token::CreateTokenError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateTokenFluentBuilder {
51    /// Creates a new `CreateTokenFluentBuilder`.
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 CreateToken as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_token::builders::CreateTokenInputBuilder {
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::CreateTokenOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_token::CreateTokenError,
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::CreateToken::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_token::CreateToken::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::CreateTokenOutput,
97        crate::operation::create_token::CreateTokenError,
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 comes from the result of the <code>RegisterClient</code> API.</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 comes from the result of the <code>RegisterClient</code> API.</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 comes from the result of the <code>RegisterClient</code> API.</p>
122    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_client_id()
124    }
125    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
126    pub fn client_secret(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.client_secret(input.into());
128        self
129    }
130    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
131    pub fn set_client_secret(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_client_secret(input);
133        self
134    }
135    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
136    pub fn get_client_secret(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_client_secret()
138    }
139    /// <p>Supports the following OAuth grant types: Authorization Code, Device Code, and Refresh Token. Specify one of the following values, depending on the grant type that you want:</p>
140    /// <p>* Authorization Code - <code>authorization_code</code></p>
141    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
142    /// <p>* Refresh Token - <code>refresh_token</code></p>
143    pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        self.inner = self.inner.grant_type(input.into());
145        self
146    }
147    /// <p>Supports the following OAuth grant types: Authorization Code, Device Code, and Refresh Token. Specify one of the following values, depending on the grant type that you want:</p>
148    /// <p>* Authorization Code - <code>authorization_code</code></p>
149    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
150    /// <p>* Refresh Token - <code>refresh_token</code></p>
151    pub fn set_grant_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_grant_type(input);
153        self
154    }
155    /// <p>Supports the following OAuth grant types: Authorization Code, Device Code, and Refresh Token. Specify one of the following values, depending on the grant type that you want:</p>
156    /// <p>* Authorization Code - <code>authorization_code</code></p>
157    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
158    /// <p>* Refresh Token - <code>refresh_token</code></p>
159    pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
160        self.inner.get_grant_type()
161    }
162    /// <p>Used only when calling this API for the Device Code grant type. This short-lived code is used to identify this authorization request. This comes from the result of the <code>StartDeviceAuthorization</code> API.</p>
163    pub fn device_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164        self.inner = self.inner.device_code(input.into());
165        self
166    }
167    /// <p>Used only when calling this API for the Device Code grant type. This short-lived code is used to identify this authorization request. This comes from the result of the <code>StartDeviceAuthorization</code> API.</p>
168    pub fn set_device_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169        self.inner = self.inner.set_device_code(input);
170        self
171    }
172    /// <p>Used only when calling this API for the Device Code grant type. This short-lived code is used to identify this authorization request. This comes from the result of the <code>StartDeviceAuthorization</code> API.</p>
173    pub fn get_device_code(&self) -> &::std::option::Option<::std::string::String> {
174        self.inner.get_device_code()
175    }
176    /// <p>Used only when calling this API for the Authorization Code grant type. The short-lived code is used to identify this authorization request.</p>
177    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
178        self.inner = self.inner.code(input.into());
179        self
180    }
181    /// <p>Used only when calling this API for the Authorization Code grant type. The short-lived code is used to identify this authorization request.</p>
182    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
183        self.inner = self.inner.set_code(input);
184        self
185    }
186    /// <p>Used only when calling this API for the Authorization Code grant type. The short-lived code is used to identify this authorization request.</p>
187    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
188        self.inner.get_code()
189    }
190    /// <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>
191    /// <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>
192    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193        self.inner = self.inner.refresh_token(input.into());
194        self
195    }
196    /// <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>
197    /// <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>
198    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199        self.inner = self.inner.set_refresh_token(input);
200        self
201    }
202    /// <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>
203    /// <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>
204    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
205        self.inner.get_refresh_token()
206    }
207    ///
208    /// Appends an item to `scope`.
209    ///
210    /// To override the contents of this collection use [`set_scope`](Self::set_scope).
211    ///
212    /// <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 this value is not specified, IAM Identity Center authorizes all scopes that are configured for the client during the call to <code>RegisterClient</code>.</p>
213    pub fn scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
214        self.inner = self.inner.scope(input.into());
215        self
216    }
217    /// <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 this value is not specified, IAM Identity Center authorizes all scopes that are configured for the client during the call to <code>RegisterClient</code>.</p>
218    pub fn set_scope(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
219        self.inner = self.inner.set_scope(input);
220        self
221    }
222    /// <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 this value is not specified, IAM Identity Center authorizes all scopes that are configured for the client during the call to <code>RegisterClient</code>.</p>
223    pub fn get_scope(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
224        self.inner.get_scope()
225    }
226    /// <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>
227    pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
228        self.inner = self.inner.redirect_uri(input.into());
229        self
230    }
231    /// <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>
232    pub fn set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
233        self.inner = self.inner.set_redirect_uri(input);
234        self
235    }
236    /// <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>
237    pub fn get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
238        self.inner.get_redirect_uri()
239    }
240    /// <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>
241    pub fn code_verifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
242        self.inner = self.inner.code_verifier(input.into());
243        self
244    }
245    /// <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>
246    pub fn set_code_verifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
247        self.inner = self.inner.set_code_verifier(input);
248        self
249    }
250    /// <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>
251    pub fn get_code_verifier(&self) -> &::std::option::Option<::std::string::String> {
252        self.inner.get_code_verifier()
253    }
254}