Struct rusoto_sts::StsSessionCredentialsProvider
source · [−]pub struct StsSessionCredentialsProvider { /* private fields */ }
Expand description
AwsCredentials provider that calls
GetSessionToken
using the provided StsClient.
To use with MFA, pass in the MFA serial number then set the MFA code.
You will need to ensure the provider has a valid code each time you
acquire a new STS token.
Implementations
sourceimpl StsSessionCredentialsProvider
impl StsSessionCredentialsProvider
sourcepub fn new(
sts_client: StsClient,
duration: Option<Duration>,
mfa_serial: Option<String>
) -> StsSessionCredentialsProvider
pub fn new(
sts_client: StsClient,
duration: Option<Duration>,
mfa_serial: Option<String>
) -> StsSessionCredentialsProvider
Creates a new StsSessionCredentialsProvider
with the given
StsClient and session parameters.
sts_client
- The StsClient to use to acquire session tokens.duration
- The duration of the session tokens. Default 1 hour.mfa_serial
- Optional MFA hardware device serial number or virtual device ARN. Set the MFA code withset_mfa_code
.
sourcepub fn set_mfa_code<S>(&mut self, code: S) where
S: Into<String>,
pub fn set_mfa_code<S>(&mut self, code: S) where
S: Into<String>,
Set the MFA code for use when acquiring session tokens.
sourcepub fn clear_mfa_code(&mut self)
pub fn clear_mfa_code(&mut self)
Clear the MFA code.
sourcepub async fn get_session_token(
&self
) -> Result<GetSessionTokenResponse, RusotoError<GetSessionTokenError>>
pub async fn get_session_token(
&self
) -> Result<GetSessionTokenResponse, RusotoError<GetSessionTokenError>>
Calls GetSessionToken
to get a session token from the STS Api.
Optionally uses MFA if the MFA serial number and code are set.
Trait Implementations
sourceimpl ProvideAwsCredentials for StsSessionCredentialsProvider
impl ProvideAwsCredentials for StsSessionCredentialsProvider
Auto Trait Implementations
impl !RefUnwindSafe for StsSessionCredentialsProvider
impl Send for StsSessionCredentialsProvider
impl Sync for StsSessionCredentialsProvider
impl Unpin for StsSessionCredentialsProvider
impl !UnwindSafe for StsSessionCredentialsProvider
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
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> 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