File: environments.rst

package info (click to toggle)
python-gitlab 1%3A4.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,048 kB
  • sloc: python: 24,168; makefile: 171; ruby: 27; javascript: 3
file content (46 lines) | stat: -rw-r--r-- 984 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
############
Environments
############

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectEnvironment`
  + :class:`gitlab.v4.objects.ProjectEnvironmentManager`
  + :attr:`gitlab.v4.objects.Project.environments`

* GitLab API: https://docs.gitlab.com/ce/api/environments.html

Examples
--------

List environments for a project::

    environments = project.environments.list()

Create an environment for a project::

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

Retrieve a specific environment for a project::

    environment = project.environments.get(112)

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()

Stop an environment::

    environment.stop()

To manage protected environments, see :doc:`/gl_objects/protected_environments`.