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}
56impl ::aws_types::request_id::RequestId for CreateTokenOutput {
57    fn request_id(&self) -> Option<&str> {
58        self._request_id.as_deref()
59    }
60}
61impl CreateTokenOutput {
62    /// Creates a new builder-style object to manufacture [`CreateTokenOutput`](crate::operation::create_token::CreateTokenOutput).
63    pub fn builder() -> crate::operation::create_token::builders::CreateTokenOutputBuilder {
64        crate::operation::create_token::builders::CreateTokenOutputBuilder::default()
65    }
66}
67
68/// A builder for [`CreateTokenOutput`](crate::operation::create_token::CreateTokenOutput).
69#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
70#[non_exhaustive]
71pub struct CreateTokenOutputBuilder {
72    pub(crate) access_token: ::std::option::Option<::std::string::String>,
73    pub(crate) token_type: ::std::option::Option<::std::string::String>,
74    pub(crate) expires_in: ::std::option::Option<i32>,
75    pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
76    pub(crate) id_token: ::std::option::Option<::std::string::String>,
77    _request_id: Option<String>,
78}
79impl CreateTokenOutputBuilder {
80    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
81    pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
82        self.access_token = ::std::option::Option::Some(input.into());
83        self
84    }
85    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
86    pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
87        self.access_token = input;
88        self
89    }
90    /// <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
91    pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
92        &self.access_token
93    }
94    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
95    pub fn token_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
96        self.token_type = ::std::option::Option::Some(input.into());
97        self
98    }
99    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
100    pub fn set_token_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
101        self.token_type = input;
102        self
103    }
104    /// <p>Used to notify the client that the returned token is an access token. The supported token type is <code>Bearer</code>.</p>
105    pub fn get_token_type(&self) -> &::std::option::Option<::std::string::String> {
106        &self.token_type
107    }
108    /// <p>Indicates the time in seconds when an access token will expire.</p>
109    pub fn expires_in(mut self, input: i32) -> Self {
110        self.expires_in = ::std::option::Option::Some(input);
111        self
112    }
113    /// <p>Indicates the time in seconds when an access token will expire.</p>
114    pub fn set_expires_in(mut self, input: ::std::option::Option<i32>) -> Self {
115        self.expires_in = input;
116        self
117    }
118    /// <p>Indicates the time in seconds when an access token will expire.</p>
119    pub fn get_expires_in(&self) -> &::std::option::Option<i32> {
120        &self.expires_in
121    }
122    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
123    /// <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>
124    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
125        self.refresh_token = ::std::option::Option::Some(input.into());
126        self
127    }
128    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
129    /// <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>
130    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131        self.refresh_token = input;
132        self
133    }
134    /// <p>A token that, if present, can be used to refresh a previously issued access token that might have expired.</p>
135    /// <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>
136    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
137        &self.refresh_token
138    }
139    /// <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>
140    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
141    pub fn id_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.id_token = ::std::option::Option::Some(input.into());
143        self
144    }
145    /// <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>
146    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
147    pub fn set_id_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
148        self.id_token = input;
149        self
150    }
151    /// <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>
152    /// <p>A JSON Web Token (JWT) that identifies who is associated with the issued access token.</p>
153    pub fn get_id_token(&self) -> &::std::option::Option<::std::string::String> {
154        &self.id_token
155    }
156    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
157        self._request_id = Some(request_id.into());
158        self
159    }
160
161    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
162        self._request_id = request_id;
163        self
164    }
165    /// Consumes the builder and constructs a [`CreateTokenOutput`](crate::operation::create_token::CreateTokenOutput).
166    pub fn build(self) -> crate::operation::create_token::CreateTokenOutput {
167        crate::operation::create_token::CreateTokenOutput {
168            access_token: self.access_token,
169            token_type: self.token_type,
170            expires_in: self.expires_in.unwrap_or_default(),
171            refresh_token: self.refresh_token,
172            id_token: self.id_token,
173            _request_id: self._request_id,
174        }
175    }
176}
177impl ::std::fmt::Debug for CreateTokenOutputBuilder {
178    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
179        let mut formatter = f.debug_struct("CreateTokenOutputBuilder");
180        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
181        formatter.field("token_type", &self.token_type);
182        formatter.field("expires_in", &self.expires_in);
183        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
184        formatter.field("id_token", &"*** Sensitive Data Redacted ***");
185        formatter.field("_request_id", &self._request_id);
186        formatter.finish()
187    }
188}