k8s_pb/
lib.rs

1pub mod api;
2pub mod apiextensions_apiserver;
3pub mod apimachinery;
4pub mod kube_aggregator;
5pub mod metrics;
6
7#[doc = r" The scope of a [`Resource`]."]
8pub trait ResourceScope {}
9#[doc = r" Indicates that a [`Resource`] is cluster-scoped."]
10pub struct ClusterResourceScope {}
11impl ResourceScope for ClusterResourceScope {}
12#[doc = r" Indicates that a [`Resource`] is namespace-scoped."]
13pub struct NamespaceResourceScope {}
14impl ResourceScope for NamespaceResourceScope {}
15#[doc = r" Indicates that a [`Resource`] is neither cluster-scoped nor namespace-scoped."]
16pub struct SubResourceScope {}
17impl ResourceScope for SubResourceScope {}
18#[doc = r" A trait applied to all Kubernetes resources."]
19pub trait Resource {
20    #[doc = r#" The API version of the resource. This is a composite of [`Resource::GROUP`] and [`Resource::VERSION`] (eg `"apiextensions.k8s.io/v1beta1"`)"#]
21    #[doc = r#" or just the version for resources without a group (eg `"v1"`)."#]
22    #[doc = r""]
23    #[doc = r" This is the string used in the `apiVersion` field of the resource's serialized form."]
24    const API_VERSION: &'static str;
25    #[doc = r" The group of the resource, or the empty string if the resource doesn't have a group."]
26    const GROUP: &'static str;
27    #[doc = r" The kind of the resource."]
28    #[doc = r""]
29    #[doc = r" This is the string used in the `kind` field of the resource's serialized form."]
30    const KIND: &'static str;
31    #[doc = r" The version of the resource."]
32    const VERSION: &'static str;
33    #[doc = r" The URL path segment used to construct URLs related to this resource."]
34    #[doc = r""]
35    #[doc = r" For cluster- and namespaced-scoped resources, this is the plural name of the resource that is followed by the resource name."]
36    #[doc = r#" For example, [`api::core::v1::Pod`](crate::api::core::v1::Pod)'s value is `"pods"` and its URLs look like `.../pods/{name}`."#]
37    #[doc = r""]
38    #[doc = r" For subresources, this is the subresource name that comes after the parent resource's name."]
39    #[doc = r#" For example, [`api::authentication::v1::TokenRequest`](crate::api::authentication::v1::TokenRequest)'s value is `"token"`,"#]
40    #[doc = r" and its URLs look like `.../serviceaccounts/{name}/token`."]
41    const URL_PATH_SEGMENT: &'static str;
42    #[doc = r" Indicates whether the resource is namespace-scoped or cluster-scoped or a subresource."]
43    #[doc = r""]
44    #[doc = r" If you need to restrict some generic code to resources of a specific scope, use this associated type to create a bound on the generic."]
45    #[doc = r" For example, `fn foo<T: k8s_openapi::Resource<Scope = k8s_openapi::ClusterResourceScope>>() { }` can only be called with cluster-scoped resources."]
46    type Scope: ResourceScope;
47}
48#[doc = r" A trait applied to all Kubernetes resources that have Metadata"]
49pub trait Metadata: Resource {
50    type Ty;
51    fn metadata(&self) -> Option<&Self::Ty>;
52    fn metadata_mut(&mut self) -> Option<&mut Self::Ty>;
53}
54pub trait HasSpec {
55    type Spec;
56    fn spec(&self) -> Option<&Self::Spec>;
57    fn spec_mut(&mut self) -> Option<&mut Self::Spec>;
58}
59pub trait HasStatus {
60    type Status;
61    fn status(&self) -> Option<&Self::Status>;
62    fn status_mut(&mut self) -> Option<&mut Self::Status>;
63}
64pub trait HasConditions {
65    type Condition;
66    fn conditions(&self) -> Option<&[Self::Condition]>;
67    fn conditions_mut(&mut self) -> Option<&mut Vec<Self::Condition>>;
68}