vorteil/direktiv

View on GitHub
openapi/src/paths/paths.yaml

Summary

Maintainability
Test Coverage

/api/v2/namespaces/{namespace}/events/broadcast:
  post:
    tags:
    - events
    summary: Broadcast a cloud event to a namespace.    
    description: |
      This endpoint allows you to broadcast a cloud event to a specific namespace using json encoding. Cloud events are a specification for describing event data in a common way. https://github.com/cloudevents/spec
    parameters:
      - name: namespace
        in: path
        description: The namespace to which the cloud event will be broadcasted.
        required: true
        schema:
            type: string
            pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
        style: simple
    requestBody:
      description: Data representing the cloud event(s) to be broadcasted.
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              specversion:
                type: string
                description: The version of the CloudEvents specification.
              id:
                type: string
                description: The unique identifier for the event.
              source:
                type: string
                format: uri
                description: The source of the event.
              type:
                type: string
                description: The type of the event.
              additionalProperties:
                  type: object
        application/cloudevents-batch+json:
          schema:
            type: array
            items: 
              type: object
              properties:
                specversion:
                  type: string
                  description: The version of the CloudEvents specification.
                id:
                  type: string
                  description: The unique identifier for the event.
                source:
                  type: string
                  format: uri
                  description: The source of the event.
                type:
                  type: string
                  description: The type of the event.
                additionalProperties:
                  type: object
/api/v2/namespaces/{namespace}/events/history:
  get:
    tags:
    - events
    summary: Retrieve the history of events within a specific namespace.
    description: |
      This endpoint allows you to retrieve the history of events within the specified namespace. You can filter events based on various criteria such as creation time, reception time, event type, and text contained in the event.
    parameters:
      - name: namespace
        in: path
        description: The namespace for which to retrieve event history.
        required: true
        schema:
            type: string
            pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
        style: simple
      - name: before
        in: query
        description: Retrieve events created before the specified timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: createdBefore
        in: query
        description: Retrieve events created before a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: createdAfter
        in: query
        description: Retrieve events created after a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: receivedBefore
        in: query
        description: Retrieve events received before a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: receivedAfter
        in: query
        description: Retrieve events received after a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: eventContains
        in: query
        description: Retrieve events containing specific text.
        schema:
          type: string
      - name: typeContains
        in: query
        description: Retrieve events containing specific type.
        schema:
          type: string
    responses:
      '200':
        description: OK
        content:
          'application/json':
            example:
              meta:
                previousPage: '2024-04-25T13:39:00.01915Z'
                startingFrom: '2024-01-16T01:44:08.128136Z'
              data:
              - event:
                  specversion: '1.0'
                  id: '4'
                  source: 'https://direktiv.io/test'
                  type: 'testerDuplicate'
                namespace: 'b1e7f55b-3e16-4b9c-b5b5-3f94c5e149c0'
                namespaceName: 'wfeventsv2'
                receivedAt: '2024-04-25T13:39:00.01915Z'
                serialID: 1
            schema:
              type: object
              properties:
                meta:
                  type: object
                  nullable: true
                  properties:
                    previousPage:
                      type: string
                      format: RFC3339Nano
                      nullable: true
                    startingFrom:
                      type: string
                      format: RFC3339Nano
                data:
                  type: array
                  items: 
                    type: object
                    properties:
                      namespaceName: 
                        type: string
                      namespace: 
                        type: string
                      receivedAt: 
                        type: string
                        format: RFC3339Nano
                      serialID:
                        type: int
                      event:       
                        type: object
                        required:
                          - specversion
                          - id
                          - source 
                          - type
                        properties:
                          specversion:
                            type: string
                          id:
                            type: string
                          source:
                            type: string
                            format: uri
                          type:
                            type: string
                          additionalProperties:
                            type: object
/api/v2/namespaces/{namespace}/events/subscribe:
  get:
    tags:
    - events
    summary: Api for SSE streaming of incoming events stating the systems current time.
    parameters:
      - name: namespace
        in: path
        required: true
        schema:
            type: string
            pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
        style: simple
      - name: Last-Event-ID
        in: header
        required: false
        schema:
          type: integer
      - name: createdBefore
        in: query
        description: Retrieve events created before a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: createdAfter
        in: query
        description: Retrieve events created after a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: receivedBefore
        in: query
        description: Retrieve events received before a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: receivedAfter
        in: query
        description: Retrieve events received after a specific timestamp.
        schema:
          type: string
          format: RFC3339Nano
      - name: eventContains
        in: query
        description: Retrieve events containing specific text.
        schema:
          type: string
      - name: typeContains
        in: query
        description: Retrieve events containing specific type.
        schema:
          type: string
    responses:
      '200':
        description: OK
        content:
          text/event-stream:
            example: |
              id: 1
              event: message
              data: {"Event":{"specversion":"1.0","id":"1234","source":"https://direktiv.io/test","type":"testerDuplicate"},"namespace":"e09f0392-fe09-4378-bc0a-de3ab634f4e6","namespaceName":"wfeventsv2","receivedAt":"2024-04-25T14:28:56.374147Z", "serialID":1}

              id: 2
              event: message
              data: {"Event":{"specversion":"1.0","id":"1234-234234","source":"https://direktiv.io/test","type":"testerDuplicate"},"namespace":"e09f0392-fe09-4378-bc0a-de3ab634f4e6","namespaceName":"wfeventsv2","receivedAt":"2024-04-25T14:28:56.374148Z", "serialID":2}
