openapi: 3.0.1
info:
  title: Fractal Live Systems
  description: Fractal Live Systems description
  contact:
    name: Fractal Cloud
    url: https://fractal.cloud/
    email: contact-us@fractal.cloud
  version: v1.0
paths:
  /Health:
    get:
      tags:
        - Health
      responses:
        '200':
          description: Success
  /LiveSystems:
    post:
      tags:
        - LiveSystems
      summary: Instantiate Live System
      requestBody:
        description: Command Request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InstantiateCommandRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/InstantiateCommandRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/InstantiateCommandRequest'
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/LiveSystemMutationDto'
            application/json:
              schema:
                $ref: '#/components/schemas/LiveSystemMutationDto'
            text/json:
              schema:
                $ref: '#/components/schemas/LiveSystemMutationDto'
  /LiveSystems/{resourceGroupId}/{liveSystemName}:
    put:
      tags:
        - LiveSystems
      summary: Update Live System
      parameters:
        - name: resourceGroupId
          in: path
          description: Resource Group Id
          required: true
          schema:
            type: string
        - name: liveSystemName
          in: path
          description: Live System Name
          required: true
          schema:
            type: string
      requestBody:
        description: Update Command Request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCommandRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/UpdateCommandRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/UpdateCommandRequest'
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/LiveSystemMutationDto'
            application/json:
              schema:
                $ref: '#/components/schemas/LiveSystemMutationDto'
            text/json:
              schema:
                $ref: '#/components/schemas/LiveSystemMutationDto'
    delete:
      tags:
        - LiveSystems
      summary: Delete Live System
      parameters:
        - name: resourceGroupId
          in: path
          description: Resource Group Id
          required: true
          schema:
            type: string
        - name: liveSystemName
          in: path
          description: Live System Name
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
    get:
      tags:
        - LiveSystems
      summary: Retrieve Live System
      parameters:
        - name: resourceGroupId
          in: path
          description: Resource Group Id
          required: true
          schema:
            type: string
        - name: liveSystemName
          in: path
          description: Live System Name
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/LiveSystemDto'
            application/json:
              schema:
                $ref: '#/components/schemas/LiveSystemDto'
            text/json:
              schema:
                $ref: '#/components/schemas/LiveSystemDto'
