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: schema:
type: array type: array
items: items:
$ref: '#/definitions/ListSecretsResponse' $ref: '#/definitions/Secret'
post: post:
summary: Create a new secret. summary: Create a new secret.
description: '' description: ''
@ -280,7 +280,7 @@ paths:
description: A new secret to create description: A new secret to create
required: true required: true
schema: schema:
$ref: '#/definitions/SecretInfo' $ref: '#/definitions/Secret'
responses: responses:
'201': '201':
description: Created description: Created
@ -301,7 +301,7 @@ paths:
description: Secret to update description: Secret to update
required: true required: true
schema: schema:
$ref: '#/definitions/SecretInfo' $ref: '#/definitions/Secret'
responses: responses:
'200': '200':
description: Ok description: Ok
@ -324,7 +324,7 @@ paths:
description: Secret to delete description: Secret to delete
required: true required: true
schema: schema:
$ref: '#/definitions/DeleteSecretRequest' $ref: '#/definitions/Secret'
responses: responses:
'204': '204':
description: OK description: OK
@ -533,6 +533,19 @@ definitions:
- availableReplicas - availableReplicas
- envProcess - envProcess
- labels - 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: externalDocs:
description: More documentation available on Github description: More documentation available on Github
url: 'https://github.com/openfaas/faas' url: 'https://github.com/openfaas/faas'

View File

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