/api/v2/namespaces/{namespace}/events/listener:
  get:
    tags:
    - events
    summary: Retrieve a list of the last 200 event listeners within a specific namespace.
    description: |
      This endpoint retrieves a list of the last 200 event listeners configured within the specified namespace. Event listeners are entities that listen for specific events within a workflow environment, allowing for event-driven architecture.
    parameters:
      - name: namespace
        in: path
        description: The namespace for which to retrieve event listeners.
        required: true
        schema:
            type: string
            pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
    responses:
      '200':
        description: OK
        content:
          'application/json':
            example:
              meta:
                previousPage: '2024-04-25T13:39:00.01915Z'
                startingFrom: '2024-01-16T01:44:08.128136Z'
              data:
                - id: '977a5b18-27bf-4914-b666-456cc0073ea9'
                  createdAt: '2024-04-25T20:55:00.956697Z'
                  updatedAt: '2024-04-25T20:55:00.956697Z'
                  namespace: 'wfeventsv2'
                  listeningForEventTypes: 
                    - 'greeting'
                  triggerType: 'StartSimple'
                  triggerWorkflow: '/listener.yml'
            schema:
              type: object
              properties:
                meta:
                  type: object
                  nullable: true
                  properties:
                    previousPage:
                      type: string
                      format: RFC3339Nano
                      nullable: true
                    startingFrom:
                      type: string
                      format: RFC3339Nano
                data:
                  type: array
                  items: 
                    type: object
                    properties:
                      id:
                        type: string
                        required: true
                        description: The unique identifier of the event listener.
                      createdAt:
                        type: string
                        required: true
                        description: The timestamp indicating when the event listener was created.
                      updatedAt:
                        type: string
                        required: true
                        description: The timestamp indicating when the event listener was last updated.
                      namespace:
                        type: string
                        required: true
                        description: The namespace to which the event listener belongs.
                      listeningForEventTypes:
                        type: array
                        items:
                          type: string
                        description: The types of events the listener is configured to listen for.
                      triggerType:
                        type: string
                        required: true
                        description: The type of trigger associated with the event listener.
                      triggerWorkflow:
                        type: string
                        description: The workflow triggered by the event listener.
                      triggerInstance:
                        type: string
                        description: The instance triggered by the event listener.
                      globGatekeepers:
                        type: object
                        description: Global gatekeepers associated with the event listener.

/api/v2/namespaces/{namespace}/events/listener/{listenerID}:
    get:
      tags:
      - events
      summary: Retrieve details of an individual event listener within a namespace.
      description: |
        This endpoint retrieves details of an individual event listener identified by the provided listener ID within the specified namespace. Event listeners are entities configured to listen for specific events within a workflow environment, facilitating event-driven interactions.
      parameters:
        - name: namespace
          in: path
          required: true
          schema:
              type: string
              pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
        - name: listenerID
          in: path    
          required: true
          schema:
              type: string
              pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
      responses:
        '200':
          description: OK
          content:
            'application/json':
              example:
                data:
                  id: '977a5b18-27bf-4914-b666-456cc0073ea9'
                  createdAt: '2024-04-25T20:55:00.956697Z'
                  updatedAt: '2024-04-25T20:55:00.956697Z'
                  namespace: 'wfeventsv2'
                  listeningForEventTypes: 
                    - 'greeting'
                  triggerType: 'StartSimple'
                  triggerWorkflow: '/listener.yml'
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        required: true
                        description: The unique identifier of the event listener.
                      createdAt:
                        type: string
                        required: true
                        description: The timestamp indicating when the event listener was created.
                      updatedAt:
                        type: string
                        required: true
                        description: The timestamp indicating when the event listener was last updated.
                      namespace:
                        type: string
                        required: true
                        description: The namespace to which the event listener belongs.
                      listeningForEventTypes:
                        type: array
                        items:
                          type: string
                        description: The types of events the listener is configured to listen for.
                      triggerType:
                        type: string
                        required: true
                        description: The type of trigger associated with the event listener.
                      triggerWorkflow:
                        type: string
                        description: The workflow triggered by the event listener.
                      triggerInstance:
                        type: string
                        description: The instance triggered by the event listener.
                      globGatekeepers:
                        type: object
                        description: Global gatekeepers associated with the event listener.

