pub async fn assume_role(&self) -> Result<AwsCredentials, RusotoError<AssumeRoleError>> {
        let request = AssumeRoleRequest {
            role_arn: self.role_arn.clone(),
            role_session_name: self.session_name.clone(),
            duration_seconds: Some(self.session_duration.num_seconds() as i64),
            external_id: self.external_id.clone(),
            policy: self.scope_down_policy.clone(),
            serial_number: self.mfa_serial.clone(),
            token_code: self.mfa_code.clone(),
            ..Default::default()
        };
        let resp = self.sts_client.assume_role(request).await?;

        let creds = resp
            .credentials
            .ok_or(CredentialsError::new("no credentials in response"))?;

        Ok(AwsCredentials::new_for_credentials(creds)?)
    }
Calls `AssumeRole` to get a session token from the STS Api.
Optionally uses MFA if the MFA serial number and code are set.
rusoto/services/sts/src/custom/credential.rs