Skip to content

Commit

Permalink
Feature: enable / disable the deploy key in a project
Browse files Browse the repository at this point in the history
  • Loading branch information
Asher256 committed Oct 29, 2016
1 parent 4689e73 commit 6310d71
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gitlab/objects.py
Expand Up @@ -1253,6 +1253,18 @@ class ProjectKey(GitlabObject):
class ProjectKeyManager(BaseManager):
obj_cls = ProjectKey

def enable_deploy_key(self, project_id, key_id):
"""Enable a deploy key in a project."""
url = '/projects/%s/deploy_keys/%s/enable' % (project_id, key_id)
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)

def disable_deploy_key(self, project_id, key_id):
"""Disable a deploy key in a project."""
url = '/projects/%s/deploy_keys/%s/disable' % (project_id, key_id)
r = self.gitlab._raw_post(url)
raise_error_from_response(r, GitlabBuildRetryError, 201)


class ProjectEvent(GitlabObject):
_url = '/projects/%(project_id)s/events'
Expand Down

0 comments on commit 6310d71

Please sign in to comment.