/api/v2/namespaces/{namespace}/files/{path}:
  get:
    tags:
      - files
    summary: Read any node in the filesystem tree
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: path
        in: path
        schema:
          type: string
          description: path of the node to read (with slashes)
        required: true
    responses:
      "200":
        description: filesystem tree node data
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  allOf: # Combines the BasicErrorModel and the inline model
                    - $ref: '../objects.yaml#/FileNodeWithoutData'
                    - type: object
                      description: files node data
                      properties:
                        data:
                          type: string
                          description: (only with type != directory) base64 encoded string of the file content
                        children:
                          type: array
                          description: list of files child nodes
                          items:
                            $ref: '../objects.yaml#/FileNodeWithoutData'

  delete:
    tags:
      - files
    summary: Delete any node in the filesystem tree
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: path
        in: path
        schema:
          type: string
          description: path of the node to delete (with slashes)
        required: true
    responses:
      "200":
        description: filesystem tree node deleted successfully


  post:
    tags:
      - files
    summary: Create a node in the filesystem tree
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: path
        in: path
        schema:
          type: string
          description: path of the parent node (with slashes)
        required: true
    requestBody:
      description: User data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
             name:
               type: string
               description: name of the node(file or directory name)
             type:
               type: string
               enum: [ directory, file, workflow, service, endpoint, consumer ]
               description: type of the node
             mimeType:
               type: string
               description: (only with type != directory) mime type of the file content
             data:
               type: string
               description: (only with type != directory) base64 encoded string of the file content

    responses:
      "200":
        description: filesystem tree node created successfully
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  $ref: '../objects.yaml#/FileNodeWithoutData'

  patch:
    tags:
      - files
    summary: Update a node in the filesystem tree (change path or data)
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: path
        in: path
        schema:
          type: string
          description: path of the parent node (with slashes)
        required: true
    requestBody:
      description: User data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              path:
                type: string
                description: the new absolute path of the node(file or directory name)
              data:
                type: string
                description: (only with type != directory) base64 encoded string of the file content
    responses:
      "200":
        description: filesystem tree node updated successfully
        content:
          application/json:
            schema:
              type: object
              allOf: # Combines the BasicErrorModel and the inline model
                - $ref: '../objects.yaml#/FileNodeWithoutData'
                - type: object
                  description: files node data
                  properties:
                    data:
                      type: string
                      description: (only with type != directory) base64 encoded string of the file content
/api/v2/namespaces/{namespace}/gateway/consumers:
  get:
    tags:
      - gateway
    summary: Get all consumers
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: Consumers for gateway in the namespace
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      username:
                        type: string
                        description: unique username
                      password:
                        type: string
                        description: password for basic authentication
                      api_key:
                        type: string
                        description: api key for the user
                      tags:
                        type: array
                        nullable: true
                        items:
                          type: string
                          description: tag identifier
                      groups:
                        type: array
                        nullable: true
                        items:
                          type: string
                          description: group identifier

/api/v2/namespaces/{namespace}/gateway/routes:
  get:
    tags:
      - gateway
    summary: Get all routes
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - in: query
        name: path
        schema:
          type: string
        description: Filter result by path string
    responses:
      "200":
        description: Routes for gateway in the namespace
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '../objects.yaml#/route'

/api/v2/namespaces/{namespace}/instances:
  get:
    tags:
      - instances
    summary: Get all instances
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: limit
        in: query
        required: false
        schema:
          type: integer
      - name: offset
        in: query
        required: false
        schema:
          type: integer
      - name: filter.field
        in: query
        required: false
        schema:
          type: string
      - name: filter.type
        in: query
        required: false
        schema:
          type: string
      - name: filter.val
        in: query
        required: false
        schema:
          type: string
    responses:
      "200":
        description: Instances list returned
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    $ref: '../objects.yaml#/InstanceData'
  
  post:
    tags:
      - instances
    summary: Create an instance
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: path
        in: query
        schema:
          type: string
          description: filepath of the workflow to base the instance on
        required: true
      - name: wait
        in: query
        schema:
          type: string
    responses:
      "200":
        description: Instance created.
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: '../objects.yaml#/InstanceData'

/api/v2/namespaces/{namespace}/instances/{instanceID}:
  patch:
    tags:
      - instances
    summary: Change information about an instance. Right now this can only be used to cancel an instance.
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/instanceID'
    requestBody:
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                description: Must be 'cancelled'.
    responses:
      "200":
        description: This request returns nothing.

  get:
    tags:
      - instances
    summary: Get detailed instance information including blob lengths.
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/instanceID'
    responses:
      "200":
        description: Instance summary information only returned.
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: '../objects.yaml#/InstanceData'

