diplomat v0.11.2 Diplomat.Key

Link to this section Summary

Types

t()

A Key for uniquely identifying a Diplomat.Entity

Functions

Creates a new Diplomat.Key from a path. The path should be either a list with two elements or a list of lists of two elements. Each two element list represents a segment of the key path

Creates a new Diplomat.Key from a Diplomat.Proto.Key struct

Determines whether or not a Key is incomplete. This is most useful when figuring out whether or not we must first call the API to allocate an ID for the associated entity

Creates a new Diplomat.Key from a kind

Creates a new Diplomat.Key form a kind and a name

Creates a new Diplomat.Key from a kind, an id or name, and a parent Entity

Generates a path list ffor a given key. The path identifies the Enity's location nested within another Diplomat.Entity

Convert a Diplomat.Key to its protobuf struct

Link to this section Types

Link to this type

key_pair()
key_pair() :: [String.t() | integer() | nil]

Link to this type

t()
t() :: %Diplomat.Key{
  id: integer() | nil,
  kind: String.t(),
  name: String.t() | nil,
  namespace: String.t() | nil,
  parent: Diplomat.Key.t() | nil,
  project_id: String.t() | nil
}

A Key for uniquely identifying a Diplomat.Entity.

A Key must have a unique identifier, which is either a name or an id. Most often, if setting a unique identifier manually, you will use the name field. However, if neither a name nor an id is defined, Diplomat will auto-assign an id by calling the API to allocate an id for the Key.

Link to this section Functions

Link to this function

allocate_ids(type, count \\ 1)
allocate_ids(String.t(), pos_integer()) :: [t()] | Client.error()

Link to this function

complete?(k)
complete?(t()) :: boolean()

Link to this function

from_allocate_ids_proto(allocate_ids_response)
from_allocate_ids_proto(Diplomat.Proto.AllocateIdsResponse.t()) :: [t()]

Link to this function

from_commit_proto(commit_response)
from_commit_proto(Diplomat.Proto.CommitResponse.t()) :: [t()]

Link to this function

from_path(path)
from_path(key_pair() | [key_pair()]) :: t()

Creates a new Diplomat.Key from a path. The path should be either a list with two elements or a list of lists of two elements. Each two element list represents a segment of the key path.

Link to this function

from_proto(arg1)
from_proto(nil | Diplomat.Proto.Key.t()) :: t()

Creates a new Diplomat.Key from a Diplomat.Proto.Key struct

Link to this function

get(keys)
get([t()] | t()) :: [Entity.t()] | Client.error()

Link to this function

incomplete?(key)
incomplete?(t()) :: boolean()

Determines whether or not a Key is incomplete. This is most useful when figuring out whether or not we must first call the API to allocate an ID for the associated entity.

Link to this function

new(kind)
new(String.t()) :: t()

Creates a new Diplomat.Key from a kind

Link to this function

new(kind, id)
new(String.t(), String.t() | integer()) :: t()

Creates a new Diplomat.Key form a kind and a name

Link to this function

new(kind, id_or_name, parent)
new(String.t(), String.t() | integer(), t()) :: t()

Creates a new Diplomat.Key from a kind, an id or name, and a parent Entity

Link to this function

path(key)
path(t()) :: [key_pair()]

Generates a path list ffor a given key. The path identifies the Enity's location nested within another Diplomat.Entity.

Link to this function

proto(key)
proto(nil | t()) :: nil | Diplomat.Proto.Key.t()

Convert a Diplomat.Key to its protobuf struct.

It should be noted that this function does not convert the struct to its binary representation, but instead returns a Diplomat.Proto.Key struct (which is later converted to the binary format).