pub struct Builder { /* private fields */ }
Expand description
Builder for AWS Shared Configuration
Implementations
sourceimpl Builder
impl Builder
sourcepub fn region(self, region: impl Into<Option<Region>>) -> Self
pub fn region(self, region: impl Into<Option<Region>>) -> Self
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();
sourcepub fn set_region(&mut self, region: impl Into<Option<Region>>) -> &mut Self
pub fn set_region(&mut self, region: impl Into<Option<Region>>) -> &mut Self
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();
sourcepub fn retry_config(self, retry_config: RetryConfig) -> Self
pub fn retry_config(self, retry_config: RetryConfig) -> Self
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();
sourcepub fn set_retry_config(
&mut self,
retry_config: Option<RetryConfig>
) -> &mut Self
pub fn set_retry_config(
&mut self,
retry_config: Option<RetryConfig>
) -> &mut Self
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();
sourcepub fn timeout_config(self, timeout_config: TimeoutConfig) -> Self
pub fn timeout_config(self, timeout_config: TimeoutConfig) -> Self
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();
sourcepub fn set_timeout_config(
&mut self,
timeout_config: Option<TimeoutConfig>
) -> &mut Self
pub fn set_timeout_config(
&mut self,
timeout_config: Option<TimeoutConfig>
) -> &mut Self
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();
sourcepub fn credentials_provider(self, provider: SharedCredentialsProvider) -> Self
pub fn credentials_provider(self, provider: SharedCredentialsProvider) -> 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 {
// ...
}
let config = Config::builder()
.credentials_provider(SharedCredentialsProvider::new(make_provider()))
.build();
sourcepub 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();
sourcepub fn app_name(self, app_name: AppName) -> Self
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.
sourcepub fn set_app_name(&mut self, app_name: Option<AppName>) -> &mut Self
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.
sourcepub fn http_connector(self, http_connector: HttpConnector) -> Self
pub fn http_connector(self, http_connector: HttpConnector) -> Self
Sets the HTTP connector that clients will use to make HTTP requests.
sourcepub fn set_http_connector(
&mut self,
http_connector: Option<HttpConnector>
) -> &mut Self
pub fn set_http_connector(
&mut self,
http_connector: Option<HttpConnector>
) -> &mut Self
Sets the HTTP connector that clients will use to make HTTP requests.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl !UnwindSafe for Builder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more