Struct aws_config::sts::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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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