swagger: "2.0"
info:
  description: "Capability service for the SSA Workspaces project"
  version: "1.0.0"
  title: "Capability Service"
  contact:
    email: "dms-ssa@nrao.edu"
host: "ws-dev.nrao.edu"
tags:
  - name: "capabilities"
    description: "Access capabilities and create requests"
  - name: "requests"
    description: "Access and submit capability requests"
  - name: "workflows"
    description: "Access and submit workflow requests"
schemes:
  - "https"
paths:
  /capabilities:
    get:
      tags:
        - "capabilities"
      summary: "View enabled capabilities"
      description: ""
      operationId: "view_enabled_capabilities"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityList"
  /capabilities/available_qa_staff:
    get:
      tags:
        - "capabilities"
      summary: "View available QA staff"
      description: ""
      operationId: "retrieve_available_qa_staff_in_group"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: query
          name: "group"
          description: ""
          required: true
          type: "string"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/QaStaffList"
        "404":
          description: "no staff found"
  /capabilities/analyst_email:
    get:
      tags:
        - "capabilities"
      summary: "Get workspaces analyst email address"
      description: ""
      operationId: "get_analyst_email"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/AnalystEmail"
        "404":
          description: "No email address found"
  /capability/create:
    post:
      tags:
        - "capabilities"
      summary: "Create a new capability"
      description: ""
      operationId: "create_capability"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid name supplied"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Capability"
  /capability/{name}:
    parameters:
      - $ref: "#/parameters/capability-name"
    get:
      tags:
        - "capabilities"
      summary: "View the named capability"
      description: ""
      operationId: "view_capability"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Capability"
    post:
      tags:
        - "capabilities"
      summary: "Update an existing capability"
      description: ""
      operationId: "edit_capability"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: "body"
          name: "body"
          description: "Capability object that needs to be added to the system"
          required: true
          schema:
            $ref: "#/definitions/Capability"
      responses:
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Capability"
  /capability/{name}/enable:
    post:
      tags:
        - "capabilities"
      summary: "Enable a capability"
      operationId: "enable_capability"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - $ref: "#/parameters/capability-name"
      responses:
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
  /capability/{name}/disable:
    post:
      tags:
        - "capabilities"
      summary: "Disable a capability"
      operationId: "disable_capability"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - $ref: "#/parameters/capability-name"
      responses:
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
  /capability/{name}/request:
    parameters:
      - $ref: "#/parameters/capability-name"
    get:
      tags:
        - "requests"
      summary: "View the active capability requests"
      description: ""
      operationId: "view_active_capability_requests"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
  /capability/{name}/request/create:
    parameters:
      - $ref: "#/parameters/capability-name"
    post:
      tags:
        - "requests"
      summary: "Create a capability request"
      description: ""
      operationId: "create_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
  /capability/request/{id}/followon/{followon_type}:
    parameters:
      - $ref: "#/parameters/capability-request-id"
      - in: path
        name: "followon_type"
        description: "name of capability for follow-on"
        required: true
        type: "string"
    post:
      tags:
        - "requests"
      summary: "Create a follow-on capability request"
      description: ""
      operationId: "create_followon_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
  /capability/{name}/created-requests:
    parameters:
      - $ref: "#/parameters/capability-name"
    get:
      tags:
        - "requests"
      summary: "View the created capability requests"
      description: ""
      operationId: "view_created_capability_requests"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
  /capability/request/{id}:
    parameters:
      - $ref: "#/parameters/capability-request-id"
    get:
      tags:
        - "requests"
      summary: "View the identified capability request"
      description: ""
      operationId: "view_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
    post:
      tags:
        - "requests"
      summary: "Update an existing capability request"
      description: ""
      operationId: "edit_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - in: "body"
          name: "body"
          description: "Capability object that needs to be added to the system"
          required: true
          schema:
            $ref: "#/definitions/Capability"
      responses:
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
    delete:
      tags:
        - "requests"
      summary: "Delete a capability request"
      description: ""
      operationId: "delete_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid name supplied"
        "403":
          description: "Permission denied; capability request already executed"
        "404":
          description: "Capability not found"
  /capability/request/{id}/submit:
    post:
      tags:
        - "requests"
      summary: "Submit a capability request for execution"
      description: ""
      operationId: "submit_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - $ref: "#/parameters/capability-request-id"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityExecution"
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
  /capability/request/{id}/create-and-submit:
    post:
      tags:
        - "requests"
      summary: "Create and submit a capability request for execution in one step"
      description: "Mirror image of the workflow functionality of the same name."
      operationId: "create_and_submit_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - $ref: "#/parameters/capability-request-id"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityExecution"
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
  /capability/request/{id}/close:
    post:
      tags:
        - "requests"
      summary: "Close a failed capability request."
      description: "Sets a capability request to sealed."
      operationId: "close_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - $ref: '#/parameters/capability-request-id'
      responses:
        "404":
          description:
            "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            type: string
  /capability/request/{id}/cancel:
    post:
      tags:
        - "requests"
      summary: "Cancel a capability request"
      description: ""
      operationId: "cancel_capability_request"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      parameters:
        - $ref: "#/parameters/capability-request-id"
      responses:
        "400":
          description: "Invalid name supplied"
        "404":
          description: "Capability not found"
  /capability/request/{id}/version/latest:
    parameters:
      - $ref: "#/parameters/capability-request-id"
    get:
      tags:
        - "requests"
      summary: "View the latest version of this capability request"
      description: ""
      operationId: "view_latest_version"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
  /capability/request/{id}/version/create:
    parameters:
      - $ref: "#/parameters/capability-request-id"
    post:
      tags:
        - "requests"
      summary: "Create a new version of this capability request"
      description: ""
      operationId: "create_capability_version"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "400":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityRequest"
  /capability/request/{id}/version/{version_id}/internal_notes:
    parameters:
      - $ref: "#/parameters/capability-request-id"
      - $ref: "#/parameters/capability-version-id"
    get:
      tags:
        - "requests"
      summary: "Update the data analyst notes for this version"
      description: ""
      operationId: "view_internal_notes"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "412":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Notes"
    post:
      tags:
        - "requests"
      summary: "Update the data analyst notes for this version"
      description: ""
      operationId: "update_internal_notes"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "412":
          description: "Invalid capability name or request ID supplied"
        "404":
          description: "Capability request not found"
        "200":
          description: "successful operation"
          schema:
            type: string
  /capability/request/{id}/version/{version_id}/workflow_metadata:
    parameters:
      - $ref: "#/parameters/capability-request-id"
      - $ref: "#/parameters/capability-version-id"
    get:
      tags:
        - "requests"
      summary: "Get the workflow metadata for this version"
      description: ""
      operationId: "view_version_metadata"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "200":
          description: "successful operation"
        "404":
          description: "Capability request not found"
    post:
      tags:
        - "requests"
      summary: "Edit the workflow metadata for this version"
      description: ""
      operationId: "edit_version_metadata"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "200":
          description: "successful operation"
        "404":
          description: "Capability request not found"
  /capability/request/{id}/version/srdp_compatible:
    parameters:
      - $ref: "#/parameters/capability-request-id"
      - $ref: "#/parameters/capability-version-id"
    post:
      tags:
        - "requests"
      summary: "Set the SRDP compatibility flag"
      description: ""
      operationId: "change_srdp_compatibility_version_metadata"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "200":
          description: "successful operation"
        "404":
          description: "Capability request not found"
        "500":
          description: "Unable to update"
        "400":
          description: "No metadata associated with this capability request version"
  /capability/request/{id}/version/latest/files/{filename}:
    parameters:
      - $ref: "#/parameters/capability-request-id"
      - $ref: "#/parameters/filename"
    put:
      tags:
        - "requests"
      summary: "Files in the latest version of this capability request"
      description: ""
      operationId: "update_file_for_latest"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityVersionFile"
        "412":
          description: "No versions exist for this capability request"
        "404":
          description: "Capability request not found"
  /capability/request/execution/{request_id}:
    parameters:
        - $ref: "#/parameters/workflow-request-id"
    get:
      tags:
        - "requests"
      summary: "Get the execution for this workflow request ID"
      description: ""
      operationId: "get_execution_from_workflow_id"
      responses:
        412:
          description: "No capability exists for this workflow ID"
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityExecution"
  /capability/request/{id}/version/{version_id}/execution:
    parameters:
      - $ref: "#/parameters/capability-request-id"
      - $ref: "#/parameters/capability-version-id"
    get:
      tags:
        - "requests"
      summary: "Get the execution under this request and version"
      description: ""
      operationId: "get_execution_by_version"
      responses:
        412:
          description: "No capability exists for this workflow ID"
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/CapabilityExecution"
  /capability/request/execution/{request_id}/create_version:
    parameters:
      - $ref: "#/parameters/workflow-request-id"
    post:
      tags:
        - "requests"
      summary: "Create a new capability version based on the supplied workflow request ID"
      description: ""
      operationId: "create_version_from_previous_execution_script"
      responses:
        412:
          description: "No capability exists for this workflow ID"
        200:
          description: "successful operation"
          schema:
            type: integer
  /workflows:
    get:
      tags:
        - "workflows"
      summary: "View the list of workflows"
      description: ""
      operationId: "Workflows.list_workflows"
      produces:
        - "application/json"
      responses:
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowList"
  /workflows/{name}:
    get:
      tags:
        - "workflows"
      summary: "View the named workflow"
      description: ""
      operationId: "Workflows.get_workflow"
      parameters:
        - $ref: '#/parameters/workflow-name'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Workflow"
  /workflows/{name}/requests/create:
    post:
      tags:
        - "workflows"
      summary: "Create a workflow request"
      description: ""
      operationId: "WorkflowRequestRestService.create_workflow_request"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - name: "body"
          in: "body"
          description: "Argument to the workflow"
          schema:
            type: "object"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/{name}/requests/create-and-submit:
    post:
      tags:
        - "workflows"
      summary: "Create and submit a workflow request"
      description: ""
      operationId: "WorkflowRequestRestService.create_and_submit_workflow_request"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - name: "body"
          in: "body"
          description: "Argument to the workflow"
          schema:
            type: "object"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/{name}/requests/{request_id}:
    get:
      tags:
        - "workflows"
      summary: "View the workflow request with this ID"
      description: ""
      operationId: "WorkflowRequestRestService.get_workflow_request"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/{name}/requests/{request_id}/dir/{*paths}:
    get:
      tags:
        - "workflows"
      summary: "View files in the working directory for the workflow request with this ID"
      description: ""
      operationId: "WorkflowWorkingDirRestService.show_workdir_content"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
        - name: "*paths"
          in: "path"
          description: "path to the file under this workflow request"
          required: true
          type: "string"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/{name}/requests/{request_id}/weblog:
    get:
      tags:
        - "workflows"
      summary: "View the weblog under this workflow request"
      description: ""
      operationId: "WorkflowWorkingDirRestService.serve_weblog"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/{name}/requests/{request_id}/qa_notes:
    get:
      tags:
        - "workflows"
      summary: "View the QA notes under this workflow request"
      description: ""
      operationId: "WorkflowWorkingDirRestService.get_qa_notes"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Notes"
    post:
      tags:
        - "workflows"
      summary: "Save the QA notes for this workflow request"
      description: ""
      operationId: "WorkflowWorkingDirRestService.save_qa_notes"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/Notes"
  /workflows/{name}/requests/{request_id}/html:
    get:
      tags:
        - "workflows"
      summary: "Access a CARTA instance"
      description: ""
      operationId: "WorkflowWorkingDirRestService.serve_carta_wrapper"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      produces:
        - "text/html"
      responses:
        200:
          description: "successful operation"
  /workflows/{name}/requests/{request_id}/htcondor_id:
    get:
      tags:
        - "workflows"
      summary: "Get the HTCondor ID for this request"
      description: ""
      operationId: "WorkflowRequestRestService.get_request_htcondor_id"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/HtCondorId"

  /workflows/requests/stale/{days}:
    get:
      tags:
        - "workflows"
      summary: "Get a list of stale requests"
      description: ""
      operationId: "WorkflowRequestRestService.get_stale_requests"
      parameters:
        - in: path
          name: days
          type: integer
          required: true
          description: "days back to look"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/StaleDirectories"
  /workflows/{name}/requests/{request_id}/files:
    get:
      tags:
        - "workflows"
      summary: "See the files under this workflow request"
      description: ""
      operationId: "WorkflowFilesRestService.get_file"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/octet-stream"
      produces:
        - "application/json"
      responses:
        "400":
          description: "File already exists"
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequestFile"
  /workflows/{name}/requests/{request_id}/files/{filename}:
    put:
      tags:
        - "workflows"
      summary: "Add a file to this workflow request"
      description: ""
      operationId: "WorkflowFilesRestService.add_file"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
        - name: "filename"
          in: "path"
          description: "filename to add"
          type: "string"
          required: true
      consumes:
        - "application/octet-stream"
      produces:
        - "application/json"
      responses:
        "400":
          description: "File already exists"
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequestFile"
  /workflows/{name}/requests/{request_id}/submit:
    post:
      tags:
        - "workflows"
      summary: "Submit the workflow request for execution"
      description: ""
      operationId: "WorkflowRequestRestService.submit_workflow"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/{name}/requests/{request_id}/ingest:
    post:
      tags:
        - "workflows"
      summary: "Ingest the result of this workflow"
      description: ""
      operationId: "WorkflowRequestRestService.ingest"
      parameters:
        - $ref: '#/parameters/workflow-name'
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            $ref: "#/definitions/WorkflowRequest"
  /workflows/requests/{request_id}/abort:
    post:
      tags:
        - "workflows"
      summary: "Abort the execution of this running workflow"
      description: ""
      operationId: "WorkflowRequestRestService.abort"
      parameters:
        - $ref: '#/parameters/workflow-request-id'
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
          schema:
            type: string
  /workflows/requests/vlass_ingest/{vlass_type}:
    post:
      tags:
        - "workflows"
      summary: "Ingest the result of this workflow using a VLASS ingest workflow"
      description: ""
      operationId: "WorkflowRequestRestService.ingest_vlass_products"
      parameters:
        - in: path
          name: vlass_type
          description: "type of VLASS product to ingest"
          required: true
          type: string
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        "404":
          description:
            "Workflow request not found"
        "200":
          description: "successful operation"
  /workflows/requests/message-archive/{msg_type}:
    post:
      tags:
        - "workflows"
      summary: "Send a message to the archive"
      description: ""
      operationId: "WorkflowRequestRestService.message_archive"
      parameters:
        - in: path
          name: msg_type
          description: "the message type to send"
          required: true
          type: string
        - name: request_id
          in: body
          description: "the workflow request ID to use"
          schema:
            $ref: "#/definitions/ArchiveMessage"
      consumes:
        - "application/json"
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            type: string
  /workflows/carta/requests/{request_id}/send-url-to-aat:
    post:
      tags:
        - "workflows"
      summary: "Send the CARTA URL to the AAT"
      description: ""
      operationId: "WorkflowRequestRestService.send_carta_url_to_aat"
      parameters:
        - $ref: "#/parameters/workflow-request-id"
        - in: body
          name: carta_url
          description: "The URL to the CARTA instance which is running"
          schema:
            type: string
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            type: string
  /workflows/carta/requests/{request_id}/url:
    post:
      tags:
        - "workflows"
      summary: "Send the CARTA URL... somewhere else..."
      description: ""
      operationId: "WorkflowRequestRestService.send_carta_url"
      parameters:
        - $ref: "#/parameters/workflow-request-id"
        - in: body
          name: carta_url
          description: "The URL to the CARTA instance which is running"
          schema:
            type: string
      produces:
        - "application/json"
      responses:
        200:
          description: "successful operation"
          schema:
            type: string
  /workflows/{name}/requests/{request_id}/fail:
    post:
      tags:
        - "workflows"
      summary: "Force fail a workflow"
      description: ""
      operationId: "WorkflowRequestRestService.send_force_fail"
      parameters:
        - $ref: "#/parameters/workflow-name"
        - $ref: "#/parameters/workflow-request-id"
      responses:
        200:
          description: "successful operation"
  /workflows/{name}/requests/{request_id}/qa_fail:
    post:
      tags:
        - "workflows"
      summary: "Fail the quality assurance for a workflow"
      description: ""
      operationId: "WorkflowRequestRestService.qa_fail"
      parameters:
        - $ref: "#/parameters/workflow-name"
        - $ref: "#/parameters/workflow-request-id"
      responses:
        200:
          description: "successful operation"
  /workflows/requests/{request_id}/qa/{msg_type}:
    post:
      tags:
        - "workflows"
      summary: "Force fail a workflow"
      description: ""
      operationId: "WorkflowRequestRestService.announce_qa"
      parameters:
        - $ref: "#/parameters/workflow-request-id"
        - in: path
          name: msg_type
          description: "The message type to send"
          required: true
          type: string
        - in: body
          name: version
          description: "The capability version to send this QA announcement for"
          required: true
          schema:
            $ref: "#/definitions/CapabilityVersion"
      responses:
        200:
          description: "successful operation"
  /workflows/requests/cleaned:
    put:
      tags:
        - "workflows"
      summary: "Mark when a request was last cleaned"
      description: ""
      operationId: "WorkflowRequestRestService.set_request_cleaned"
      parameters:
        - in: body
          name: clean_parameters
          schema:
            $ref: "#/definitions/CleanRequest"
          required: true
      responses:
        200:
          description: "successful operation"
          schema:
            type: string
  /healthcheck:
    get:
      tags:
        - "workflows"
      summary: "Returns a success value if the service is healthy"
      description: ""
      operationId: "WorkflowWorkingDirRestService.get_healthcheck"
      responses:
        200:
          description: "successful operation"
