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
impl AssumeRoleProviderBuilder
sourcepub fn new(role: impl Into<String>) -> Self
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
sourcepub fn external_id(self, id: impl Into<String>) -> Self
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.
sourcepub fn session_name(self, name: impl Into<String>) -> Self
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.
sourcepub fn policy(self, policy: impl Into<String>) -> Self
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
sourcepub fn policy_arns(self, policy_arns: Vec<String>) -> Self
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
sourcepub fn session_length(self, length: Duration) -> Self
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
sourcepub fn region(self, region: Region) -> Self
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(...)
sourcepub fn configure(self, conf: &SdkConfig) -> Self
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();
}
sourcepub async fn build(self) -> AssumeRoleProvider
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.
sourcepub async fn build_from_provider(
self,
provider: impl ProvideCredentials + 'static,
) -> AssumeRoleProvider
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§
Auto Trait Implementations§
impl Freeze for AssumeRoleProviderBuilder
impl !RefUnwindSafe for AssumeRoleProviderBuilder
impl Send for AssumeRoleProviderBuilder
impl Sync for AssumeRoleProviderBuilder
impl Unpin for AssumeRoleProviderBuilder
impl !UnwindSafe for AssumeRoleProviderBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);