k8s v0.2.12 K8s.Operation

Encapsulates a k8s swagger operations.

  • method is the HTTP method
  • verb is the kubernetes REST API verb (deletecollection, update, create, watch, etc)

Link to this section Summary

Functions

Builds an Operation given an verb and a k8s resource.

Builds an Operation given an verb and a k8s resource info

Link to this section Types

Link to this type

t()
t() :: %K8s.Operation{
  group_version: binary(),
  kind: binary() | atom(),
  method: atom(),
  path_params: keyword(atom()),
  resource: map(),
  verb: atom()
}

Link to this section Functions

Link to this function

build(verb, resource)
build(atom(), map()) :: K8s.Operation.t()

Builds an Operation given an verb and a k8s resource.

Examples

iex> deploy = %{"apiVersion" => "apps/v1", "kind" => "Deployment", "metadata" => %{"namespace" => "default", "name" => "nginx"}}
...> K8s.Operation.build(:put, deploy)
%K8s.Operation{
  method: :put,
  verb: :put,
  resource: %{"apiVersion" => "apps/v1", "kind" => "Deployment", "metadata" => %{"namespace" => "default", "name" => "nginx"}},
  path_params: [namespace: "default", name: "nginx"],
  group_version: "apps/v1",
  kind: "Deployment"
}
Link to this function

build(verb, group_version, kind, path_params, resource \\ nil)
build(atom(), binary(), atom() | binary(), keyword(), map() | nil) ::
  K8s.Operation.t()

Builds an Operation given an verb and a k8s resource info

Examples

iex> K8s.Operation.build(:get, "apps/v1", :deployment, [namespace: "default", name: "nginx"])
%K8s.Operation{
  method: :get,
  verb: :get,
  resource: nil,
  path_params: [namespace: "default", name: "nginx"],
  group_version: "apps/v1",
  kind: :deployment
}