View Source Bonny.API.CRD (bonny v1.4.0)
A Custom Resource Definition.
The %Bonny.API.CRD{}
struct contains the fields group
, resource_type
,
scope
and version
. New definitions can be created directly, using the
new!/1
function.
Summary
Functions
Build a map of names form the given kind.
Creates a new %Bonny.API.CRD{} struct from the given values. :scope
is
optional and defaults to :Namespaced
.
Converts the internally used structure to a map representing a kubernetes CRD manifest.
Types
@type names_t() :: %{ :singular => binary(), :plural => binary(), :kind => binary(), optional(:shortNames) => [binary()] }
Defines the names section of the CRD.
plural
: name to be used in the URL: /apis/<group>/<version>/<plural> - e.g. crontabssingular
: singular name to be used as an alias on the CLI and for display - e.g. crontabkind
: is normally the CamelCased singular type. Your resource manifests use this. - e.g. CronTabshortnames
: allow shorter string to match your resource on the CLI - e.g. [ct]
@type t() :: %Bonny.API.CRD{ group: binary(), names: names_t(), scope: :Namespaced | :Cluster, versions: [module()] }
A Custom Resource Definition.
scope
: either Namespaced or Clustergroup
: group name to use for REST API: /apis/<group>/<version>, defaults to the group in config.exsnames
: seenames_t
versions
: list of API Version modules for this Resource, defaults to the versions in config.exs
Functions
See Map.fetch/2
.
See Map.get/3
.
See Map.get_and_update/3
.
Build a map of names form the given kind.
Examples
iex> Bonny.API.CRD.kind_to_names("SomeKind")
%{singular: "somekind", plural: "somekinds", kind: "SomeKind", shortNames: []}
The :inflex
library is used to generate the plural form.
iex> Bonny.API.CRD.kind_to_names("Hero")
%{singular: "hero", plural: "heroes", kind: "Hero", shortNames: []}
Accepts an optional list of abbreviations as second argument.
iex> Bonny.API.CRD.kind_to_names("SomeKind", ["sk", "some"])
%{singular: "somekind", plural: "somekinds", kind: "SomeKind", shortNames: ["sk", "some"]}
Creates a new %Bonny.API.CRD{} struct from the given values. :scope
is
optional and defaults to :Namespaced
.
Converts the internally used structure to a map representing a kubernetes CRD manifest.