kube_core

Trait ResourceExt

source
pub trait ResourceExt: Resource {
Show 16 methods // Required methods fn name_unchecked(&self) -> String; fn name_any(&self) -> String; fn namespace(&self) -> Option<String>; fn resource_version(&self) -> Option<String>; fn uid(&self) -> Option<String>; fn creation_timestamp(&self) -> Option<Time>; fn labels(&self) -> &BTreeMap<String, String>; fn labels_mut(&mut self) -> &mut BTreeMap<String, String>; fn annotations(&self) -> &BTreeMap<String, String>; fn annotations_mut(&mut self) -> &mut BTreeMap<String, String>; fn owner_references(&self) -> &[OwnerReference]; fn owner_references_mut(&mut self) -> &mut Vec<OwnerReference>; fn finalizers(&self) -> &[String]; fn finalizers_mut(&mut self) -> &mut Vec<String>; fn managed_fields(&self) -> &[ManagedFieldsEntry]; fn managed_fields_mut(&mut self) -> &mut Vec<ManagedFieldsEntry>;
}
Expand description

Helper methods for resources.

Required Methods§

source

fn name_unchecked(&self) -> String

Returns the name of the resource, panicking if it is unset

Only use this function if you know that name is set; for example when the resource was received from the apiserver (post-admission), or if you constructed the resource with the name.

At admission, .metadata.generateName can be set instead of name and in those cases this function can panic.

Prefer using .meta().name or name_any for the more general cases.

source

fn name_any(&self) -> String

Returns the most useful name identifier available

This is tries name, then generateName, and falls back on an empty string when neither is set. Generally you always have one of the two unless you are creating the object locally.

This is intended to provide something quick and simple for standard logging purposes. For more precise use cases, prefer doing your own defaulting. For true uniqueness, prefer uid.

source

fn namespace(&self) -> Option<String>

The namespace the resource is in

source

fn resource_version(&self) -> Option<String>

The resource version

source

fn uid(&self) -> Option<String>

Unique ID (if you delete resource and then create a new resource with the same name, it will have different ID)

source

fn creation_timestamp(&self) -> Option<Time>

Returns the creation timestamp

This is guaranteed to exist on resources received by the apiserver.

source

fn labels(&self) -> &BTreeMap<String, String>

Returns resource labels

source

fn labels_mut(&mut self) -> &mut BTreeMap<String, String>

Provides mutable access to the labels

source

fn annotations(&self) -> &BTreeMap<String, String>

Returns resource annotations

source

fn annotations_mut(&mut self) -> &mut BTreeMap<String, String>

Provider mutable access to the annotations

source

fn owner_references(&self) -> &[OwnerReference]

Returns resource owner references

source

fn owner_references_mut(&mut self) -> &mut Vec<OwnerReference>

Provides mutable access to the owner references

source

fn finalizers(&self) -> &[String]

Returns resource finalizers

source

fn finalizers_mut(&mut self) -> &mut Vec<String>

Provides mutable access to the finalizers

source

fn managed_fields(&self) -> &[ManagedFieldsEntry]

Returns managed fields

source

fn managed_fields_mut(&mut self) -> &mut Vec<ManagedFieldsEntry>

Provides mutable access to managed fields

Object Safety§

This trait is not object safe.

Implementors§