Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
e7551214
Commit
e7551214
authored
Feb 20, 2017
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API: Remove `DELETE projects/:id/deploy_keys/:key_id/disable`
parent
12cd4c83
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
73 deletions
+14
-73
changelogs/unreleased/api-remove-deploy-key-disable.yml
changelogs/unreleased/api-remove-deploy-key-disable.yml
+4
-0
doc/api/deploy_keys.md
doc/api/deploy_keys.md
+6
-33
doc/api/v3_to_v4.md
doc/api/v3_to_v4.md
+1
-0
lib/api/deploy_keys.rb
lib/api/deploy_keys.rb
+3
-19
spec/requests/api/deploy_keys_spec.rb
spec/requests/api/deploy_keys_spec.rb
+0
-21
No files found.
changelogs/unreleased/api-remove-deploy-key-disable.yml
0 → 100644
View file @
e7551214
---
title
:
'
API:
Remove
`DELETE
projects/:id/deploy_keys/:key_id/disable`'
merge_request
:
9365
author
:
Robert Schilling
doc/api/deploy_keys.md
View file @
e7551214
...
...
@@ -137,7 +137,7 @@ Example response:
## Delete deploy key
Delete a deploy key from a project
Removes a deploy key from the project. If the deploy is used only for this project, it will be deleted from the system.
```
DELETE /projects/:id/deploy_keys/:key_id
...
...
@@ -156,14 +156,11 @@ Example response:
```
json
{
"updated_at"
:
"2015-08-29T12:50:57.259Z"
,
"key"
:
"ssh-rsa AAAA..."
,
"public"
:
false
,
"title"
:
"My deploy key"
,
"user_id"
:
null
,
"id"
:
6
,
"deploy_key_id"
:
14
,
"project_id"
:
1
,
"created_at"
:
"2015-08-29T12:50:57.259Z"
,
"fingerprint"
:
"6a:33:1f:74:51:c0:39:81:79:ec:7a:31:f8:40:20:43"
,
"id"
:
13
"updated_at"
:
"2015-08-29T12:50:57.259Z"
}
```
...
...
@@ -190,27 +187,3 @@ Example response:
"created_at"
:
"2015-08-29T12:44:31.550Z"
}
```
## Disable a deploy key
Disable a deploy key for a project. Returns the disabled key.
```
bash
curl
--request
DELETE
--header
"PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK"
https://gitlab.example.com/api/v3/projects/5/deploy_keys/13/disable
```
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
|
`id`
| integer | yes | The ID of the project |
|
`key_id`
| integer | yes | The ID of the deploy key |
Example response:
```
json
{
"key"
:
"ssh-rsa AAAA..."
,
"id"
:
12
,
"title"
:
"My deploy key"
,
"created_at"
:
"2015-08-29T12:44:31.550Z"
}
```
doc/api/v3_to_v4.md
View file @
e7551214
...
...
@@ -25,3 +25,4 @@ changes are in V4:
-
Moved
`/projects/fork/:id`
to
`/projects/:id/fork`
-
Endpoints
`/projects/owned`
,
`/projects/visible`
,
`/projects/starred`
&
`/projects/all`
are consolidated into
`/projects`
using query parameters
-
Return pagination headers for all endpoints that return an array
-
Removed
`DELETE projects/:id/deploy_keys/:key_id/disable`
. Use
`DELETE projects/:id/deploy_keys/:key_id`
instead
lib/api/deploy_keys.rb
View file @
e7551214
...
...
@@ -93,20 +93,6 @@ module API
end
end
desc
'Disable a deploy key for a project'
do
detail
'This feature was added in GitLab 8.11'
success
Entities
::
SSHKey
end
params
do
requires
:key_id
,
type:
Integer
,
desc:
'The ID of the deploy key'
end
delete
":id/deploy_keys/:key_id/disable"
do
key
=
user_project
.
deploy_keys_projects
.
find_by
(
deploy_key_id:
params
[
:key_id
])
key
.
destroy
present
key
.
deploy_key
,
with:
Entities
::
SSHKey
end
desc
'Delete deploy key for a project'
do
success
Key
end
...
...
@@ -115,11 +101,9 @@ module API
end
delete
":id/deploy_keys/:key_id"
do
key
=
user_project
.
deploy_keys_projects
.
find_by
(
deploy_key_id:
params
[
:key_id
])
if
key
not_found!
(
'Deploy Key'
)
unless
key
key
.
destroy
else
not_found!
(
'Deploy Key'
)
end
end
end
end
...
...
spec/requests/api/deploy_keys_spec.rb
View file @
e7551214
...
...
@@ -148,25 +148,4 @@ describe API::DeployKeys, api: true do
end
end
end
describe
'DELETE /projects/:id/deploy_keys/:key_id/disable'
do
context
'when the user can admin the project'
do
it
'disables the key'
do
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/deploy_keys/
#{
deploy_key
.
id
}
/disable"
,
admin
)
end
.
to
change
{
project
.
deploy_keys
.
count
}.
from
(
1
).
to
(
0
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'id'
]).
to
eq
(
deploy_key
.
id
)
end
end
context
'when authenticated as non-admin user'
do
it
'should return a 404 error'
do
delete
api
(
"/projects/
#{
project
.
id
}
/deploy_keys/
#{
deploy_key
.
id
}
/disable"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment