Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ea71f1d

Browse filesBrowse files
esabouraudgpocentek
authored andcommitted
Add project protected tags management (python-gitlab#581)
1 parent 77f4d3a commit ea71f1d
Copy full SHA for ea71f1d

File tree

Expand file treeCollapse file tree

2 files changed

+46
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+46
-0
lines changed
Open diff view settings
Collapse file

‎docs/gl_objects/projects.rst‎

Copy file name to clipboardExpand all lines: docs/gl_objects/projects.rst
+33Lines changed: 33 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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()
Collapse file

‎gitlab/v4/objects.py‎

Copy file name to clipboardExpand all lines: gitlab/v4/objects.py
+13Lines changed: 13 additions & 0 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.