Struct rusoto_sts::StsAssumeRoleSessionCredentialsProvider
[−]
[src]
pub struct StsAssumeRoleSessionCredentialsProvider { /* fields omitted */ }
AwsCredentials provider that calls
AssumeRole
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.
Methods
impl StsAssumeRoleSessionCredentialsProvider
[src]
fn new<P, D>(
sts_client: StsClient<P, D>,
role_arn: String,
session_name: String,
external_id: Option<String>,
session_duration: Option<Duration>,
scope_down_policy: Option<String>,
mfa_serial: Option<String>
) -> StsAssumeRoleSessionCredentialsProvider where
P: ProvideAwsCredentials + 'static,
D: DispatchSignedRequest + 'static,
sts_client: StsClient<P, D>,
role_arn: String,
session_name: String,
external_id: Option<String>,
session_duration: Option<Duration>,
scope_down_policy: Option<String>,
mfa_serial: Option<String>
) -> StsAssumeRoleSessionCredentialsProvider where
P: ProvideAwsCredentials + 'static,
D: DispatchSignedRequest + 'static,
Creates a new StsAssumeRoleSessionCredentialsProvider
with the given
StsClient and session parameters.
sts_client
- StsClient to use to acquire session tokens.role_arn
- The ARN of the role to assume.session_name
- An identifier for the assumed role session. Minimum length of 2. Maximum length of 64. Pattern:[\w+=,.@-]*
external_id
-session_duration
- Duration of session tokens. Default 1 hour.scope_down_policy
- Optional inline IAM policy in JSON format to further restrict the access granted to the negotiated session.mfa_serial
- Optional MFA hardware device serial number or virtual device ARN. Useset_mfa_code
to set the MFA code.
fn set_mfa_code<S>(&mut self, code: S) where
S: Into<String>,
S: Into<String>,
Set the MFA code for use when acquiring session tokens.
fn clear_mfa_code(&mut self)
Clear the MFA code.
fn assume_role(&self) -> Result<AwsCredentials, CredentialsError>
Calls AssumeRole
to get a session token from the STS Api.
Optionally uses MFA if the MFA serial number and code are set.
Trait Implementations
impl ProvideAwsCredentials for StsAssumeRoleSessionCredentialsProvider
[src]
fn credentials(&self) -> Result<AwsCredentials, CredentialsError>
Produce a new AwsCredentials
.