Trait kube::Resource[][src]

pub trait Resource {
    type DynamicType: 'static + Send + Sync;
    fn kind(dt: &Self::DynamicType) -> Cow<'_, str>;
fn group(dt: &Self::DynamicType) -> Cow<'_, str>;
fn version(dt: &Self::DynamicType) -> Cow<'_, str>;
fn plural(dt: &Self::DynamicType) -> Cow<'_, str>;
fn meta(&self) -> &ObjectMeta;
fn meta_mut(&mut self) -> &mut ObjectMeta; fn api_version(dt: &Self::DynamicType) -> Cow<'_, str> { ... }
fn url_path(dt: &Self::DynamicType, namespace: Option<&str>) -> String { ... } }
Expand description

An accessor trait for a kubernetes Resource.

This is for a subset of Kubernetes type that do not end in List. These types, using ObjectMeta, SHOULD all have required properties:

  • .metadata
  • .metadata.name

And these optional properties:

  • .metadata.namespace
  • .metadata.resource_version

This avoids a bunch of the unnecessary unwrap mechanics for apps.

Associated Types

Type information for types that do not know their resource information at compile time.

Types that know their metadata at compile time should select DynamicType = (). Types that require some information at runtime should select DynamicType as type of this information.

See DynamicObject for a valid implementation of non-k8s-openapi resources.

Required methods

Returns kind of this object

Returns group of this object

Returns version of this object

Returns the plural name of the kind

This is known as the resource in apimachinery, we rename it for disambiguation.

Metadata that all persisted resources must have

Metadata that all persisted resources must have

Provided methods

Returns apiVersion of this object

Creates a url path for http requests for this resource

Implementors