Trait kube_core::Resource [−][src]
pub trait Resource { type DynamicType: Send + Sync + 'static; fn kind(dt: &Self::DynamicType) -> Cow<'_, str>; fn group(dt: &Self::DynamicType) -> Cow<'_, str>; fn version(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 plural(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 DynamicType: Send + Sync + 'static
[src]
type DynamicType: Send + Sync + 'static
[src]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
fn kind(dt: &Self::DynamicType) -> Cow<'_, str>
[src]
fn kind(dt: &Self::DynamicType) -> Cow<'_, str>
[src]Returns kind of this object
fn group(dt: &Self::DynamicType) -> Cow<'_, str>
[src]
fn group(dt: &Self::DynamicType) -> Cow<'_, str>
[src]Returns group of this object
fn version(dt: &Self::DynamicType) -> Cow<'_, str>
[src]
fn version(dt: &Self::DynamicType) -> Cow<'_, str>
[src]Returns version of this object
fn meta(&self) -> &ObjectMeta
[src]
fn meta(&self) -> &ObjectMeta
[src]Metadata that all persisted resources must have
fn meta_mut(&mut self) -> &mut ObjectMeta
[src]
fn meta_mut(&mut self) -> &mut ObjectMeta
[src]Metadata that all persisted resources must have
Provided methods
fn api_version(dt: &Self::DynamicType) -> Cow<'_, str>
[src]
fn api_version(dt: &Self::DynamicType) -> Cow<'_, str>
[src]Returns apiVersion of this object
fn plural(dt: &Self::DynamicType) -> Cow<'_, str>
[src]
fn plural(dt: &Self::DynamicType) -> Cow<'_, str>
[src]Returns the plural name of the kind
This is known as the resource in apimachinery, we rename it for disambiguation. By default, we infer this name through pluralization.
The pluralization process is not recommended to be relied upon, and is only used for
k8s_openapi
types, where we maintain a list of special pluralisations for compatibility.
Thus when used with DynamicObject
or kube-derive
, we override this with correct values.
Implementors
impl Resource for DynamicObject
[src]
impl Resource for DynamicObject
[src]type DynamicType = ApiResource
fn group(dt: &ApiResource) -> Cow<'_, str>
[src]
fn version(dt: &ApiResource) -> Cow<'_, str>
[src]
fn kind(dt: &ApiResource) -> Cow<'_, str>
[src]
fn api_version(dt: &ApiResource) -> Cow<'_, str>
[src]
fn plural(dt: &ApiResource) -> Cow<'_, str>
[src]
fn meta(&self) -> &ObjectMeta
[src]
fn meta_mut(&mut self) -> &mut ObjectMeta
[src]
impl<K> Resource for K where
K: Metadata<Ty = ObjectMeta>,
[src]
impl<K> Resource for K where
K: Metadata<Ty = ObjectMeta>,
[src]Implement accessor trait for any ObjectMeta-using Kubernetes Resource
impl<P, U> Resource for Object<P, U> where
P: Clone,
U: Clone,
[src]
impl<P, U> Resource for Object<P, U> where
P: Clone,
U: Clone,
[src]