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: Device Code and Refresh Token. Specify either of the following values, depending on the grant type that you want:</p>
11 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
12 /// <p>* Refresh Token - <code>refresh_token</code></p>
13 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</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-term 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-term code is used to identify this authorization request. This grant type is currently unsupported for the <code>CreateToken</code> API.</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-term 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: Device Code and Refresh Token. Specify either of the following values, depending on the grant type that you want:</p>
39 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
40 /// <p>* Refresh Token - <code>refresh_token</code></p>
41 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</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-term 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-term code is used to identify this authorization request. This grant type is currently unsupported for the <code>CreateToken</code> API.</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-term 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()
63 .unwrap_or_default()
64 }
65 /// <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>
66 pub fn redirect_uri(&self) -> ::std::option::Option<&str> {
67 self.redirect_uri.as_deref()
68 }
69 /// <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>
70 pub fn code_verifier(&self) -> ::std::option::Option<&str> {
71 self.code_verifier.as_deref()
72 }
73}
74impl ::std::fmt::Debug for CreateTokenInput {
75 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
76 let mut formatter = f.debug_struct("CreateTokenInput");
77 formatter.field("client_id", &self.client_id);
78 formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
79 formatter.field("grant_type", &self.grant_type);
80 formatter.field("device_code", &self.device_code);
81 formatter.field("code", &self.code);
82 formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
83 formatter.field("scope", &self.scope);
84 formatter.field("redirect_uri", &self.redirect_uri);
85 formatter.field("code_verifier", &"*** Sensitive Data Redacted ***");
86 formatter.finish()
87 }
88}
89impl CreateTokenInput {
90 /// Creates a new builder-style object to manufacture [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
91 pub fn builder() -> crate::operation::create_token::builders::CreateTokenInputBuilder {
92 crate::operation::create_token::builders::CreateTokenInputBuilder::default()
93 }
94}
95
96/// A builder for [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
97#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
98#[non_exhaustive]
99pub struct CreateTokenInputBuilder {
100 pub(crate) client_id: ::std::option::Option<::std::string::String>,
101 pub(crate) client_secret: ::std::option::Option<::std::string::String>,
102 pub(crate) grant_type: ::std::option::Option<::std::string::String>,
103 pub(crate) device_code: ::std::option::Option<::std::string::String>,
104 pub(crate) code: ::std::option::Option<::std::string::String>,
105 pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
106 pub(crate) scope: ::std::option::Option<::std::vec::Vec::<::std::string::String>>,
107 pub(crate) redirect_uri: ::std::option::Option<::std::string::String>,
108 pub(crate) code_verifier: ::std::option::Option<::std::string::String>,
109}
110impl CreateTokenInputBuilder {
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 /// This field is required.
113 pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.client_id = ::std::option::Option::Some(input.into());
115 self
116 }
117 /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
118 pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.client_id = input; 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; 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.client_secret
138 }
139 /// <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>
140 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
141 /// <p>* Refresh Token - <code>refresh_token</code></p>
142 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
143 /// This field is required.
144 pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145 self.grant_type = ::std::option::Option::Some(input.into());
146 self
147 }
148 /// <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>
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 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
152 pub fn set_grant_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153 self.grant_type = input; self
154 }
155 /// <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>
156 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
157 /// <p>* Refresh Token - <code>refresh_token</code></p>
158 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
159 pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
160 &self.grant_type
161 }
162 /// <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>
163 pub fn device_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
164 self.device_code = ::std::option::Option::Some(input.into());
165 self
166 }
167 /// <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>
168 pub fn set_device_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169 self.device_code = input; self
170 }
171 /// <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>
172 pub fn get_device_code(&self) -> &::std::option::Option<::std::string::String> {
173 &self.device_code
174 }
175 /// <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>
176 pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177 self.code = ::std::option::Option::Some(input.into());
178 self
179 }
180 /// <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>
181 pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.code = input; self
183 }
184 /// <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>
185 pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
186 &self.code
187 }
188 /// <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>
189 /// <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>
190 pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191 self.refresh_token = ::std::option::Option::Some(input.into());
192 self
193 }
194 /// <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>
195 /// <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>
196 pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197 self.refresh_token = input; self
198 }
199 /// <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>
200 /// <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>
201 pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
202 &self.refresh_token
203 }
204 /// Appends an item to `scope`.
205 ///
206 /// To override the contents of this collection use [`set_scope`](Self::set_scope).
207 ///
208 /// <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>
209 pub fn scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
210 let mut v = self.scope.unwrap_or_default();
211 v.push(input.into());
212 self.scope = ::std::option::Option::Some(v);
213 self
214 }
215 /// <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>
216 pub fn set_scope(mut self, input: ::std::option::Option<::std::vec::Vec::<::std::string::String>>) -> Self {
217 self.scope = input; self
218 }
219 /// <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>
220 pub fn get_scope(&self) -> &::std::option::Option<::std::vec::Vec::<::std::string::String>> {
221 &self.scope
222 }
223 /// <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>
224 pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
225 self.redirect_uri = ::std::option::Option::Some(input.into());
226 self
227 }
228 /// <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>
229 pub fn set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
230 self.redirect_uri = input; self
231 }
232 /// <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>
233 pub fn get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
234 &self.redirect_uri
235 }
236 /// <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>
237 pub fn code_verifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
238 self.code_verifier = ::std::option::Option::Some(input.into());
239 self
240 }
241 /// <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>
242 pub fn set_code_verifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
243 self.code_verifier = input; 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 get_code_verifier(&self) -> &::std::option::Option<::std::string::String> {
247 &self.code_verifier
248 }
249 /// Consumes the builder and constructs a [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
250 pub fn build(self) -> ::std::result::Result<crate::operation::create_token::CreateTokenInput, ::aws_smithy_types::error::operation::BuildError> {
251 ::std::result::Result::Ok(
252 crate::operation::create_token::CreateTokenInput {
253 client_id: self.client_id
254 ,
255 client_secret: self.client_secret
256 ,
257 grant_type: self.grant_type
258 ,
259 device_code: self.device_code
260 ,
261 code: self.code
262 ,
263 refresh_token: self.refresh_token
264 ,
265 scope: self.scope
266 ,
267 redirect_uri: self.redirect_uri
268 ,
269 code_verifier: self.code_verifier
270 ,
271 }
272 )
273 }
274}
275impl ::std::fmt::Debug for CreateTokenInputBuilder {
276 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
277 let mut formatter = f.debug_struct("CreateTokenInputBuilder");
278 formatter.field("client_id", &self.client_id);
279 formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
280 formatter.field("grant_type", &self.grant_type);
281 formatter.field("device_code", &self.device_code);
282 formatter.field("code", &self.code);
283 formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
284 formatter.field("scope", &self.scope);
285 formatter.field("redirect_uri", &self.redirect_uri);
286 formatter.field("code_verifier", &"*** Sensitive Data Redacted ***");
287 formatter.finish()
288 }
289}
290