aws_config::sts

Struct AssumeRoleProviderBuilder

Source
pub struct AssumeRoleProviderBuilder { /* private fields */ }
Expand description

A builder for AssumeRoleProvider.

Construct one through AssumeRoleProvider::builder.

Implementations§

Source§

impl AssumeRoleProviderBuilder

Source

pub fn new(role: impl Into<String>) -> Self

Start a new assume role builder for the given role.

The role argument should take the form an Amazon Resource Name (ARN) like

arn:aws:iam::123456789012:role/example
Source

pub fn external_id(self, id: impl Into<String>) -> Self

Set a unique identifier that might be required when you assume a role in another account.

If the administrator of the account to which the role belongs provided you with an external ID, then provide that value in this parameter. The value can be any string, such as a passphrase or account number.

Source

pub fn session_name(self, name: impl Into<String>) -> Self

Set an identifier for the assumed role session.

Use the role session name to uniquely identify a session when the same role is assumed by different principals or for different reasons. In cross-account scenarios, the role session name is visible to, and can be logged by the account that owns the role. The role session name is also used in the ARN of the assumed role principal.

Source

pub fn policy(self, policy: impl Into<String>) -> Self

Set an IAM policy in JSON format that you want to use as an inline session policy.

This parameter is optional For more information, see policy

Source

pub fn policy_arns(self, policy_arns: Vec<String>) -> Self

Set the Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies.

This parameter is optional. For more information, see policy_arns

Source

pub fn session_length(self, length: Duration) -> Self

Set the expiration time of the role session.

When unset, this value defaults to 1 hour.

The value specified can range from 900 seconds (15 minutes) up to the maximum session duration set for the role. The maximum session duration setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting or the administrator setting (whichever is lower), you will be unable to assume the role. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, you cannot assume the role.

For more information, see duration_seconds

Source

pub fn region(self, region: Region) -> Self

Set the region to assume the role in.

This dictates which STS endpoint the AssumeRole action is invoked on. This will override a region set from .configure(...)

Source

pub fn configure(self, conf: &SdkConfig) -> Self

Sets the configuration used for this provider

This enables overriding the connection used to communicate with STS in addition to other internal fields like the time source and sleep implementation used for caching.

If this field is not provided, configuration from [aws_config::load_from_env().await] is used.

§Examples
use aws_types::region::Region;
use aws_config::sts::AssumeRoleProvider;
let config = aws_config::from_env().region(Region::from_static("us-west-2")).load().await;
let assume_role_provider = AssumeRoleProvider::builder("arn:aws:iam::123456789012:role/example")
  .configure(&config)
  .build();
}
Source

pub async fn build(self) -> AssumeRoleProvider

Build a credentials provider for this role.

Base credentials will be used from the SdkConfig set via Self::configure or loaded from aws_config::from_env if configure was never called.

Source

pub async fn build_from_provider( self, provider: impl ProvideCredentials + 'static, ) -> AssumeRoleProvider

Build a credentials provider for this role authorized by the given provider.

Trait Implementations§

Source§

impl Debug for AssumeRoleProviderBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more