pub struct ClientBuilder<Svc> { /* private fields */ }Implementations§
Source§impl<Svc> ClientBuilder<Svc>
impl<Svc> ClientBuilder<Svc>
Sourcepub fn new(service: Svc, default_namespace: impl Into<String>) -> Self
pub fn new(service: Svc, default_namespace: impl Into<String>) -> Self
Construct a ClientBuilder from scratch with a fully custom Service stack.
This method is only intended for advanced use cases, most users will want to use ClientBuilder::try_from instead,
which provides a default stack as a starting point.
Sourcepub fn with_layer<L: Layer<Svc>>(self, layer: &L) -> ClientBuilder<L::Service>
pub fn with_layer<L: Layer<Svc>>(self, layer: &L) -> ClientBuilder<L::Service>
Sourcepub fn with_valid_until(self, valid_until: Option<Timestamp>) -> Self
pub fn with_valid_until(self, valid_until: Option<Timestamp>) -> Self
Sets an expiration timestamp for the client.
Trait Implementations§
Source§impl<E> TryFrom<(Config, E)> for ClientBuilder<BoxService<Request<Body>, Response<Box<DynBody>>, BoxError>>
impl<E> TryFrom<(Config, E)> for ClientBuilder<BoxService<Request<Body>, Response<Box<DynBody>>, BoxError>>
Source§fn try_from((config, executor): (Config, E)) -> Result<Self>
fn try_from((config, executor): (Config, E)) -> Result<Self>
Builds a default ClientBuilder stack from a given configuration.
§Examples
Install a tracing executor that propagates tracing spans to
spawned tasks.
use hyper_util::rt::{CurrentSpanExecutor, TokioExecutor};
use kube_client::{client::ClientBuilder, config::Config};
#[tokio::main]
async fn main() {
let config = Config::infer().await.unwrap();
let executor = CurrentSpanExecutor::new(TokioExecutor::new());
let builder = ClientBuilder::try_from((config, executor)).unwrap();
let client = builder.build();
}Source§impl TryFrom<Config> for ClientBuilder<BoxService<Request<Body>, Response<Box<DynBody>>, BoxError>>
impl TryFrom<Config> for ClientBuilder<BoxService<Request<Body>, Response<Box<DynBody>>, BoxError>>
Source§fn try_from(config: Config) -> Result<Self>
fn try_from(config: Config) -> Result<Self>
Builds a default ClientBuilder stack from a given configuration.
By default, the client builder builds an HTTP client that relies on a
TokioExecutor to spawn background tasks. To install an executor
that propagates tracing spans, use
<ClientBuilder<Svc> as TryFrom<(Config, E)>>::try_from().
§Examples
use kube_client::{client::ClientBuilder, config::Config};
#[tokio::main]
async fn main() {
let config = Config::infer().await.unwrap();
let builder = ClientBuilder::try_from(config).unwrap();
let client = builder.build();
}Auto Trait Implementations§
impl<Svc> Freeze for ClientBuilder<Svc>where
Svc: Freeze,
impl<Svc> RefUnwindSafe for ClientBuilder<Svc>where
Svc: RefUnwindSafe,
impl<Svc> Send for ClientBuilder<Svc>where
Svc: Send,
impl<Svc> Sync for ClientBuilder<Svc>where
Svc: Sync,
impl<Svc> Unpin for ClientBuilder<Svc>where
Svc: Unpin,
impl<Svc> UnsafeUnpin for ClientBuilder<Svc>where
Svc: UnsafeUnpin,
impl<Svc> UnwindSafe for ClientBuilder<Svc>where
Svc: UnwindSafe,
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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 moreSource§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Decompress response bodies. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more