Ptolemy v0.2.0 Ptolemy.Engines.KV View Source
Ptolemy.Engines.KV
provides a public facing API for CRUD operations for the Vault KV2 engine.
Link to this section Summary
Functions
Creates a secret according to the path specified in the :kv_engine
specification
Creates a secret according to the path specified in the ":kv_engine" specification, errors out if an error occurs
Deletes a secific version of a secret via the :kv_engine
configuration
Deletes a secific version of a secret via the :kv_engine
configuration, errors out if an errors occurs
Destroys a secific version of a secret via the :kv_engine
configuration
Destroys a secific version of a secret via the :kv_engine
configuration, errors out if an error occurs
Creates a new secret via a KV engine at the specified path
Deletes a secific version of a secret at a specified path
Destroys a specific version of secret at a specified path
Fetches all of a given secret's key and values from a KV engine via the specified path
Updates an already existing secret via the specified path
Fetches all of a secret's keys and value via the :kv_engine
configuration
Fetches all of a secret's keys and value via the :kv_engine
configuration, errors out if an error occurs
Updates an already existing secret via the :kv_engine
configuration
Updates an already existing secret via the :kv_engine
configuration, errors out if an error occurs
Link to this section Functions
create(server_name, engine_name, secret, payload, cas \\ nil) View Source
Creates a secret according to the path specified in the :kv_engine
specification.
Example
iex(2)> Ptolemy.Engines.KV.create(:production, :engine1, :ptolemy, %{test: "i was created from config"})
{:ok, "KV secret created"}
create!(server_name, engine_name, secret, payload, cas \\ nil) View Source
Creates a secret according to the path specified in the ":kv_engine" specification, errors out if an error occurs.
delete(server_name, engine_name, secret, vers, destroy \\ false) View Source
Deletes a secific version of a secret via the :kv_engine
configuration.
Specifying false under the destroy paramter will "delete" the secret (secret will be sent to recyling bin), sepcifying true will permanently destroy the secret.
iex(2)> Ptolemy.Engines.KV.delete(:production, :engine1, :ptolemy, [1,2], false)
{:ok, "KV secret deleted"}
delete!(server_name, engine_name, secret, vers, destroy \\ false) View Source
Deletes a secific version of a secret via the :kv_engine
configuration, errors out if an errors occurs.
destroy(server_name, engine_name, secret, vers) View Source
Destroys a secific version of a secret via the :kv_engine
configuration.
iex(2)> Ptolemy.Engines.KV.destroy(:production, :engine1, :ptolemy, [1,2])
{:ok, "KV secret destroyed"}
destroy!(server_name, engine_name, secret, vers) View Source
Destroys a secific version of a secret via the :kv_engine
configuration, errors out if an error occurs.
path_create(server_name, secret, payload, cas \\ nil) View Source
Creates a new secret via a KV engine at the specified path.
Example
iex(2)> Ptolemy.Engines.KV.path_create(:production, "secret/data/new", %{test: "i am created from path"})
{:ok, "KV secret created"}
path_delete(server_name, secret, vers) View Source
Deletes a secific version of a secret at a specified path.
iex(2)> Ptolemy.Engines.KV.path_delete(:production, "secret/delete/ptolemy", [1,2])
{:ok, "KV secret deleted"}
path_destroy(server_name, secret, vers) View Source
Destroys a specific version of secret at a specified path.
iex(2)> Ptolemy.Engines.KV.path_destroy(:production, "secret/destroy/ptolemy", [1,2])
{:ok, "KV secret destroyed"}
path_read(server_name, secret, silent \\ false, version \\ 0) View Source
Fetches all of a given secret's key and values from a KV engine via the specified path.
This function returns the full reponse of the remote vault server, enabling the silent option will only return a map with the key and value of the secret. The version option will allow you to fetch specific version of the target secret.
Example
iex(2)> Ptolemy.Engines.KV.path_read(:production, "secret/data/ptolemy")
{:ok, %{
"Foo" => test"
...
}
}
path_update(server_name, secret, payload, cas \\ nil) View Source
Updates an already existing secret via the specified path.
Example
iex(2)> Ptolemy.Engines.KV.path_update(:production, "secret/data/ptolemy", %{test: "i am up-to-date from path"}, 1)
{:ok, "KV secret updated"}
read(server_name, engine_name, secret, silent \\ false, version \\ 0) View Source
Fetches all of a secret's keys and value via the :kv_engine
configuration.
See fetch/2
for the description of the silent and version options.
Example
iex(2)> Ptolemy.Engines.KV.read(:production, :engine1, :ptolemy)
{:ok, %{
"test" => i am some value"
...
}
}
read!(server_name, engine_name, secret, silent \\ false, version \\ 0) View Source
Fetches all of a secret's keys and value via the :kv_engine
configuration, errors out if an error occurs.
update(server_name, engine_name, secret, payload, cas \\ nil) View Source
Updates an already existing secret via the :kv_engine
configuration.
Example
iex(2)> Ptolemy.Engines.KV.update(:production, :engine1, :ptolemy, %{test: "i am a new value from config"})
{:ok, "KV secret updated"}
update!(server_name, engine_name, secret, payload, cas \\ nil) View Source
Updates an already existing secret via the :kv_engine
configuration, errors out if an error occurs.