diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2017-09-02 16:37:43 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2017-09-02 16:37:43 +0200 |
commit | c99e399443819024e2e44cbd437091a39641ae68 (patch) | |
tree | c658432a57a087494df5557f4b975ce0af05f2ee /gitlab/v4/objects.py | |
parent | fcccfbda6342659ae4e040901bfd0ddaeb4541d5 (diff) | |
download | gitlab-c99e399443819024e2e44cbd437091a39641ae68.tar.gz |
Add support for protected branches
This feature appeared in gitlab 9.5.
Fixes #299
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 92c4543..bf79deb 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1732,6 +1732,17 @@ class ProjectDeploymentManager(RetrieveMixin, RESTManager): _from_parent_attrs = {'project_id': 'id'} +class ProjectProtectedBranch(ObjectDeleteMixin, RESTObject): + _id_attr = 'name' + + +class ProjectProtectedBranchManager(NoUpdateMixin, RESTManager): + _path = '/projects/%(project_id)s/protected_branches' + _obj_cls = ProjectProtectedBranch + _from_parent_attrs = {'project_id': 'id'} + _create_attrs = (('name', ), ('push_access_level', 'merge_access_level')) + + class ProjectRunner(ObjectDeleteMixin, RESTObject): pass @@ -1767,6 +1778,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): ('notes', 'ProjectNoteManager'), ('notificationsettings', 'ProjectNotificationSettingsManager'), ('pipelines', 'ProjectPipelineManager'), + ('protectedbranches', 'ProjectProtectedBranchManager'), ('runners', 'ProjectRunnerManager'), ('services', 'ProjectServiceManager'), ('snippets', 'ProjectSnippetManager'), |