aws-sdk-connect 1.172.0

AWS SDK for Amazon Connect Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains credentials to use for federation.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Credentials {
    /// <p>An access token generated for a federated user to access Amazon Connect.</p>
    pub access_token: ::std::option::Option<::std::string::String>,
    /// <p>A token generated with an expiration time for the session a user is logged in to Amazon Connect.</p>
    pub access_token_expiration: ::std::option::Option<::aws_smithy_types::DateTime>,
    /// <p>Renews a token generated for a user to access the Amazon Connect instance.</p>
    pub refresh_token: ::std::option::Option<::std::string::String>,
    /// <p>Renews the expiration timer for a generated token.</p>
    pub refresh_token_expiration: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl Credentials {
    /// <p>An access token generated for a federated user to access Amazon Connect.</p>
    pub fn access_token(&self) -> ::std::option::Option<&str> {
        self.access_token.as_deref()
    }
    /// <p>A token generated with an expiration time for the session a user is logged in to Amazon Connect.</p>
    pub fn access_token_expiration(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.access_token_expiration.as_ref()
    }
    /// <p>Renews a token generated for a user to access the Amazon Connect instance.</p>
    pub fn refresh_token(&self) -> ::std::option::Option<&str> {
        self.refresh_token.as_deref()
    }
    /// <p>Renews the expiration timer for a generated token.</p>
    pub fn refresh_token_expiration(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
        self.refresh_token_expiration.as_ref()
    }
}
impl ::std::fmt::Debug for Credentials {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("Credentials");
        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
        formatter.field("access_token_expiration", &"*** Sensitive Data Redacted ***");
        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
        formatter.field("refresh_token_expiration", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}
impl Credentials {
    /// Creates a new builder-style object to manufacture [`Credentials`](crate::types::Credentials).
    pub fn builder() -> crate::types::builders::CredentialsBuilder {
        crate::types::builders::CredentialsBuilder::default()
    }
}

/// A builder for [`Credentials`](crate::types::Credentials).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CredentialsBuilder {
    pub(crate) access_token: ::std::option::Option<::std::string::String>,
    pub(crate) access_token_expiration: ::std::option::Option<::aws_smithy_types::DateTime>,
    pub(crate) refresh_token: ::std::option::Option<::std::string::String>,
    pub(crate) refresh_token_expiration: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl CredentialsBuilder {
    /// <p>An access token generated for a federated user to access Amazon Connect.</p>
    pub fn access_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.access_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>An access token generated for a federated user to access Amazon Connect.</p>
    pub fn set_access_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.access_token = input;
        self
    }
    /// <p>An access token generated for a federated user to access Amazon Connect.</p>
    pub fn get_access_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.access_token
    }
    /// <p>A token generated with an expiration time for the session a user is logged in to Amazon Connect.</p>
    pub fn access_token_expiration(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.access_token_expiration = ::std::option::Option::Some(input);
        self
    }
    /// <p>A token generated with an expiration time for the session a user is logged in to Amazon Connect.</p>
    pub fn set_access_token_expiration(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.access_token_expiration = input;
        self
    }
    /// <p>A token generated with an expiration time for the session a user is logged in to Amazon Connect.</p>
    pub fn get_access_token_expiration(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.access_token_expiration
    }
    /// <p>Renews a token generated for a user to access the Amazon Connect instance.</p>
    pub fn refresh_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.refresh_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Renews a token generated for a user to access the Amazon Connect instance.</p>
    pub fn set_refresh_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.refresh_token = input;
        self
    }
    /// <p>Renews a token generated for a user to access the Amazon Connect instance.</p>
    pub fn get_refresh_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.refresh_token
    }
    /// <p>Renews the expiration timer for a generated token.</p>
    pub fn refresh_token_expiration(mut self, input: ::aws_smithy_types::DateTime) -> Self {
        self.refresh_token_expiration = ::std::option::Option::Some(input);
        self
    }
    /// <p>Renews the expiration timer for a generated token.</p>
    pub fn set_refresh_token_expiration(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
        self.refresh_token_expiration = input;
        self
    }
    /// <p>Renews the expiration timer for a generated token.</p>
    pub fn get_refresh_token_expiration(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
        &self.refresh_token_expiration
    }
    /// Consumes the builder and constructs a [`Credentials`](crate::types::Credentials).
    pub fn build(self) -> crate::types::Credentials {
        crate::types::Credentials {
            access_token: self.access_token,
            access_token_expiration: self.access_token_expiration,
            refresh_token: self.refresh_token,
            refresh_token_expiration: self.refresh_token_expiration,
        }
    }
}
impl ::std::fmt::Debug for CredentialsBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CredentialsBuilder");
        formatter.field("access_token", &"*** Sensitive Data Redacted ***");
        formatter.field("access_token_expiration", &"*** Sensitive Data Redacted ***");
        formatter.field("refresh_token", &"*** Sensitive Data Redacted ***");
        formatter.field("refresh_token_expiration", &"*** Sensitive Data Redacted ***");
        formatter.finish()
    }
}