/api/v2/namespaces/{namespace}/instances/{instanceID}/input:
  get:
    tags:
      - instances
    summary: Get detailed instance information including the input blob.
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/instanceID'
    responses:
      "200":
        description: Instance summary information plus input blob returned.
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: '../objects.yaml#/InstanceData'

/api/v2/namespaces/{namespace}/instances/{instanceID}/output:
  get:
    tags:
      - instances
    summary: Get detailed instance information including the output blob.
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/instanceID'
    responses:
      "200":
        description: Instance summary information plus output blob returned.
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: '../objects.yaml#/InstanceData'

/api/v2/namespaces/{namespace}/instances/{instanceID}/metadata:
  get:
    tags:
      - instances
    summary: Get detailed instance information including the metadata blob.
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/instanceID'
    responses:
      "200":
        description: Instance summary information plus metadata blob returned.
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  $ref: '../objects.yaml#/InstanceData'

/api/v2/namespaces/{namespace}/instances/{instancesID}/subscribe:
 get:
   tags:
     - instances
   summary: API for SSE streaming of instance data. The form of the data should match the generic instance request.
   parameters:
     - $ref: '../parameters.yaml#/namespace'
     - $ref: '../parameters.yaml#/instanceID'
   responses:
     "200":
       description: Instance summary information only returned.
       content:
         text/event-stream:
           schema:
             type: object
#

/api/v2/namespaces/{namespace}/metrics/instance:
  get:
    tags:
      - metrics
    summary: Gets all notifications in a namespace
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - in: query
        name: workflowPath
        required: true
        schema:
          type: string
        description: Defined which workflow the instances will be related to.
    responses:
      "200":
        description: Workflow instance metrics.
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    complete:
                      type: int
                    failed:
                      type: int
                    cancelled:
                      type: int
                    crashed:
                      type: int
                    pending:
                      type: int
                    total:
                      type: int

/api/v2/namespaces:
  get:
    tags:
      - namespaces
    summary: List all direktiv namespaces
    responses:
      "200":
        description: list of direktiv namespaces
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        description: a unique string that represent name of the namespace
                      isSystemNamespace:
                        type: boolean
                        description: returns true only if this is a privileged namespace with special system-wide impacts.
                      mirror:
                        type: object
                        nullable: true
                        description: git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
                        properties:
                          url:
                            type: string
                            description: url of the git repo
                          gitRef:
                            type: string
                            description: git branch name
                          authType:
                            type: string
                            enum: [ public, ssh, token]
                            description: this field indicated what kind of authentication is used
                          publicKey:
                            type: string(optional)
                            description: associated publish key ssh credential
                          insecure:
                            type: boolean
                            description: to ignore insecure ssl certificates
                          createdAt:
                            type: string
                            description: timestamp of creation date
                          updatedAt:
                            type: string
                            description: timestamp of last updating date
                      createdAt:
                        type: string
                        description: timestamp of creation date
                      updatedAt:
                        type: string
                        description: timestamp of last updating date

  post:
    tags:
      - namespaces
    summary: Creates a new direktiv namespace
    requestBody:
      description: Namespace's creating data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                description: a unique name string of the namespace
              mirror:
                type: object
                nullable: true
                description: git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
                properties:
                  url:
                    type: string
                    description: url of the git repo
                  gitRef:
                    type: string
                    description: git branch name
                  authType:
                    type: string
                    enum: [ public, ssh, token ]
                    description: this field indicated what kind of authentication is used
                  authToken:
                    type: string(optional)
                    description: auth token used to clone git repo
                  publicKey:
                    type: string(optional)
                    description: associated publish key ssh credential
                  privateKey:
                    type: string(optional)
                    description: associated private key ssh credential
                  privateKeyPassphrase:
                    type: string(optional)
                    description: associated private key passphrase ssh credential
                  insecure:
                    type: boolean
                    description: to ignore insecure ssl certificates

    responses:
      "200":
        description: data of the created direktiv namespace
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    name:
                      type: string
                      description: a unique string that represent name of the namespace
                    isSystemNamespace:
                        type: boolean
                        description: returns true only if this is a privileged namespace with special system-wide impacts.
                    mirror:
                      type: object
                      nullable: true
                      description: git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
                      properties:
                        url:
                          type: string
                          description: url of the git repo
                        gitRef:
                          type: string
                          description: git branch name
                        authType:
                          type: string
                          enum: [ public, ssh, token]
                          description: this field indicated what kind of authentication is used
                        publicKey:
                          type: string(optional)
                          description: associated publish key ssh credential
                        insecure:
                          type: boolean
                          description: to ignore insecure ssl certificates
                        createdAt:
                          type: string
                          description: timestamp of creation date
                        updatedAt:
                          type: string
                          description: timestamp of last updating date
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date


