Struct kube_runtime::reflector::ObjectRef [−][src]
pub struct ObjectRef<K: Resource> { pub name: String, pub namespace: Option<String>, // some fields omitted }
Expand description
A typed and namedspaced (if relevant) reference to a Kubernetes object
K
may be either the object type or DynamicObject
, in which case the
type is stored at runtime. Erased ObjectRef
s pointing to different types
are still considered different.
use kube_runtime::reflector::ObjectRef; use k8s_openapi::api::core::v1::{ConfigMap, Secret}; assert_ne!( ObjectRef::<ConfigMap>::new("a").erase(), ObjectRef::<Secret>::new("a").erase(), );
Fields
name: String
The name of the object
namespace: Option<String>
The namespace of the object
May only be None
if the kind is cluster-scoped (not located in a namespace).
Note that it is acceptable for an ObjectRef
to a cluster-scoped resource to
have a namespace. These are, however, not considered equal:
assert_ne!(ObjectRef::<ConfigMap>::new("foo"), ObjectRef::new("foo").within("bar"));
Implementations
Creates ObjectRef
from the resource and dynamic type.
Panics if name is missing (name always exists if the object
was returned from the apiserver)
pub fn from_owner_ref(
namespace: Option<&str>,
owner: &OwnerReference,
dyntype: K::DynamicType
) -> Option<Self>
[src]
pub fn from_owner_ref(
namespace: Option<&str>,
owner: &OwnerReference,
dyntype: K::DynamicType
) -> Option<Self>
[src]Create an ObjectRef
from an OwnerReference
Returns None
if the types do not match.
Convert into a reference to K2
Note that no checking is done on whether this conversion makes sense. For example, every Service
has a corresponding Endpoints
, but it wouldn’t make sense to convert a Pod
into a Deployment
.
Trait Implementations
Auto Trait Implementations
impl<K> RefUnwindSafe for ObjectRef<K> where
<K as Resource>::DynamicType: RefUnwindSafe,
impl<K> UnwindSafe for ObjectRef<K> where
<K as Resource>::DynamicType: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more