aws_sdk_ssooidc/operation/create_token/
_create_token_output.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 CreateTokenOutput  {
6    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
7    pub access_token: ::std::option::Option<::std::string::String>,
8    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
9    pub token_type: ::std::option::Option<::std::string::String>,
10    /// <p>Indicates the time in seconds when an access token will expire.</p>
11    pub expires_in: i32,
12    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
13    /// <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>
14    pub refresh_token: ::std::option::Option<::std::string::String>,
15    /// <p>The <code>idToken</code> is not implemented or supported. 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>
16    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
17    pub id_token: ::std::option::Option<::std::string::String>,
18    _request_id: Option<String>,
19}
20impl  CreateTokenOutput  {
21    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
22    pub fn access_token(&self) -> ::std::option::Option<&str> {
23        self.access_token.as_deref()
24    }
25    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
26    pub fn token_type(&self) -> ::std::option::Option<&str> {
27        self.token_type.as_deref()
28    }
29    /// <p>Indicates the time in seconds when an access token will expire.</p>
30    pub fn expires_in(&self) -> i32 {
31        self.expires_in
32    }
33    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
34    /// <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>
35    pub fn refresh_token(&self) -> ::std::option::Option<&str> {
36        self.refresh_token.as_deref()
37    }
38    /// <p>The <code>idToken</code> is not implemented or supported. 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>
39    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
40    pub fn id_token(&self) -> ::std::option::Option<&str> {
41        self.id_token.as_deref()
42    }
43}
44impl  ::std::fmt::Debug for CreateTokenOutput  {
45    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
46        let mut formatter = f.debug_struct("CreateTokenOutput");
47        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
48        formatter.field("token_type", &self.token_type);
49        formatter.field("expires_in", &self.expires_in);
50        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
51        formatter.field("id_token", &"*** Sensitive Data Redacted ***");
52        formatter.field("_request_id", &self._request_id);
53        formatter.finish()
54    }
55}
56static CREATETOKENOUTPUT_SCHEMA_ID: ::aws_smithy_schema::ShapeId = ::aws_smithy_schema::ShapeId::from_static("com.amazonaws.ssooidc.synthetic#CreateTokenOutput", "com.amazonaws.ssooidc.synthetic", "CreateTokenOutput");
57static CREATETOKENOUTPUT_MEMBER_ACCESS_TOKEN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
58                            ::aws_smithy_schema::ShapeId::from_static(
59                                "com.amazonaws.ssooidc.synthetic#CreateTokenOutput$accessToken",
60                                "com.amazonaws.ssooidc.synthetic",
61                                "CreateTokenOutput",
62                            ),
63                            ::aws_smithy_schema::ShapeType::String,
64                            "accessToken",
65                            0,
66                        );
67static CREATETOKENOUTPUT_MEMBER_TOKEN_TYPE: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
68                            ::aws_smithy_schema::ShapeId::from_static(
69                                "com.amazonaws.ssooidc.synthetic#CreateTokenOutput$tokenType",
70                                "com.amazonaws.ssooidc.synthetic",
71                                "CreateTokenOutput",
72                            ),
73                            ::aws_smithy_schema::ShapeType::String,
74                            "tokenType",
75                            1,
76                        );
77static CREATETOKENOUTPUT_MEMBER_EXPIRES_IN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
78                            ::aws_smithy_schema::ShapeId::from_static(
79                                "com.amazonaws.ssooidc.synthetic#CreateTokenOutput$expiresIn",
80                                "com.amazonaws.ssooidc.synthetic",
81                                "CreateTokenOutput",
82                            ),
83                            ::aws_smithy_schema::ShapeType::Integer,
84                            "expiresIn",
85                            2,
86                        );
87static CREATETOKENOUTPUT_MEMBER_REFRESH_TOKEN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
88                            ::aws_smithy_schema::ShapeId::from_static(
89                                "com.amazonaws.ssooidc.synthetic#CreateTokenOutput$refreshToken",
90                                "com.amazonaws.ssooidc.synthetic",
91                                "CreateTokenOutput",
92                            ),
93                            ::aws_smithy_schema::ShapeType::String,
94                            "refreshToken",
95                            3,
96                        );
97static CREATETOKENOUTPUT_MEMBER_ID_TOKEN: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
98                            ::aws_smithy_schema::ShapeId::from_static(
99                                "com.amazonaws.ssooidc.synthetic#CreateTokenOutput$idToken",
100                                "com.amazonaws.ssooidc.synthetic",
101                                "CreateTokenOutput",
102                            ),
103                            ::aws_smithy_schema::ShapeType::String,
104                            "idToken",
105                            4,
106                        );
107static CREATETOKENOUTPUT_MEMBER__REQUEST_ID: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_member(
108                            ::aws_smithy_schema::ShapeId::from_static(
109                                "synthetic#request_id",
110                                "synthetic",
111                                "request_id",
112                            ),
113                            ::aws_smithy_schema::ShapeType::String,
114                            "request_id",
115                            5,
116                        ).with_http_header("x-amzn-requestid");
117static CREATETOKENOUTPUT_SCHEMA: ::aws_smithy_schema::Schema = ::aws_smithy_schema::Schema::new_struct(
118                            CREATETOKENOUTPUT_SCHEMA_ID,
119                            ::aws_smithy_schema::ShapeType::Structure,
120                            &[&CREATETOKENOUTPUT_MEMBER_ACCESS_TOKEN, &CREATETOKENOUTPUT_MEMBER_TOKEN_TYPE, &CREATETOKENOUTPUT_MEMBER_EXPIRES_IN, &CREATETOKENOUTPUT_MEMBER_REFRESH_TOKEN, &CREATETOKENOUTPUT_MEMBER_ID_TOKEN, &CREATETOKENOUTPUT_MEMBER__REQUEST_ID],
121                        );
122impl CreateTokenOutput {
123                /// The schema for this shape.
124                pub const SCHEMA: &'static ::aws_smithy_schema::Schema = &CREATETOKENOUTPUT_SCHEMA;
125            }
126impl ::aws_smithy_schema::serde::SerializableStruct for CreateTokenOutput {
127                #[allow(unused_variables, clippy::diverging_sub_expression)]
128                fn serialize_members(&self, ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
129                    if let Some(ref val) = self.access_token {
130                                ser.write_string(&CREATETOKENOUTPUT_MEMBER_ACCESS_TOKEN, val)?;
131                            }
132if let Some(ref val) = self.token_type {
133                                ser.write_string(&CREATETOKENOUTPUT_MEMBER_TOKEN_TYPE, val)?;
134                            }
135{
136                                let val = &self.expires_in;
137                                ser.write_integer(&CREATETOKENOUTPUT_MEMBER_EXPIRES_IN, *val)?;
138                            }
139if let Some(ref val) = self.refresh_token {
140                                ser.write_string(&CREATETOKENOUTPUT_MEMBER_REFRESH_TOKEN, val)?;
141                            }
142if let Some(ref val) = self.id_token {
143                                ser.write_string(&CREATETOKENOUTPUT_MEMBER_ID_TOKEN, val)?;
144                            }
145                    Ok(())
146                }
147            }
148impl CreateTokenOutput {
149                /// Deserializes this structure from a [`ShapeDeserializer`].
150                pub fn deserialize(deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
151                    #[allow(unused_variables, unused_mut)]
152                    let mut builder = Self::builder();
153                    #[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
154                    deserializer.read_struct(&CREATETOKENOUTPUT_SCHEMA, &mut |member, deser| {
155                        match member.member_index() {
156                            Some(0) => {
157                                    builder.access_token = Some(deser.read_string(member)?);
158                                }
159Some(1) => {
160                                    builder.token_type = Some(deser.read_string(member)?);
161                                }
162Some(2) => { builder.expires_in = Some(deser.read_integer(member)?); }
163Some(3) => {
164                                    builder.refresh_token = Some(deser.read_string(member)?);
165                                }
166Some(4) => {
167                                    builder.id_token = Some(deser.read_string(member)?);
168                                }
169Some(5) => {
170                                builder._request_id = Some(deser.read_string(member)?);
171                            }
172                            _ => {}
173                        }
174                        Ok(())
175                    })?;
176                    Ok(builder.build())
177                }
178            }
179impl CreateTokenOutput {
180                /// Deserializes this structure from a body deserializer and HTTP response headers.
181                /// Header-bound members are read directly from headers, avoiding runtime
182                /// member iteration overhead. Body members are read via the deserializer.
183                pub fn deserialize_with_response(
184                    deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
185                    headers: &::aws_smithy_runtime_api::http::Headers,
186                    _status: u16,
187                    _body: &[u8],
188                ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
189                    #[allow(unused_variables, unused_mut)]
190                    let mut builder = Self::builder();
191if let Some(val) = headers.get("x-amzn-requestid") {
192                    builder._request_id = Some(val.to_string());
193                }
194#[allow(unused_variables, unreachable_code, clippy::single_match, clippy::match_single_binding, clippy::diverging_sub_expression)]
195                    deserializer.read_struct(&CREATETOKENOUTPUT_SCHEMA, &mut |member, deser| {
196                        match member.member_index() {
197                            Some(0) => { builder.access_token = Some(deser.read_string(member)?); }
198Some(1) => { builder.token_type = Some(deser.read_string(member)?); }
199Some(2) => { builder.expires_in = Some(deser.read_integer(member)?); }
200Some(3) => { builder.refresh_token = Some(deser.read_string(member)?); }
201Some(4) => { builder.id_token = Some(deser.read_string(member)?); }
202                            _ => {}
203                        }
204                        Ok(())
205                    })?;
206                    Ok(builder.build())
207                    }
208                    }
209impl ::aws_types::request_id::RequestId for CreateTokenOutput {
210                                    fn request_id(&self) -> Option<&str> {
211                                        self._request_id.as_deref()
212                                    }
213                                }
214impl CreateTokenOutput {
215    /// Creates a new builder-style object to manufacture [`CreateTokenOutput`](crate::operation::create_token::CreateTokenOutput).
216    pub fn builder() -> crate::operation::create_token::builders::CreateTokenOutputBuilder {
217        crate::operation::create_token::builders::CreateTokenOutputBuilder::default()
218    }
219}
220
221/// A builder for [`CreateTokenOutput`](crate::operation::create_token::CreateTokenOutput).
222#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
223#[non_exhaustive]
224pub struct CreateTokenOutputBuilder {
225    pub(crate) access_token: ::std::option::Option<::std::string::String>,
226    pub(crate) token_type: ::std::option::Option<::std::string::String>,
227    pub(crate) expires_in: ::std::option::Option<i32>,
228    pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
229    pub(crate) id_token: ::std::option::Option<::std::string::String>,
230    _request_id: Option<String>,
231}
232impl CreateTokenOutputBuilder {
233    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
234    pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
235        self.access_token = ::std::option::Option::Some(input.into());
236        self
237    }
238    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
239    pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
240        self.access_token = input; self
241    }
242    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
243    pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
244        &self.access_token
245    }
246    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
247    pub fn token_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
248        self.token_type = ::std::option::Option::Some(input.into());
249        self
250    }
251    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
252    pub fn set_token_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
253        self.token_type = input; self
254    }
255    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
256    pub fn get_token_type(&self) -> &::std::option::Option<::std::string::String> {
257        &self.token_type
258    }
259    /// <p>Indicates the time in seconds when an access token will expire.</p>
260    pub fn expires_in(mut self, input: i32) -> Self {
261        self.expires_in = ::std::option::Option::Some(input);
262        self
263    }
264    /// <p>Indicates the time in seconds when an access token will expire.</p>
265    pub fn set_expires_in(mut self, input: ::std::option::Option<i32>) -> Self {
266        self.expires_in = input; self
267    }
268    /// <p>Indicates the time in seconds when an access token will expire.</p>
269    pub fn get_expires_in(&self) -> &::std::option::Option<i32> {
270        &self.expires_in
271    }
272    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
273    /// <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>
274    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
275        self.refresh_token = ::std::option::Option::Some(input.into());
276        self
277    }
278    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
279    /// <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>
280    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
281        self.refresh_token = input; self
282    }
283    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
284    /// <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>
285    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
286        &self.refresh_token
287    }
288    /// <p>The <code>idToken</code> is not implemented or supported. 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>
289    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
290    pub fn id_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
291        self.id_token = ::std::option::Option::Some(input.into());
292        self
293    }
294    /// <p>The <code>idToken</code> is not implemented or supported. 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>
295    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
296    pub fn set_id_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
297        self.id_token = input; self
298    }
299    /// <p>The <code>idToken</code> is not implemented or supported. 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>
300    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
301    pub fn get_id_token(&self) -> &::std::option::Option<::std::string::String> {
302        &self.id_token
303    }
304    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
305                                        self._request_id = Some(request_id.into());
306                                        self
307                                    }
308    
309                                    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
310                                        self._request_id = request_id;
311                                        self
312                                    }
313    /// Consumes the builder and constructs a [`CreateTokenOutput`](crate::operation::create_token::CreateTokenOutput).
314    pub fn build(self) -> crate::operation::create_token::CreateTokenOutput {
315        crate::operation::create_token::CreateTokenOutput {
316            access_token: self.access_token
317            ,
318            token_type: self.token_type
319            ,
320            expires_in: self.expires_in
321                .unwrap_or_default()
322            ,
323            refresh_token: self.refresh_token
324            ,
325            id_token: self.id_token
326            ,
327            _request_id: self._request_id,
328        }
329    }
330}
331impl ::std::fmt::Debug for CreateTokenOutputBuilder {
332    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
333        let mut formatter = f.debug_struct("CreateTokenOutputBuilder");
334        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
335        formatter.field("token_type", &self.token_type);
336        formatter.field("expires_in", &self.expires_in);
337        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
338        formatter.field("id_token", &"*** Sensitive Data Redacted ***");
339        formatter.field("_request_id", &self._request_id);
340        formatter.finish()
341    }
342}
343