/api/v2/namespaces/{namespace}:
  get:
    tags:
      - namespaces
    summary: Fetches a direktiv namespace
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: data of the direktiv  namespace
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    name:
                      type: string
                      description: a unique name string of the namespace
                    isSystemNamespace:
                        type: boolean
                        description: returns true only if this is a privileged namespace with special system-wide impacts.
                    mirror:
                      type: object
                      nullable: true
                      description: git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
                      properties:
                        url:
                          type: string
                          description: url of the git repo
                        gitRef:
                          type: string
                          description: git branch name
                        authType:
                          type: string
                          enum: [ public, ssh, token]
                          description: this field indicated what kind of authentication is used
                        publicKey:
                          type: string(optional)
                          description: associated publish key ssh credential
                        insecure:
                          type: boolean
                          description: to ignore insecure ssl certificates
                        createdAt:
                          type: string
                          description: timestamp of creation date
                        updatedAt:
                          type: string
                          description: timestamp of last updating date
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

  delete:
    tags:
      - namespaces
    summary: Removes a direktiv namespace and all related resources
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description:  object deleted successfully

  patch:
    tags:
      - namespaces
    summary: Patches a direktiv namespace
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    requestBody:
      description: Namespace's updated data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              mirror:
                type: object
                nullable: true
                description: git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
                properties:
                  url:
                    type: string
                    description: url of the git repo
                  gitRef:
                    type: string
                    description: git branch name
                  authType:
                    type: string
                    enum: [ public, ssh, token ]
                    description: this field indicated what kind of authentication is used
                  authToken:
                    type: string(optional)
                    description: auth token used to clone git repo
                  publicKey:
                    type: string(optional)
                    description: associated publish key ssh credential
                  privateKey:
                    type: string(optional)
                    description: associated private key ssh credential
                  privateKeyPassphrase:
                    type: string(optional)
                    description: associated private key passphrase ssh credential
                  insecure:
                    type: boolean
                    description: to ignore insecure ssl certificates

    responses:
      "200":
        description: data of the updated direktiv namespace
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    name:
                      type: string
                      description: a unique string that represent name of the namespace
                    isSystemNamespace:
                        type: boolean
                        description: returns true only if this is a privileged namespace with special system-wide impacts.
                    mirror:
                      type: object
                      nullable: true
                      description: git mirror settings associated with the namespace (only with git mirrored namespace). Null value means this is a none mirrored (ordinary) namespace
                      properties:
                        url:
                          type: string
                          description: url of the git repo
                        gitRef:
                          type: string
                          description: git branch name
                        authType:
                          type: string
                          enum: [ public, ssh, token]
                          description: this field indicated what kind of authentication is used
                        publicKey:
                          type: string(optional)
                          description: associated publish key ssh credential
                        insecure:
                          type: boolean
                          description: to ignore insecure ssl certificates
                        createdAt:
                          type: string
                          description: timestamp of creation date
                        updatedAt:
                          type: string
                          description: timestamp of last updating date
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

/api/v2/namespaces/{namespace}/notifications:
  get:
    tags:
      - notifications
    summary: Gets all notifications in a namespace
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: list of notifications
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      issue:
                        type: string
                        description: dynamic string for humans to read
                      level:
                        type: string
                        description: enum of the notification severity level (currently only 'warning' exists)
                      type:
                        type: string
                        description: one of many fixed values that can be used as by tools to categorize the notification

