pub struct RepositoryRef {
pub kind: RepositoryKind,
pub name: String,
pub namespace: Option<String>,
}Expand description
Reference from a consumer CR to a Repository or ClusterRepository.
Fields§
§kind: RepositoryKindWhich repository CRD this points at; defaults to RepositoryKind::Repository.
name: StringName of the referenced Repository/ClusterRepository.
namespace: Option<String>Cross-namespace Repository reference; ignored/forbidden for ClusterRepository.
Implementations§
Source§impl RepositoryRef
impl RepositoryRef
Sourcepub fn resolves_to(
&self,
owner_namespace: &str,
target_kind: RepositoryKind,
target_name: &str,
target_namespace: Option<&str>,
) -> bool
pub fn resolves_to( &self, owner_namespace: &str, target_kind: RepositoryKind, target_name: &str, target_namespace: Option<&str>, ) -> bool
True if this reference points at the given repository.
owner_namespace is the namespace of the resource that holds the ref
(e.g. the Maintenance CR’s own namespace), used to resolve a namespaced
Repository reference that omits namespace. The match is exhaustive over
RepositoryKind (ADR §5.5):
RepositoryKind::Repository: kind+name must match AND the effective namespace (self.namespaceorowner_namespace) must equaltarget_namespace.RepositoryKind::ClusterRepository: kind+name must match; namespace is ignored on both sides (cluster-scoped).
target_namespace is None for a ClusterRepository target.
use kopiur_api::common::{RepositoryKind, RepositoryRef};
// A namespaced ref that omits `namespace` resolves against the owner's namespace.
let r = RepositoryRef { kind: RepositoryKind::Repository, name: "nas".into(), namespace: None };
assert!(r.resolves_to("apps", RepositoryKind::Repository, "nas", Some("apps")));
assert!(!r.resolves_to("apps", RepositoryKind::Repository, "nas", Some("other")));
// A cluster-scoped target ignores namespace entirely.
let cr = RepositoryRef {
kind: RepositoryKind::ClusterRepository,
name: "hetzner".into(),
namespace: None,
};
assert!(cr.resolves_to("apps", RepositoryKind::ClusterRepository, "hetzner", None));
// Kind must match even when names collide.
assert!(!r.resolves_to("apps", RepositoryKind::ClusterRepository, "nas", None));Trait Implementations§
Source§impl Clone for RepositoryRef
impl Clone for RepositoryRef
Source§fn clone(&self) -> RepositoryRef
fn clone(&self) -> RepositoryRef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RepositoryRef
impl Debug for RepositoryRef
Source§impl<'de> Deserialize<'de> for RepositoryRef
impl<'de> Deserialize<'de> for RepositoryRef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for RepositoryRef
impl JsonSchema for RepositoryRef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for RepositoryRef
impl PartialEq for RepositoryRef
Source§fn eq(&self, other: &RepositoryRef) -> bool
fn eq(&self, other: &RepositoryRef) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RepositoryRef
impl Serialize for RepositoryRef
impl Eq for RepositoryRef
impl StructuralPartialEq for RepositoryRef
Auto Trait Implementations§
impl Freeze for RepositoryRef
impl RefUnwindSafe for RepositoryRef
impl Send for RepositoryRef
impl Sync for RepositoryRef
impl Unpin for RepositoryRef
impl UnsafeUnpin for RepositoryRef
impl UnwindSafe for RepositoryRef
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
Attempts to downcast this to
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Attempts to downcast owned
Self to T,
useful only in generic context as a workaround for specializationSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more