aws_sdk_s3::config

Struct Builder

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

Builder for creating a Config.

Implementations§

Source§

impl Builder

Source

pub fn new() -> Self

Constructs a config builder.

Source

pub fn stalled_stream_protection( self, stalled_stream_protection_config: StalledStreamProtectionConfig, ) -> Self

Set the StalledStreamProtectionConfig to configure protection for stalled streams.

Source

pub fn set_stalled_stream_protection( &mut self, stalled_stream_protection_config: Option<StalledStreamProtectionConfig>, ) -> &mut Self

Set the StalledStreamProtectionConfig to configure protection for stalled streams.

Source

pub fn http_client(self, http_client: impl HttpClient + 'static) -> Self

Sets the HTTP client to use when making requests.

§Examples
use std::time::Duration;
use aws_sdk_s3::config::Config;
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;

let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
    .with_webpki_roots()
    .https_only()
    .enable_http1()
    .enable_http2()
    .build();
let hyper_client = HyperClientBuilder::new().build(https_connector);

// This connector can then be given to a generated service Config
let config = my_service_client::Config::builder()
    .endpoint_url("https://example.com")
    .http_client(hyper_client)
    .build();
let client = my_service_client::Client::from_conf(config);
Source

pub fn set_http_client( &mut self, http_client: Option<SharedHttpClient>, ) -> &mut Self

Sets the HTTP client to use when making requests.

§Examples
use std::time::Duration;
use aws_sdk_s3::config::{Builder, Config};
use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder;

fn override_http_client(builder: &mut Builder) {
    let https_connector = hyper_rustls::HttpsConnectorBuilder::new()
        .with_webpki_roots()
        .https_only()
        .enable_http1()
        .enable_http2()
        .build();
    let hyper_client = HyperClientBuilder::new().build(https_connector);
    builder.set_http_client(Some(hyper_client));
}

let mut builder = aws_sdk_s3::Config::builder();
override_http_client(&mut builder);
let config = builder.build();
Source

pub fn force_path_style(self, force_path_style: impl Into<bool>) -> Self

Forces this client to use path-style addressing for buckets.

Source

pub fn set_force_path_style( &mut self, force_path_style: Option<bool>, ) -> &mut Self

Forces this client to use path-style addressing for buckets.

Source

pub fn use_arn_region(self, use_arn_region: impl Into<bool>) -> Self

Enables this client to use an ARN’s region when constructing an endpoint instead of the client’s configured region.

Source

pub fn set_use_arn_region(&mut self, use_arn_region: Option<bool>) -> &mut Self

Enables this client to use an ARN’s region when constructing an endpoint instead of the client’s configured region.

Source

pub fn disable_multi_region_access_points( self, disable_multi_region_access_points: impl Into<bool>, ) -> Self

Disables this client’s usage of Multi-Region Access Points.

Source

pub fn set_disable_multi_region_access_points( &mut self, disable_multi_region_access_points: Option<bool>, ) -> &mut Self

Disables this client’s usage of Multi-Region Access Points.

Source

pub fn accelerate(self, accelerate: impl Into<bool>) -> Self

Enables this client to use S3 Transfer Acceleration endpoints.

Source

pub fn set_accelerate(&mut self, accelerate: Option<bool>) -> &mut Self

Enables this client to use S3 Transfer Acceleration endpoints.

Source

pub fn disable_s3_express_session_auth( self, disable_s3_express_session_auth: impl Into<bool>, ) -> Self

Disables this client’s usage of Session Auth for S3Express buckets and reverts to using conventional SigV4 for those.

Source

pub fn set_disable_s3_express_session_auth( &mut self, disable_s3_express_session_auth: Option<bool>, ) -> &mut Self

Disables this client’s usage of Session Auth for S3Express buckets and reverts to using conventional SigV4 for those.

Source

pub fn endpoint_resolver( self, endpoint_resolver: impl ResolveEndpoint + 'static, ) -> Self

Sets the endpoint resolver to use when making requests.

When unset, the client will used a generated endpoint resolver based on the endpoint resolution rules for aws_sdk_s3.

Note: setting an endpoint resolver will replace any endpoint URL that has been set. This method accepts an endpoint resolver specific to this service. If you want to provide a shared endpoint resolver, use Self::set_endpoint_resolver.

§Examples

Create a custom endpoint resolver that resolves a different endpoing per-stage, e.g. staging vs. production.

use aws_sdk_s3::config::endpoint::{ResolveEndpoint, EndpointFuture, Params, Endpoint};
#[derive(Debug)]
struct StageResolver { stage: String }
impl ResolveEndpoint for StageResolver {
    fn resolve_endpoint(&self, params: &Params) -> EndpointFuture<'_> {
        let stage = &self.stage;
        EndpointFuture::ready(Ok(Endpoint::builder().url(format!("{stage}.myservice.com")).build()))
    }
}
let resolver = StageResolver { stage: std::env::var("STAGE").unwrap() };
let config = aws_sdk_s3::Config::builder().endpoint_resolver(resolver).build();
let client = aws_sdk_s3::Client::from_conf(config);
Source

pub fn set_endpoint_resolver( &mut self, endpoint_resolver: Option<SharedEndpointResolver>, ) -> &mut Self

Sets the endpoint resolver to use when making requests.

When unset, the client will used a generated endpoint resolver based on the endpoint resolution rules for aws_sdk_s3.

Source

pub fn retry_config(self, retry_config: RetryConfig) -> Self

Set the retry_config for the builder

§Examples
use aws_sdk_s3::config::Config;
use aws_sdk_s3::config::retry::RetryConfig;

let retry_config = RetryConfig::standard().with_max_attempts(5);
let config = Config::builder().retry_config(retry_config).build();
Source

pub fn set_retry_config( &mut self, retry_config: Option<RetryConfig>, ) -> &mut Self

Set the retry_config for the builder

§Examples
use aws_sdk_s3::config::{Builder, Config};
use aws_sdk_s3::config::retry::RetryConfig;

fn disable_retries(builder: &mut Builder) {
    let retry_config = RetryConfig::standard().with_max_attempts(1);
    builder.set_retry_config(Some(retry_config));
}

let mut builder = Config::builder();
disable_retries(&mut builder);
let config = builder.build();
Source

pub fn sleep_impl(self, sleep_impl: impl AsyncSleep + 'static) -> Self

Set the sleep_impl for the builder

§Examples
use aws_sdk_s3::config::{AsyncSleep, Config, SharedAsyncSleep, Sleep};

#[derive(Debug)]
pub struct ForeverSleep;

impl AsyncSleep for ForeverSleep {
    fn sleep(&self, duration: std::time::Duration) -> Sleep {
        Sleep::new(std::future::pending())
    }
}

let sleep_impl = SharedAsyncSleep::new(ForeverSleep);
let config = Config::builder().sleep_impl(sleep_impl).build();
Source

pub fn set_sleep_impl( &mut self, sleep_impl: Option<SharedAsyncSleep>, ) -> &mut Self

Set the sleep_impl for the builder

§Examples
use aws_sdk_s3::config::{AsyncSleep, Builder, Config, SharedAsyncSleep, Sleep};

#[derive(Debug)]
pub struct ForeverSleep;

impl AsyncSleep for ForeverSleep {
    fn sleep(&self, duration: std::time::Duration) -> Sleep {
        Sleep::new(std::future::pending())
    }
}

fn set_never_ending_sleep_impl(builder: &mut Builder) {
    let sleep_impl = SharedAsyncSleep::new(ForeverSleep);
    builder.set_sleep_impl(Some(sleep_impl));
}

let mut builder = Config::builder();
set_never_ending_sleep_impl(&mut builder);
let config = builder.build();
Source

pub fn timeout_config(self, timeout_config: TimeoutConfig) -> Self

Set the timeout_config for the builder

§Examples
use aws_sdk_s3::config::Config;
use aws_sdk_s3::config::timeout::TimeoutConfig;

let timeout_config = TimeoutConfig::builder()
    .operation_attempt_timeout(Duration::from_secs(1))
    .build();
let config = Config::builder().timeout_config(timeout_config).build();
Source

pub fn set_timeout_config( &mut self, timeout_config: Option<TimeoutConfig>, ) -> &mut Self

Set the timeout_config for the builder.

Setting this to None has no effect if another source of configuration has set timeouts. If you are attempting to disable timeouts, use TimeoutConfig::disabled

§Examples
use aws_sdk_s3::config::{Builder, Config};
use aws_sdk_s3::config::timeout::TimeoutConfig;

fn set_request_timeout(builder: &mut Builder) {
    let timeout_config = TimeoutConfig::builder()
        .operation_attempt_timeout(Duration::from_secs(1))
        .build();
    builder.set_timeout_config(Some(timeout_config));
}

let mut builder = Config::builder();
set_request_timeout(&mut builder);
let config = builder.build();
Source

pub fn retry_partition(self, retry_partition: RetryPartition) -> Self

Set the partition for retry-related state. When clients share a retry partition, they will also share things like token buckets and client rate limiters. By default, all clients for the same service will share a partition.

Source

pub fn set_retry_partition( &mut self, retry_partition: Option<RetryPartition>, ) -> &mut Self

Set the partition for retry-related state. When clients share a retry partition, they will also share things like token buckets and client rate limiters. By default, all clients for the same service will share a partition.

Source

pub fn identity_cache( self, identity_cache: impl ResolveCachedIdentity + 'static, ) -> Self

Set the identity cache for auth.

The identity cache defaults to a lazy caching implementation that will resolve an identity when it is requested, and place it in the cache thereafter. Subsequent requests will take the value from the cache while it is still valid. Once it expires, the next request will result in refreshing the identity.

This configuration allows you to disable or change the default caching mechanism. To use a custom caching mechanism, implement the ResolveCachedIdentity trait and pass that implementation into this function.

§Examples

Disabling identity caching:

use aws_sdk_s3::config::IdentityCache;

let config = aws_sdk_s3::Config::builder()
    .identity_cache(IdentityCache::no_cache())
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);

Customizing lazy caching:

use aws_sdk_s3::config::IdentityCache;
use std::time::Duration;

let config = aws_sdk_s3::Config::builder()
    .identity_cache(
        IdentityCache::lazy()
            // change the load timeout to 10 seconds
            .load_timeout(Duration::from_secs(10))
            .build()
    )
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);
Source

pub fn set_identity_cache( &mut self, identity_cache: impl ResolveCachedIdentity + 'static, ) -> &mut Self

Set the identity cache for auth.

The identity cache defaults to a lazy caching implementation that will resolve an identity when it is requested, and place it in the cache thereafter. Subsequent requests will take the value from the cache while it is still valid. Once it expires, the next request will result in refreshing the identity.

This configuration allows you to disable or change the default caching mechanism. To use a custom caching mechanism, implement the ResolveCachedIdentity trait and pass that implementation into this function.

§Examples

Disabling identity caching:

use aws_sdk_s3::config::IdentityCache;

let config = aws_sdk_s3::Config::builder()
    .identity_cache(IdentityCache::no_cache())
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);

Customizing lazy caching:

use aws_sdk_s3::config::IdentityCache;
use std::time::Duration;

let config = aws_sdk_s3::Config::builder()
    .identity_cache(
        IdentityCache::lazy()
            // change the load timeout to 10 seconds
            .load_timeout(Duration::from_secs(10))
            .build()
    )
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);
Source

