Skip to content

Commit 756c73c

Browse files
authored
Merge branch 'master' into docker
2 parents 21d2577 + ea71f1d commit 756c73c

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

docs/gl_objects/projects.rst

+33
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,36 @@ Edit project push rules::
657657
Delete project push rules::
658658

659659
pr.delete()
660+
661+
Project protected tags
662+
==================
663+
664+
Reference
665+
---------
666+
667+
* v4 API:
668+
669+
+ :class:`gitlab.v4.objects.ProjectProtectedTag`
670+
+ :class:`gitlab.v4.objects.ProjectProtectedTagManager`
671+
+ :attr:`gitlab.v4.objects.Project.protectedtags`
672+
673+
* GitLab API: https://docs.gitlab.com/ce/api/protected_tags.html
674+
675+
Examples
676+
---------
677+
678+
Get a list of protected tags from a project::
679+
680+
protected_tags = project.protectedtags.list()
681+
682+
Get a single protected tag or wildcard protected tag::
683+
684+
protected_tag = project.protectedtags.get('v*')
685+
686+
Protect a single repository tag or several project repository tags using a wildcard protected tag::
687+
688+
project.protectedtags.create({'name': 'v*', 'create_access_level': '40'})
689+
690+
Unprotect the given protected tag or wildcard protected tag.::
691+
692+
protected_tag.delete()

gitlab/v4/objects.py

+13
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,18 @@ class ProjectTagManager(NoUpdateMixin, RESTManager):
19651965
_create_attrs = (('tag_name', 'ref'), ('message',))
19661966

19671967

1968+
class ProjectProtectedTag(ObjectDeleteMixin, RESTObject):
1969+
_id_attr = 'name'
1970+
_short_print_attr = 'name'
1971+
1972+
1973+
class ProjectProtectedTagManager(NoUpdateMixin, RESTManager):
1974+
_path = '/projects/%(project_id)s/protected_tags'
1975+
_obj_cls = ProjectProtectedTag
1976+
_from_parent_attrs = {'project_id': 'id'}
1977+
_create_attrs = (('name',), ('create_access_level',))
1978+
1979+
19681980
class ProjectMergeRequestApproval(SaveMixin, RESTObject):
19691981
_id_attr = None
19701982

@@ -3124,6 +3136,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
31243136
('pagesdomains', 'ProjectPagesDomainManager'),
31253137
('pipelines', 'ProjectPipelineManager'),
31263138
('protectedbranches', 'ProjectProtectedBranchManager'),
3139+
('protectedtags', 'ProjectProtectedTagManager'),
31273140
('pipelineschedules', 'ProjectPipelineScheduleManager'),
31283141
('pushrules', 'ProjectPushRulesManager'),
31293142
('runners', 'ProjectRunnerManager'),

0 commit comments

Comments
 (0)