Struct aws_types::config::Builder [−][src]
pub struct Builder { /* fields omitted */ }
Expand description
Builder for AWS Shared Configuration
Implementations
Set the region for the builder
Examples
use aws_types::config::Config;
use aws_types::region::Region;
let config = Config::builder().region(Region::new("us-east-1")).build();
Set the region for the builder
Examples
fn region_override() -> Option<Region> {
// ...
}
use aws_types::config::Config;
use aws_types::region::Region;
let mut builder = Config::builder();
if let Some(region) = region_override() {
builder.set_region(region);
}
let config = builder.build();
Set the retry_config for the builder
Examples
use aws_types::config::Config;
use aws_smithy_types::retry::RetryConfig;
let retry_config = RetryConfig::new().with_max_attempts(5);
let config = Config::builder().retry_config(retry_config).build();
Set the retry_config for the builder
Examples
use aws_types::config::{Config, Builder};
use aws_smithy_types::retry::RetryConfig;
fn disable_retries(builder: &mut Builder) {
let retry_config = RetryConfig::new().with_max_attempts(1);
builder.set_retry_config(Some(retry_config));
}
let mut builder = Config::builder();
disable_retries(&mut builder);
let config = builder.build();
Set the TimeoutConfig
for the builder
Examples
use aws_types::config::Config;
use aws_smithy_types::timeout::TimeoutConfig;
let timeout_config = TimeoutConfig::new()
.with_api_call_attempt_timeout(Some(Duration::from_secs(1)));
let config = Config::builder().timeout_config(timeout_config).build();
Set the TimeoutConfig
for the builder
Examples
use aws_types::config::{Config, Builder};
use aws_smithy_types::timeout::TimeoutConfig;
fn set_preferred_timeouts(builder: &mut Builder) {
let timeout_config = TimeoutConfig::new()
.with_api_call_attempt_timeout(Some(Duration::from_secs(2)))
.with_api_call_timeout(Some(Duration::from_secs(5)));
builder.set_timeout_config(Some(timeout_config));
}
let mut builder = Config::builder();
set_preferred_timeouts(&mut builder);
let config = builder.build();
Set the credentials provider for the builder
Examples
use aws_types::credentials::{ProvideCredentials, SharedCredentialsProvider};
use aws_types::config::Config;
fn make_provider() -> impl ProvideCredentials {
// ...
}
let config = Config::builder()
.credentials_provider(SharedCredentialsProvider::new(make_provider()))
.build();
pub fn set_credentials_provider(
&mut self,
provider: Option<SharedCredentialsProvider>
) -> &mut Self
pub fn set_credentials_provider(
&mut self,
provider: Option<SharedCredentialsProvider>
) -> &mut Self
Set the credentials provider for the builder
Examples
use aws_types::credentials::{ProvideCredentials, SharedCredentialsProvider};
use aws_types::config::Config;
fn make_provider() -> impl ProvideCredentials {
// ...
}
fn override_provider() -> bool {
// ...
}
let mut builder = Config::builder();
if override_provider() {
builder.set_credentials_provider(Some(SharedCredentialsProvider::new(make_provider())));
}
let config = builder.build();
Sets the name of the app that is using the client.
This optional name is used to identify the application in the user agent that gets sent along with requests.
Sets the name of the app that is using the client.
This optional name is used to identify the application in the user agent that gets sent along with requests.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Builder
impl !UnwindSafe for Builder
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more