/api/v2/namespaces/{namespace}/logs:
  get:
    tags:
    - plattformlogs
    summary: Api for listing the last 200 log entries for a given resource.
    parameters:
      - name: namespace
        in: path
        required: true
        schema:
            type: string
            pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
        style: simple
      - name: instance
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: route
        in: query
        required: false
        schema:
          type: string
      - name: activity
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: trace
        in: query
        required: false
        schema:
          type: string
      - name: before
        in: query
        required: false
        description: Optional argument for using to request logs older then the given time.
        schema: 
          type: string 
          format: RFC3339Nano
    responses:
      '200':
        description: OK
        content:
          'application/json':
            example:
              previousPage: '2024-01-17T01:44:08.128136Z'
              startingFrom: '2024-01-16T01:44:08.128136Z'
              data:
              - id: 0,
                time: '2024-01-17T01:44:08.128136Z'
                level: 'INFO'
                msg: 'Running state logic'
                trace: "00000000000000000000000000000000"
                span: "0000000000000000"
                workflow:
                  status: "running"
                  state: null,
                  branch: null,
                  path: "/test.yaml"
                  calledAs: null,
                  instance: 1bdf4042-1708-4212-b21d-7240f4685e4a
              - id: 13976,
                time: "2024-03-11T12:30:00.007424Z"
                msg: "Workflow has been triggered"
                level: "INFO"
                namespace: "nsfad"
                trace: "00000000000000000000000000000000"
                span: "0000000000000000"
                error: null
              - id: 14943
                time: "2024-03-11T12:35:55.978736Z"
                msg: "File 'variables/README.md' loaded."
                level: "INFO"
                namespace: null,
                trace: null,
                span: null,
                activity:
                  id: "29960091-2797-493e-a262-1a7765146cd4"
                error: null
              - id: 16138
                time: "2024-03-11T12:56:51.268669Z"
                msg: "can not process plugin"
                level: "ERROR"
                namespace: "myns"
                trace: 00000000000000000000000000000000
                span: 0000000000000000
                route: 
                  path: "/consumer"
                error: "forbidden"
            schema:
              type: object
              properties:
                meta:
                  type: object
                  nullable: true
                  properties:
                    previousPage:
                      type: string
                      format: RFC3339Nano
                      nullable: true
                    startingFrom:
                      type: string
                      format: RFC3339Nano
                data:
                  type: array
                  items: 
                    type: object
                    properties:
                      time: 
                        type: string 
                        format: RFC3339Nano
                      level: 
                        type: string 
                        enum: ["INFO", "ERROR", "WARNING", "DEBUG"]
                      msg: 
                        type: string
                      id: 
                        type: string
                      trace: 
                        type: string
                      span: 
                        type: string
                      namespace: 
                        type: string
                      error:
                        type: object
                        nullable: true
                      workflow:
                        type: object
                        nullable: true
                        properties:
                          status:
                            type: string
                            enum: ["error", "unknown", "running", "failed", "completed"]
                          state:
                            type: string
                          branch:
                            type: string
                            nullable: true
                          workflow:
                            type: string
                          calledAs:
                            type: string
                            nullable: true
                          instance:
                            type: string
                      activity:
                        type: object
                        nullable: true
                        properties:
                          id:
                            type: string
                            format: uuid
                            nullable: true
                      route:
                        type: object
                        nullable: true
                        properties:
                          path:
                            type: string
                            nullable: true
/api/v2/namespaces/{namespace}/logs/subscribe:
  get:
    tags:
    - plattformlogs
    summary: Api for SSE streaming of incoming logs stating the systems current time.
    parameters:
      - name: namespace
        in: path
        required: true
        schema:
            type: string
            pattern: '^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$'
        style: simple
      - name: instance
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: route
        in: query
        required: false
        schema:
          type: string
      - name: activity
        in: query
        required: false
        schema:
          type: string
          format: uuid
      - name: trace
        in: query
        required: false
        schema:
          type: string
      - name: Last-Event-ID
        in: header
        required: false
        schema:
          type: integer
    responses:
      '200':
        description: OK
        content:
          text/event-stream:
            example: |
              id: 4
              event: message
              data: {'id':'4','time':'2024-02-07T08:59:52.666925Z','msg':'Starting workflow /action.yaml','level':'INFO'}
              
              id: 6
              event: message
              data: {'id':'6','time':'2024-02-07T09:00:01.770604Z','msg':'Workflow /action.yaml completed.','level':'INFO'}

/api/v2/namespaces/{namespace}/registries:
  get:
    tags:
      - registries
    summary: Get all namespace registries
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: Registries list returned
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: a unique string that represent id of the registry
                      namespace:
                        type: string
                        description: the namespace of registry belongs
                      url:
                        type: string
                        description: url of the registry
                      user:
                        type: string
                        description: anonymize username of the registry

  post:
    tags:
      - registries
    summary: Create a new registry secret
    requestBody:
      description: User data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              url:
                type: string
                description: url of the registry
              user:
                type: string
                description: username of the registry
              password:
                type: string
                description: password string
    responses:
      "200":
        description: Created registry object returned
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: a unique string that represent id of the registry
                namespace:
                  type: string
                  description: the namespace of registry belongs
                url:
                  type: string
                  description: url of the registry
                user:
                  type: string
                  description: anonymize username of the registry

/api/v2/namespaces/{namespace}/registries/{registryID}:
  delete:
    tags:
      - registries
    summary: Remove a registry secret
    parameters:
      - $ref: '../parameters.yaml#/registryID'
    responses:
      "200":
        description:  Registry object deleted
/api/v2/namespaces/{namespace}/secrets:
  get:
    tags:
      - secrets
    summary: Gets all direktiv secrets in a namespace
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: list of direktiv secrets
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        description: a unique string that represent name of the secret
                      createdAt:
                        type: string
                        description: timestamp of creation date
                      updatedAt:
                        type: string
                        description: timestamp of last updating date

  post:
    tags:
      - secrets
    summary: Creates a new direktiv secret
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    requestBody:
      description: Secret's creating data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                description: a unique name string of the secret
              data:
                type: string
                description: base64 encoded string of the secret's data
    responses:
      "200":
        description: data of the created direktiv secret
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    name:
                      type: string
                      description: a unique name string of the secret
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

