Environments

Use ProjectEnvironment objects to manipulate environments for projects. The gitlab.Gitlab.project_environments and Project.environments manager objects provide helper functions.

Examples

List environments for a project:

environments = gl.project_environments.list(project_id=1)
# or
environments = project.environments.list()

Get a single environment:

environment = gl.project_environments.get(environment_id, project_id=1)
# or
environment = project.environments.get(environment_id)

Create an environment for a project:

environment = gl.project_environments.create({'name': 'production'},
                                             project_id=1)
# or
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 = gl.project_environments.delete(environment_id, project_id=1)
# or
environment = project.environments.list(environment_id)
# or
environment.delete()