Struct kube_core::api_resource::ApiResource[][src]

pub struct ApiResource {
    pub group: String,
    pub version: String,
    pub api_version: String,
    pub kind: String,
    pub plural: String,
}
Expand description

Contains information about Kubernetes API resources which is enough for working with it.

Fields

group: String
Expand description

Resource group, empty for core group.

version: String
Expand description

group version

api_version: String
Expand description

apiVersion of the resource (v1 for core group, groupName/groupVersions for other).

kind: String
Expand description

Singular PascalCase name of the resource

plural: String
Expand description

Plural name of the resource

Implementations

impl ApiResource[src]

pub fn from_apiresource(ar: &APIResource, group_version: &str) -> Self[src]

Creates ApiResource from meta::v1::APIResource instance.

APIResource objects can be extracted from Client::list_api_group_resources. If it does not specify version and/or group, they will be taken from group_version (otherwise the second parameter is ignored).

Example usage:

use kube::api::{ApiResource, Api, DynamicObject};
let apps = client.list_api_group_resources("apps/v1").await?;
for ar in &apps.resources {
    let resource = ApiResource::from_apiresource(ar, &apps.group_version);
    dbg!(&resource);
    let api: Api<DynamicObject> = Api::namespaced_with(client.clone(), "default", &resource);
}

pub fn erase<K: Resource>(dt: &K::DynamicType) -> Self[src]

Creates ApiResource by type-erasing another Resource

pub fn from_gvk(gvk: &GroupVersionKind) -> Self[src]

Creates ApiResource from group, version and kind.

Warning

This function has to guess resource plural name. While it makes it best to guess correctly, sometimes it can be wrong, and using returned ApiResource will lead to incorrect api requests.

pub fn from_gvk_with_plural(gvk: &GroupVersionKind, plural: &str) -> Self[src]

Creates ApiResource from group, version, kind and plural name.

Trait Implementations

impl Clone for ApiResource[src]

fn clone(&self) -> ApiResource[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ApiResource[src]

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

Formats the value using the given formatter. Read more

impl Hash for ApiResource[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<ApiResource> for ApiResource[src]

fn eq(&self, other: &ApiResource) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &ApiResource) -> bool[src]

This method tests for !=.

impl Eq for ApiResource[src]

impl StructuralEq for ApiResource[src]

impl StructuralPartialEq for ApiResource[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.