openapi: 3.0.0
info:
  description: Azion Services
  title: Services API
  version: 2.0.0
servers:
- description: Local Dev
  url: http://localhost:3002
- description: Staging
  url: http://stage-bff-gke.azion.net:3002
- description: Production
  url: http://bff.azion.net:3002
security:
- bearerAuth: []
paths:
  /edge_services/:
    get:
      operationId: getServices
      parameters:
      - explode: true
        in: query
        name: page
        required: false
        schema:
          format: int64
          type: integer
        style: form
      - explode: true
        in: query
        name: page_size
        required: false
        schema:
          format: int64
          type: integer
        style: form
      - explode: true
        in: query
        name: filter
        required: false
        schema:
          type: string
        style: form
      - explode: true
        in: query
        name: order_by
        required: false
        schema:
          type: string
        style: form
      - explode: true
        in: query
        name: sort
        required: false
        schema:
          type: string
        style: form
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceResponseWithTotals'
          description: OK
        "400":
          description: Bad Request
        "500":
          description: Internal Server Error
      summary: Return Services by page
    post:
      operationId: newService
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateServiceRequest'
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceResponse'
          description: Created
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Create Service
  /edge_services/{id}:
    delete:
      operationId: deleteService
      parameters:
      - explode: false
        in: path
        name: id
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      responses:
        "204":
          description: No Content
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Delete Service by ID
    get:
      operationId: getService
      parameters:
      - explode: false
        in: path
        name: id
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      - explode: true
        in: query
        name: with_vars
        required: false
        schema:
          type: boolean
        style: form
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceResponse'
          description: OK
        "400":
          description: Bad Request
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      summary: Return Service by ID
    patch:
      operationId: patchService
      parameters:
      - explode: false
        in: path
        name: id
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateServiceRequest'
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceResponse'
          description: OK
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Update Service by ID
  /edge_services/{serviceId}/resources:
    get:
      operationId: getResources
      parameters:
      - explode: false
        in: path
        name: serviceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      - explode: true
        in: query
        name: page
        required: false
        schema:
          format: int64
          type: integer
        style: form
      - explode: true
        in: query
        name: page_size
        required: false
        schema:
          format: int64
          type: integer
        style: form
      - explode: true
        in: query
        name: filter
        required: false
        schema:
          type: string
        style: form
      - explode: true
        in: query
        name: order_by
        required: false
        schema:
          type: string
        style: form
      - explode: true
        in: query
        name: sort
        required: false
        schema:
          type: string
        style: form
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceResponseWithTotal'
          description: OK
        "400":
          description: Bad Request
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      summary: Return Service Resources by page
    post:
      operationId: postResource
      parameters:
      - explode: false
        in: path
        name: serviceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateResourceRequest'
        required: true
      responses:
        "201":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceDetail'
          description: Created
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Create Service Resource
  /edge_services/{serviceId}/resources/{resourceId}:
    delete:
      operationId: deleteResource
      parameters:
      - explode: false
        in: path
        name: serviceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      - explode: false
        in: path
        name: resourceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      responses:
        "204":
          description: No Content
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Delete Service Resource by ID
    get:
      operationId: getResource
      parameters:
      - explode: false
        in: path
        name: serviceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      - explode: false
        in: path
        name: resourceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceDetail'
          description: OK
        "400":
          description: Bad Request
        "404":
          description: Not Found
        "500":
          description: Internal Server Error
      summary: Return Service Resource by ID
    patch:
      operationId: patchServiceResource
      parameters:
      - explode: false
        in: path
        name: serviceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      - explode: false
        in: path
        name: resourceId
        required: true
        schema:
          format: int64
          type: integer
        style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateResourceRequest'
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceDetail'
          description: OK
        "400":
          description: Bad Request
        "403":
          description: Forbidden
        "404":
          description: Not Found
        "422":
          description: Unprocessable Entity
        "500":
          description: Internal Server Error
      summary: Update Service Resource by ID
