View Source K8s.Resource.FieldAccessors (k8s v1.1.1)
Helper functions for accessing common fields
Link to this section Summary
Functions
Returns the value of a k8s resource's annotation.
Returns the annotations of k8s resource.
Returns the apiVersion of k8s resource.
Check if an annotation is present.
Check if a label is present.
Returns the kind of k8s resource.
Returns the value of a k8s resource's label.
Returns the labels of k8s resource.
Returns the metadata of k8s resource.
Returns the name of k8s resource.
Returns the namespace of k8s resource.
Link to this section Functions
Specs
Returns the value of a k8s resource's annotation.
examples
Examples
iex> K8s.Resource.FieldAccessors.annotation(%{"metadata" => %{"annotations" => %{"env" => "test"}}}, "env")
"test"
Specs
Returns the annotations of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.annotations(%{"metadata" => %{"annotations" => %{"env" => "test"}}})
%{"env" => "test"}
Specs
Returns the apiVersion of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.api_version(%{"apiVersion" => "apps/v1"})
"apps/v1"
Specs
Check if an annotation is present.
examples
Examples
iex> K8s.Resource.FieldAccessors.has_annotation?(%{"metadata" => %{"annotations" => %{"env" => "test"}}}, "env")
true
iex> K8s.Resource.FieldAccessors.has_annotation?(%{"metadata" => %{"annotations" => %{"env" => "test"}}}, "foo")
false
Specs
Check if a label is present.
examples
Examples
iex> K8s.Resource.FieldAccessors.has_label?(%{"metadata" => %{"labels" => %{"env" => "test"}}}, "env")
true
iex> K8s.Resource.FieldAccessors.has_label?(%{"metadata" => %{"labels" => %{"env" => "test"}}}, "foo")
false
Specs
Returns the kind of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.kind(%{"kind" => "Deployment"})
"Deployment"
Specs
Returns the value of a k8s resource's label.
examples
Examples
iex> K8s.Resource.FieldAccessors.label(%{"metadata" => %{"labels" => %{"env" => "test"}}}, "env")
"test"
Specs
Returns the labels of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.labels(%{"metadata" => %{"labels" => %{"env" => "test"}}})
%{"env" => "test"}
Specs
Returns the metadata of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.metadata(%{"metadata" => %{"name" => "nginx", "namespace" => "foo"}})
%{"name" => "nginx", "namespace" => "foo"}
Specs
Returns the name of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.name(%{"metadata" => %{"name" => "nginx", "namespace" => "foo"}})
"nginx"
Specs
Returns the namespace of k8s resource.
examples
Examples
iex> K8s.Resource.FieldAccessors.namespace(%{"metadata" => %{"name" => "nginx", "namespace" => "foo"}})
"foo"