Trait k8s_openapi::Resource

source ·
pub trait Resource {
    type Scope: ResourceScope;

    const API_VERSION: &'static str;
    const GROUP: &'static str;
    const KIND: &'static str;
    const VERSION: &'static str;
    const URL_PATH_SEGMENT: &'static str;
}
Expand description

A trait applied to all Kubernetes resources.

Required Associated Types§

Indicates whether the resource is namespace-scoped or cluster-scoped or a subresource.

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. For example, fn foo<T: k8s_openapi::Resource<Scope = k8s_openapi::ClusterResourceScope>>() { } can only be called with cluster-scoped resources.

Required Associated Constants§

The API version of the resource. This is a composite of Resource::GROUP and Resource::VERSION (eg "apiextensions.k8s.io/v1beta1") or just the version for resources without a group (eg "v1").

This is the string used in the apiVersion field of the resource’s serialized form.

The group of the resource, or the empty string if the resource doesn’t have a group.

The kind of the resource.

This is the string used in the kind field of the resource’s serialized form.

The version of the resource.

The URL path segment used to construct URLs related to this resource.

For cluster- and namespaced-scoped resources, this is the plural name of the resource that is followed by the resource name. For example, api::core::v1::Pod’s value is "pods" and its URLs look like .../pods/{name}.

For subresources, this is the subresource name that comes after the parent resource’s name. For example, api::authentication::v1::TokenRequest’s value is "token", and its URLs look like .../serviceaccounts/{name}/token.

Implementors§