/api/v2/namespaces/{namespace}/secrets/{secretName}:
  get:
    tags:
      - secrets
    summary: Fetches a direktiv secret
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: secretName
        in: path
        required: true
        schema:
          type: string
          description: name of the secret
    responses:
      "200":
        description: data of the direktiv  secret
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    name:
                      type: string
                      description: a unique name string of the secret
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

  delete:
    tags:
      - secrets
    summary: Removes a direktiv  secret
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: secretName
        in: path
        required: true
        schema:
          type: string
          description: name of the secret
    responses:
      "200":
        description:  object deleted successfully

  patch:
    tags:
      - secrets
    summary: Updates a direktiv secret
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: secretName
        in: path
        required: true
        schema:
          type: string
          description: name of the secret
    requestBody:
      description: Secret's patching data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                description: a unique name string of the secret
              data:
                type: string
                description: base64 encoded string of the secret's data
    responses:
      "200":
        description: data of the updated direktiv secret
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    data:
                      type: string
                      description: base64 encoded string of the secret's data

/api/v2/namespaces/{namespace}/services:
  get:
    tags:
      - services
    summary: Get all services
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: Services list returned
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: a unique string that represent id of the service
                      type:
                        type: string
                        description: enum value ("workflow-service" or "namespace-service")
                      namespace:
                        type: string
                        description: the namespace of service belongs
                      name:
                        type: string
                        description: name of the service
                      filePath:
                        type: string
                        description: file path where this service is defined
                      image:
                        type: string
                        description: docker image of the service
                      cmd:
                        type: string
                        description: docker command
                      size:
                        type: string
                        description: can be 'large', 'medium' or 'small'
                      scale:
                        type: integer
                        description: number from 0 to 9
                      error:
                        type: [ string, null ]
                        description: error string when service failed to be scheduled, otherwise null
                      envs:
                        type: array
                        nullable: false
                        description: environment variables used to exec the service
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                              description: name of the variable
                            value:
                              type: string
                              description: value of the variable
                      conditions:
                        type: array
                        nullable: true
                        description: list of checks indicating the health checks of the service, null value means the service is not scheduled yet
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              description: name of the check
                            status:
                              type: string
                              description: can be 'True', 'False' or 'Unknown'
                            message:
                              type: string
                              description: human readable message about the reason of this condition - can be empty

/api/v2/namespaces/{namespace}/services/{serviceID}/pods:
  get:
    tags:
      - services
    summary: Get all pods for a given service
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/serviceID'
    responses:
      "200":
        description: Pods list returned
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: a unique string that represent id of the pod

/api/v2/namespaces/{namespace}/services/{serviceID}/pods/{podID}/logs:
  get:
    tags:
      - services
    summary: Stream logs for a given pod
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/serviceID'
      - $ref: '../parameters.yaml#/podID'
    responses:
      "200":
        description: Stream of plain text log data

/api/v2/namespaces/{namespace}/services/{serviceID}/actions/rebuild:
  post:
    tags:
      - services
    summary:  Rebuilds service
    # description:
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - $ref: '../parameters.yaml#/serviceID'
    responses:
      "200":
        description: Service rebuilds successfully

/api/v2/namespaces/{namespace}/syncs:
  get:
    tags:
      - syncs
    summary: Gets all direktiv namespace mirroring syncs
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: list of direktiv namespace mirroring syncs processes
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: a unique uuid string that identifies a namespace mirroring sync process
                      status:
                        type: string
                        enum: ["complete", "pending", "executing", "failed"]
                        description: string that indicate the status of the sync process
                      endedAt:
                        type: string
                        description: timestamp of process completion
                      createdAt:
                        type: string
                        description: timestamp of creation date
                      updatedAt:
                        type: string
                        description: timestamp of last updating date


  post:
    tags:
      - syncs
    summary: Creates (trigger) a new namespace mirroring sync
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    responses:
      "200":
        description: data of the created direktiv namespace mirroring sync status
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    id:
                      type: string
                      description: a unique uuid string that identifies a namespace mirroring sync process
                    status:
                      type: string
                      enum: ["complete", "pending", "executing", "failed"]
                      description: string that indicate the status of the sync process
                    endedAt:
                      type: string
                      description: timestamp of process completion
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date



