pub struct ObjectReference {
pub kind: Option<String>,
pub namespace: Option<String>,
pub name: Option<String>,
pub uid: Option<String>,
pub api_version: Option<String>,
pub resource_version: Option<String>,
pub field_path: Option<String>,
}
Expand description
§ObjectReference contains enough information to let you inspect or modify the referred object.
New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs.
- Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage.
- Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular restrictions like, “must refer only to types A and B” or “UID not honored” or “name must be restricted”. Those cannot be well described when embedded.
- Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen.
- The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple and the version of the actual struct is irrelevant.
- We cannot easily change it. Because this type is embedded in many locations, updates to this type will affect numerous schemas. Don’t make new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used type that is well-focused on your reference. For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 . +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +structType=atomic
Fields§
§kind: Option<String>
Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds +optional
namespace: Option<String>
Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/ +optional
name: Option<String>
Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names +optional
uid: Option<String>
UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids +optional
api_version: Option<String>
API version of the referent. +optional
resource_version: Option<String>
Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency +optional
field_path: Option<String>
If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: “spec.containers{name}” (where “name” refers to the name of the container that triggered the event) or if no container name is specified “spec.containers[2]” (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future. +optional
Implementations§
Source§impl ObjectReference
impl ObjectReference
Sourcepub fn namespace(&self) -> &str
pub fn namespace(&self) -> &str
Returns the value of namespace
, or the default value if namespace
is unset.
Sourcepub fn api_version(&self) -> &str
pub fn api_version(&self) -> &str
Returns the value of api_version
, or the default value if api_version
is unset.
Sourcepub fn resource_version(&self) -> &str
pub fn resource_version(&self) -> &str
Returns the value of resource_version
, or the default value if resource_version
is unset.
Sourcepub fn field_path(&self) -> &str
pub fn field_path(&self) -> &str
Returns the value of field_path
, or the default value if field_path
is unset.
Trait Implementations§
Source§impl Clone for ObjectReference
impl Clone for ObjectReference
Source§fn clone(&self) -> ObjectReference
fn clone(&self) -> ObjectReference
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ObjectReference
impl Debug for ObjectReference
Source§impl Default for ObjectReference
impl Default for ObjectReference
Source§impl Hash for ObjectReference
impl Hash for ObjectReference
Source§impl Message for ObjectReference
impl Message for ObjectReference
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self
.