summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/deploy_keys.rb11
-rw-r--r--lib/api/entities/deploy_key.rb9
-rw-r--r--lib/api/entities/deploy_key_with_user.rb3
-rw-r--r--lib/api/entities/deploy_keys_project.rb2
4 files changed, 17 insertions, 8 deletions
diff --git a/lib/api/deploy_keys.rb b/lib/api/deploy_keys.rb
index 11340e91aae..3259b615369 100644
--- a/lib/api/deploy_keys.rb
+++ b/lib/api/deploy_keys.rb
@@ -25,8 +25,7 @@ module API
get "deploy_keys" do
authenticated_as_admin!
- deploy_keys = DeployKey.all.preload_users
- present paginate(deploy_keys), with: Entities::SSHKey
+ present paginate(DeployKey.all), with: Entities::DeployKey
end
params do
@@ -43,7 +42,7 @@ module API
end
# rubocop: disable CodeReuse/ActiveRecord
get ":id/deploy_keys" do
- keys = user_project.deploy_keys_projects.preload(deploy_key: [:user])
+ keys = user_project.deploy_keys_projects.preload(:deploy_key)
present paginate(keys), with: Entities::DeployKeysProject
end
@@ -105,7 +104,7 @@ module API
# rubocop: enable CodeReuse/ActiveRecord
desc 'Update an existing deploy key for a project' do
- success Entities::SSHKey
+ success Entities::DeployKey
end
params do
requires :key_id, type: Integer, desc: 'The ID of the deploy key'
@@ -140,7 +139,7 @@ module API
desc 'Enable a deploy key for a project' do
detail 'This feature was added in GitLab 8.11'
- success Entities::SSHKey
+ success Entities::DeployKey
end
params do
requires :key_id, type: Integer, desc: 'The ID of the deploy key'
@@ -150,7 +149,7 @@ module API
current_user, declared_params).execute
if key
- present key, with: Entities::SSHKey
+ present key, with: Entities::DeployKey
else
not_found!('Deploy Key')
end
diff --git a/lib/api/entities/deploy_key.rb b/lib/api/entities/deploy_key.rb
new file mode 100644
index 00000000000..ed922c24eda
--- /dev/null
+++ b/lib/api/entities/deploy_key.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module API
+ module Entities
+ class DeployKey < Entities::SSHKey
+ expose :key
+ end
+ end
+end
diff --git a/lib/api/entities/deploy_key_with_user.rb b/lib/api/entities/deploy_key_with_user.rb
index 31024dc3910..a8f6440b67c 100644
--- a/lib/api/entities/deploy_key_with_user.rb
+++ b/lib/api/entities/deploy_key_with_user.rb
@@ -2,7 +2,8 @@
module API
module Entities
- class DeployKeyWithUser < Entities::SSHKeyWithUser
+ class DeployKeyWithUser < Entities::DeployKey
+ expose :user, using: Entities::UserPublic
expose :deploy_keys_projects
end
end
diff --git a/lib/api/entities/deploy_keys_project.rb b/lib/api/entities/deploy_keys_project.rb
index 64725459167..12a86fbdf8e 100644
--- a/lib/api/entities/deploy_keys_project.rb
+++ b/lib/api/entities/deploy_keys_project.rb
@@ -3,7 +3,7 @@
module API
module Entities
class DeployKeysProject < Grape::Entity
- expose :deploy_key, merge: true, using: Entities::SSHKey
+ expose :deploy_key, merge: true, using: Entities::DeployKey
expose :can_push
end
end