Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Randa <randa.alex@gmail.com>2017-03-31 15:54:38 +0300
committerAlexander Randa <randa.alex@gmail.com>2017-06-02 19:44:36 +0300
commit3d70eeb5bb9dac8073a149547dc3b85c90d65e7d (patch)
treeb925f3518e991df59a094ae9d7a6926241c9f5aa /lib/api/deploy_keys.rb
parentf07aee72bef4604312e11a43fce3a47865bce100 (diff)
Implement ability to update deploy keys
Diffstat (limited to 'lib/api/deploy_keys.rb')
-rw-r--r--lib/api/deploy_keys.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/api/deploy_keys.rb b/lib/api/deploy_keys.rb
index 8a54f7f3f05..7cdee8aced7 100644
--- a/lib/api/deploy_keys.rb
+++ b/lib/api/deploy_keys.rb
@@ -76,6 +76,27 @@ module API
end
end
+ desc 'Update an existing deploy key for a project' do
+ success Entities::SSHKey
+ end
+ params do
+ requires :key_id, type: Integer, desc: 'The ID of the deploy key'
+ optional :title, type: String, desc: 'The name of the deploy key'
+ optional :can_push, type: Boolean, desc: "Can deploy key push to the project's repository"
+ at_least_one_of :title, :can_push
+ end
+ put ":id/deploy_keys/:key_id" do
+ key = user_project.deploy_keys.find(params.delete(:key_id))
+
+ authorize!(:update_deploy_key, key)
+
+ if key.update_attributes(declared_params(include_missing: false))
+ present key, with: Entities::SSHKey
+ else
+ render_validation_error!(key)
+ end
+ end
+
desc 'Enable a deploy key for a project' do
detail 'This feature was added in GitLab 8.11'
success Entities::SSHKey