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>;
}
client
only.Expand description
Helper methods for resources.
Required Methods§
sourcefn name_unchecked(&self) -> String
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.
sourcefn name_any(&self) -> String
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
.
sourcefn resource_version(&self) -> Option<String>
fn resource_version(&self) -> Option<String>
The resource version
sourcefn uid(&self) -> Option<String>
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)
sourcefn creation_timestamp(&self) -> Option<Time>
fn creation_timestamp(&self) -> Option<Time>
Returns the creation timestamp
This is guaranteed to exist on resources received by the apiserver.
sourcefn labels_mut(&mut self) -> &mut BTreeMap<String, String>
fn labels_mut(&mut self) -> &mut BTreeMap<String, String>
Provides mutable access to the labels
sourcefn annotations(&self) -> &BTreeMap<String, String>
fn annotations(&self) -> &BTreeMap<String, String>
Returns resource annotations
sourcefn annotations_mut(&mut self) -> &mut BTreeMap<String, String>
fn annotations_mut(&mut self) -> &mut BTreeMap<String, String>
Provider mutable access to the annotations
sourcefn owner_references(&self) -> &[OwnerReference]
fn owner_references(&self) -> &[OwnerReference]
Returns resource owner references
sourcefn owner_references_mut(&mut self) -> &mut Vec<OwnerReference>
fn owner_references_mut(&mut self) -> &mut Vec<OwnerReference>
Provides mutable access to the owner references
sourcefn finalizers(&self) -> &[String]
fn finalizers(&self) -> &[String]
Returns resource finalizers
sourcefn finalizers_mut(&mut self) -> &mut Vec<String>
fn finalizers_mut(&mut self) -> &mut Vec<String>
Provides mutable access to the finalizers
sourcefn managed_fields(&self) -> &[ManagedFieldsEntry]
fn managed_fields(&self) -> &[ManagedFieldsEntry]
Returns managed fields
sourcefn managed_fields_mut(&mut self) -> &mut Vec<ManagedFieldsEntry>
fn managed_fields_mut(&mut self) -> &mut Vec<ManagedFieldsEntry>
Provides mutable access to managed fields