aws_sdk_ssooidc/operation/create_token/
_create_token_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct CreateTokenInput {
6    /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
7    pub client_id: ::std::option::Option<::std::string::String>,
8    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
9    pub client_secret: ::std::option::Option<::std::string::String>,
10    /// <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>
11    /// <p>* Authorization Code - <code>authorization_code</code></p>
12    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
13    /// <p>* Refresh Token - <code>refresh_token</code></p>
14    pub grant_type: ::std::option::Option<::std::string::String>,
15    /// <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>
16    pub device_code: ::std::option::Option<::std::string::String>,
17    /// <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>
18    pub code: ::std::option::Option<::std::string::String>,
19    /// <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>
20    /// <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>
21    pub refresh_token: ::std::option::Option<::std::string::String>,
22    /// <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>
23    pub scope: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
24    /// <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>
25    pub redirect_uri: ::std::option::Option<::std::string::String>,
26    /// <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>
27    pub code_verifier: ::std::option::Option<::std::string::String>,
28}
29impl CreateTokenInput {
30    /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
31    pub fn client_id(&self) -> ::std::option::Option<&str> {
32        self.client_id.as_deref()
33    }
34    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
35    pub fn client_secret(&self) -> ::std::option::Option<&str> {
36        self.client_secret.as_deref()
37    }
38    /// <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>
39    /// <p>* Authorization Code - <code>authorization_code</code></p>
40    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
41    /// <p>* Refresh Token - <code>refresh_token</code></p>
42    pub fn grant_type(&self) -> ::std::option::Option<&str> {
43        self.grant_type.as_deref()
44    }
45    /// <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>
46    pub fn device_code(&self) -> ::std::option::Option<&str> {
47        self.device_code.as_deref()
48    }
49    /// <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>
50    pub fn code(&self) -> ::std::option::Option<&str> {
51        self.code.as_deref()
52    }
53    /// <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>
54    /// <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>
55    pub fn refresh_token(&self) -> ::std::option::Option<&str> {
56        self.refresh_token.as_deref()
57    }
58    /// <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>
59    ///
60    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.scope.is_none()`.
61    pub fn scope(&self) -> &[::std::string::String] {
62        self.scope.as_deref().unwrap_or_default()
63    }
64    /// <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>
65    pub fn redirect_uri(&self) -> ::std::option::Option<&str> {
66        self.redirect_uri.as_deref()
67    }
68    /// <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>
69    pub fn code_verifier(&self) -> ::std::option::Option<&str> {
70        self.code_verifier.as_deref()
71    }
72}
73impl ::std::fmt::Debug for CreateTokenInput {
74    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
75        let mut formatter = f.debug_struct("CreateTokenInput");
76        formatter.field("client_id", &self.client_id);
77        formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
78        formatter.field("grant_type", &self.grant_type);
79        formatter.field("device_code", &self.device_code);
80        formatter.field("code", &self.code);
81        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
82        formatter.field("scope", &self.scope);
83        formatter.field("redirect_uri", &self.redirect_uri);
84        formatter.field("code_verifier", &"*** Sensitive Data Redacted ***");
85        formatter.finish()
86    }
87}
88impl CreateTokenInput {
89    /// Creates a new builder-style object to manufacture [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
90    pub fn builder() -> crate::operation::create_token::builders::CreateTokenInputBuilder {
91        crate::operation::create_token::builders::CreateTokenInputBuilder::default()
92    }
93}
94
95/// A builder for [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
96#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
97#[non_exhaustive]
98pub struct CreateTokenInputBuilder {
99    pub(crate) client_id: ::std::option::Option<::std::string::String>,
100    pub(crate) client_secret: ::std::option::Option<::std::string::String>,
101    pub(crate) grant_type: ::std::option::Option<::std::string::String>,
102    pub(crate) device_code: ::std::option::Option<::std::string::String>,
103    pub(crate) code: ::std::option::Option<::std::string::String>,
104    pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
105    pub(crate) scope: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
106    pub(crate) redirect_uri: ::std::option::Option<::std::string::String>,
107    pub(crate) code_verifier: ::std::option::Option<::std::string::String>,
108}
109impl CreateTokenInputBuilder {
110    /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
111    /// This field is required.
112    pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.client_id = ::std::option::Option::Some(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.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.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    /// This field is required.
127    pub fn client_secret(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.client_secret = ::std::option::Option::Some(input.into());
129        self
130    }
131    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
132    pub fn set_client_secret(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.client_secret = input;
134        self
135    }
136    /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
137    pub fn get_client_secret(&self) -> &::std::option::Option<::std::string::String> {
138        &self.client_secret
139    }
140    /// <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>
141    /// <p>* Authorization Code - <code>authorization_code</code></p>
142    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
143    /// <p>* Refresh Token - <code>refresh_token</code></p>
144    /// This field is required.
145    pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.grant_type = ::std::option::Option::Some(input.into());
147        self
148    }
149    /// <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>
150    /// <p>* Authorization Code - <code>authorization_code</code></p>
151    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
152    /// <p>* Refresh Token - <code>refresh_token</code></p>
153    pub fn set_grant_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154        self.grant_type = input;
155        self
156    }
157    /// <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>
158    /// <p>* Authorization Code - <code>authorization_code</code></p>
159    /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
160    /// <p>* Refresh Token - <code>refresh_token</code></p>
161    pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
162        &self.grant_type
163    }
164    /// <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>
165    pub fn device_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
166        self.device_code = ::std::option::Option::Some(input.into());
167        self
168    }
169    /// <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>
170    pub fn set_device_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
171        self.device_code = input;
172        self
173    }
174    /// <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>
175    pub fn get_device_code(&self) -> &::std::option::Option<::std::string::String> {
176        &self.device_code
177    }
178    /// <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>
179    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
180        self.code = ::std::option::Option::Some(input.into());
181        self
182    }
183    /// <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>
184    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
185        self.code = input;
186        self
187    }
188    /// <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>
189    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
190        &self.code
191    }
192    /// <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>
193    /// <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>
194    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
195        self.refresh_token = ::std::option::Option::Some(input.into());
196        self
197    }
198    /// <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>
199    /// <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>
200    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
201        self.refresh_token = input;
202        self
203    }
204    /// <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>
205    /// <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>
206    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
207        &self.refresh_token
208    }
209    /// Appends an item to `scope`.
210    ///
211    /// To override the contents of this collection use [`set_scope`](Self::set_scope).
212    ///
213    /// <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>
214    pub fn scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
215        let mut v = self.scope.unwrap_or_default();
216        v.push(input.into());
217        self.scope = ::std::option::Option::Some(v);
218        self
219    }
220    /// <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>
221    pub fn set_scope(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
222        self.scope = input;
223        self
224    }
225    /// <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>
226    pub fn get_scope(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
227        &self.scope
228    }
229    /// <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>
230    pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
231        self.redirect_uri = ::std::option::Option::Some(input.into());
232        self
233    }
234    /// <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>
235    pub fn set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
236        self.redirect_uri = input;
237        self
238    }
239    /// <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>
240    pub fn get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
241        &self.redirect_uri
242    }
243    /// <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>
244    pub fn code_verifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
245        self.code_verifier = ::std::option::Option::Some(input.into());
246        self
247    }
248    /// <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>
249    pub fn set_code_verifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
250        self.code_verifier = input;
251        self
252    }
253    /// <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>
254    pub fn get_code_verifier(&self) -> &::std::option::Option<::std::string::String> {
255        &self.code_verifier
256    }
257    /// Consumes the builder and constructs a [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
258    pub fn build(self) -> ::std::result::Result<crate::operation::create_token::CreateTokenInput, ::aws_smithy_types::error::operation::BuildError> {
259        ::std::result::Result::Ok(crate::operation::create_token::CreateTokenInput {
260            client_id: self.client_id,
261            client_secret: self.client_secret,
262            grant_type: self.grant_type,
263            device_code: self.device_code,
264            code: self.code,
265            refresh_token: self.refresh_token,
266            scope: self.scope,
267            redirect_uri: self.redirect_uri,
268            code_verifier: self.code_verifier,
269        })
270    }
271}
272impl ::std::fmt::Debug for CreateTokenInputBuilder {
273    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
274        let mut formatter = f.debug_struct("CreateTokenInputBuilder");
275        formatter.field("client_id", &self.client_id);
276        formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
277        formatter.field("grant_type", &self.grant_type);
278        formatter.field("device_code", &self.device_code);
279        formatter.field("code", &self.code);
280        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
281        formatter.field("scope", &self.scope);
282        formatter.field("redirect_uri", &self.redirect_uri);
283        formatter.field("code_verifier", &"*** Sensitive Data Redacted ***");
284        formatter.finish()
285    }
286}