Updated secret types based on PR feedback:

- SecretInfo type
- ListSecretsResponse
- Move Annotations to SecretInfo
- update swagger api docs

Signed-off-by: Andrew Cornies <acornies@gmail.com>
This commit is contained in:
Andrew Cornies 2018-12-03 22:23:50 -05:00 committed by Alex Ellis
parent b49dded3b3
commit b206cb829a
2 changed files with 93 additions and 7 deletions

View File

@ -253,6 +253,87 @@ paths:
description: Not Found description: Not Found
'500': '500':
description: Internal Server Error description: Internal Server Error
'/system/secrets':
get:
summary: 'Get a list of secret names and metadata from the provider'
consumes:
- application/json
produces:
- application/json
responses:
'200':
description: List of submitted secrets.
schema:
type: array
items:
$ref: '#/definitions/ListSecretsResponse'
post:
summary: Create a new secret.
description: ''
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: A new secret to create
required: true
schema:
$ref: '#/definitions/SecretInfo'
responses:
'201':
description: Created
'400':
description: Bad Request
'500':
description: Internal Server Error
put:
summary: Update a secret.
description: ''
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Secret to update
required: true
schema:
$ref: '#/definitions/SecretInfo'
responses:
'200':
description: Ok
'400':
description: Bad Request
'404':
description: Not Found
'500':
description: Internal Server Error
delete:
summary: Remove a secret.
description: ''
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Secret to delete
required: true
schema:
$ref: '#/definitions/DeleteSecretRequest'
responses:
'204':
description: OK
'400':
description: Bad Request
'404':
description: Not Found
'500':
description: Internal Server Error
'/system/info': '/system/info':
get: get:
summary: Get info such as provider version number and provider orchestrator summary: Get info such as provider version number and provider orchestrator

View File

@ -91,9 +91,15 @@ type DeleteFunctionRequest struct {
FunctionName string `json:"functionName"` FunctionName string `json:"functionName"`
} }
// CreateSecretRequest create a secret w/ annotations // SecretInfo payload for PUT,POST secret w/ annotations
type CreateSecretRequest struct { type SecretInfo struct {
Secret Secret `json:"secret"` Secret Secret `json:"secret"`
Annotations map[string]string `json:"annotations,omitempty"`
}
// ListSecretsResponse GET response for secrets (value omitted)
type ListSecretsResponse struct {
Secrets []SecretInfo `json:"secrets"`
} }
// DeleteSecretRequest remote a secret by name // DeleteSecretRequest remote a secret by name
@ -101,9 +107,8 @@ type DeleteSecretRequest struct {
SecretName string `json:"secretName"` SecretName string `json:"secretName"`
} }
// Secret schema use Value only in write-only http verbs // Secret schema use Value only in PUT,POST http verbs
type Secret struct { type Secret struct {
Name string `json:"name"` Name string `json:"name"`
Value string `json:"value"` // write-only Value string `json:"value,omitempty"` // write-only, base64
Annotations *map[string]string `json:"annotations"`
} }