aws_sdk_sts/types/
_credentials.rs#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct Credentials {
pub access_key_id: ::std::string::String,
pub secret_access_key: ::std::string::String,
pub session_token: ::std::string::String,
pub expiration: ::aws_smithy_types::DateTime,
}
impl Credentials {
pub fn access_key_id(&self) -> &str {
use std::ops::Deref;
self.access_key_id.deref()
}
pub fn secret_access_key(&self) -> &str {
use std::ops::Deref;
self.secret_access_key.deref()
}
pub fn session_token(&self) -> &str {
use std::ops::Deref;
self.session_token.deref()
}
pub fn expiration(&self) -> &::aws_smithy_types::DateTime {
&self.expiration
}
}
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_key_id", &"*** Sensitive Data Redacted ***");
formatter.field("secret_access_key", &"*** Sensitive Data Redacted ***");
formatter.field("session_token", &"*** Sensitive Data Redacted ***");
formatter.field("expiration", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}
impl Credentials {
pub fn builder() -> crate::types::builders::CredentialsBuilder {
crate::types::builders::CredentialsBuilder::default()
}
}
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CredentialsBuilder {
pub(crate) access_key_id: ::std::option::Option<::std::string::String>,
pub(crate) secret_access_key: ::std::option::Option<::std::string::String>,
pub(crate) session_token: ::std::option::Option<::std::string::String>,
pub(crate) expiration: ::std::option::Option<::aws_smithy_types::DateTime>,
}
impl CredentialsBuilder {
pub fn access_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.access_key_id = ::std::option::Option::Some(input.into());
self
}
pub fn set_access_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.access_key_id = input;
self
}
pub fn get_access_key_id(&self) -> &::std::option::Option<::std::string::String> {
&self.access_key_id
}
pub fn secret_access_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.secret_access_key = ::std::option::Option::Some(input.into());
self
}
pub fn set_secret_access_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.secret_access_key = input;
self
}
pub fn get_secret_access_key(&self) -> &::std::option::Option<::std::string::String> {
&self.secret_access_key
}
pub fn session_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.session_token = ::std::option::Option::Some(input.into());
self
}
pub fn set_session_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.session_token = input;
self
}
pub fn get_session_token(&self) -> &::std::option::Option<::std::string::String> {
&self.session_token
}
pub fn expiration(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.expiration = ::std::option::Option::Some(input);
self
}
pub fn set_expiration(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.expiration = input;
self
}
pub fn get_expiration(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.expiration
}
pub fn build(self) -> ::std::result::Result<crate::types::Credentials, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Credentials {
access_key_id: self.access_key_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"access_key_id",
"access_key_id was not specified but it is required when building Credentials",
)
})?,
secret_access_key: self.secret_access_key.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"secret_access_key",
"secret_access_key was not specified but it is required when building Credentials",
)
})?,
session_token: self.session_token.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"session_token",
"session_token was not specified but it is required when building Credentials",
)
})?,
expiration: self.expiration.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"expiration",
"expiration was not specified but it is required when building Credentials",
)
})?,
})
}
}
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_key_id", &"*** Sensitive Data Redacted ***");
formatter.field("secret_access_key", &"*** Sensitive Data Redacted ***");
formatter.field("session_token", &"*** Sensitive Data Redacted ***");
formatter.field("expiration", &"*** Sensitive Data Redacted ***");
formatter.finish()
}
}