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(self, client: &crate::Client) -> ::std::result::Result<
9                        crate::operation::create_token::CreateTokenOutput,
10                        ::aws_smithy_runtime_api::client::result::SdkError<
11                            crate::operation::create_token::CreateTokenError,
12                            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse
13                        >
14                    > {
15                        let mut fluent_builder = client.create_token();
16                        fluent_builder.inner = self;
17                        fluent_builder.send().await
18                    }
19                }
20/// Fluent builder constructing a request to `CreateToken`.
21/// 
22/// <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-term credentials for the assigned AWS accounts or to access application APIs using <code>bearer</code> authentication.</p>
23#[derive(::std::clone::Clone, ::std::fmt::Debug)]
24pub struct CreateTokenFluentBuilder {
25                handle: ::std::sync::Arc<crate::client::Handle>,
26                inner: crate::operation::create_token::builders::CreateTokenInputBuilder,
27config_override: ::std::option::Option<crate::config::Builder>,
28            }
29impl
30                crate::client::customize::internal::CustomizableSend<
31                    crate::operation::create_token::CreateTokenOutput,
32                    crate::operation::create_token::CreateTokenError,
33                > for CreateTokenFluentBuilder
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::CreateTokenOutput,
41                        crate::operation::create_token::CreateTokenError,
42                    >,
43                > {
44                    ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
45                }
46            }
47impl CreateTokenFluentBuilder {
48    /// Creates a new `CreateTokenFluentBuilder`.
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 CreateToken as a reference.
57                    pub fn as_input(&self) -> &crate::operation::create_token::builders::CreateTokenInputBuilder {
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::CreateTokenOutput, ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::create_token::CreateTokenError, ::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::CreateToken::operation_runtime_plugins(
71                            self.handle.runtime_plugins.clone(),
72                            &self.handle.conf,
73                            self.config_override,
74                        );
75                        crate::operation::create_token::CreateToken::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::CreateTokenOutput, crate::operation::create_token::CreateTokenError, 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 comes from the result of the <code>RegisterClient</code> API.</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 comes from the result of the <code>RegisterClient</code> API.</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 comes from the result of the <code>RegisterClient</code> API.</p>
110    pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
111                    self.inner.get_client_id()
112                }
113    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
114    pub fn client_secret(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115                    self.inner = self.inner.client_secret(input.into());
116                    self
117                }
118    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
119    pub fn set_client_secret(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120                    self.inner = self.inner.set_client_secret(input);
121                    self
122                }
123    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
124    pub fn get_client_secret(&self) -> &::std::option::Option<::std::string::String> {
125                    self.inner.get_client_secret()
126                }
127    /// <p>Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values, depending on the grant type that you want:</p>
128    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
129    /// <p>* Refresh Token - <code>refresh_token</code></p>
130    /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
131    pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132                    self.inner = self.inner.grant_type(input.into());
133                    self
134                }
135    /// <p>Supports the following OAuth grant types: Device Code and Refresh Token. Specify either of the following values, depending on the grant type that you want:</p>
136    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
137    /// <p>* Refresh Token - <code>refresh_token</code></p>
138    /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</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: Device Code and Refresh Token. Specify either of the following values, depending on the grant type that you want:</p>
144    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
145    /// <p>* Refresh Token - <code>refresh_token</code></p>
146    /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
147    pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
148                    self.inner.get_grant_type()
149                }
150    /// <p>Used only when calling this API for the Device Code grant type. This short-term code is used to identify this authorization request. This comes from the result of the <code>StartDeviceAuthorization</code> API.</p>
151    pub fn device_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
152                    self.inner = self.inner.device_code(input.into());
153                    self
154                }
155    /// <p>Used only when calling this API for the Device Code grant type. This short-term code is used to identify this authorization request. This comes from the result of the <code>StartDeviceAuthorization</code> API.</p>
156    pub fn set_device_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
157                    self.inner = self.inner.set_device_code(input);
158                    self
159                }
160    /// <p>Used only when calling this API for the Device Code grant type. This short-term code is used to identify this authorization request. This comes from the result of the <code>StartDeviceAuthorization</code> API.</p>
161    pub fn get_device_code(&self) -> &::std::option::Option<::std::string::String> {
162                    self.inner.get_device_code()
163                }
164    /// <p>Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify this authorization request. This grant type is currently unsupported for the <code>CreateToken</code> API.</p>
165    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166                    self.inner = self.inner.code(input.into());
167                    self
168                }
169    /// <p>Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify this authorization request. This grant type is currently unsupported for the <code>CreateToken</code> API.</p>
170    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171                    self.inner = self.inner.set_code(input);
172                    self
173                }
174    /// <p>Used only when calling this API for the Authorization Code grant type. The short-term code is used to identify this authorization request. This grant type is currently unsupported for the <code>CreateToken</code> API.</p>
175    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
176                    self.inner.get_code()
177                }
178    /// <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>
179    /// <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>
180    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
181                    self.inner = self.inner.refresh_token(input.into());
182                    self
183                }
184    /// <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>
185    /// <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>
186    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
187                    self.inner = self.inner.set_refresh_token(input);
188                    self
189                }
190    /// <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>
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 get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
193                    self.inner.get_refresh_token()
194                }
195    /// 
196    /// Appends an item to `scope`.
197    /// 
198    /// To override the contents of this collection use [`set_scope`](Self::set_scope).
199    /// 
200    /// <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>
201    pub fn scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202                        self.inner = self.inner.scope(input.into());
203                        self
204                    }
205    /// <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>
206    pub fn set_scope(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::string::String>>) -> Self {
207                    self.inner = self.inner.set_scope(input);
208                    self
209                }
210    /// <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>
211    pub fn get_scope(&self) -> &::std::option::Option<::std::vec::Vec::<::std::string::String>> {
212                    self.inner.get_scope()
213                }
214    /// <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>
215    pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
216                    self.inner = self.inner.redirect_uri(input.into());
217                    self
218                }
219    /// <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>
220    pub fn set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
221                    self.inner = self.inner.set_redirect_uri(input);
222                    self
223                }
224    /// <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>
225    pub fn get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
226                    self.inner.get_redirect_uri()
227                }
228    /// <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>
229    pub fn code_verifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
230                    self.inner = self.inner.code_verifier(input.into());
231                    self
232                }
233    /// <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>
234    pub fn set_code_verifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
235                    self.inner = self.inner.set_code_verifier(input);
236                    self
237                }
238    /// <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>
239    pub fn get_code_verifier(&self) -> &::std::option::Option<::std::string::String> {
240                    self.inner.get_code_verifier()
241                }
242}
243