components:
  schemas:
    BlueprintComponentDto:
      type: object
      properties:
        displayName:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        id:
          type: string
          nullable: true
        version:
          type: string
          nullable: true
        parameters:
          type: object
          additionalProperties: {}
          nullable: true
        dependencies:
          uniqueItems: true
          type: array
          items:
            type: string
          nullable: true
        links:
          type: array
          items:
            $ref: '#/components/schemas/ComponentLinkDto'
          nullable: true
        outputFields:
          uniqueItems: true
          type: array
          items:
            type: string
          nullable: true
      additionalProperties: false
    BlueprintDto:
      type: object
      properties:
        fractalId:
          type: string
          nullable: true
        isPrivate:
          type: boolean
        status:
          $ref: '#/components/schemas/BlueprintStatusDto'
        reasonCode:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        components:
          type: array
          items:
            $ref: '#/components/schemas/BlueprintComponentDto'
          nullable: true
      additionalProperties: false
    BlueprintStatusDto:
      enum:
        - Unknown
        - Draft
        - Active
        - Processing
        - Error
        - Ready
        - Deleted
      type: string
    ComponentLinkDto:
      type: object
      properties:
        componentId:
          type: string
          nullable: true
        settings:
          type: object
          additionalProperties: {}
          nullable: true
      additionalProperties: false
    EnvironmentDto:
      type: object
      properties:
        id:
          type: string
          nullable: true
        displayName:
          type: string
          nullable: true
        parentId:
          type: string
          nullable: true
        parentType:
          type: string
          nullable: true
      additionalProperties: false
    InstantiateCommandRequest:
      type: object
      properties:
        liveSystemId:
          type: string
          nullable: true
        fractalId:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        provider:
          type: string
          nullable: true
        blueprintMap:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/LiveSystemComponentDto'
          nullable: true
        environment:
          $ref: '#/components/schemas/EnvironmentDto'
      additionalProperties: false
    InstantiationStepDto:
      type: object
      properties:
        id:
          type: string
          nullable: true
        liveSystemId:
          type: string
          nullable: true
        lastUpdated:
          type: string
          format: date-time
        provider:
          $ref: '#/components/schemas/ProviderTypeDto'
        component:
          $ref: '#/components/schemas/LiveSystemComponentDto'
        isExecuting:
          type: boolean
      additionalProperties: false
    LiveSystemComponentDto:
      type: object
      properties:
        displayName:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        id:
          type: string
          nullable: true
        version:
          type: string
          nullable: true
        parameters:
          type: object
          additionalProperties: {}
          nullable: true
        dependencies:
          uniqueItems: true
          type: array
          items:
            type: string
          nullable: true
        links:
          type: array
          items:
            $ref: '#/components/schemas/ComponentLinkDto'
          nullable: true
        status:
          $ref: '#/components/schemas/LiveSystemComponentStatusDto'
        outputFields:
          type: object
          additionalProperties: {}
          nullable: true
        lastUpdated:
          type: string
          format: date-time
        lastOperationRetried:
          type: integer
          format: int32
        provider:
          $ref: '#/components/schemas/ProviderTypeDto'
        lastOperationStatusMessage:
          type: string
          nullable: true
      additionalProperties: false
    LiveSystemComponentStatusDto:
      enum:
        - Unknown
        - Instantiating
        - Active
        - Failed
        - Mutating
        - Deleting
        - Deleted
      type: string
    LiveSystemDto:
      type: object
      properties:
        liveSystemId:
          type: string
          nullable: true
        fractalId:
          type: string
          nullable: true
        requesterId:
          type: string
          nullable: true
        blueprint:
          $ref: '#/components/schemas/BlueprintDto'
        orderTimestamp:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/LiveSystemStatusDto'
        statusMessage:
          type: string
          nullable: true
        environment:
          $ref: '#/components/schemas/EnvironmentDto'
        currentMutation:
          $ref: '#/components/schemas/LiveSystemMutationDto'
        currentMutationId:
          type: string
          nullable: true
        lastUpdated:
          type: string
          format: date-time
      additionalProperties: false
    LiveSystemMutationDto:
      type: object
      properties:
        liveSystemId:
          type: string
          nullable: true
        id:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/LiveSystemMutationStatusDto'
        created:
          type: string
          format: date-time
        lastUpdated:
          type: string
          format: date-time
        stepsReadyIds:
          uniqueItems: true
          type: array
          items:
            type: string
          nullable: true
        stepsCompletedIds:
          uniqueItems: true
          type: array
          items:
            type: string
          nullable: true
        stepsFailedIds:
          uniqueItems: true
          type: array
          items:
            type: string
          nullable: true
        stepsById:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/InstantiationStepDto'
          nullable: true
        stepsBlockedIdsByStepBlockingId:
          type: object
          additionalProperties:
            uniqueItems: true
            type: array
            items:
              type: string
          nullable: true
      additionalProperties: false
    LiveSystemMutationStatusDto:
      enum:
        - Unknown
        - InProgress
        - Completed
        - Failed
        - Cancelled
        - Deleting
      type: string
    LiveSystemStatusDto:
      enum:
        - Unknown
        - Mutating
        - Active
        - FailedMutation
        - Processing
        - Error
        - Ready
        - Deleting
      type: string
    ProviderTypeDto:
      enum:
        - Unknown
        - AWS
        - GCP
        - Azure
        - CaaS
        - SaaS
      type: string
    UpdateCommandRequest:
      type: object
      properties:
        liveSystemId:
          type: string
          nullable: true
        fractalId:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        provider:
          type: string
          nullable: true
        blueprintMap:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/LiveSystemComponentDto'
          nullable: true
        environment:
          $ref: '#/components/schemas/EnvironmentDto'
        newResourceGroupId:
          type: string
          nullable: true
        newLiveSystemName:
          type: string
          nullable: true
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: apiKey
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        "Authorization: Bearer {token}"
      name: JWT Authorization
      in: header
security:
  - Bearer: []
