Permalink
Browse files

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>
  • Loading branch information...
alexellis committed Jan 4, 2019
1 parent b206cb8 commit a65df4795bc66147c41161c48bfd4c72f60c7434
Showing with 19 additions and 22 deletions.
  1. +17 −4 api-docs/swagger.yml
  2. +2 −18 gateway/requests/requests.go
@@ -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'
@@ -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"`
}

0 comments on commit a65df47

Please sign in to comment.