pub struct Builder { /* private fields */ }
Expand description

Builder for AWS Shared Configuration

Implementations

Set the region for the builder

Examples
use aws_types::SdkConfig;
use aws_types::region::Region;
let config = SdkConfig::builder().region(Region::new("us-east-1")).build();

Set the region for the builder

Examples
fn region_override() -> Option<Region> {
    // ...
}
use aws_types::SdkConfig;
use aws_types::region::Region;
let mut builder = SdkConfig::builder();
if let Some(region) = region_override() {
    builder.set_region(region);
}
let config = builder.build();

Set the endpoint resolver to use when making requests

Examples
use std::sync::Arc;
use aws_types::SdkConfig;
use aws_smithy_http::endpoint::Endpoint;
use http::Uri;
let config = SdkConfig::builder().endpoint_resolver(
    Endpoint::immutable(Uri::from_static("http://localhost:8080"))
).build();

Set the endpoint resolver to use when making requests

Examples
use std::sync::Arc;
use aws_types::SdkConfig;
use aws_types::endpoint::ResolveAwsEndpoint;
fn endpoint_resolver_override() -> Option<Arc<dyn ResolveAwsEndpoint>> {
    // ...
}
let mut config = SdkConfig::builder();
config.set_endpoint_resolver(endpoint_resolver_override());
config.build();

Set the retry_config for the builder

Examples
use aws_types::SdkConfig;
use aws_smithy_types::retry::RetryConfig;

let retry_config = RetryConfig::new().with_max_attempts(5);
let config = SdkConfig::builder().retry_config(retry_config).build();

Set the retry_config for the builder

Examples
use aws_types::sdk_config::{SdkConfig, 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 = SdkConfig::builder();
disable_retries(&mut builder);
let config = builder.build();

Set the timeout::Config for the builder

Examples
use aws_types::SdkConfig;
use aws_smithy_types::{timeout, tristate::TriState};

let api_timeout_config = timeout::Api::new()
    .with_call_attempt_timeout(TriState::Set(Duration::from_secs(2)))
    .with_call_timeout(TriState::Set(Duration::from_secs(5)));
let timeout_config = timeout::Config::new()
    .with_api_timeouts(api_timeout_config);
let config = SdkConfig::builder().timeout_config(timeout_config).build();

Set the timeout::Config for the builder

Examples
use aws_types::sdk_config::{SdkConfig, Builder};
use aws_smithy_types::{timeout, tristate::TriState};

fn set_preferred_timeouts(builder: &mut Builder) {
    let api_timeout_config = timeout::Api::new()
        .with_call_attempt_timeout(TriState::Set(Duration::from_secs(2)))
        .with_call_timeout(TriState::Set(Duration::from_secs(5)));
    let timeout_config = timeout::Config::new()
        .with_api_timeouts(api_timeout_config);
    builder.set_timeout_config(Some(timeout_config));
}

let mut builder = SdkConfig::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::SdkConfig;
fn make_provider() -> impl ProvideCredentials {
  // ...
}

let config = SdkConfig::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::SdkConfig;
fn make_provider() -> impl ProvideCredentials {
  // ...
}

fn override_provider() -> bool {
  // ...
}

let mut builder = SdkConfig::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.

Sets the HTTP connector that clients will use to make HTTP requests.

Sets the HTTP connector that clients will use to make HTTP requests.

Build a SdkConfig 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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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