Deploy keys

Deploy keys

Deploy keys allow read-only access to multiple projects with a single SSH key.

Examples

List the deploy keys:

keys = gl.deploykeys.list()

Get a single deploy key:

key = gl.deploykeys.get(key_id)

Deploy keys for projects

Deploy keys can be managed on a per-project basis.

Examples

List keys for a project:

keys = gl.project_keys.list(project_id=1)
# or
keys = project.keys.list()

Get a single deploy key:

key = gl.project_keys.get(key_id, project_id=1)
# or
key = project.keys.get(key_id)

Create a deploy key for a project:

key = gl.project_keys.create({'title': 'jenkins key',
                              'key': open('/home/me/.ssh/id_rsa.pub').read()},
                             project_id=1)
# or
key = project.keys.create({'title': 'jenkins key',
                           'key': open('/home/me/.ssh/id_rsa.pub').read()})

Delete a deploy key for a project:

key = gl.project_keys.delete(key_id, project_id=1)
# or
key = project.keys.list(key_id)
# or
key.delete()

Enable a deploy key for a project:

project.keys.enable(key_id)

Disable a deploy key for a project:

project.keys.disable(key_id)