Trait kube_client::client::ConfigExt [−][src]
pub trait ConfigExt: Sealed {
fn base_uri_layer(&self) -> BaseUriLayer;
fn auth_layer(&self) -> Result<Option<AuthLayer>>;
fn native_tls_https_connector(
&self
) -> Result<HttpsConnector<HttpConnector>>;
fn rustls_https_connector(&self) -> Result<HttpsConnector<HttpConnector>>;
fn native_tls_connector(&self) -> Result<TlsConnector>;
fn rustls_client_config(&self) -> Result<ClientConfig>;
}This is supported on crate feature
client only.Expand description
Extensions to Config for custom Client.
See Client::new for an example.
This trait is sealed and cannot be implemented.
Required methods
fn base_uri_layer(&self) -> BaseUriLayer
fn base_uri_layer(&self) -> BaseUriLayer
Layer to set the base URI of requests to the configured server.
fn auth_layer(&self) -> Result<Option<AuthLayer>>
fn auth_layer(&self) -> Result<Option<AuthLayer>>
Optional layer to set up Authorization header depending on the config.
fn native_tls_https_connector(&self) -> Result<HttpsConnector<HttpConnector>>
fn native_tls_https_connector(&self) -> Result<HttpsConnector<HttpConnector>>
This is supported on crate feature
native-tls only.Create hyper_tls::HttpsConnector based on config.
Example
let config = Config::infer().await?;
let https = config.native_tls_https_connector()?;
let hyper_client: hyper::Client<_, hyper::Body> = hyper::Client::builder().build(https);fn rustls_https_connector(&self) -> Result<HttpsConnector<HttpConnector>>
fn rustls_https_connector(&self) -> Result<HttpsConnector<HttpConnector>>
This is supported on crate feature
rustls-tls only.Create hyper_rustls::HttpsConnector based on config.
Example
let config = Config::infer().await?;
let https = config.rustls_https_connector()?;
let hyper_client: hyper::Client<_, hyper::Body> = hyper::Client::builder().build(https);fn native_tls_connector(&self) -> Result<TlsConnector>
fn native_tls_connector(&self) -> Result<TlsConnector>
This is supported on crate feature
native-tls only.Create native_tls::TlsConnector based on config.
Example
let config = Config::infer().await?;
let https = {
let tls = tokio_native_tls::TlsConnector::from(
config.native_tls_connector()?
);
let mut http = HttpConnector::new();
http.enforce_http(false);
hyper_tls::HttpsConnector::from((http, tls))
};fn rustls_client_config(&self) -> Result<ClientConfig>
fn rustls_client_config(&self) -> Result<ClientConfig>
This is supported on crate feature
rustls-tls only.Create rustls::ClientConfig based on config.
Example
let config = Config::infer().await?;
let https = {
let rustls_config = std::sync::Arc::new(config.rustls_client_config()?);
let mut http = HttpConnector::new();
http.enforce_http(false);
hyper_rustls::HttpsConnector::from((http, rustls_config))
};