swagger: "2.0"
info:
  description: VMware Dispatch Secret Store
  title: Secret Store
  version: 0.0.1
consumes:
- application/json
produces:
- application/json
schemes:
- http
- https
tags:
- name: secret
  description: Operations on secrets
parameters:
  orgIDParam:
    in: header
    name: X-Dispatch-Org
    type: string
    pattern: '^[\w\d][\w\d\-]*[\w\d]|[\w\d]+$'
    default: 'default'
  projectNameParam:
    in: header
    name: X-Dispatch-Project
    type: string
    pattern: '^[\w\d][\w\d\-]*[\w\d]|[\w\d]+$'
    default: 'default'
basePath: /v1/secret
paths:
  /:
    parameters:
    - $ref: '#/parameters/orgIDParam'
    - $ref: '#/parameters/projectNameParam'
    get:
      tags:
      - secret
      operationId: getSecrets
      parameters:
      - in: query
        type: array
        name: tags
        description: Filter based on tags
        items:
          type: string
        collectionFormat: 'multi'
      responses:
        200:
          description: An array of registered secrets
          schema:
            type: array
            items:
              $ref: "./models.json#/definitions/Secret"
        400:
          description: Bad Request
          schema:
            $ref: './models.json#/definitions/Error'
        401:
          description: Unauthorized Request
          schema:
            $ref: './models.json#/definitions/Error'
        403:
          description: access to this resource is forbidden
          schema:
            $ref: './models.json#/definitions/Error'
        default:
          description: Standard error
          schema:
            $ref: "./models.json#/definitions/Error"
    post:
      tags:
        - secret
      operationId: addSecret
      consumes:
        - application/json
      parameters:
        - in: body
          name: secret
          schema:
            $ref: "./models.json#/definitions/Secret"
      responses:
        201:
          description: The created secret.
          schema:
            $ref: "./models.json#/definitions/Secret"
        400:
          description: Bad Request
          schema:
            $ref: './models.json#/definitions/Error'
        401:
          description: Unauthorized Request
          schema:
            $ref: './models.json#/definitions/Error'
        403:
          description: access to this resource is forbidden
          schema:
            $ref: './models.json#/definitions/Error'
        409:
          description: Already Exists
          schema:
            $ref: './models.json#/definitions/Error'
        default:
          description: Standard error
          schema:
            $ref: "./models.json#/definitions/Error"
  /{secretName}:
    parameters:
    - $ref: '#/parameters/orgIDParam'
    - $ref: '#/parameters/projectNameParam'
    - in: path
      name: secretName
      description: name of the secret to operate on
      required: true
      type: string
      pattern: '^[\w\d][\w\d\-]*[\w\d]|[\w\d]+$'
    get:
      operationId: getSecret
      tags:
        - secret
      produces:
        - application/json
      responses:
        200:
          description: The secret identified by the secretName
          schema:
            $ref: "./models.json#/definitions/Secret"
        400:
          description: Bad Request
          schema:
            $ref: './models.json#/definitions/Error'
        401:
          description: Unauthorized Request
          schema:
            $ref: './models.json#/definitions/Error'
        403:
          description: access to this resource is forbidden
          schema:
            $ref: './models.json#/definitions/Error'
        404:
          description: Resource Not Found if no secret exists with the given name
          schema:
            $ref: "./models.json#/definitions/Error"
        default:
          description: Standard error
          schema:
            $ref: "./models.json#/definitions/Error"
    put:
      operationId: updateSecret
      tags:
        - secret
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: secret
          schema:
            $ref: "./models.json#/definitions/Secret"
        - in: path
          name: secretName
          type: string
          pattern: '^[\w\d][\w\d\-]*[\w\d]|[\w\d]+$'
          required: true
      responses:
        201:
          description: The updated secret
          schema:
            $ref: "./models.json#/definitions/Secret"
        400:
          description: Bad Request
          schema:
            $ref: './models.json#/definitions/Error'
        401:
          description: Unauthorized Request
          schema:
            $ref: './models.json#/definitions/Error'
        403:
          description: access to this resource is forbidden
          schema:
            $ref: './models.json#/definitions/Error'
        404:
          description: Resource Not Found if no secret exists with the given name
          schema:
            $ref: "./models.json#/definitions/Error"
        default:
          description: generic error
          schema:
            $ref: "./models.json#/definitions/Error"
    delete:
      operationId: deleteSecret
      tags:
        - secret
      parameters:
        - in: path
          name: secretName
          type: string
          pattern: '^[\w\d][\w\d\-]*[\w\d]|[\w\d]+$'
          required: true
      responses:
        204:
          description: Successful deletion
        400:
          description: Bad Request
          schema:
            $ref: './models.json#/definitions/Error'
        401:
          description: Unauthorized Request
          schema:
            $ref: './models.json#/definitions/Error'
        403:
          description: access to this resource is forbidden
          schema:
            $ref: './models.json#/definitions/Error'
        404:
          description: Resource Not Found if no secret exists with the given name
          schema:
            $ref: "./models.json#/definitions/Error"
        default:
          description: generic error
          schema:
            $ref: "./models.json#/definitions/Error"