# Environments

## Reference

- v4 API:
  - `gitlab.v4.objects.ProjectEnvironment`
  - `gitlab.v4.objects.ProjectEnvironmentManager`
  - `gitlab.v4.objects.Project.environments`
- v3 API:
  - `gitlab.v3.objects.ProjectEnvironment`
  - `gitlab.v3.objects.ProjectEnvironmentManager`
  - `gitlab.v3.objects.Project.environments`
  - `gitlab.Gitlab.project_environments`
- GitLab API: https://docs.gitlab.com/ce/api/environments.html

## Examples

List environments for a project:

    environments = project.environments.list()

Get a single environment:

    environment = project.environments.get(environment_id)

Create an environment for a project:

    environment = project.environments.create({'name': 'production'})

Update an environment for a project:

    environment.external_url = 'http://foo.bar.com'
    environment.save()

Delete an environment for a project:

    environment = project.environments.delete(environment_id)
    # or
    environment.delete()