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}
27impl CreateTokenInput {
28 /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
29 pub fn client_id(&self) -> ::std::option::Option<&str> {
30 self.client_id.as_deref()
31 }
32 /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
33 pub fn client_secret(&self) -> ::std::option::Option<&str> {
34 self.client_secret.as_deref()
35 }
36 /// <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>
37 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
38 /// <p>* Refresh Token - <code>refresh_token</code></p>
39 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
40 pub fn grant_type(&self) -> ::std::option::Option<&str> {
41 self.grant_type.as_deref()
42 }
43 /// <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>
44 pub fn device_code(&self) -> ::std::option::Option<&str> {
45 self.device_code.as_deref()
46 }
47 /// <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>
48 pub fn code(&self) -> ::std::option::Option<&str> {
49 self.code.as_deref()
50 }
51 /// <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>
52 /// <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>
53 pub fn refresh_token(&self) -> ::std::option::Option<&str> {
54 self.refresh_token.as_deref()
55 }
56 /// <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>
57 ///
58 /// 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()`.
59 pub fn scope(&self) -> &[::std::string::String] {
60 self.scope.as_deref().unwrap_or_default()
61 }
62 /// <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>
63 pub fn redirect_uri(&self) -> ::std::option::Option<&str> {
64 self.redirect_uri.as_deref()
65 }
66}
67impl ::std::fmt::Debug for CreateTokenInput {
68 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
69 let mut formatter = f.debug_struct("CreateTokenInput");
70 formatter.field("client_id", &self.client_id);
71 formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
72 formatter.field("grant_type", &self.grant_type);
73 formatter.field("device_code", &self.device_code);
74 formatter.field("code", &self.code);
75 formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
76 formatter.field("scope", &self.scope);
77 formatter.field("redirect_uri", &self.redirect_uri);
78 formatter.finish()
79 }
80}
81impl CreateTokenInput {
82 /// Creates a new builder-style object to manufacture [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
83 pub fn builder() -> crate::operation::create_token::builders::CreateTokenInputBuilder {
84 crate::operation::create_token::builders::CreateTokenInputBuilder::default()
85 }
86}
87
88/// A builder for [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
89#[non_exhaustive]
90#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
91pub struct CreateTokenInputBuilder {
92 pub(crate) client_id: ::std::option::Option<::std::string::String>,
93 pub(crate) client_secret: ::std::option::Option<::std::string::String>,
94 pub(crate) grant_type: ::std::option::Option<::std::string::String>,
95 pub(crate) device_code: ::std::option::Option<::std::string::String>,
96 pub(crate) code: ::std::option::Option<::std::string::String>,
97 pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
98 pub(crate) scope: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
99 pub(crate) redirect_uri: ::std::option::Option<::std::string::String>,
100}
101impl CreateTokenInputBuilder {
102 /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
103 /// This field is required.
104 pub fn client_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105 self.client_id = ::std::option::Option::Some(input.into());
106 self
107 }
108 /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
109 pub fn set_client_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110 self.client_id = input;
111 self
112 }
113 /// <p>The unique identifier string for the client or application. This value comes from the result of the <code>RegisterClient</code> API.</p>
114 pub fn get_client_id(&self) -> &::std::option::Option<::std::string::String> {
115 &self.client_id
116 }
117 /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
118 /// This field is required.
119 pub fn client_secret(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.client_secret = ::std::option::Option::Some(input.into());
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 set_client_secret(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125 self.client_secret = input;
126 self
127 }
128 /// <p>A secret string generated for the client. This value should come from the persisted result of the <code>RegisterClient</code> API.</p>
129 pub fn get_client_secret(&self) -> &::std::option::Option<::std::string::String> {
130 &self.client_secret
131 }
132 /// <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>
133 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
134 /// <p>* Refresh Token - <code>refresh_token</code></p>
135 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
136 /// This field is required.
137 pub fn grant_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138 self.grant_type = ::std::option::Option::Some(input.into());
139 self
140 }
141 /// <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>
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 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
145 pub fn set_grant_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146 self.grant_type = input;
147 self
148 }
149 /// <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>
150 /// <p>* Device Code - <code>urn:ietf:params:oauth:grant-type:device_code</code></p>
151 /// <p>* Refresh Token - <code>refresh_token</code></p>
152 /// <p>For information about how to obtain the device code, see the <code>StartDeviceAuthorization</code> topic.</p>
153 pub fn get_grant_type(&self) -> &::std::option::Option<::std::string::String> {
154 &self.grant_type
155 }
156 /// <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>
157 pub fn device_code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 self.device_code = ::std::option::Option::Some(input.into());
159 self
160 }
161 /// <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>
162 pub fn set_device_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163 self.device_code = input;
164 self
165 }
166 /// <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>
167 pub fn get_device_code(&self) -> &::std::option::Option<::std::string::String> {
168 &self.device_code
169 }
170 /// <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>
171 pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
172 self.code = ::std::option::Option::Some(input.into());
173 self
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 set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
177 self.code = input;
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 get_code(&self) -> &::std::option::Option<::std::string::String> {
182 &self.code
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 refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
187 self.refresh_token = ::std::option::Option::Some(input.into());
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 set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193 self.refresh_token = input;
194 self
195 }
196 /// <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>
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 get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
199 &self.refresh_token
200 }
201 /// Appends an item to `scope`.
202 ///
203 /// To override the contents of this collection use [`set_scope`](Self::set_scope).
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 scope(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
207 let mut v = self.scope.unwrap_or_default();
208 v.push(input.into());
209 self.scope = ::std::option::Option::Some(v);
210 self
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 set_scope(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
214 self.scope = input;
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 get_scope(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
219 &self.scope
220 }
221 /// <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>
222 pub fn redirect_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
223 self.redirect_uri = ::std::option::Option::Some(input.into());
224 self
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 set_redirect_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
228 self.redirect_uri = input;
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 get_redirect_uri(&self) -> &::std::option::Option<::std::string::String> {
233 &self.redirect_uri
234 }
235 /// Consumes the builder and constructs a [`CreateTokenInput`](crate::operation::create_token::CreateTokenInput).
236 pub fn build(self) -> ::std::result::Result<crate::operation::create_token::CreateTokenInput, ::aws_smithy_types::error::operation::BuildError> {
237 ::std::result::Result::Ok(crate::operation::create_token::CreateTokenInput {
238 client_id: self.client_id,
239 client_secret: self.client_secret,
240 grant_type: self.grant_type,
241 device_code: self.device_code,
242 code: self.code,
243 refresh_token: self.refresh_token,
244 scope: self.scope,
245 redirect_uri: self.redirect_uri,
246 })
247 }
248}
249impl ::std::fmt::Debug for CreateTokenInputBuilder {
250 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
251 let mut formatter = f.debug_struct("CreateTokenInputBuilder");
252 formatter.field("client_id", &self.client_id);
253 formatter.field("client_secret", &"*** Sensitive Data Redacted ***");
254 formatter.field("grant_type", &self.grant_type);
255 formatter.field("device_code", &self.device_code);
256 formatter.field("code", &self.code);
257 formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
258 formatter.field("scope", &self.scope);
259 formatter.field("redirect_uri", &self.redirect_uri);
260 formatter.finish()
261 }
262}