File: status_checks.rst

package info (click to toggle)
python-gitlab 1%3A8.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,884 kB
  • sloc: python: 25,823; makefile: 171; ruby: 27; javascript: 3
file content (57 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
#######################
External Status Checks
#######################

Manage external status checks for projects and merge requests.


Project external status checks
===============================

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectExternalStatusCheck`
  + :class:`gitlab.v4.objects.ProjectExternalStatusCheckManager`
  + :attr:`gitlab.v4.objects.Project.external_status_checks`

* GitLab API: https://docs.gitlab.com/api/status_checks

Examples
---------

List external status checks for a project::

    status_checks = project.external_status_checks.list(get_all=True)

Create an external status check with shared secret::

    status_checks = project.external_status_checks.create({
        "name": "mr_blocker",
        "external_url": "https://example.com/mr-status-check",
        "shared_secret": "secret-string"
    })

Create an external status check with shared secret for protected branches::

    protected_branch = project.protectedbranches.get('main')

    status_check = project.external_status_checks.create({
        "name": "mr_blocker",
        "external_url": "https://example.com/mr-status-check",
        "shared_secret": "secret-string",
        "protected_branch_ids": [protected_branch.id]
    })


Update an external status check::

    status_check.external_url = "https://example.com/mr-blocker"
    status_check.save()

Delete an external status check::

    status_check.delete(status_check_id)