{
  "openapi": "3.0.1",
  "info": {
    "title": "Vatis Stream Service",
    "description": "Vatis Stream Service API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://stream-service.vatis.tech",
      "description": "Default server"
    }
  ],
  "paths": {
    "/stream-service/api/v1/streams/{streamId}/cancel": {
      "put": {
        "tags": [
          "stream-resource-impl"
        ],
        "summary": "Cancel",
        "description": "Cancels a stream. This operation can be performed by a gateway, on behalf of the user",
        "operationId": "cancel",
        "parameters": [
          {
            "name": "streamId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Exception on client authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Exception on webhook configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "One or more processors are not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Stream usage limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Failed to create the stream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Requested feature is not implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Default error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "Stream canceled successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerToken": []
          }
        ]
      }
    },
    "/stream-service/api/v1/streams": {
      "get": {
        "tags": [
          "stream-resource-impl"
        ],
        "summary": "Find all",
        "description": "Find all streams the current user has access to in a paginated manner",
        "operationId": "findAll",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "description": "One or more stream states to filter by",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "READY",
                  "COMPLETED",
                  "FAILED",
                  "EXPIRED"
                ]
              }
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "size",
            "in": "query",
            "description": "Page size",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Exception on client authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Exception on webhook configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "One or more processors are not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Stream usage limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Failed to create the stream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Requested feature is not implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Default error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "Page of streams",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerToken": []
          }
        ]
      }
    },
    "/stream-service/api/v1/streams/{streamId}": {
      "get": {
        "tags": [
          "stream-resource-impl"
        ],
        "summary": "Find by id",
        "description": "Retrieves a stream by id",
        "operationId": "findById",
        "parameters": [
          {
            "name": "streamId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Exception on client authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Exception on webhook configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "One or more processors are not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Stream usage limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Failed to create the stream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Requested feature is not implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Default error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "Stream retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerToken": []
          }
        ]
      }
    },
    "/stream-service/api/v1/streams/{streamId}/components": {
      "get": {
        "tags": [
          "stream-resource-impl"
        ],
        "summary": "Get components",
        "description": "Get the components of a stream",
        "operationId": "getComponents",
        "parameters": [
          {
            "name": "streamId",
            "in": "path",
            "description": "Stream id",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Exception on client authorization",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "400": {
            "description": "Exception on webhook configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Access denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "One or more processors are not available",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Stream usage limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Failed to create the stream",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "501": {
            "description": "Requested feature is not implemented",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Default error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "200": {
            "description": "Stream components retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamComponentsDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerToken": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer",
            "format": "int32"
          },
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "internalErrorName": {
            "type": "string"
          },
          "nestedErrors": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "ProcessorConfigurationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "source": {
            "$ref": "#/components/schemas/SubscriptionDto"
          },
          "destination": {
            "$ref": "#/components/schemas/TopicDto"
          },
          "clusterDomainName": {
            "type": "string"
          },
          "podsDiscoveryClusterDomainName": {
            "type": "string"
          },
          "propertiesSchema": {
            "type": "string"
          },
          "properties": {
            "type": "object"
          },
          "egress": {
            "$ref": "#/components/schemas/ProcessorEgressConfigurationDto"
          }
        }
      },
      "ProcessorEgressConfigurationDto": {
        "type": "object",
        "properties": {
          "persist": {
            "type": "boolean"
          },
          "sink": {
            "type": "boolean"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "StreamConfigurationDto": {
        "type": "object",
        "properties": {
          "streamConfigurationTemplateId": {
            "type": "string"
          },
          "dataSource": {
            "$ref": "#/components/schemas/TopicDto"
          },
          "dataSinks": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/TopicDto"
            }
          },
          "processors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProcessorConfigurationDto"
            }
          },
          "dynamicWebhookEndpoints": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpointDto"
            }
          }
        }
      },
      "StreamDto": {
        "type": "object",
        "properties": {
          "streamId": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "groupId": {
            "type": "string",
            "format": "uuid"
          },
          "configuration": {
            "$ref": "#/components/schemas/StreamConfigurationDto"
          },
          "createdTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "creatorId": {
            "type": "string"
          },
          "groupCreatorId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "READY",
              "COMPLETED",
              "FAILED",
              "EXPIRED"
            ]
          },
          "stateDescription": {
            "type": "string"
          },
          "finalizedTimestamp": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SubscriptionDto": {
        "type": "object",
        "properties": {
          "subscription": {
            "type": "string"
          },
          "topic": {
            "type": "string"
          },
          "messageSchema": {
            "type": "string"
          },
          "connectionOptions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      "TopicDto": {
        "type": "object",
        "properties": {
          "topic": {
            "type": "string"
          },
          "messageSchema": {
            "type": "string"
          },
          "connectionOptions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "messageHeaders": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "subscriptions": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/SubscriptionDto"
            }
          }
        }
      },
      "WebhookEndpointDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "enabled": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "Page": {
        "type": "object",
        "properties": {
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalElements": {
            "type": "integer",
            "format": "int64"
          },
          "pageable": {
            "$ref": "#/components/schemas/PageableObject"
          },
          "numberOfElements": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int32"
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "number": {
            "type": "integer",
            "format": "int32"
          },
          "sort": {
            "$ref": "#/components/schemas/SortObject"
          },
          "first": {
            "type": "boolean"
          },
          "last": {
            "type": "boolean"
          },
          "empty": {
            "type": "boolean"
          }
        }
      },
      "PageableObject": {
        "type": "object",
        "properties": {
          "paged": {
            "type": "boolean"
          },
          "unpaged": {
            "type": "boolean"
          },
          "pageNumber": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "offset": {
            "type": "integer",
            "format": "int64"
          },
          "sort": {
            "$ref": "#/components/schemas/SortObject"
          }
        }
      },
      "SortObject": {
        "type": "object",
        "properties": {
          "unsorted": {
            "type": "boolean"
          },
          "sorted": {
            "type": "boolean"
          },
          "empty": {
            "type": "boolean"
          }
        }
      },
      "GatewayComponentDto": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "CONNECTED",
              "DISCONNECTED",
              "CLOSED",
              "ERROR"
            ]
          },
          "stateChangedTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "stateDescription": {
            "type": "string"
          }
        }
      },
      "ProcessorComponentDto": {
        "type": "object",
        "properties": {
          "processorId": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "RUNNING",
              "COMPLETED",
              "WAITING",
              "ERROR",
              "CLOSED"
            ]
          },
          "stateChangedTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "stateDescription": {
            "type": "string"
          }
        }
      },
      "StreamComponentsDto": {
        "type": "object",
        "properties": {
          "streamId": {
            "type": "string",
            "format": "uuid"
          },
          "groupId": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "READY",
              "COMPLETED",
              "FAILED",
              "EXPIRED"
            ]
          },
          "stateDescription": {
            "type": "string"
          },
          "stateChangedTimestamp": {
            "type": "string",
            "format": "date-time"
          },
          "gateway": {
            "$ref": "#/components/schemas/GatewayComponentDto"
          },
          "processors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProcessorComponentDto"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  }
}
