aws_sdk_amplifyuibuilder/operation/refresh_token/
_refresh_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 RefreshTokenOutput {
6    /// <p>The access token.</p>
7    pub access_token: ::std::string::String,
8    /// <p>The date and time when the new access token expires.</p>
9    pub expires_in: i32,
10    _request_id: Option<String>,
11}
12impl RefreshTokenOutput {
13    /// <p>The access token.</p>
14    pub fn access_token(&self) -> &str {
15        use std::ops::Deref;
16        self.access_token.deref()
17    }
18    /// <p>The date and time when the new access token expires.</p>
19    pub fn expires_in(&self) -> i32 {
20        self.expires_in
21    }
22}
23impl ::std::fmt::Debug for RefreshTokenOutput {
24    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
25        let mut formatter = f.debug_struct("RefreshTokenOutput");
26        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
27        formatter.field("expires_in", &self.expires_in);
28        formatter.field("_request_id", &self._request_id);
29        formatter.finish()
30    }
31}
32impl ::aws_types::request_id::RequestId for RefreshTokenOutput {
33    fn request_id(&self) -> Option<&str> {
34        self._request_id.as_deref()
35    }
36}
37impl RefreshTokenOutput {
38    /// Creates a new builder-style object to manufacture [`RefreshTokenOutput`](crate::operation::refresh_token::RefreshTokenOutput).
39    pub fn builder() -> crate::operation::refresh_token::builders::RefreshTokenOutputBuilder {
40        crate::operation::refresh_token::builders::RefreshTokenOutputBuilder::default()
41    }
42}
43
44/// A builder for [`RefreshTokenOutput`](crate::operation::refresh_token::RefreshTokenOutput).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
46#[non_exhaustive]
47pub struct RefreshTokenOutputBuilder {
48    pub(crate) access_token: ::std::option::Option<::std::string::String>,
49    pub(crate) expires_in: ::std::option::Option<i32>,
50    _request_id: Option<String>,
51}
52impl RefreshTokenOutputBuilder {
53    /// <p>The access token.</p>
54    /// This field is required.
55    pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.access_token = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The access token.</p>
60    pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.access_token = input;
62        self
63    }
64    /// <p>The access token.</p>
65    pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
66        &self.access_token
67    }
68    /// <p>The date and time when the new access token expires.</p>
69    /// This field is required.
70    pub fn expires_in(mut self, input: i32) -> Self {
71        self.expires_in = ::std::option::Option::Some(input);
72        self
73    }
74    /// <p>The date and time when the new access token expires.</p>
75    pub fn set_expires_in(mut self, input: ::std::option::Option<i32>) -> Self {
76        self.expires_in = input;
77        self
78    }
79    /// <p>The date and time when the new access token expires.</p>
80    pub fn get_expires_in(&self) -> &::std::option::Option<i32> {
81        &self.expires_in
82    }
83    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
84        self._request_id = Some(request_id.into());
85        self
86    }
87
88    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
89        self._request_id = request_id;
90        self
91    }
92    /// Consumes the builder and constructs a [`RefreshTokenOutput`](crate::operation::refresh_token::RefreshTokenOutput).
93    /// This method will fail if any of the following fields are not set:
94    /// - [`access_token`](crate::operation::refresh_token::builders::RefreshTokenOutputBuilder::access_token)
95    /// - [`expires_in`](crate::operation::refresh_token::builders::RefreshTokenOutputBuilder::expires_in)
96    pub fn build(
97        self,
98    ) -> ::std::result::Result<crate::operation::refresh_token::RefreshTokenOutput, ::aws_smithy_types::error::operation::BuildError> {
99        ::std::result::Result::Ok(crate::operation::refresh_token::RefreshTokenOutput {
100            access_token: self.access_token.ok_or_else(|| {
101                ::aws_smithy_types::error::operation::BuildError::missing_field(
102                    "access_token",
103                    "access_token was not specified but it is required when building RefreshTokenOutput",
104                )
105            })?,
106            expires_in: self.expires_in.ok_or_else(|| {
107                ::aws_smithy_types::error::operation::BuildError::missing_field(
108                    "expires_in",
109                    "expires_in was not specified but it is required when building RefreshTokenOutput",
110                )
111            })?,
112            _request_id: self._request_id,
113        })
114    }
115}
116impl ::std::fmt::Debug for RefreshTokenOutputBuilder {
117    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
118        let mut formatter = f.debug_struct("RefreshTokenOutputBuilder");
119        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
120        formatter.field("expires_in", &self.expires_in);
121        formatter.field("_request_id", &self._request_id);
122        formatter.finish()
123    }
124}