From e04da8090e250f65ad74a9eeeab1d2bfbeb47a0f Mon Sep 17 00:00:00 2001 From: Patrick Bajao Date: Fri, 10 Jan 2020 14:06:13 +0800 Subject: [PATCH 1/2] Update protected_branches API doc to include `id` --- doc/api/protected_branches.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/protected_branches.md b/doc/api/protected_branches.md index 4a750b42f65f87..e6844536c333f1 100644 --- a/doc/api/protected_branches.md +++ b/doc/api/protected_branches.md @@ -34,6 +34,7 @@ Example response: ```json [ { + "id": 1, "name": "master", "push_access_levels": [ { @@ -61,6 +62,7 @@ Example response: ```json [ { + "id": 1, "name": "master", "push_access_levels": [ { @@ -105,6 +107,7 @@ Example response: ```json { + "id": 1, "name": "master", "push_access_levels": [ { @@ -129,6 +132,7 @@ Example response: ```json { + "id": 1, "name": "master", "push_access_levels": [ { @@ -179,6 +183,7 @@ Example response: ```json { + "id": 1, "name": "*-stable", "push_access_levels": [ { @@ -209,6 +214,7 @@ Example response: ```json { + "id": 1, "name": "*-stable", "push_access_levels": [ { @@ -251,6 +257,7 @@ Example response: ```json { + "id": 1, "name": "*-stable", "push_access_levels": [ { -- GitLab From 680ebafdf66c007dd27e0c33199bacb1a139ffbe Mon Sep 17 00:00:00 2001 From: Patrick Bajao Date: Mon, 20 Jan 2020 10:56:05 +0800 Subject: [PATCH 2/2] Update approval rules API doc to include new param Also include some information about the `protected_branches` property being present for GitLab Premium and above. --- doc/api/merge_request_approvals.md | 110 ++++++++++++++++++++++++----- 1 file changed, 94 insertions(+), 16 deletions(-) diff --git a/doc/api/merge_request_approvals.md b/doc/api/merge_request_approvals.md index 4552a56d808c29..4cee25f4680b9a 100644 --- a/doc/api/merge_request_approvals.md +++ b/doc/api/merge_request_approvals.md @@ -63,7 +63,8 @@ POST /projects/:id/approvals ### Get project-level rules -> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/11877) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.3. +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/11877) in [GitLab Starter](https://about.gitlab.com/pricing/) 12.3. +> - `protected_branches` property was [introduced](https://gitlab.com/gitlab-org/gitlab/issues/460) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.7. You can request information about a project's approval rules using the following endpoint: @@ -130,6 +131,31 @@ GET /projects/:id/approval_rules "ldap_access": null } ], + "protected_branches": [ + { + "id": 1, + "name": "master", + "push_access_levels": [ + { + "access_level": 30, + "access_level_description": "Developers + Maintainers" + } + ], + "merge_access_levels": [ + { + "access_level": 30, + "access_level_description": "Developers + Maintainers" + } + ], + "unprotect_access_levels": [ + { + "access_level": 40, + "access_level_description": "Maintainers" + } + ], + "code_owner_approval_required": "false" + } + ], "contains_hidden_groups": false } ] @@ -147,13 +173,14 @@ POST /projects/:id/approval_rules **Parameters:** -| Attribute | Type | Required | Description | -|----------------------|---------|----------|-----------------------------------------------------------| -| `id` | integer | yes | The ID of a project | -| `name` | string | yes | The name of the approval rule | -| `approvals_required` | integer | yes | The number of required approvals for this rule | -| `user_ids` | Array | no | The ids of users as approvers | -| `group_ids` | Array | no | The ids of groups as approvers | +| Attribute | Type | Required | Description | +|------------------------|---------|----------|------------------------------------------------------------------| +| `id` | integer | yes | The ID of a project | +| `name` | string | yes | The name of the approval rule | +| `approvals_required` | integer | yes | The number of required approvals for this rule | +| `user_ids` | Array | no | The ids of users as approvers | +| `group_ids` | Array | no | The ids of groups as approvers | +| `protected_branch_ids` | Array | no | **(PREMIUM)** The ids of protected branches to scope the rule by | ```json { @@ -207,6 +234,31 @@ POST /projects/:id/approval_rules "ldap_access": null } ], + "protected_branches": [ + { + "id": 1, + "name": "master", + "push_access_levels": [ + { + "access_level": 30, + "access_level_description": "Developers + Maintainers" + } + ], + "merge_access_levels": [ + { + "access_level": 30, + "access_level_description": "Developers + Maintainers" + } + ], + "unprotect_access_levels": [ + { + "access_level": 40, + "access_level_description": "Maintainers" + } + ], + "code_owner_approval_required": "false" + } + ], "contains_hidden_groups": false } ``` @@ -225,14 +277,15 @@ PUT /projects/:id/approval_rules/:approval_rule_id **Parameters:** -| Attribute | Type | Required | Description | -|----------------------|---------|----------|-----------------------------------------------------------| -| `id` | integer | yes | The ID of a project | -| `approval_rule_id` | integer | yes | The ID of a approval rule | -| `name` | string | yes | The name of the approval rule | -| `approvals_required` | integer | yes | The number of required approvals for this rule | -| `user_ids` | Array | no | The ids of users as approvers | -| `group_ids` | Array | no | The ids of groups as approvers | +| Attribute | Type | Required | Description | +|------------------------|---------|----------|------------------------------------------------------------------| +| `id` | integer | yes | The ID of a project | +| `approval_rule_id` | integer | yes | The ID of a approval rule | +| `name` | string | yes | The name of the approval rule | +| `approvals_required` | integer | yes | The number of required approvals for this rule | +| `user_ids` | Array | no | The ids of users as approvers | +| `group_ids` | Array | no | The ids of groups as approvers | +| `protected_branch_ids` | Array | no | **(PREMIUM)** The ids of protected branches to scope the rule by | ```json { @@ -286,6 +339,31 @@ PUT /projects/:id/approval_rules/:approval_rule_id "ldap_access": null } ], + "protected_branches": [ + { + "id": 1, + "name": "master", + "push_access_levels": [ + { + "access_level": 30, + "access_level_description": "Developers + Maintainers" + } + ], + "merge_access_levels": [ + { + "access_level": 30, + "access_level_description": "Developers + Maintainers" + } + ], + "unprotect_access_levels": [ + { + "access_level": 40, + "access_level_description": "Maintainers" + } + ], + "code_owner_approval_required": "false" + } + ], "contains_hidden_groups": false } ``` -- GitLab