Update swagger for missing secret definitions

- added secret definition and removed types used previously

Remove structs for secrets

- after discussion on PR the core contributors decided we just
want simple CRUD with the Secret type.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (VMware) 2019-01-04 16:46:03 +00:00 committed by Alex Ellis
parent b206cb829a
commit a65df4795b
2 changed files with 19 additions and 22 deletions

View File

@ -266,7 +266,7 @@ paths:
schema:
type: array
items:
$ref: '#/definitions/ListSecretsResponse'
$ref: '#/definitions/Secret'
post:
summary: Create a new secret.
description: ''
@ -280,7 +280,7 @@ paths:
description: A new secret to create
required: true
schema:
$ref: '#/definitions/SecretInfo'
$ref: '#/definitions/Secret'
responses:
'201':
description: Created
@ -301,7 +301,7 @@ paths:
description: Secret to update
required: true
schema:
$ref: '#/definitions/SecretInfo'
$ref: '#/definitions/Secret'
responses:
'200':
description: Ok
@ -324,7 +324,7 @@ paths:
description: Secret to delete
required: true
schema:
$ref: '#/definitions/DeleteSecretRequest'
$ref: '#/definitions/Secret'
responses:
'204':
description: OK
@ -533,6 +533,19 @@ definitions:
- availableReplicas
- envProcess
- labels
Secret:
type: object
properties:
name:
type: string
description: Name of secret
example: aws-key
value:
type: string
description: Value of secret in plain-text
example: changeme
required:
- name
externalDocs:
description: More documentation available on Github
url: 'https://github.com/openfaas/faas'

View File

@ -91,24 +91,8 @@ type DeleteFunctionRequest struct {
FunctionName string `json:"functionName"`
}
// SecretInfo payload for PUT,POST secret w/ annotations
type SecretInfo struct {
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
type DeleteSecretRequest struct {
SecretName string `json:"secretName"`
}
// Secret schema use Value only in PUT,POST http verbs
// Secret for underlying orchestrator
type Secret struct {
Name string `json:"name"`
Value string `json:"value,omitempty"` // write-only, base64
Value string `json:"value,omitempty"`
}