Struct kube_core::request::Request

source ·
pub struct Request {
    pub url_path: String,
}
Expand description

A Kubernetes request builder

Takes a base_path and supplies constructors for common operations The extra operations all return http::Request objects.

Fields§

§url_path: String

The path component of a url

Implementations§

source§

impl Request

source

pub fn new<S: Into<String>>(url_path: S) -> Self

New request with a resource’s url path

source§

impl Request

Convenience methods found from API conventions

source

pub fn list(&self, lp: &ListParams) -> Result<Request<Vec<u8>>, Error>

List a collection of a resource

source

pub fn watch( &self, wp: &WatchParams, ver: &str, ) -> Result<Request<Vec<u8>>, Error>

Watch a resource at a given version

source

pub fn get(&self, name: &str, gp: &GetParams) -> Result<Request<Vec<u8>>, Error>

Get a single instance

source

pub fn create( &self, pp: &PostParams, data: Vec<u8>, ) -> Result<Request<Vec<u8>>, Error>

Create an instance of a resource

source

pub fn delete( &self, name: &str, dp: &DeleteParams, ) -> Result<Request<Vec<u8>>, Error>

Delete an instance of a resource

source

pub fn delete_collection( &self, dp: &DeleteParams, lp: &ListParams, ) -> Result<Request<Vec<u8>>, Error>

Delete a collection of a resource

source

pub fn patch<P: Serialize>( &self, name: &str, pp: &PatchParams, patch: &Patch<P>, ) -> Result<Request<Vec<u8>>, Error>

Patch an instance of a resource

Requires a serialized merge-patch+json at the moment.

source

pub fn replace( &self, name: &str, pp: &PostParams, data: Vec<u8>, ) -> Result<Request<Vec<u8>>, Error>

Replace an instance of a resource

Requires metadata.resourceVersion set in data

source§

impl Request

Subresources

source

pub fn get_subresource( &self, subresource_name: &str, name: &str, ) -> Result<Request<Vec<u8>>, Error>

Get an instance of the subresource

source

pub fn create_subresource( &self, subresource_name: &str, name: &str, pp: &PostParams, data: Vec<u8>, ) -> Result<Request<Vec<u8>>, Error>

Create an instance of the subresource

source

pub fn patch_subresource<P: Serialize>( &self, subresource_name: &str, name: &str, pp: &PatchParams, patch: &Patch<P>, ) -> Result<Request<Vec<u8>>, Error>

Patch an instance of the subresource

source

pub fn replace_subresource( &self, subresource_name: &str, name: &str, pp: &PostParams, data: Vec<u8>, ) -> Result<Request<Vec<u8>>, Error>

Replace an instance of the subresource

source§

impl Request

Metadata-only request implementations

Requests set an extended Accept header compromised of JSON media type and additional parameters that retrieve only necessary metadata from an object.

source

pub fn get_metadata( &self, name: &str, gp: &GetParams, ) -> Result<Request<Vec<u8>>, Error>

Get a single metadata instance for a named resource

source

pub fn list_metadata(&self, lp: &ListParams) -> Result<Request<Vec<u8>>, Error>

List a collection of metadata of a resource

source

pub fn watch_metadata( &self, wp: &WatchParams, ver: &str, ) -> Result<Request<Vec<u8>>, Error>

Watch metadata of a resource at a given version

source

pub fn patch_metadata<P: Serialize>( &self, name: &str, pp: &PatchParams, patch: &Patch<P>, ) -> Result<Request<Vec<u8>>, Error>

Patch an instance of a resource and receive its metadata only

Requires a serialized merge-patch+json at the moment

source§

impl Request

source

pub fn logs( &self, name: &str, lp: &LogParams, ) -> Result<Request<Vec<u8>>, Error>

Get a pod logs

source§

impl Request

source

pub fn evict( &self, name: &str, ep: &EvictParams, ) -> Result<Request<Vec<u8>>, Error>

Create an eviction

source§

impl Request

source

pub fn attach( &self, name: &str, ap: &AttachParams, ) -> Result<Request<Vec<u8>>, Error>

Attach to a pod

source§

impl Request

source

pub fn exec<I, T>( &self, name: &str, command: I, ap: &AttachParams, ) -> Result<Request<Vec<u8>>, Error>
where I: IntoIterator<Item = T>, T: Into<String>,

Execute command in a pod

source§

impl Request

source

pub fn portforward( &self, name: &str, ports: &[u16], ) -> Result<Request<Vec<u8>>, Error>

Request to forward ports of a pod

source§

impl Request

source

pub fn restart(&self, name: &str) -> Result<Request<Vec<u8>>, Error>

Restart a resource

source§

impl Request

source

pub fn cordon(&self, name: &str) -> Result<Request<Vec<u8>>, Error>

Cordon a resource

source

pub fn uncordon(&self, name: &str) -> Result<Request<Vec<u8>>, Error>

Uncordon a resource

Trait Implementations§

source§

impl Clone for Request

source§

fn clone(&self) -> Request

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Request

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.