mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 07:11:05 +01:00
Return key ID on create, add passphrase
This commit is contained in:
parent
c8935eabdb
commit
aac032db96
@ -93,6 +93,7 @@ func main() {
|
||||
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/matchers > Add Integration Matcher > 204 > application/json", capabilityWrapper("integration"))
|
||||
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/matchers/{matcher_id} > Updates Integration Matcher > 204 > application/json", capabilityWrapper("integrationmatcher"))
|
||||
|
||||
h.Before("project > /api/project/{project_id}/keys > Add access key > 201 > application/json", capabilityWrapper("access_key"))
|
||||
h.Before("project > /api/project/{project_id}/keys/{key_id} > Updates access key > 204 > application/json", capabilityWrapper("access_key"))
|
||||
h.Before("project > /api/project/{project_id}/keys/{key_id} > Removes access key > 204 > application/json", capabilityWrapper("access_key"))
|
||||
|
||||
|
10
api-docs.yml
10
api-docs.yml
@ -368,6 +368,8 @@ definitions:
|
||||
type: integer
|
||||
minimum: 1
|
||||
x-example: 2
|
||||
override_secret:
|
||||
type: boolean
|
||||
login_password:
|
||||
type: object
|
||||
properties:
|
||||
@ -386,6 +388,10 @@ definitions:
|
||||
type: string
|
||||
x-example: user
|
||||
example: user
|
||||
passphrase:
|
||||
type: string
|
||||
x-example: passphrase
|
||||
example: passphrase
|
||||
private_key:
|
||||
type: string
|
||||
x-example: private key
|
||||
@ -1741,8 +1747,10 @@ paths:
|
||||
schema:
|
||||
$ref: "#/definitions/AccessKeyRequest"
|
||||
responses:
|
||||
204:
|
||||
201:
|
||||
description: Access Key created
|
||||
schema:
|
||||
$ref: "#/definitions/AccessKey"
|
||||
400:
|
||||
description: Bad type
|
||||
/project/{project_id}/keys/{key_id}:
|
||||
|
@ -101,7 +101,14 @@ func AddKey(w http.ResponseWriter, r *http.Request) {
|
||||
Description: fmt.Sprintf("Access Key %s created", key.Name),
|
||||
})
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
// Reload key to drop sensitive fields
|
||||
key, err = helpers.Store(r).GetAccessKey(*newKey.ProjectID, newKey.ID)
|
||||
if err != nil {
|
||||
helpers.WriteError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
helpers.WriteJSON(w, http.StatusCreated, key)
|
||||
}
|
||||
|
||||
// UpdateKey updates key in database
|
||||
|
Loading…
Reference in New Issue
Block a user