ExDoppler.Secrets (ExDoppler v1.0.1)
View SourceModule for interacting with ExDoppler.Secret
๐ Resources
- ๐ Doppler docs
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Summary
Functions
Same as create_secret/4
but won't wrap a successful response in {:ok, response}
Same as delete_secret/2
but won't wrap a successful response in {:ok, response}
Retrieves multiple ExDoppler.Secret
and responds in a format ready to put into a file
Same as download/2
but won't wrap a successful response in {:ok, response}
Retrieves a ExDoppler.Secret
Same as get_secret/2
but won't wrap a successful response in {:ok, response}
Lists the names of ExDoppler.Secret
Same as list_secret_names/2
but won't wrap a successful response in {:ok, response}
Same as list_secrets/2
but won't wrap a successful response in {:ok, response}
Same as update_secret/4
but won't wrap a successful response in {:ok, response}
Updates the note
field on a ExDoppler.Secret
Same as update_secret_note/3
but won't wrap a successful response in {:ok, response}
Functions
Creates a new ExDoppler.Secret
๐ท๏ธ Params
- config - Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - new_secret_name - Name of this new secret
- value - Value of this new secret
- opts: Optional modifications
- visibility - how the secret should appear -
:masked
,:unmasked
, or:restricted
. Default::masked
- visibility - how the secret should appear -
โคต๏ธ Returns
โ On Success
{:ok, %ExDoppler.Secret{...}}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> _ = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
iex> {:ok, _secret} = Secrets.create_secret(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL", "example.com")
iex> :ok = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as create_secret/4
but won't wrap a successful response in {:ok, response}
Deletes a ExDoppler.Secret
๐ท๏ธ Params
- config - Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - secret_name - Name of secret to delete
โคต๏ธ Returns
โ On Success
{:ok, {:success, true}}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> _ = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
iex> {:ok, _secret} = Secrets.create_secret(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL", "example.com")
iex> {:ok, {:success, true}} = Secrets.delete_secret(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as delete_secret/2
but won't wrap a successful response in {:ok, response}
Retrieves multiple ExDoppler.Secret
and responds in a format ready to put into a file
๐ท๏ธ Params
- config - Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - opts: Optional modifications to the download call
- include_dynamic_secrets - whether to include dynamic secrets. Default:
false
- dynamic_secrets_ttl_sec - The number of seconds until dynamic leases expire. Must be used with include_dynamic_secrets. Defaults to 1800 (30 minutes). Default:
nil
- format - File format to use. (e.g
"dotnet-json"
,"env"
,"yaml"
,"docker"
,"env-no-quotes"
) Default:json
- name_transformer - Transform secret names to a different case (e.g
"camel"
,"upper-camel"
,"lower-snake"
,"tf-var"
,"dotnet"
,"dotnet-env"
,"lower-kebab"
). Default:nil
- secrets - Comma-delimited list of secrets to include in the download. Defaults to all secrets if left unspecified.
- include_dynamic_secrets - whether to include dynamic secrets. Default:
โคต๏ธ Returns
โ On Success
{:ok, requested_body}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> {:ok, _formatted_body} = Secrets.download(%Config{name: "dev_personal", project: "example-project"}, format: :env, name_transformer: "lower-snake")
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as download/2
but won't wrap a successful response in {:ok, response}
Retrieves a ExDoppler.Secret
๐ท๏ธ Params
- config - Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - secret_name - Name of the secret to get (e.g
"API_KEY"
)
โคต๏ธ Returns
โ On Success
{:ok, %ExDoppler.Secret{...}}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> {:ok, _secret} = Secrets.get_secret(%Config{name: "dev_personal", project: "example-project"}, "DB_URL")
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as get_secret/2
but won't wrap a successful response in {:ok, response}
Lists the names of ExDoppler.Secret
๐ท๏ธ Params
- config - Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - opts: Optional modifications to the list call
- include_dynamic_secrets - whether to include dynamic secrets. Default:
false
- include_managed_secrets - whether to include managed secrets. Default:
true
- include_dynamic_secrets - whether to include dynamic secrets. Default:
โคต๏ธ Returns
โ On Success
{:ok, names}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> {:ok, _names} = Secrets.list_secret_names(%Config{name: "dev_personal", project: "example-project"})
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as list_secret_names/2
but won't wrap a successful response in {:ok, response}
Lists ExDoppler.Secret
๐ท๏ธ Params
- config: Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - opts: Optional modifications to the list call
- include_dynamic_secrets - whether to include dynamic secrets. Default:
false
- include_managed_secrets - whether to include dynamic secrets. Default:
true
- secrets - A comma-separated list of secrets to include in the response. Default:
nil
- include_dynamic_secrets - whether to include dynamic secrets. Default:
โคต๏ธ Returns
โ On Success
{:ok, [%ExDoppler.Secret{...} ...]}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Configs
iex> alias ExDoppler.Projects
iex> alias ExDoppler.Secrets
iex> [project | _] = Projects.list_projects!()
iex> [config | _] = Configs.list_configs!(project)
iex> {:ok, _secrets} = Secrets.list_secrets(config)
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as list_secrets/2
but won't wrap a successful response in {:ok, response}
Updates a ExDoppler.Secret
๐ท๏ธ Params
- config - Config to get secrets from (e.g
%Config{name: "dev_personal", project: "example-project" ...}
) - secret_name - Name of this secret
- value - Value of this secret
- opts: Optional modifications
- visibility - how the secret should appear -
:masked
,:unmasked
, or:restricted
. Default::masked
- should_promote - Defaults to false. Can only be set to true if the config being updated is a branch config. If set to true, the provided secret will be set in both the branch config as well as the root config in that environment.
- should_delete - Defaults to false. If set to true, will delete the secret matching the name field.
- should_converge - Defaults to false. Can only be set to true if the config being updated is a branch config and there is a secret with the same name in the root config. In this case, the branch secret will inherit the value and visibility type from the root secret.
- visibility - how the secret should appear -
โคต๏ธ Returns
โ On Success
{:ok, %ExDoppler.Secret{...}}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> _ = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
iex> {:ok, _secret} = Secrets.create_secret(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL", "example.com")
iex> {:ok, _secret} = Secrets.update_secret(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL", "example.com2", visibility: :unmasked)
iex> :ok = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as update_secret/4
but won't wrap a successful response in {:ok, response}
Updates the note
field on a ExDoppler.Secret
๐ท๏ธ Params
- project_name - Name of the associated project (e.g
"example-project"
) - secret_name - Name of this secret
- note - Attached Note
โคต๏ธ Returns
โ On Success
{:ok, %{note: note secret: %ExDoppler.Secret{...}}}
โ On Failure
{:error, err}
๐ป Examples
iex> alias ExDoppler.Config
iex> alias ExDoppler.Secrets
iex> _ = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
iex> {:ok, _secret} = Secrets.create_secret(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL", "example.com")
iex> {:ok, _secret} = Secrets.update_secret_note("example-project", "DOC_URL", "a new note")
iex> :ok = Secrets.delete_secret!(%Config{name: "dev_personal", project: "example-project"}, "DOC_URL")
๐ Resources
- ๐ Doppler API docs
- ๐ฌ Contact the maintainer (he's happy to help!)
Same as update_secret_note/3
but won't wrap a successful response in {:ok, response}