Struct aws_sdk_connect::config::Builder
source · [−]pub struct Builder { /* private fields */ }
Expand description
Builder for creating a Config
.
Implementations
sourceimpl Builder
impl Builder
sourcepub fn make_token(self, make_token: impl Into<IdempotencyTokenProvider>) -> Self
pub fn make_token(self, make_token: impl Into<IdempotencyTokenProvider>) -> Self
Sets the idempotency token provider to use for service calls that require tokens.
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_sdk_connect::config::Config;
use aws_smithy_types::retry::RetryConfig;
let retry_config = RetryConfig::standard().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_sdk_connect::config::{Builder, Config};
use aws_smithy_types::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();
sourcepub fn sleep_impl(self, sleep_impl: Arc<dyn AsyncSleep>) -> Self
pub fn sleep_impl(self, sleep_impl: Arc<dyn AsyncSleep>) -> Self
Set the sleep_impl for the builder
Examples
use aws_sdk_connect::config::Config;
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_async::rt::sleep::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 = std::sync::Arc::new(ForeverSleep);
let config = Config::builder().sleep_impl(sleep_impl).build();
sourcepub fn set_sleep_impl(
&mut self,
sleep_impl: Option<Arc<dyn AsyncSleep>>
) -> &mut Self
pub fn set_sleep_impl(
&mut self,
sleep_impl: Option<Arc<dyn AsyncSleep>>
) -> &mut Self
Set the sleep_impl for the builder
Examples
use aws_sdk_connect::config::{Builder, Config};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_async::rt::sleep::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 = std::sync::Arc::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();
sourcepub fn timeout_config(self, timeout_config: Config) -> Self
pub fn timeout_config(self, timeout_config: Config) -> Self
Set the timeout_config for the builder
Examples
use aws_sdk_connect::config::Config;
use aws_smithy_types::{timeout, tristate::TriState};
let api_timeouts = timeout::Api::new()
.with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
let timeout_config = timeout::Config::new()
.with_api_timeouts(api_timeouts);
let config = Config::builder().timeout_config(timeout_config).build();
sourcepub fn set_timeout_config(&mut self, timeout_config: Option<Config>) -> &mut Self
pub fn set_timeout_config(&mut self, timeout_config: Option<Config>) -> &mut Self
Set the timeout_config for the builder
Examples
use aws_sdk_connect::config::{Builder, Config};
use aws_smithy_types::{timeout, tristate::TriState};
fn set_request_timeout(builder: &mut Builder) {
let api_timeouts = timeout::Api::new()
.with_call_attempt_timeout(TriState::Set(Duration::from_secs(1)));
let timeout_config = timeout::Config::new()
.with_api_timeouts(api_timeouts);
builder.set_timeout_config(Some(timeout_config));
}
let mut builder = Config::builder();
set_request_timeout(&mut builder);
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 endpoint_resolver(
self,
endpoint_resolver: impl ResolveAwsEndpoint + 'static
) -> Self
pub fn endpoint_resolver(
self,
endpoint_resolver: impl ResolveAwsEndpoint + 'static
) -> Self
Overrides the endpoint resolver to use when making requests.
When unset, the client will used a generated endpoint resolver based on the endpoint metadata
for aws_sdk_connect
.
Examples
use aws_types::region::Region;
use aws_sdk_connect::config::{Builder, Config};
use aws_sdk_connect::Endpoint;
let config = aws_sdk_connect::Config::builder()
.endpoint_resolver(
Endpoint::immutable("http://localhost:8080".parse().expect("valid URI"))
).build();
sourcepub fn set_endpoint_resolver(
&mut self,
endpoint_resolver: Option<Arc<dyn ResolveAwsEndpoint>>
) -> &mut Self
pub fn set_endpoint_resolver(
&mut self,
endpoint_resolver: Option<Arc<dyn ResolveAwsEndpoint>>
) -> &mut Self
Sets the endpoint resolver to use when making requests.
sourcepub fn region(self, region: impl Into<Option<Region>>) -> Self
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_connect::config::{Builder, Config};
let config = aws_sdk_connect::Config::builder()
.region(Region::new("us-east-1"))
.build();
sourcepub fn credentials_provider(
self,
credentials_provider: impl ProvideCredentials + 'static
) -> Self
pub fn credentials_provider(
self,
credentials_provider: impl ProvideCredentials + 'static
) -> Self
Sets the credentials provider for this service
sourcepub fn set_credentials_provider(
&mut self,
credentials_provider: Option<SharedCredentialsProvider>
) -> &mut Self
pub fn set_credentials_provider(
&mut self,
credentials_provider: Option<SharedCredentialsProvider>
) -> &mut Self
Sets the credentials provider for this service