pub fn interceptor(self, interceptor: impl Intercept + 'static) -> Self

Add an interceptor that runs at specific stages of the request execution pipeline.

Interceptors targeted at a certain stage are executed according to the pre-defined priority. The SDK provides a default set of interceptors. An interceptor configured by this method will run after those default interceptors.

§Examples
use aws_smithy_runtime_api::client::interceptors::context::phase::BeforeTransmit;
use aws_smithy_runtime_api::client::interceptors::{Interceptor, InterceptorContext};
use aws_smithy_types::config_bag::ConfigBag;
use aws_sdk_s3::config::Config;

fn base_url() -> String {
    // ...
}

#[derive(Debug)]
pub struct UriModifierInterceptor;
impl Intercept for UriModifierInterceptor {
    fn modify_before_signing(
        &self,
        context: &mut InterceptorContext<BeforeTransmit>,
        _cfg: &mut ConfigBag,
    ) -> Result<(), aws_smithy_runtime_api::client::interceptors::BoxError> {
        let request = context.request_mut();
        let uri = format!("{}{}", base_url(), request.uri().path());
        *request.uri_mut() = uri.parse()?;

        Ok(())
    }
}

let config = Config::builder()
    .interceptor(UriModifierInterceptor)
    .build();
Source

pub fn push_interceptor(&mut self, interceptor: SharedInterceptor) -> &mut Self

Add a SharedInterceptor that runs at specific stages of the request execution pipeline.

Interceptors targeted at a certain stage are executed according to the pre-defined priority. The SDK provides a default set of interceptors. An interceptor configured by this method will run after those default interceptors.

§Examples
use aws_smithy_runtime_api::client::interceptors::context::phase::BeforeTransmit;
use aws_smithy_runtime_api::client::interceptors::{Interceptor, InterceptorContext, SharedInterceptor};
use aws_smithy_types::config_bag::ConfigBag;
use aws_sdk_s3::config::{Builder, Config};

fn base_url() -> String {
    // ...
}

fn modify_request_uri(builder: &mut Builder) {
    #[derive(Debug)]
    pub struct UriModifierInterceptor;
    impl Intercept for UriModifierInterceptor {
        fn modify_before_signing(
            &self,
            context: &mut InterceptorContext<BeforeTransmit>,
            _cfg: &mut ConfigBag,
        ) -> Result<(), aws_smithy_runtime_api::client::interceptors::BoxError> {
            let request = context.request_mut();
            let uri = format!("{}{}", base_url(), request.uri().path());
            *request.uri_mut() = uri.parse()?;

            Ok(())
        }
    }
    builder.push_interceptor(SharedInterceptor::new(UriModifierInterceptor));
}

let mut builder = Config::builder();
modify_request_uri(&mut builder);
let config = builder.build();
Source

pub fn set_interceptors( &mut self, interceptors: impl IntoIterator<Item = SharedInterceptor>, ) -> &mut Self

Set SharedInterceptors for the builder.

Source

pub fn time_source(self, time_source: impl TimeSource + 'static) -> Self

Sets the time source used for this service

Source

pub fn set_time_source( &mut self, time_source: Option<SharedTimeSource>, ) -> &mut Self

Sets the time source used for this service

Source

pub fn retry_classifier( self, retry_classifier: impl ClassifyRetry + 'static, ) -> Self

Add type implementing ClassifyRetry that will be used by the RetryStrategy to determine what responses should be retried.

A retry classifier configured by this method will run according to its priority.

§Examples
use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;
use aws_smithy_runtime_api::client::orchestrator::OrchestratorError;
use aws_smithy_runtime_api::client::retries::classifiers::{
    ClassifyRetry, RetryAction, RetryClassifierPriority,
};
use aws_smithy_types::error::metadata::ProvideErrorMetadata;
use aws_smithy_types::retry::ErrorKind;
use std::error::Error as StdError;
use std::marker::PhantomData;
use aws_sdk_s3::config::Config;

const RETRYABLE_ERROR_CODES: &[&str] = [
    // List error codes to be retried here...
];

// When classifying at an operation's error type, classifiers require a generic parameter.
// When classifying the HTTP response alone, no generic is needed.
#[derive(Debug, Default)]
pub struct ErrorCodeClassifier<E> {
    _inner: PhantomData<E>,
}

impl<E> ExampleErrorCodeClassifier<E> {
    pub fn new() -> Self {
        Self {
            _inner: PhantomData,
        }
    }
}

impl<E> ClassifyRetry for ExampleErrorCodeClassifier<E>
where
    // Adding a trait bound for ProvideErrorMetadata allows us to inspect the error code.
    E: StdError + ProvideErrorMetadata + Send + Sync + 'static,
{
    fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction {
        // Check for a result
        let output_or_error = ctx.output_or_error();
        // Check for an error
        let error = match output_or_error {
            Some(Ok(_)) | None => return RetryAction::NoActionIndicated,
              Some(Err(err)) => err,
        };

        // Downcast the generic error and extract the code
        let error_code = OrchestratorError::as_operation_error(error)
            .and_then(|err| err.downcast_ref::<E>())
            .and_then(|err| err.code());

        // If this error's code is in our list, return an action that tells the RetryStrategy to retry this request.
        if let Some(error_code) = error_code {
            if RETRYABLE_ERROR_CODES.contains(&error_code) {
                return RetryAction::transient_error();
            }
        }

        // Otherwise, return that no action is indicated i.e. that this classifier doesn't require a retry.
        // Another classifier may still classify this response as retryable.
        RetryAction::NoActionIndicated
    }

    fn name(&self) -> &'static str { "Example Error Code Classifier" }
}

let config = Config::builder()
    .retry_classifier(ExampleErrorCodeClassifier::<SomeOperationError>::new())
    .build();
Source

pub fn push_retry_classifier( &mut self, retry_classifier: SharedRetryClassifier, ) -> &mut Self

Add a SharedRetryClassifier that will be used by the RetryStrategy to determine what responses should be retried.

A retry classifier configured by this method will run according to its priority.

§Examples
use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext;
use aws_smithy_runtime_api::client::orchestrator::OrchestratorError;
use aws_smithy_runtime_api::client::retries::classifiers::{
    ClassifyRetry, RetryAction, RetryClassifierPriority,
};
use aws_smithy_types::error::metadata::ProvideErrorMetadata;
use aws_smithy_types::retry::ErrorKind;
use std::error::Error as StdError;
use std::marker::PhantomData;
use aws_sdk_s3::config::{Builder, Config};

const RETRYABLE_ERROR_CODES: &[&str] = [
    // List error codes to be retried here...
];
fn set_example_error_code_classifier(builder: &mut Builder) {
    // When classifying at an operation's error type, classifiers require a generic parameter.
    // When classifying the HTTP response alone, no generic is needed.
    #[derive(Debug, Default)]
    pub struct ExampleErrorCodeClassifier<E> {
        _inner: PhantomData<E>,
    }

    impl<E> ExampleErrorCodeClassifier<E> {
        pub fn new() -> Self {
            Self {
                _inner: PhantomData,
            }
        }
    }

    impl<E> ClassifyRetry for ExampleErrorCodeClassifier<E>
    where
        // Adding a trait bound for ProvideErrorMetadata allows us to inspect the error code.
        E: StdError + ProvideErrorMetadata + Send + Sync + 'static,
    {
        fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction {
            // Check for a result
            let output_or_error = ctx.output_or_error();
            // Check for an error
            let error = match output_or_error {
                Some(Ok(_)) | None => return RetryAction::NoActionIndicated,
                  Some(Err(err)) => err,
            };

            // Downcast the generic error and extract the code
            let error_code = OrchestratorError::as_operation_error(error)
                .and_then(|err| err.downcast_ref::<E>())
                .and_then(|err| err.code());

            // If this error's code is in our list, return an action that tells the RetryStrategy to retry this request.
            if let Some(error_code) = error_code {
                if RETRYABLE_ERROR_CODES.contains(&error_code) {
                    return RetryAction::transient_error();
                }
            }

            // Otherwise, return that no action is indicated i.e. that this classifier doesn't require a retry.
            // Another classifier may still classify this response as retryable.
            RetryAction::NoActionIndicated
        }

        fn name(&self) -> &'static str { "Example Error Code Classifier" }
    }

    builder.push_retry_classifier(ExampleErrorCodeClassifier::<SomeOperationError>::new())
}

let mut builder = Config::builder();
set_example_error_code_classifier(&mut builder);
let config = builder.build();
Source

pub fn set_retry_classifiers( &mut self, retry_classifiers: impl IntoIterator<Item = SharedRetryClassifier>, ) -> &mut Self

Set SharedRetryClassifiers for the builder, replacing any that were previously set.

Source

pub fn app_name(self, app_name: AppName) -> Self

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.

Source

pub fn set_app_name(&mut self, app_name: Option<AppName>) -> &mut Self

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.

Source

pub fn invocation_id_generator( self, gen: impl InvocationIdGenerator + 'static, ) -> Self

Overrides the default invocation ID generator.

The invocation ID generator generates ID values for the amz-sdk-invocation-id header. By default, this will be a random UUID. Overriding it may be useful in tests that examine the HTTP request and need to be deterministic.

Source

pub fn set_invocation_id_generator( &mut self, gen: Option<SharedInvocationIdGenerator>, ) -> &mut Self

Overrides the default invocation ID generator.

The invocation ID generator generates ID values for the amz-sdk-invocation-id header. By default, this will be a random UUID. Overriding it may be useful in tests that examine the HTTP request and need to be deterministic.

Source

pub fn endpoint_url(self, endpoint_url: impl Into<String>) -> Self

Sets the endpoint URL used to communicate with this service Note: this is used in combination with other endpoint rules, e.g. an API that applies a host-label prefix will be prefixed onto this URL. To fully override the endpoint resolver, use Builder::endpoint_resolver.

Source

pub fn set_endpoint_url(&mut self, endpoint_url: Option<String>) -> &mut Self

Sets the endpoint URL used to communicate with this service Note: this is used in combination with other endpoint rules, e.g. an API that applies a host-label prefix will be prefixed onto this URL. To fully override the endpoint resolver, use Builder::endpoint_resolver.

Source

pub fn use_dual_stack(self, use_dual_stack: impl Into<bool>) -> Self

When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.

Source

pub fn set_use_dual_stack(&mut self, use_dual_stack: Option<bool>) -> &mut Self

When true, use the dual-stack endpoint. If the configured endpoint does not support dual-stack, dispatching the request MAY return an error.

Source

pub fn use_fips(self, use_fips: impl Into<bool>) -> Self

When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.

Source

pub fn set_use_fips(&mut self, use_fips: Option<bool>) -> &mut Self

When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.

Source

pub fn region(self, region: impl Into<Option<Region>>) -> Self

Sets the AWS region to use when making requests.

§Examples
use aws_types::region::Region;
use aws_sdk_s3::config::{Builder, Config};

let config = aws_sdk_s3::Config::builder()
    .region(Region::new("us-east-1"))
    .build();
Source

pub fn set_region(&mut self, region: Option<Region>) -> &mut Self

Sets the AWS region to use when making requests.

Source

pub fn credentials_provider( self, credentials_provider: impl ProvideCredentials + 'static, ) -> Self

Sets the credentials provider for this service

Source

pub fn set_credentials_provider( &mut self, credentials_provider: Option<SharedCredentialsProvider>, ) -> &mut Self

Sets the credentials provider for this service

Source

pub fn express_credentials_provider( self, credentials_provider: impl ProvideCredentials + 'static, ) -> Self

Sets the credentials provider for S3 Express One Zone

Source

pub fn set_express_credentials_provider( &mut self, credentials_provider: Option<SharedCredentialsProvider>, ) -> &mut Self

Sets the credentials provider for S3 Express One Zone

Source

pub fn behavior_version(self, behavior_version: BehaviorVersion) -> Self

Sets the behavior major version.

Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards compatible. For example, a change which introduces new default timeouts or a new retry-mode for all operations might be the ideal behavior but could break existing applications.

§Examples

Set the behavior major version to latest. This is equivalent to enabling the behavior-version-latest cargo feature.

use aws_sdk_s3::config::BehaviorVersion;

let config = aws_sdk_s3::Config::builder()
    .behavior_version(BehaviorVersion::latest())
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);

Customizing behavior major version:

use aws_sdk_s3::config::BehaviorVersion;

let config = aws_sdk_s3::Config::builder()
    .behavior_version(BehaviorVersion::v2023_11_09())
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);
Source

pub fn set_behavior_version( &mut self, behavior_version: Option<BehaviorVersion>, ) -> &mut Self

Sets the behavior major version.

Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards compatible. For example, a change which introduces new default timeouts or a new retry-mode for all operations might be the ideal behavior but could break existing applications.

§Examples

Set the behavior major version to latest. This is equivalent to enabling the behavior-version-latest cargo feature.

use aws_sdk_s3::config::BehaviorVersion;

let config = aws_sdk_s3::Config::builder()
    .behavior_version(BehaviorVersion::latest())
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);

Customizing behavior major version:

use aws_sdk_s3::config::BehaviorVersion;

let config = aws_sdk_s3::Config::builder()
    .behavior_version(BehaviorVersion::v2023_11_09())
    // ...
    .build();
let client = aws_sdk_s3::Client::from_conf(config);
Source

pub fn behavior_version_latest(self) -> Self

Convenience method to set the latest behavior major version

This is equivalent to enabling the behavior-version-latest Cargo feature

Source

pub fn apply_test_defaults(&mut self) -> &mut Self

Available on crate feature test-util only.

Apply test defaults to the builder

Source

pub fn with_test_defaults(self) -> Self

Available on crate feature test-util only.

Apply test defaults to the builder

Source

pub fn build(self) -> Config

Builds a Config.

Trait Implementations§

Source§

impl Clone for Builder

Source§

fn clone(&self) -> Builder

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Builder

Source§

fn default() -> Self

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

impl From<&SdkConfig> for Builder

Source§

fn from(input: &SdkConfig) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Paint for T
where T: ?Sized,

Source§

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

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to Color::Primary.

§Example
println!("{}", value.primary());
Source§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to Color::Fixed.

§Example
println!("{}", value.fixed(color));
Source§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to Color::Rgb.

§Example
println!("{}", value.rgb(r, g, b));
Source§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to Color::Black.

§Example
println!("{}", value.black());
Source§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to Color::Red.

§Example
println!("{}", value.red());
Source§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to Color::Green.

§Example
println!("{}", value.green());
Source§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to Color::Yellow.

§Example
println!("{}", value.yellow());
Source§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to Color::Blue.

§Example
println!("{}", value.blue());
Source§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to Color::Magenta.

§Example
println!("{}", value.magenta());
Source§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to Color::Cyan.

§Example
println!("{}", value.cyan());
Source§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to Color::White.

§Example
println!("{}", value.white());
Source§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightBlack.

§Example
println!("{}", value.bright_black());
Source§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightRed.

§Example
println!("{}", value.bright_red());
Source§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightGreen.

§Example
println!("{}", value.bright_green());
Source§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightYellow.

§Example
println!("{}", value.bright_yellow());
Source§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightBlue.

§Example
println!("{}", value.bright_blue());
Source§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightMagenta.

§Example
println!("{}", value.bright_magenta());
Source§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightCyan.

§Example
println!("{}", value.bright_cyan());
Source§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to Color::BrightWhite.

§Example
println!("{}", value.bright_white());
Source§

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

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to Color::Primary.

§Example
println!("{}", value.on_primary());
Source§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to Color::Fixed.

§Example
println!("{}", value.on_fixed(color));
Source§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to Color::Rgb.

§Example
println!("{}", value.on_rgb(r, g, b));
Source§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to Color::Black.

§Example
println!("{}", value.on_black());
Source§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to Color::Red.

§Example
println!("{}", value.on_red());
Source§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to Color::Green.

§Example
println!("{}", value.on_green());
Source§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to Color::Yellow.

§Example
println!("{}", value.on_yellow());
Source§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to Color::Blue.

§Example
println!("{}", value.on_blue());
Source§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to Color::Magenta.

§Example
println!("{}", value.on_magenta());
Source§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to Color::Cyan.

§Example
println!("{}", value.on_cyan());
Source§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to Color::White.

§Example
println!("{}", value.on_white());
Source§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightBlack.

§Example
println!("{}", value.on_bright_black());
Source§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightRed.

§Example
println!("{}", value.on_bright_red());
Source§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightGreen.

§Example
println!("{}", value.on_bright_green());
Source§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightYellow.

§Example
println!("{}", value.on_bright_yellow());
Source§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightBlue.

§Example
println!("{}", value.on_bright_blue());
Source§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightMagenta.

§Example
println!("{}", value.on_bright_magenta());
Source§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightCyan.

§Example
println!("{}", value.on_bright_cyan());
Source§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to Color::BrightWhite.

§Example
println!("{}", value.on_bright_white());
Source§

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

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Bold.

§Example
println!("{}", value.bold());
Source§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Dim.

§Example
println!("{}", value.dim());
Source§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Italic.

§Example
println!("{}", value.italic());
Source§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Underline.

§Example
println!("{}", value.underline());

Returns self with the attr() set to Attribute::Blink.

§Example
println!("{}", value.blink());

Returns self with the attr() set to Attribute::RapidBlink.

§Example
println!("{}", value.rapid_blink());
Source§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Invert.

§Example
println!("{}", value.invert());
Source§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Conceal.

§Example
println!("{}", value.conceal());
Source§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to Attribute::Strike.

§Example
println!("{}", value.strike());
Source§

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

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Mask.

§Example
println!("{}", value.mask());
Source§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Wrap.

§Example
println!("{}", value.wrap());
Source§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Linger.

§Example
println!("{}", value.linger());
Source§

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.

Returns self with the quirk() set to Quirk::Clear.

§Example
println!("{}", value.clear());
Source§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Resetting.

§Example
println!("{}", value.resetting());
Source§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::Bright.

§Example
println!("{}", value.bright());
Source§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to Quirk::OnBright.

§Example
println!("{}", value.on_bright());
Source§

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);
Source§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new Painted with a default Style. Read more
Source§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T