components:
  schemas:
    CreateResourceRequest:
      additionalProperties: false
      example:
        content_type: content_type
        name: name
        trigger: trigger
        content: content
      properties:
        content:
          type: string
        content_type:
          type: string
        name:
          type: string
        trigger:
          type: string
      required:
      - content
      - content_type
      - name
      - trigger
      type: object
    CreateServiceRequest:
      additionalProperties: false
      example:
        name: name
      properties:
        name:
          type: string
      required:
      - name
      type: object
    ResourceDetail:
      additionalProperties: false
      example:
        content_type: content_type
        name: name
        id: 0
        type: type
        content: content
      properties:
        content:
          type: string
        content_type:
          type: string
        id:
          format: int64
          type: integer
        name:
          type: string
        trigger:
          type: string
      required:
      - content
      - content_type
      - id
      - name
      - trigger
      type: object
    ResourceResponse:
      additionalProperties: false
      example:
        content_type: content_type
        updated_at: updated_at
        last_editor: last_editor
        name: name
        id: 0
        trigger: reload
      properties:
        content_type:
          type: string
        id:
          format: int64
          type: integer
        last_editor:
          type: string
        name:
          type: string
        trigger:
          type: string
        updated_at:
          type: string
      required:
      - content_type
      - id
      - last_editor
      - name
      - trigger
      - updated_at
      type: object
    ResourceResponseWithTotal:
      additionalProperties: false
      example:
        total: 6
        resources:
        - content_type: content_type
          updated_at: updated_at
          last_editor: last_editor
          name: name
          id: 0
          type: type
        - content_type: content_type
          updated_at: updated_at
          last_editor: last_editor
          name: name
          id: 0
          type: type
      properties:
        resources:
          items:
            $ref: '#/components/schemas/ResourceResponse'
          type: array
        total:
          format: int64
          type: integer
      required:
      - resources
      - total
      type: object
    ServiceResponse:
      additionalProperties: false
      example:
        variables:
        - name: name
          value: value
        - name: name
          value: value
        updated_at: updated_at
        permissions:
        - permissions
        - permissions
        last_editor: last_editor
        name: name
        active: true
        bound_nodes: 0
        id: 6
      properties:
        active:
          type: boolean
        bound_nodes:
          format: int64
          type: integer
        id:
          format: int64
          type: integer
        last_editor:
          type: string
        name:
          type: string
        permissions:
          items:
            type: string
          type: array
        updated_at:
          type: string
        variables:
          items:
            $ref: '#/components/schemas/Variable'
          type: array
      required:
      - active
      - bound_nodes
      - id
      - last_editor
      - name
      - permissions
      - updated_at
      type: object
    ServiceResponseWithTotals:
      additionalProperties: false
      example:
        total: 1
        services:
        - variables:
          - name: name
            value: value
          - name: name
            value: value
          updated_at: updated_at
          permissions:
          - permissions
          - permissions
          last_editor: last_editor
          name: name
          active: true
          bound_nodes: 0
          id: 6
        - variables:
          - name: name
            value: value
          - name: name
            value: value
          updated_at: updated_at
          permissions:
          - permissions
          - permissions
          last_editor: last_editor
          name: name
          active: true
          bound_nodes: 0
          id: 6
      properties:
        services:
          items:
            $ref: '#/components/schemas/ServiceResponse'
          type: array
        total:
          format: int64
          type: integer
      required:
      - services
      - total
      type: object
    UpdateResourceRequest:
      additionalProperties: false
      example:
        content_type: content_type
        name: name
        trigger: trigger
        content: content
      properties:
        content:
          type: string
        content_type:
          type: string
        name:
          type: string
        trigger:
          type: string
      type: object
    UpdateServiceRequest:
      additionalProperties: false
      example:
        variables:
        - name: name
          value: value
        - name: name
          value: value
        name: name
        active: true
      properties:
        active:
          type: boolean
        name:
          type: string
        variables:
          items:
            $ref: '#/components/schemas/Variable'
          type: array
      type: object
    Variable:
      additionalProperties: false
      example:
        name: name
        value: value
      properties:
        name:
          type: string
        value:
          type: string
      required:
      - name
      - value
      type: object
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