definitions:
  CapabilityList:
    type: "array"
    items:
      $ref: "#/definitions/Capability"
  Capability:
    type: "object"
    properties:
      name:
        type: "string"
      steps:
        type: "string"
      max_jobs:
        type: "integer"
        format: "int64"
  CapabilityExecution:
    type: "object"
    properties:
      type:
        type: "string"
      id:
        type: "integer"
      state_name:
        type: "string"
      queue_state:
        type: "string"
      capability_request_id:
        type: "integer"
      version_number:
        type: "integer"
      current_workflow_request_id:
        type: "integer"
      delivery_url:
        type: "string"
      created_at:
        type: "string"
      updated_at:
        type: "string"
  CapabilityRequest:
    type: "object"
    properties:
      body:
        type: "object"
  CapabilityVersion:
    type: "object"
    properties:
      type:
        type: "string"
      capability_request_id:
        type: "integer"
      version_number:
        type: "integer"
      current_execution:
        type: "string"
      state:
        type: "string"
      parameters:
        type: "object"
      workflow_metadata:
        type: "object"
      sealed:
        type: "boolean"
      files:
        type: "array"
        items:
          $ref: "#/definitions/CapabilityVersionFile"
      capability_name:
        type: "string"
      status_url:
        type: "string"
      internal_notes:
        type: "string"
  CapabilityVersionFile:
    type: "object"
    properties:
      type:
        type: "string"
      capability_request_id:
        type: "integer"
      version_number:
        type: "integer"
      filename:
        type: "string"
      content:
        type: "string"
  CleanRequest:
    type: "object"
    properties:
      directory:
        type: string
      update_to:
        type: string
  HtCondorId:
    type: "object"
    properties:
      htcondor_job_id:
        type: integer
  Notes:
    type: "object"
    properties:
      resp:
        type: "string"
  QaStaff:
    type: "object"
    properties:
      user_name:
        type: "string"
      group:
        type: "string"
      available:
        type: "boolean"
      email:
        type: "string"
  QaStaffList:
    type: "array"
    items:
      $ref: "#/definitions/QaStaff"
  AnalystEmail:
    type: "object"
    properties:
      resp:
        type: "string"
  StaleDirectories:
    type: "object"
    properties:
      stale_dirs:
        type: "string"
  ArchiveMessage:
    type: "object"
    properties:
      request_id:
        type: integer
      project_code:
        type: string
  WorkflowList:
    type: "array"
    items:
      $ref: "#/definitions/Workflow"
  Workflow:
    type: "object"
    properties:
      name:
        type: "string"
  WorkflowRequest:
    type: "object"
    properties:
      workflow_request_id:
        type: "integer"
        format: "int64"
      workflow_name:
        type: "string"
      argument:
        type: "object"
      state:
        type: "string"
      results_dir:
        type: "string"
  WorkflowRequestFile:
    type: "object"
    properties:
      workflow_request_id:
        type: "integer"
        format: "int64"
      filename:
        type: "string"
      content:
        type: "string"
parameters:
  capability-name:
    name: "name"
    in: "path"
    description: "name of capability to view"
    required: true
    type: "string"
  capability-request-id:
    name: "id"
    in: "path"
    description: "ID of capability request"
    required: true
    type: "integer"
    format: "int64"
  capability-version-id:
    name: "version_id"
    in: "path"
    description: "ID of capability version"
    required: true
    type: "integer"
    format: "int64"
  filename:
    name: "filename"
    in: "path"
    description: "Filename"
    required: true
    type: "string"
    format: "string"
  workflow-name:
    name: "name"
    in: "path"
    description: "name of workflow this request belongs to"
    required: true
    type: "string"
  workflow-request-id:
    name: "request_id"
    in: "path"
    description: "ID of the request"
    type: "integer"
    required: true

externalDocs:
  description: "More about the capability service"
  url: "http://builder.aoc.nrao.edu/ssa/architecture/workspaces"
