summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.rst12
-rw-r--r--docs/gl_objects/deploy_keys.py4
-rw-r--r--docs/gl_objects/deploy_keys.rst14
-rw-r--r--gitlab/__init__.py1
-rw-r--r--gitlab/objects.py17
5 files changed, 40 insertions, 8 deletions
diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index d107aaa..0b15c11 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -15,5 +15,15 @@ Changes from 0.19 to 0.20
group.projects.list()
- Documentation for ``Group`` objects:
+ Documentation:
http://python-gitlab.readthedocs.io/en/stable/gl_objects/groups.html#examples
+
+ Related issue: https://github.com/gpocentek/python-gitlab/issues/209
+
+* The ``Key`` objects are deprecated in favor of the new ``DeployKey`` objects.
+ They are exactly the same but the name makes more sense.
+
+ Documentation:
+ http://python-gitlab.readthedocs.io/en/stable/gl_objects/deploy_keys.html
+
+ Related issue: https://github.com/gpocentek/python-gitlab/issues/212
diff --git a/docs/gl_objects/deploy_keys.py b/docs/gl_objects/deploy_keys.py
index 5d85055..84da079 100644
--- a/docs/gl_objects/deploy_keys.py
+++ b/docs/gl_objects/deploy_keys.py
@@ -1,9 +1,9 @@
# global list
-keys = gl.keys.list()
+keys = gl.deploykeys.list()
# end global list
# global get
-key = gl.keys.get(key_id)
+key = gl.deploykeys.get(key_id)
# end global get
# list
diff --git a/docs/gl_objects/deploy_keys.rst b/docs/gl_objects/deploy_keys.rst
index 57c1298..28033cb 100644
--- a/docs/gl_objects/deploy_keys.rst
+++ b/docs/gl_objects/deploy_keys.rst
@@ -5,8 +5,10 @@ Deploy keys
Deploy keys
===========
-Use :class:`~gitlab.objects.Key` objects to manipulate deploy keys. The
-:attr:`gitlab.Gitlab.keys` manager object provides helper functions.
+Deploy keys allow read-only access to multiple projects with a single SSH key.
+
+* Object class: :class:`~gitlab.objects.DeployKey`
+* Manager object: :attr:`gitlab.Gitlab.deploykeys`
Examples
--------
@@ -26,9 +28,11 @@ Get a single deploy key:
Deploy keys for projects
========================
-Use :class:`~gitlab.objects.ProjectKey` objects to manipulate deploy keys for
-projects. The :attr:`gitlab.Gitlab.project_keys` and :attr:`Project.keys
-<gitlab.objects.Project.keys>` manager objects provide helper functions.
+Deploy keys can be managed on a per-project basis.
+
+* Object class: :class:`~gitlab.objects.ProjectKey`
+* Manager objects: :attr:`gitlab.Gitlab.project_keys` and :attr:`Project.keys
+ <gitlab.objects.Project.keys>`
Examples
--------
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 119dab0..cce282d 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -91,6 +91,7 @@ class Gitlab(object):
self.broadcastmessages = BroadcastMessageManager(self)
self.keys = KeyManager(self)
+ self.deploykeys = DeployKeyManager(self)
self.gitlabciymls = GitlabciymlManager(self)
self.gitignores = GitignoreManager(self)
self.groups = GroupManager(self)
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 3c38e8e..f067657 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -802,11 +802,28 @@ class Key(GitlabObject):
canUpdate = False
canDelete = False
+ def __init__(self, *args, **kwargs):
+ warnings.warn("`Key` is deprecated, use `DeployKey` instead",
+ DeprecationWarning)
+ super(Key, self).__init__(*args, **kwargs)
+
class KeyManager(BaseManager):
obj_cls = Key
+class DeployKey(GitlabObject):
+ _url = '/deploy_keys'
+ canGet = 'from_list'
+ canCreate = False
+ canUpdate = False
+ canDelete = False
+
+
+class DeployKeyManager(BaseManager):
+ obj_cls = DeployKey
+
+
class NotificationSettings(GitlabObject):
_url = '/notification_settings'
_id_in_update_url = False