diff options
author | Max Wittig <max.wittig@siemens.com> | 2020-04-07 10:39:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-07 10:39:46 +0200 |
commit | 5979750fcc953148fcca910c04258f56c3027bce (patch) | |
tree | 08ee6b2556dce3a53248895d040a580c8770b1b1 /gitlab/v4/objects.py | |
parent | 3396aa51e055b7e7d3bceddc1b91deed17323f3a (diff) | |
parent | 01de524ce39a67b549b3157bf4de827dd0568d6b (diff) | |
download | gitlab-5979750fcc953148fcca910c04258f56c3027bce.tar.gz |
Merge pull request #1052 from machine424/deploy-tokens-support
feat(api): add support for Gitlab Deploy Token API
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 25d890e..0d745b4 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -695,6 +695,43 @@ class DeployKeyManager(ListMixin, RESTManager): _obj_cls = DeployKey +class DeployToken(ObjectDeleteMixin, RESTObject): + pass + + +class DeployTokenManager(ListMixin, RESTManager): + _path = "/deploy_tokens" + _obj_cls = DeployToken + + +class ProjectDeployToken(ObjectDeleteMixin, RESTObject): + pass + + +class ProjectDeployTokenManager(ListMixin, CreateMixin, DeleteMixin, RESTManager): + _path = "/projects/%(project_id)s/deploy_tokens" + _from_parent_attrs = {"project_id": "id"} + _obj_cls = ProjectDeployToken + _create_attrs = ( + ("name", "scopes",), + ("expires_at", "username",), + ) + + +class GroupDeployToken(ObjectDeleteMixin, RESTObject): + pass + + +class GroupDeployTokenManager(ListMixin, CreateMixin, DeleteMixin, RESTManager): + _path = "/groups/%(group_id)s/deploy_tokens" + _from_parent_attrs = {"group_id": "id"} + _obj_cls = GroupDeployToken + _create_attrs = ( + ("name", "scopes",), + ("expires_at", "username",), + ) + + class NotificationSettings(SaveMixin, RESTObject): _id_attr = None @@ -1323,6 +1360,7 @@ class Group(SaveMixin, ObjectDeleteMixin, RESTObject): ("subgroups", "GroupSubgroupManager"), ("variables", "GroupVariableManager"), ("clusters", "GroupClusterManager"), + ("deploytokens", "GroupDeployTokenManager"), ) @cli.register_custom_action("Group", ("to_project_id",)) @@ -4271,6 +4309,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): ("clusters", "ProjectClusterManager"), ("additionalstatistics", "ProjectAdditionalStatisticsManager"), ("issuesstatistics", "ProjectIssuesStatisticsManager"), + ("deploytokens", "ProjectDeployTokenManager"), ) @cli.register_custom_action("Project", ("submodule", "branch", "commit_sha")) |