Struct aws_types::Credentials
source · [−]pub struct Credentials(_);
Expand description
AWS SDK Credentials
An opaque struct representing credentials that may be used in an AWS SDK, modeled on the CRT credentials implementation.
When Credentials
is dropped, its contents are zeroed in memory. Credentials uses an interior Arc to ensure
that even when cloned, credentials don’t exist in multiple memory locations.
Implementations
sourceimpl Credentials
impl Credentials
sourcepub fn new(
access_key_id: impl Into<String>,
secret_access_key: impl Into<String>,
session_token: Option<String>,
expires_after: Option<SystemTime>,
provider_name: &'static str
) -> Self
pub fn new(
access_key_id: impl Into<String>,
secret_access_key: impl Into<String>,
session_token: Option<String>,
expires_after: Option<SystemTime>,
provider_name: &'static str
) -> Self
Creates Credentials
.
This is intended to be used from a custom credentials provider implementation. It is NOT secure to hardcode credentials into your application.
sourcepub fn from_keys(
access_key_id: impl Into<String>,
secret_access_key: impl Into<String>,
session_token: Option<String>
) -> Self
pub fn from_keys(
access_key_id: impl Into<String>,
secret_access_key: impl Into<String>,
session_token: Option<String>
) -> Self
Creates Credentials
from hardcoded access key, secret key, and session token.
Note: In general, you should prefer to use the credential providers that come
with the AWS SDK to get credentials. It is NOT secure to hardcode credentials
into your application. If you’re writing a custom credentials provider, then
use Credentials::new
instead of this.
This function requires the hardcoded-credentials
feature to be enabled.
Credentials
implement
ProvideCredentials
directly, so no custom provider
implementation is required when wiring these up to a client:
use aws_types::Credentials;
use aws_types::region::Region;
let creds = Credentials::from_keys("akid", "secret_key", None);
let config = Config::builder()
.credentials_provider(creds)
.region(Region::new("us-east-1"))
.build();
let client = Client::from_conf(config);
sourcepub fn access_key_id(&self) -> &str
pub fn access_key_id(&self) -> &str
Returns the access key ID.
sourcepub fn secret_access_key(&self) -> &str
pub fn secret_access_key(&self) -> &str
Returns the secret access key.
sourcepub fn expiry(&self) -> Option<SystemTime>
pub fn expiry(&self) -> Option<SystemTime>
Returns the time when the credentials will expire.
sourcepub fn expiry_mut(&mut self) -> &mut Option<SystemTime>
pub fn expiry_mut(&mut self) -> &mut Option<SystemTime>
Returns a mutable reference to the time when the credentials will expire.
sourcepub fn session_token(&self) -> Option<&str>
pub fn session_token(&self) -> Option<&str>
Returns the session token.
Trait Implementations
sourceimpl Clone for Credentials
impl Clone for Credentials
sourcefn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Credentials
impl Debug for Credentials
sourceimpl PartialEq<Credentials> for Credentials
impl PartialEq<Credentials> for Credentials
sourcefn eq(&self, other: &Credentials) -> bool
fn eq(&self, other: &Credentials) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Credentials) -> bool
fn ne(&self, other: &Credentials) -> bool
This method tests for !=
.
sourceimpl ProvideCredentials for Credentials
impl ProvideCredentials for Credentials
sourcefn provide_credentials<'a>(&'a self) -> ProvideCredentials<'a>ⓘNotable traits for ProvideCredentials<'_>impl Future for ProvideCredentials<'_> type Output = Result;
where
Self: 'a,
fn provide_credentials<'a>(&'a self) -> ProvideCredentials<'a>ⓘNotable traits for ProvideCredentials<'_>impl Future for ProvideCredentials<'_> type Output = Result;
where
Self: 'a,
Returns a future that provides credentials.
impl Eq for Credentials
impl StructuralEq for Credentials
impl StructuralPartialEq for Credentials
Auto Trait Implementations
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnwindSafe for Credentials
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more