pub struct TransportBuilder { /* private fields */ }
Expand description
Builds a HTTP transport to make API calls to Elasticsearch
Implementations§
Source§impl TransportBuilder
impl TransportBuilder
Sourcepub fn new<P>(conn_pool: P) -> TransportBuilder
pub fn new<P>(conn_pool: P) -> TransportBuilder
Creates a new instance of TransportBuilder. Accepts a ConnectionPool from which Connections to Elasticsearch will be retrieved.
Sourcepub fn proxy(
self,
url: Url,
username: Option<&str>,
password: Option<&str>,
) -> TransportBuilder
pub fn proxy( self, url: Url, username: Option<&str>, password: Option<&str>, ) -> TransportBuilder
Configures a proxy.
An optional username and password will be used to set the
Proxy-Authorization
header using Basic Authentication.
Sourcepub fn disable_proxy(self) -> TransportBuilder
pub fn disable_proxy(self) -> TransportBuilder
Whether to disable proxies, including system proxies.
NOTE: System proxies are enabled by default.
Sourcepub fn auth(self, credentials: Credentials) -> TransportBuilder
pub fn auth(self, credentials: Credentials) -> TransportBuilder
Credentials for the client to use for authentication to Elasticsearch
Sourcepub fn cert_validation(
self,
validation: CertificateValidation,
) -> TransportBuilder
pub fn cert_validation( self, validation: CertificateValidation, ) -> TransportBuilder
Validation applied to the certificate provided to establish a HTTPS connection. By default, full validation is applied. When using a self-signed certificate, different validation can be applied.
Sourcepub fn header(self, key: HeaderName, value: HeaderValue) -> TransportBuilder
pub fn header(self, key: HeaderName, value: HeaderValue) -> TransportBuilder
Adds a HTTP header that will be added to all client API calls.
A default HTTP header can be overridden on a per API call basis.
Sourcepub fn headers(self, headers: HeaderMap) -> TransportBuilder
pub fn headers(self, headers: HeaderMap) -> TransportBuilder
Adds HTTP headers that will be added to all client API calls.
Default HTTP headers can be overridden on a per API call basis.
Sourcepub fn enable_meta_header(self, enable: bool) -> TransportBuilder
pub fn enable_meta_header(self, enable: bool) -> TransportBuilder
Whether to send a x-elastic-client-meta
header that describes the runtime environment.
This header contains information that is similar to what could be found in User-Agent
. Using a separate
header allows applications to use User-Agent
for their own needs, e.g. to identify application version
or other environment information. Defaults to true
.
Sourcepub fn timeout(self, timeout: Duration) -> TransportBuilder
pub fn timeout(self, timeout: Duration) -> TransportBuilder
Sets a global request timeout for the client.
The timeout is applied from when the request starts connecting until the response body has finished. Default is no timeout.
Trait Implementations§
Source§impl Default for TransportBuilder
impl Default for TransportBuilder
Source§fn default() -> TransportBuilder
fn default() -> TransportBuilder
Creates a default implementation using the default implementation of SingleNodeConnectionPool.