pub struct Credentials { /* private fields */ }Expand description
AWS-compatible credentials and optional expiration.
Secret values are zeroized on drop. Its Debug implementation redacts all
credential material, including the access-key identifier.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn new(
access_key_id: impl Into<String>,
secret_access_key: impl Into<String>,
session_token: Option<String>,
) -> Result<Self, S3Error>
pub fn new( access_key_id: impl Into<String>, secret_access_key: impl Into<String>, session_token: Option<String>, ) -> Result<Self, S3Error>
Creates non-expiring credentials.
Sourcepub fn with_expiration(
access_key_id: impl Into<String>,
secret_access_key: impl Into<String>,
session_token: Option<String>,
expires_at: Option<OffsetDateTime>,
) -> Result<Self, S3Error>
pub fn with_expiration( access_key_id: impl Into<String>, secret_access_key: impl Into<String>, session_token: Option<String>, expires_at: Option<OffsetDateTime>, ) -> Result<Self, S3Error>
Creates credentials with an optional expiration time.
Sourcepub fn access_key_id(&self) -> &str
pub fn access_key_id(&self) -> &str
Returns the access-key identifier for signing.
Sourcepub fn secret_access_key(&self) -> &SecretString
pub fn secret_access_key(&self) -> &SecretString
Returns the secret access key for signing.
Sourcepub fn session_token(&self) -> Option<&SecretString>
pub fn session_token(&self) -> Option<&SecretString>
Returns the optional session token for signing.
Sourcepub fn expires_at(&self) -> Option<OffsetDateTime>
pub fn expires_at(&self) -> Option<OffsetDateTime>
Returns the credential expiration time, when supplied by the provider.
Sourcepub fn expires_by(&self, time: OffsetDateTime) -> bool
pub fn expires_by(&self, time: OffsetDateTime) -> bool
Returns whether the credentials expire at or before time.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.