ExDoppler.Environments (ExDoppler v1.0.1)

View Source

Module for interacting with ExDoppler.Environment

๐Ÿ“– Resources

Summary

Functions

Same as delete_environment/1 but won't wrap a successful response in {:ok, response}

Same as get_environment/2 but won't wrap a successful response in {:ok, response}

Same as list_environments/2 but won't wrap a successful response in {:ok, response}

Updates an ExDoppler.Environment, given a project name, a env slug and options detailing modifications

Same as update_environment/2 but won't wrap a successful response in {:ok, response}

Functions

create_environment(project, env_name, env_slug, enable_personal_config \\ false)

Creates a new ExDoppler.Environment

๐Ÿท๏ธ Params

  • project_name: The relevant project name (e.g "example-project")
  • env_name: A new environment's name (e.g "prd")
  • env_slug: A new environment's slug (e.g "prd")
  • enable_personal_config: Optional setting if this environment has personal configs (default: false)

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Environment{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Environments
iex> alias ExDoppler.Environment
iex> alias ExDoppler.Projects
iex> [project | _] = Projects.list_projects!()
iex> _ = Environments.delete_environment(%Environment{project: project.name, slug: "envdoc"})
iex> {:ok, env} = Environments.create_environment(project, "envdoc", "envdoc")
iex> :ok = Environments.delete_environment!(env)

๐Ÿ“– Resources

create_environment!(project, env_name, env_slug, enable_personal_config \\ false)

Same as create_environment/4 but won't wrap a successful response in {:ok, response}

delete_environment(environment)

Deletes a ExDoppler.Environment

๐Ÿท๏ธ Params

  • environment: The relevant environment (e.g %Environment{project: "example-project", slug: "dev" ...})

โคต๏ธ Returns

โœ… On Success

  {:ok, {:success, true}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Environments
iex> alias ExDoppler.Environment
iex> alias ExDoppler.Projects
iex> [project | _] = Projects.list_projects!()
iex> _ = Environments.delete_environment(%Environment{project: project.name, slug: "envdoc"})
iex> {:ok, env} = Environments.create_environment(project, "envdoc", "envdoc")
iex> {:ok, {:success, true}} = Environments.delete_environment(env)

๐Ÿ“– Resources

delete_environment!(environment)

Same as delete_environment/1 but won't wrap a successful response in {:ok, response}

get_environment(project, environment_slug)

Retrieves a ExDoppler.Environment

๐Ÿท๏ธ Params

  • project_name: The relevant project name (e.g "example-project")
  • config_name: The environment to get (e.g "dev")

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Environment{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Environments
iex> alias ExDoppler.Projects
iex> [project | _] = Projects.list_projects!()
iex> {:ok, _env} = Environments.get_environment(project, "dev")

๐Ÿ“– Resources

get_environment!(project, environment_slug)

Same as get_environment/2 but won't wrap a successful response in {:ok, response}

list_environments(project, opts \\ [])

Lists ExDoppler.Environment using pagination.

๐Ÿท๏ธ Params

  • project: The ExDoppler.Project for which you want the environments (e.g %Project{name: "example-project"})
  • opts: Optional modifications to the list call
    • page - which page to list (starts at 1) (e.g page: 2). Default: 1
    • per_page - the number of ExDoppler.Environment to return for this page (e.g per_page: 50). Default: 20

โคต๏ธ Returns

โœ… On Success

  {:ok, [%ExDoppler.Environment{...}]}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Environments
iex> alias ExDoppler.Projects
iex> [project | _] = Projects.list_projects!()
iex> {:ok, _envs} = Environments.list_environments(project, page: 1, per_page: 20)

๐Ÿ“– Resources

list_environments!(project, opts \\ [])

Same as list_environments/2 but won't wrap a successful response in {:ok, response}

update_environment(environment, opts \\ [])

Updates an ExDoppler.Environment, given a project name, a env slug and options detailing modifications

๐Ÿท๏ธ Params

  • environment: The relevant environment (e.g %Environment{project: "example-project", slug: "dev" ...})
  • opts: Optional modifications
    • name - New name for this environment
    • slug - New slug for this environment
    • personal_configs - If set true, will enable personal configs

โคต๏ธ Returns

โœ… On Success

  {:ok, %ExDoppler.Environment{...}}

โŒ On Failure

  {:error, err}

๐Ÿ’ป Examples

iex> alias ExDoppler.Environments
iex> alias ExDoppler.Environment
iex> alias ExDoppler.Projects
iex> [project | _] = Projects.list_projects!()
iex> _ = Environments.delete_environment(%Environment{project: project.name, slug: "envdoc"})
iex> _ = Environments.delete_environment(%Environment{project: project.name, slug: "envdoc2"})
iex> {:ok, env} = Environments.create_environment(project, "envdoc", "envdoc")
iex> {:ok, updated} = Environments.update_environment(env, name: "envdoc2", personal_configs: true)
iex> :ok = Environments.delete_environment!(updated)

๐Ÿ“– Resources

update_environment!(environment, opts \\ [])

Same as update_environment/2 but won't wrap a successful response in {:ok, response}