Struct aws_config::default_provider::credentials::Builder
source · pub struct Builder { /* private fields */ }
Expand description
Builder for DefaultCredentialsChain
Implementations§
source§impl Builder
impl Builder
sourcepub fn region(self, region: impl ProvideRegion + 'static) -> Self
pub fn region(self, region: impl ProvideRegion + 'static) -> Self
Sets the region used when making requests to AWS services
When unset, the default region resolver chain will be used.
sourcepub fn set_region(
&mut self,
region: Option<impl ProvideRegion + 'static>
) -> &mut Self
pub fn set_region( &mut self, region: Option<impl ProvideRegion + 'static> ) -> &mut Self
Sets the region used when making requests to AWS services
When unset, the default region resolver chain will be used.
sourcepub fn load_timeout(self, timeout: Duration) -> Self
pub fn load_timeout(self, timeout: Duration) -> Self
Timeout for the entire credential loading chain.
Defaults to 5 seconds.
sourcepub fn set_load_timeout(&mut self, timeout: Option<Duration>) -> &mut Self
pub fn set_load_timeout(&mut self, timeout: Option<Duration>) -> &mut Self
Timeout for the entire credential loading chain.
Defaults to 5 seconds.
sourcepub fn buffer_time(self, buffer_time: Duration) -> Self
pub fn buffer_time(self, buffer_time: Duration) -> Self
Amount of time before the actual credential expiration time where credentials are considered expired.
For example, if credentials are expiring in 15 minutes, and the buffer time is 10 seconds, then any requests made after 14 minutes and 50 seconds will load new credentials.
Defaults to 10 seconds.
sourcepub fn set_buffer_time(&mut self, buffer_time: Option<Duration>) -> &mut Self
pub fn set_buffer_time(&mut self, buffer_time: Option<Duration>) -> &mut Self
Amount of time before the actual credential expiration time where credentials are considered expired.
For example, if credentials are expiring in 15 minutes, and the buffer time is 10 seconds, then any requests made after 14 minutes and 50 seconds will load new credentials.
Defaults to 10 seconds.
sourcepub fn default_credential_expiration(self, duration: Duration) -> Self
pub fn default_credential_expiration(self, duration: Duration) -> Self
Default expiration time to set on credentials if they don’t have an expiration time.
This is only used if the given ProvideCredentials
returns
Credentials
that don’t have their expiry
set.
This must be at least 15 minutes.
Defaults to 15 minutes.
sourcepub fn set_default_credential_expiration(
&mut self,
duration: Option<Duration>
) -> &mut Self
pub fn set_default_credential_expiration( &mut self, duration: Option<Duration> ) -> &mut Self
Default expiration time to set on credentials if they don’t have an expiration time.
This is only used if the given ProvideCredentials
returns
Credentials
that don’t have their expiry
set.
This must be at least 15 minutes.
Defaults to 15 minutes.
sourcepub fn with_custom_credential_source(
self,
name: impl Into<Cow<'static, str>>,
provider: impl ProvideCredentials + 'static
) -> Self
pub fn with_custom_credential_source( self, name: impl Into<Cow<'static, str>>, provider: impl ProvideCredentials + 'static ) -> Self
Add an additional credential source for the ProfileProvider
Assume role profiles may specify named credential sources:
[default]
role_arn = arn:aws:iam::123456789:role/RoleA
credential_source = MyCustomProvider
Typically, these are built-in providers like Environment
, however, custom sources may
also be used.
sourcepub fn profile_name(self, name: &str) -> Self
pub fn profile_name(self, name: &str) -> Self
Override the profile name used by this provider
When unset, the value of the AWS_PROFILE
environment variable will be used.
sourcepub fn imds_client(self, client: Client) -> Self
pub fn imds_client(self, client: Client) -> Self
Override the IMDS client used for this provider
When unset, the default IMDS client will be used.
sourcepub fn configure(self, config: ProviderConfig) -> Self
pub fn configure(self, config: ProviderConfig) -> Self
Override the configuration used for this provider
sourcepub async fn build(self) -> DefaultCredentialsChain
pub async fn build(self) -> DefaultCredentialsChain
Creates a DefaultCredentialsChain
Panics
This function will panic if no connector has been set and neither rustls
and native-tls
features have both been disabled.