openapi: 3.0.1
info:
  title: Deployment API
  description: Deployment API provides services to perform deployment activities
  contact:
    name: Appway AG
    url: https://community.appway.com
  version: 1.0.0
paths:
  /awdeployments/exports/{exportId}:
    get:
      tags:
      - Export
      summary: Download export artifact
      operationId: downloadAwdeploymentArtifact
      parameters:
      - name: exportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "202":
          description: Export artifact download
          content:
            application/x-appway-package-export: {}
        "404":
          description: No export found for given exportId
        "500":
          description: Unexpected server error happened
    delete:
      tags:
      - Export
      summary: Cancel running export
      operationId: cancel
      parameters:
      - name: exportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: Export is canceled
        "404":
          description: No export with given exportId is running
  /awdeployments/exports/{exportId}/status:
    get:
      tags:
      - Export
      summary: Return the status of a awdeployment export
      operationId: getStatus
      parameters:
      - name: exportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Export status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityStatusRepresentation'
        "404":
          description: No export found for given export id
  /awdeployments/exports/{exportId}/result:
    get:
      tags:
      - Export
      summary: Get export artifact path
      operationId: result
      parameters:
      - name: exportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "202":
          description: Export artifact exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportResultRepresentation'
        "404":
          description: No export found for given exportId
        "500":
          description: Unexpected server error happened
  /awdeployments/exports:
    post:
      tags:
      - Export
      summary: Start awdeployment export by Deployment Profile Id
      operationId: triggerAwdeploymentExport
      requestBody:
        description: Start awdeployment export
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportRequestByDeploymentProfileId'
        required: true
      responses:
        "202":
          description: Export request accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityRepresentation'
        "404":
          description: No Deployment Profile found for given id
        "429":
          description: There is another bocking operation running in the system
        "500":
          description: Unexpected server error happened
  /awdeployments/imports/{importId}/log:
    get:
      tags:
      - Import
      summary: Download import log
      operationId: downloadLog
      parameters:
      - name: importId
        in: path
        required: true
        schema:
          type: string
      responses:
        "202":
          description: Download import log
          content:
            application/zip: {}
        "404":
          description: No import found for given importId
        "500":
          description: Unexpected server error happened
  /awdeployments/imports/{importId}/status:
    get:
      tags:
      - Import
      summary: Return the status of a awdeployment export
      operationId: getStatus_1
      parameters:
      - name: importId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Import status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityStatusRepresentation'
        "404":
          description: No import found for given import id
  # patch start
  /awdeployments/imports:
    post:
      tags:
        - Import
      summary: Import awdeployment
      operationId: importAwdeployment
      requestBody:
        description: Import
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportFileRequest'
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  description: file
                  format: binary
                commitMessage:
                  type: string
        required: true
      responses:
        "202":
          description: Import accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportRepresentation'
        "400":
          description: Cannot read the file
        "412":
          description: File is not of expected type
        "429":
          description: There is another bocking operation running in the system
        "500":
          description: Unexpected server error happened
  # patch end
  /awexports/exports/{exportId}:
    get:
      tags:
      - Export
      summary: Download export artifact
      operationId: downloadAwexportArtifact
      parameters:
      - name: exportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "202":
          description: Export artifact download
          content:
            application/x-appway-export: {}
        "204":
          description: Export process produced no result
        "500":
          description: Unexpected server error happened
  /awexports/exports/{exportId}/status:
    get:
      tags:
      - Export
      summary: Return the status of a awexport export
      operationId: getStatus_2
      parameters:
      - name: exportId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Export status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityStatusRepresentation'
        "404":
          description: No export found for given export id
  /awexports/exports:
    post:
      tags:
      - Export
      summary: Start awexport export by Deployment Profile Id
      operationId: triggerAwexportExport
      requestBody:
        description: Start awexport export
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LegacyExportRequest'
        required: true
      responses:
        "202":
          description: Export request accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityRepresentation'
        "404":
          description: No Deployment Profile found for given id
        "429":
          description: There is another bocking operation running in the system
        "500":
          description: Unexpected server error happened
  /awexports/imports/{importId}/status:
    get:
      tags:
      - Import
      summary: Return the status of a awdeployment export
      operationId: getStatus_3
      parameters:
      - name: importId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Import status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityStatusRepresentation'
        "404":
          description: No import found for given import id
  # patch start
  /awexports/imports:
    post:
      tags:
        - Import
      summary: Import awexport
      operationId: importAwexport
      requestBody:
        description: Import
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImportFileRequest'
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  description: file
                  format: binary
                commitMessage:
                  type: string
        required: true
      responses:
        "202":
          description: Import accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImportRepresentation'
        "400":
          description: Cannot read the file
        "412":
          description: File is not of expected type
        "429":
          description: There is another bocking operation running in the system
        "500":
          description: Unexpected server error happened
  # patch end
  /deployment-profiles/{deploymentProfileId}:
    get:
      tags:
      - Deployment Profile
      summary: Get Deployment Profile by id
      operationId: get
      parameters:
      - name: deploymentProfileId
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: Deployment profile
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentProfile'
        "404":
          description: No Deployment Profile found for given id
  /deployment-profiles:
    get:
      tags:
      - Deployment Profile
      summary: Returns the list of Deployment Profile Id
      operationId: list
      responses:
        "200":
          description: Deployment profile Ids list
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
components:
  schemas:
    ActivityStatusRepresentation:
      type: object
      properties:
        id:
          type: string
        currentStatus:
          type: string
        startDateTime:
          type: string
        endDateTime:
          type: string
        percentageCompletion:
          type: integer
          format: int32
    ExportResultRepresentation:
      type: object
      properties:
        nodeName:
          type: string
        absolutePath:
          type: string
    ActivityRepresentation:
      type: object
      properties:
        id:
          type: string
    ExportRequestByDeploymentProfileId:
      type: object
      properties:
        deploymentProfileId:
          type: string
        exportNotes:
          type: string
        artifactBasePath:
          type: string
    ImportRepresentation:
      type: object
      properties:
        id:
          type: string
    ImportFileRequest:
      type: object
      properties:
        fileAbsolutePath:
          type: string
        commitMessage:
          type: string
        deleteArchiveFile:
          type: boolean
    LegacyExportRequest:
      type: object
      properties:
        customListName:
          type: string
        timestamp:
          type: string
          format: date-time
        artifactPath:
          type: string
    DeploymentProfile:
      type: object
      properties:
        id:
          type: string
        userId:
          type: string
        timestamp:
          type: integer
          format: int64
        packageInfos:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/DeploymentProfilePackageInfo'
    DeploymentProfilePackageConfiguration:
      type: object
      properties:
        configurationId:
          type: string
        selected:
          type: boolean
        exists:
          type: boolean
    DeploymentProfilePackageInfo:
      type: object
      properties:
        packageId:
          type: string
        version:
          type: string
        head:
          type: boolean
        latest:
          type: boolean
        packageConfigurations:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/DeploymentProfilePackageConfiguration'
