pub struct Builder<Tls = TlsUnset> { /* private fields */ }Expand description
Builder for a hyper-backed HttpClient implementation.
This builder can be used to customize the underlying TCP connector used, as well as hyper client configuration.
§Examples
Construct a Hyper client with the RusTLS TLS implementation. This can be useful when you want to share a Hyper connector between multiple generated Smithy clients.
Implementations§
Source§impl Builder<TlsProviderSelected>
impl Builder<TlsProviderSelected>
Sourcepub fn build_https(self) -> SharedHttpClient
pub fn build_https(self) -> SharedHttpClient
Create an HTTPS client with the selected TLS provider.
The trusted certificates will be loaded later when this becomes the selected HTTP client for a Smithy client.
Sourcepub fn build_with_resolver(
self,
resolver: impl ResolveDns + Clone + 'static,
) -> SharedHttpClient
pub fn build_with_resolver( self, resolver: impl ResolveDns + Clone + 'static, ) -> SharedHttpClient
Create an HTTPS client using a custom DNS resolver
Sourcepub fn tls_context(self, ctx: TlsContext) -> Self
pub fn tls_context(self, ctx: TlsContext) -> Self
Configure the TLS context
Source§impl<Any> Builder<Any>
impl<Any> Builder<Any>
Sourcepub fn pool_idle_timeout<D>(self, val: D) -> Self
pub fn pool_idle_timeout<D>(self, val: D) -> Self
Set an optional timeout for idle sockets being kept-alive.
Pass None to disable timeout.
Defaults to Hyper’s default timeout, which is currently 90 seconds - see
hyper_util::client::legacy::Builder::pool_idle_timeout,
but unlike that function, there is no need to call pool_timer yourself.
§Examples
use aws_smithy_http_client::{Builder, tls};
use std::time::Duration;
let client = Builder::new()
.pool_idle_timeout(Duration::from_secs(30))
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build_https();Sourcepub fn set_pool_idle_timeout(
&mut self,
val: Option<Option<Duration>>,
) -> &mut Self
pub fn set_pool_idle_timeout( &mut self, val: Option<Option<Duration>>, ) -> &mut Self
Set an optional timeout for idle sockets being kept-alive.
Pass None to use Hyper’s default timeout, Some(None) to disable timeouts.
This is the mutable version of pool_idle_timeout.
§Examples
use std::time::Duration;
use aws_smithy_http_client::{Builder, tls};
let mut client = Builder::new();
client.set_pool_idle_timeout(Some(Some(Duration::from_secs(30))));
client
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build_https();Sourcepub fn pool_max_idle_per_host(self, val: usize) -> Self
pub fn pool_max_idle_per_host(self, val: usize) -> Self
Sets the maximum number of idle pooled connections allowed per host.
Default is determined by the underlying hyper client, which is currently no limit
(usize::MAX) - see hyper_util::client::legacy::Builder::pool_max_idle_per_host.
§Examples
use aws_smithy_http_client::{Builder, tls};
let client = Builder::new()
.pool_max_idle_per_host(70)
.tls_provider(tls::Provider::Rustls(tls::rustls_provider::CryptoMode::AwsLc))
.build_https();Sourcepub fn set_pool_max_idle_per_host(&mut self, val: Option<usize>) -> &mut Self
pub fn set_pool_max_idle_per_host(&mut self, val: Option<usize>) -> &mut Self
Sets the maximum number of idle pooled connections allowed per host.
Pass None to use the hyper default (currently no limit, usize::MAX) - see
hyper_util::client::legacy::Builder::pool_max_idle_per_host.
This is the mutable version of pool_max_idle_per_host.
Trait Implementations§
Auto Trait Implementations§
impl<Tls = TlsUnset> !RefUnwindSafe for Builder<Tls>
impl<Tls = TlsUnset> !UnwindSafe for Builder<Tls>
impl<Tls> Freeze for Builder<Tls>where
Tls: Freeze,
impl<Tls> Send for Builder<Tls>where
Tls: Send,
impl<Tls> Sync for Builder<Tls>where
Tls: Sync,
impl<Tls> Unpin for Builder<Tls>where
Tls: Unpin,
impl<Tls> UnsafeUnpin for Builder<Tls>where
Tls: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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