summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects.py
diff options
context:
space:
mode:
authorKarol Ossowski <karol.ossowski@gmail.com>2019-04-23 11:17:01 +0200
committerKarol Ossowski <karol.ossowski@gmail.com>2019-05-01 22:45:05 +0200
commit910c2861a3c895cca5aff0a0df1672bb7388c526 (patch)
treeef2575df356424283109d9a73064488bbd5fb1ad /gitlab/v4/objects.py
parenta7305980ef4065a6518951fb166b11eec9003b4d (diff)
downloadgitlab-910c2861a3c895cca5aff0a0df1672bb7388c526.tar.gz
merged new release & registry apis
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r--gitlab/v4/objects.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 57df679..0b98851 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -1177,6 +1177,46 @@ class PagesDomainManager(ListMixin, RESTManager):
_obj_cls = PagesDomain
+class ProjectRegistryRepository(ObjectDeleteMixin, RESTObject):
+ _managers = (
+ ('tags', 'ProjectRegistryTagManager'),
+ )
+
+
+class ProjectRegistryRepositoryManager(DeleteMixin, ListMixin, RESTManager):
+ _path= '/projects/%(project_id)s/registry/repositories'
+ _obj_cls = ProjectRegistryRepository
+ _from_parent_attrs = {'project_id': 'id'}
+
+class ProjectRegistryTag(ObjectDeleteMixin, RESTObject):
+ _id_attr = 'name'
+
+class ProjectRegistryTagManager(DeleteMixin, RetrieveMixin, RESTManager):
+ _obj_cls = ProjectRegistryTag
+ _from_parent_attrs = {'project_id': 'project_id', 'repository_id': 'id'}
+ _path = '/projects/%(project_id)s/registry/repositories/%(repository_id)d/tags'
+
+ @exc.on_http_error(exc.GitlabDeleteError)
+ def delete_in_bulk(self, name_regex='.*', **kwargs):
+ """Delete Tag by name or in bulk
+
+ Args:
+ name_regex (string): The regex of the name to delete. To delete all
+ tags specify .*.
+ keep_n (integer): The amount of latest tags of given name to keep.
+ older_than (string): Tags to delete that are older than the given time,
+ written in human readable form 1h, 1d, 1month.
+ **kwargs: Extra options to send to the server (e.g. sudo)
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabDeleteError: If the server cannot perform the request
+ """
+ valid_attrs = ['keep_n', 'older_than']
+ data = {'name_regex':name_regex}
+ data.update({k: v for k,v in kwargs.items() if k in valid_attrs})
+ self.gitlab.http_delete(self.path, query_data=data, **kwargs)
+
+
class ProjectBoardList(SaveMixin, ObjectDeleteMixin, RESTObject):
pass
@@ -3286,6 +3326,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
('pipelineschedules', 'ProjectPipelineScheduleManager'),
('pushrules', 'ProjectPushRulesManager'),
('releases', 'ProjectReleaseManager'),
+ ('repositories', 'ProjectRegistryRepositoryManager'),
('runners', 'ProjectRunnerManager'),
('services', 'ProjectServiceManager'),
('snippets', 'ProjectSnippetManager'),