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();

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.

Build a Config from this builder

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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