pub trait ResourceExt: Resource {
Show 17 methods fn name(&self) -> String; 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, Global>; fn labels_mut(&mut self) -> &mut BTreeMap<String, String, Global>; fn annotations(&self) -> &BTreeMap<String, String, Global>; fn annotations_mut(&mut self) -> &mut BTreeMap<String, String, Global>; fn owner_references(&self) -> &[OwnerReference]; fn owner_references_mut(&mut self) -> &mut Vec<OwnerReference, Global>; fn finalizers(&self) -> &[String]; fn finalizers_mut(&mut self) -> &mut Vec<String, Global>; fn managed_fields(&self) -> &[ManagedFieldsEntry]; fn managed_fields_mut(&mut self) -> &mut Vec<ManagedFieldsEntry, Global>;
}
Expand description

Helper methods for resources.

Required Methods

👎Deprecated since 0.74.0:

ResourceExt::name can panic and has been replaced by ResourceExt::name_any and ResourceExt::name_unchecked. This fn will be removed in 0.77.0.

Deprecated fn equivalent to name_unchecked

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.

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.

The namespace the resource is in

The resource version

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

Returns the creation timestamp

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

Returns resource labels

Provides mutable access to the labels

Returns resource annotations

Provider mutable access to the annotations

Returns resource owner references

Provides mutable access to the owner references

Returns resource finalizers

Provides mutable access to the finalizers

Returns managed fields

Provides mutable access to managed fields

Implementors