pub struct CLIENT { /* private fields */ }k8s only.Methods from Deref<Target = Client>§
Sourcepub fn valid_until(&self) -> &Option<Timestamp>
pub fn valid_until(&self) -> &Option<Timestamp>
Get the expiration timestamp of the client, if it has been set.
Sourcepub fn default_namespace(&self) -> &str
pub fn default_namespace(&self) -> &str
Get the default namespace for the client
The namespace is either configured on context in the kubeconfig,
falls back to default when running locally,
or uses the service account’s namespace when deployed in-cluster.
Sourcepub async fn send(
&self,
request: Request<Body>,
) -> Result<Response<Body>, Error>
pub async fn send( &self, request: Request<Body>, ) -> Result<Response<Body>, Error>
Perform a raw HTTP request against the API and return the raw response back. This method can be used to get raw access to the API which may be used to, for example, create a proxy server or application-level gateway between localhost and the API server.
Sourcepub async fn request<T>(&self, request: Request<Vec<u8>>) -> Result<T, Error>where
T: DeserializeOwned,
pub async fn request<T>(&self, request: Request<Vec<u8>>) -> Result<T, Error>where
T: DeserializeOwned,
Perform a raw HTTP request against the API and deserialize the response as JSON to some known type.
Sourcepub async fn request_text(
&self,
request: Request<Vec<u8>>,
) -> Result<String, Error>
pub async fn request_text( &self, request: Request<Vec<u8>>, ) -> Result<String, Error>
Perform a raw HTTP request against the API and get back the response as a string
Sourcepub async fn request_stream(
&self,
request: Request<Vec<u8>>,
) -> Result<impl AsyncBufRead + use<>, Error>
pub async fn request_stream( &self, request: Request<Vec<u8>>, ) -> Result<impl AsyncBufRead + use<>, Error>
Perform a raw HTTP request against the API and stream the response body.
The response can be processed using AsyncReadExt
and AsyncBufReadExt.
Sourcepub async fn request_status<T>(
&self,
request: Request<Vec<u8>>,
) -> Result<Either<T, Status>, Error>where
T: DeserializeOwned,
pub async fn request_status<T>(
&self,
request: Request<Vec<u8>>,
) -> Result<Either<T, Status>, Error>where
T: DeserializeOwned,
Perform a raw HTTP request against the API and get back either an object
deserialized as JSON or a Status Object.
Sourcepub async fn request_events<T>(
&self,
request: Request<Vec<u8>>,
) -> Result<impl TryStream + use<T>, Error>where
T: Clone + DeserializeOwned,
pub async fn request_events<T>(
&self,
request: Request<Vec<u8>>,
) -> Result<impl TryStream + use<T>, Error>where
T: Clone + DeserializeOwned,
Perform a raw request and get back a stream of WatchEvent objects
Sourcepub async fn apiserver_version(&self) -> Result<Info, Error>
pub async fn apiserver_version(&self) -> Result<Info, Error>
Returns apiserver version.
Sourcepub async fn list_api_groups(&self) -> Result<APIGroupList, Error>
pub async fn list_api_groups(&self) -> Result<APIGroupList, Error>
Lists api groups that apiserver serves.
Sourcepub async fn list_api_group_resources(
&self,
apiversion: &str,
) -> Result<APIResourceList, Error>
pub async fn list_api_group_resources( &self, apiversion: &str, ) -> Result<APIResourceList, Error>
Lists resources served in given API group.
§Example usage:
let apigroups = client.list_api_groups().await?;
for g in apigroups.groups {
let ver = g
.preferred_version
.as_ref()
.or_else(|| g.versions.first())
.expect("preferred or versions exists");
let apis = client.list_api_group_resources(&ver.group_version).await?;
dbg!(apis);
}Sourcepub async fn list_core_api_versions(&self) -> Result<APIVersions, Error>
pub async fn list_core_api_versions(&self) -> Result<APIVersions, Error>
Lists versions of core a.k.a. "" legacy API group.
Sourcepub async fn list_core_api_resources(
&self,
version: &str,
) -> Result<APIResourceList, Error>
pub async fn list_core_api_resources( &self, version: &str, ) -> Result<APIResourceList, Error>
Lists resources served in particular core group version.
Sourcepub async fn list_api_groups_aggregated(
&self,
) -> Result<APIGroupDiscoveryList, Error>
pub async fn list_api_groups_aggregated( &self, ) -> Result<APIGroupDiscoveryList, Error>
Returns aggregated discovery for all API groups served at /apis.
This uses the Aggregated Discovery API to fetch all non-core API groups and their resources in a single request.
Requires Kubernetes 1.26+ (beta) or 1.30+ (stable).
§Example usage:
let discovery = client.list_api_groups_aggregated().await?;
for group in discovery.items {
let name = group.metadata.as_ref().and_then(|m| m.name.as_ref());
println!("Group: {:?}", name);
for version in group.versions {
println!(" Version: {:?}", version.version);
for resource in version.resources {
println!(" Resource: {:?}", resource.resource);
}
}
}Sourcepub async fn list_core_api_versions_aggregated(
&self,
) -> Result<APIGroupDiscoveryList, Error>
pub async fn list_core_api_versions_aggregated( &self, ) -> Result<APIGroupDiscoveryList, Error>
Returns aggregated discovery for core API group served at /api.
This uses the Aggregated Discovery API to fetch the core API group and all its resources in a single request.
Requires Kubernetes 1.26+ (beta) or 1.30+ (stable).
§Example usage:
let discovery = client.list_core_api_versions_aggregated().await?;
for group in discovery.items {
for version in group.versions {
println!("Core version: {:?}", version.version);
for resource in version.resources {
println!(" Resource: {:?} (scope: {:?})", resource.resource, resource.scope);
}
}
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for CLIENT
impl RefUnwindSafe for CLIENT
impl Send for CLIENT
impl Sync for CLIENT
impl Unpin for CLIENT
impl UnsafeUnpin for CLIENT
impl UnwindSafe for CLIENT
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§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,
map-response-body only.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,
trace only.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,
trace only.Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
follow-redirect only.