openapi: 3.0.0
info:
  license:
    name: MIT
    url: https://github.com/aziontech/azionapi-openapi/blob/main/LICENSE.md
  title: Variables API
  version: 1.0.0
servers:
- description: Production
  url: https://api.azionapi.net
security:
- tokenAuth: []
paths:
  /variables:
    get:
      description: List all user's Variables.
      operationId: api_variables_list
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/Variable'
                type: array
          description: ""
        "404":
          description: Not Found
      security:
      - tokenAuth: []
      summary: /variables
      tags:
      - Variables
    post:
      description: Create a new Variable. <br><ul><li>If the attribute "secret" is
        informed with value "true" in request payload the Variable value will be secret
        and no longer viewable after creation.</li><li>If the attribute "secret" is
        not informed the Variable value will be considered as not secret by default.</li></ul>
      operationId: api_variables_create
      requestBody:
        content:
          application/json:
            examples:
              SimpleVariableCreation:
                summary: Simple Variable creation
                value:
                  key: MY_SIMPLE_VAR
                  value: My not secret value
              SecretVariableCreation:
                summary: Secret Variable creation
                value:
                  key: MY_SECRET_VAR
                  value: My secret value
                  secret: true
            schema:
              $ref: '#/components/schemas/VariableCreate'
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VariableGet'
          description: ""
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      security:
      - tokenAuth: []
      summary: /variables
      tags:
      - Variables
  /variables/{uuid}:
    delete:
      description: Delete a Variable by it's UUID
      operationId: api_variables_destroy
      parameters:
      - explode: false
        in: path
        name: uuid
        required: true
        schema:
          pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
          type: string
        style: simple
      responses:
        "204":
          description: No response body
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      security:
      - tokenAuth: []
      summary: /variables/:uuid
      tags:
      - Variables
    get:
      description: Retrieve all data for a Variable by it's UUID
      operationId: api_variables_retrieve
      parameters:
      - explode: false
        in: path
        name: uuid
        required: true
        schema:
          pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
          type: string
        style: simple
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variable'
          description: ""
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      security:
      - tokenAuth: []
      summary: /variables/:uuid
      tags:
      - Variables
    put:
      description: Update variable attributes by it's UUID. Keep the Variable UUID
        but overwrite all editable attributes.
      operationId: api_variables_update
      parameters:
      - explode: false
        in: path
        name: uuid
        required: true
        schema:
          pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
          type: string
        style: simple
      requestBody:
        content:
          application/json:
            examples:
              SimpleVariableUpdate:
                summary: Simple Variable update
                value:
                  key: MY_NEW_SIMPLE_VAR_KEY
                  value: My new not secret value
              SecretVariableUpdate:
                summary: Secret Variable update
                value:
                  key: MY_NEW_SECRET_VAR_KEY
                  value: My new secret value
                  secret: true
            schema:
              $ref: '#/components/schemas/VariableCreate'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/VariableCreate'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/VariableCreate'
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VariableGet'
          description: ""
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      security:
      - tokenAuth: []
      summary: /variables/:uuid
      tags:
      - Variables
components:
  schemas:
    Variable:
      example:
        updated_at: 2000-01-23T04:56:07.000+00:00
        last_editor: last_editor
        created_at: 2000-01-23T04:56:07.000+00:00
        secret: true
        uuid: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        value: value
        key: key
      properties:
        uuid:
          format: uuid
          readOnly: true
          type: string
        key:
          maxLength: 100
          minLength: 1
          type: string
        value:
          maxLength: 32768
          minLength: 1
          type: string
        secret:
          readOnly: true
          type: boolean
        last_editor:
          readOnly: true
          type: string
        created_at:
          format: date-time
          type: string
        updated_at:
          format: date-time
          type: string
      required:
      - created_at
      - key
      - last_editor
      - secret
      - updated_at
      - uuid
      - value
      type: object
    VariableCreate:
      example:
        secret: true
        value: value
        key: key
      properties:
        key:
          maxLength: 100
          minLength: 1
          type: string
        value:
          maxLength: 32768
          minLength: 1
          type: string
        secret:
          type: boolean
      required:
      - key
      - value
      type: object
    VariableGet:
      example:
        updated_at: 2000-01-23T04:56:07.000+00:00
        last_editor: last_editor
        created_at: 2000-01-23T04:56:07.000+00:00
        secret: true
        uuid: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
        value: value
        key: key
      properties:
        uuid:
          format: uuid
          readOnly: true
          type: string
        key:
          maxLength: 100
          minLength: 1
          type: string
        value:
          description: |-
            Given the *incoming* primitive data, return the value for this field
            that should be validated and transformed to a native value.
          maxLength: 32768
          minLength: 1
          readOnly: true
          type: string
        secret:
          readOnly: true
          type: boolean
        last_editor:
          readOnly: true
          type: string
        created_at:
          format: date-time
          type: string
        updated_at:
          format: date-time
          type: string
      required:
      - created_at
      - key
      - last_editor
      - secret
      - updated_at
      - uuid
      - value
      type: object
  securitySchemes:
    tokenAuth:
      description: Token-based authentication with required prefix "Token"
      in: header
      name: Authorization
      type: apiKey