/api/v2/namespaces/{namespace}/variables:
  get:
    tags:
      - variables
    summary: Gets all direktiv variables in a namespace
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - in: query
        name: workflowPath
        schema:
          type: string
        description: When set, the list will contain all variables under this workflow path
      - in: query
        name: instanceId
        schema:
          type: string
        description: When set, the list will contain all variables under this instance id
      - in: query
        name: name
        schema:
          type: string
        description:  When set, the list will contain only variables having this name. Empty list return when the filter matches to no variable
    responses:
      "200":
        description: list of direktiv variables
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: a unique string that represent id of the variable
                      type:
                        type: string
                        description: enum value ("namespace-variable", "workflow-variable", "instance-variable")
                      reference:
                        type: string
                        description: a reference to the object the variable linked to
                      name:
                        type: string
                        description: a unique name string of the variable (unique within the referenced object)
                      size:
                        type: number
                        description: data size (in bytes) of the variable's data
                      mimeType:
                        type: string
                        description: mime type of the variable's data
                      createdAt:
                        type: string
                        description: timestamp of creation date
                      updatedAt:
                        type: string
                        description: timestamp of last updating date

  post:
    tags:
      - variables
    summary: Creates a new direktiv variable
    parameters:
      - $ref: '../parameters.yaml#/namespace'
    requestBody:
      description: Variable's creating data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                description: a unique name string of the variable (unique within the referenced object)
              mimeType:
                type: string
                description: mime type of the variable's data
              data:
                type: string
                description: base64 encoded string of the variable's data
              workflowPath:
                type: string
                description: (only when linking to a workflow) path string to a workflow file
    responses:
      "200":
        description: data of the created direktiv variable
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    id:
                      type: string
                      description: a unique string that represent id of the variable
                    type:
                      type: string
                      description: enum value ("namespace-variable", "workflow-variable", "instance-variable")
                    reference:
                      type: string
                      description: a reference to the object the variable linked to
                    name:
                      type: string
                      description: a unique name string of the variable (unique within the referenced object)
                    size:
                      type: number
                      description: data size (in bytes) of the variable's data
                    mimeType:
                      type: string
                      description: mime type of the variable's data
                    data:
                      type: string
                      description: base64 encoded string of the variable's data
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

/api/v2/namespaces/{namespace}/variables/{variableID}:
  get:
    tags:
      - variables
    summary: Fetches a direktiv variable
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: variableID
        in: path
        required: true
        schema:
          type: string
          description: id string of the variable
    responses:
      "200":
        description: data of the direktiv  variable
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    id:
                      type: string
                      description: a unique string that represent id of the variable
                    type:
                      type: string
                      description: enum value ("namespace-variable", "workflow-variable", "instance-variable")
                    reference:
                      type: string
                      description: a reference to the object the variable linked to
                    name:
                      type: string
                      description: a unique name string of the variable (unique within the referenced object)
                    size:
                      type: number
                      description: data size (in bytes) of the variable's data
                    mimeType:
                      type: string
                      description: mime type of the variable's data
                    data:
                      type: string
                      description: base64 encoded string of the variable's data
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

  delete:
    tags:
      - variables
    summary: Removes a direktiv  variable
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: variableID
        in: path
        required: true
        schema:
          type: string
          description: id string of the variable
    responses:
      "200":
        description:  object deleted successfully

  patch:
    tags:
      - variables
    summary: Updates a direktiv variable
    parameters:
      - $ref: '../parameters.yaml#/namespace'
      - name: variableID
        in: path
        required: true
        schema:
          type: string
          description: id string of the variable
    requestBody:
      description: Variable's patching data
      required: true
      content:
        application/json:
          schema:
            type: object
            properties:
              name:
                type: string
                description: a unique name string of the variable (unique within the referenced object)
              mimeType:
                type: string
                description: mime type of the variable's data
              data:
                type: string
                description: base64 encoded string of the variable's data
    responses:
      "200":
        description: data of the updated direktiv variable
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    id:
                      type: string
                      description: a unique string that represent id of the variable
                    type:
                      type: string
                      description: enum value ("namespace-variable", "workflow-variable", "instance-variable")
                    reference:
                      type: string
                      description: a reference to the object the variable linked to
                    name:
                      type: string
                      description: a unique name string of the variable (unique within the referenced object)
                    size:
                      type: number
                      description: data size (in bytes) of the variable's data
                    mimeType:
                      type: string
                      description: mime type of the variable's data
                    data:
                      type: string
                      description: base64 encoded string of the variable's data
                    createdAt:
                      type: string
                      description: timestamp of creation date
                    updatedAt:
                      type: string
                      description: timestamp of last updating date

/api/v2/status:
  get:
    summary: Get server status information.
    tags:
    - server
    responses:
      '200': 
        description: Server status information.
        content:
          application/json:
            example:
              data: "1.0.0"
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    version:
                      type: string
                      description: a unique string that represent id of the variable
                    isEnterprise:
                      type: boolean
                      description: indicates if the backend is an enterprise installation
                    requiresAuth:
                      type: boolean
                      description: indicates if the backend requires auth token to authenticate requests