diplomat v0.11.2 Diplomat.Key
Link to this section Summary
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
key_pair()
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
allocate_ids(type, count \\ 1)
allocate_ids(String.t(), pos_integer()) :: [t()] | Client.error()
allocate_ids(String.t(), pos_integer()) :: [t()] | Client.error()
complete?(k)
from_allocate_ids_proto(allocate_ids_response)
from_allocate_ids_proto(Diplomat.Proto.AllocateIdsResponse.t()) :: [t()]
from_allocate_ids_proto(Diplomat.Proto.AllocateIdsResponse.t()) :: [t()]
from_commit_proto(commit_response)
from_commit_proto(Diplomat.Proto.CommitResponse.t()) :: [t()]
from_commit_proto(Diplomat.Proto.CommitResponse.t()) :: [t()]
from_path(path)
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.
from_proto(arg1)
from_proto(nil | Diplomat.Proto.Key.t()) :: t()
from_proto(nil | Diplomat.Proto.Key.t()) :: t()
Creates a new Diplomat.Key
from a Diplomat.Proto.Key
struct
get(keys)
incomplete?(key)
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.
new(kind)
Creates a new Diplomat.Key
from a kind
new(kind, id)
Creates a new Diplomat.Key
form a kind and a name
new(kind, id_or_name, parent)
Creates a new Diplomat.Key
from a kind, an id or name, and a parent Entity
path(key)
Generates a path list ffor a given key. The path identifies the Enity's
location nested within another Diplomat.Entity
.
proto(key)
proto(nil | t()) :: nil | Diplomat.Proto.Key.t()
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).