diplomat v0.3.1 Diplomat.Key

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 king, 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

Types

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

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.

Functions

allocate_ids(type, count \\ 1)
complete?(k)
complete?(t) :: boolean
from_allocate_ids_proto(allocate_ids_response)
from_commit_proto(commit_response)
from_commit_proto(Diplomat.Proto.CommitResponse.t) :: t
from_path(path)
from_path([String.t] | [[String.t]]) :: 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.

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

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

from_urlsafe(value)
get(keys)
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.

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

Creates a new Diplomat.Key from a kind

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

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

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

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

path(key)
path(t) :: [[String.t, ...]]

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

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 instaed returns a Diplomat.Proto.Key struct (which is later converted to the binary format).

urlsafe(key)