summaryrefslogtreecommitdiff
path: root/gitlab/objects.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r--gitlab/objects.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 846da20..1ea3049 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -1366,24 +1366,23 @@ class ProjectKey(GitlabObject):
requiredUrlAttrs = ['project_id']
requiredCreateAttrs = ['title', 'key']
- def enable(self):
+
+class ProjectKeyManager(BaseManager):
+ obj_cls = ProjectKey
+
+ def enable(self, key_id):
"""Enable a deploy key for a project."""
- url = '/projects/%s/deploy_keys/%s/enable' % (self.project_id, self.id)
+ url = '/projects/%s/deploy_keys/%s/enable' % (self.parent.id, key_id)
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabProjectDeployKeyError, 201)
- def disable(self):
+ def disable(self, key_id):
"""Disable a deploy key for a project."""
- url = '/projects/%s/deploy_keys/%s/disable' % (self.project_id,
- self.id)
+ url = '/projects/%s/deploy_keys/%s/disable' % (self.parent.id, key_id)
r = self.gitlab._raw_delete(url)
raise_error_from_response(r, GitlabProjectDeployKeyError, 200)
-class ProjectKeyManager(BaseManager):
- obj_cls = ProjectKey
-
-
class ProjectEvent(GitlabObject):
_url = '/projects/%(project_id)s/events'
canGet = 'from_list'