openapi: 3.0.0
info:
  description: Aura Relase Train Branches handler API
  version: 1.1.0
  title: Aura Relase Train Branches handler API
  contact:
    email: auradev@tid.es
tags:
  - name: Branches stages status
    description: Services to manage release train branches status.
  - name: Monitoring
    description: Endpoint to monitor aura-release-train-branches server
  - name: Versions
    description: Endpoint to store the relationship between the branches and the generated versions of each component
  - name: EnvVar
    description: Endpoint to store the list of components and their aurak8s environment variables
  - name: Environments
    description: Endpoint to store the list of environments and their asigned branches
  - name: Locales
    description: Endpoint to store the locales of branches
paths:
  /globals:
    get:
      tags:
        - Globals Configuration
      summary: Gathers the global configuration
      description: Gathers the global configuration
      x-swagger-router-controller: globals
      operationId: getGlobals
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Branch status object
                example:
                  closeStatus:
                    branchIsClosing: true
                    branchName: main/example
                    createAt: 2022-09-06T09:24:40.763Z
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"

  /globals/{name}/{force}:
    patch:
      tags:
        - Globals Configuration
      summary: Updates the close properties in global configuration
      description: Updates the close properties in global configuration
      x-swagger-router-controller: globals
      operationId: updateGlobals
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for retrieve component versions
          required: true
          schema:
            type: string
        - name: force
          in: path
          description: Not validate Branch name to block, always block.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example:
                name: main/UC#976
                operation: BlockClose
                branch: main-UC-976
                force: false
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Branch status object
                example:
                  closeStatus:
                    branchIsClosing: true
                    name: main/UC#976
                    branch: main-UC-976
                    createAt: 2022-09-06T09:24:40.763Z
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"


  /environment/{name}:
    delete:
      tags:
        - Environment
      summary: Remove a environment by name
      description: Remove a environment by name
      x-swagger-router-controller: environment
      operationId: deleteEnvironment
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Environments name for delete environment.
          required: true
          schema:
            type: string
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"
    get:
      tags:
        - Environment
      summary: Get a environment by name
      description: Get a environment by name
      x-swagger-router-controller: environment
      operationId: getEnvironment
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Environment name for retrieve environment.
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"

  /environment/:
    get:
      tags:
        - Environment
      summary: Gathers the environment of all branches
      description: Gathers the environment of all branches
      x-swagger-router-controller: environment
      operationId: listEnvironments
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    patch:
      tags:
        - Environment
      summary: Updates the given fields of the environment
      description: Updates the given fields of the environment
      x-swagger-router-controller: environment
      operationId: updateEnvironment
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
            example:
              environment: AURA_TEST_BOT
              component: aura-bot
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Environment
      summary: Creates the environment of a given branch
      description: Creates the environment of a given branch
      x-swagger-router-controller: environment
      operationId: createEnvironment
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Branch status object
              example:
                environment: one
                branch: main/test
      responses:
        201:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this branch
              schema:
                type: string
                format: url
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /envvar/{name}:
    delete:
      tags:
        - EnvVar
      summary: Remove a env var by component name
      description: Remove a env var by component name
      x-swagger-router-controller: envvar
      operationId: deleteEnvVar
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Component name for retrieve env var.
          required: true
          schema:
            type: string
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"
    get:
      tags:
        - EnvVar
      summary: Get a env var by component name
      description: Get a env var by component name
      x-swagger-router-controller: envvar
      operationId: getEnvVar
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Component name for retrieve env var.
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"

  /envvar/:
    get:
      tags:
        - EnvVar
      summary: Gathers the env var of all component
      description: Gathers the env var of all component
      x-swagger-router-controller: envvar
      operationId: listEnvVars
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    patch:
      tags:
        - EnvVar
      summary: Updates the given fields of the env var
      description: Updates the given fields of the env var
      x-swagger-router-controller: envvar
      operationId: updateEnvVar
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
            example:
              envvar: AURA_TEST_BOT
              component: aura-bot
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - EnvVar
      summary: Creates the env var of a given component
      description: Creates the env var of a given component
      x-swagger-router-controller: envvar
      operationId: createEnvVar
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Branch status object
              example:
                envvar: AURA_TEST_BOT
                component: aura-bot
      responses:
        201:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this branch
              schema:
                type: string
                format: url
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"

  /versions/:
    patch:
      tags:
        - Versions
      summary: Updates the given fields of the versions
      description: Updates the given fields of the versions
      x-swagger-router-controller: versions
      operationId: updateVersions
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example:
                branch: master
                components:
                - name: aura-bot
                  version: "7.4.0"
                - name: aura-bridge
                  version: "7.4.0"
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Versions
      summary: Creates the versions of a given branch
      description: Creates the versions of a given branch
      x-swagger-router-controller: versions
      operationId: createVersions
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Branch status object
              example:
                branch: master
                components:
                - name: aura-bot
                  version: "7.4.0"
                - name: aura-bridge
                  version: "7.4.0"
      responses:
        201:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this branch
              schema:
                type: string
                format: url
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    get:
      tags:
        - Versions
      summary: Gathers the component versions of all branches
      description: Gathers the component versions of all branches
      x-swagger-router-controller: versions
      operationId: listVersions
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"

  /versions/{name}:
    delete:
      tags:
        - Versions
      summary: Remove a version by branch name
      description: Remove a version by branch name
      x-swagger-router-controller: versions
      operationId: deleteVersions
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for delete versions.
          required: true
          schema:
            type: string
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"
    get:
      tags:
        - Versions
      summary: Gathers the component versions of the given branch
      description: Gathers the component versions of the given branch
      x-swagger-router-controller: versions
      operationId: getVersions
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for retrieve component versions
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /versions/component/{name}:
    patch:
      tags:
        - Versions
      summary: Updates the given fields of the versions component
      description: Updates the given fields of the versions component
      x-swagger-router-controller: versions
      operationId: updateVersionComponent
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for retrieve component versions
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example:
                branch: master
                components:
                - name: aura-bot
                  version: "7.4.0"
                - name: aura-bridge
                  version: "7.4.0"
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /versions/library/{name}:
    patch:
      tags:
        - Versions
      summary: Updates the given fields of the versions library
      description: Updates the given fields of the versions library
      x-swagger-router-controller: versions
      operationId: updateVersionLibrary
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for retrieve component versions
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example:
                name: "@telefonica/aura-factotum-test-library"
                version: "7.8.0"
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /versions/nlppackage/{name}:
    patch:
      tags:
        - Versions
      summary: Updates the given fields of the versions nlp package
      description: Updates the given fields of the versions nlp package
      x-swagger-router-controller: versions
      operationId: updateVersionNlpPackage
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for retrieve component versions
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example:
                name: resources_es
                version: "6.47.1"
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /versions/clfpackage/{name}:
    patch:
      tags:
        - Versions
      summary: Updates the given fields of the versions nlp package
      description: Updates the given fields of the versions nlp package
      x-swagger-router-controller: versions
      operationId: updateVersionClfPackage
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for retrieve component versions
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              example:
                name: resources_es
                version: "6.47.1"
                ob: "es"
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Versions status object
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /branches/:
    get:
      tags:
        - List of branches
      summary: Get a list of branches
      description: Get a list of branches
      x-swagger-router-controller: branches
      operationId: getBranches
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: filter
          in: query
          description: Filter for the query, filter=mode:production,environment:four
          required: false
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Branch status object
                example:
                  # example for aura
                  # branch names are converted from main/new-requeriment#14566 to avoid path issues
                  branch: main_new-requirement_14566
                  teams:
                    bot:
                      stages:
                        init:
                          create_branch: false
                          prepare_repository: false
                          protect_branch: false
                          install_tools: false
                        start:
                          generate: false
                          build_env: false
                          test: false
                        close:
                          publish_master: false
                          uninstall_tools: false
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /branches/incomplete-inits:
    get:
      tags: 
        - Get all inits started but not finalized
      summary: Get all inits started but not finalized
      description: Get all inits started but not finalized
      x-swagger-router-controller: branches
      operationId: getIncompleteInits
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Inits Incomplete object
                example:
                  # example for aura
                  # branch names are converted from main/new-requeriment#14566 to avoid path issues
                  start: 0,
                  hotfix: 1
                  
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /branches/{name}:
    get:
      tags:
        - Branches stages status
      summary: Gathers the status of the given branch
      description: Gathers the status of the given branch
      x-swagger-router-controller: branches
      operationId: getBranch
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for release train handling. Usually main (for features) or release (to close releases).
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: Branch status object
                example:
                  # example for aura
                  # branch names are converted from main/new-requeriment#14566 to avoid path issues
                  branch: main_new-requirement_14566
                  teams:
                    bot:
                      stages:
                        init:
                          create_branch: false
                          prepare_repository: false
                          protect_branch: false
                          install_tools: false
                        start:
                          generate: false
                          build_env: false
                          test: false
                        close:
                          publish_master: false
                          uninstall_tools: false
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    delete:
      tags:
        - Delete branch stages status
      summary: Remove a branch stage status by name
      description: Remove the branch stages status
      x-swagger-router-controller: branches
      operationId: deleteBranch
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for release train handling. Usually main (for features) or release (to close releases).
          required: true
          schema:
            type: string
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"
    patch:
      tags:
        - Branches stages status
      summary: Updates the given fields of the  branch
      description: Updates the given fields of the  branch
      x-swagger-router-controller: branches
      operationId: updateBranch
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for release train handling. Usually main (for features) or release (to close releases).
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
            example:
              # example for aura
              # branch names are converted from main/new-requeriment#14566 to avoid path issues
              # this body will only update init.create_branch status
              teams:
                bot:
                  stages:
                    init:
                      create_branch: true
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Branches stages status
      summary: Creates the configuration for the given branch
      description: Creates the configuration for the given branch
      x-swagger-router-controller: branches
      operationId: createBranch
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: name
          in: path
          description: Branch name for release train handling. Usually main (for features) or release (to close releases).
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Branch status object
              example:
                # example for aura
                # branch names are converted from main/new-requeriment#14566 to avoid path issues
                branch: main_new-requirement_14566
                teams:
                  bot:
                    stages:
                      init:
                        create_branch: false
                        prepare_repository: false
                        protect_branch: false
                        install_tools: false
                      start:
                        generate: false
                        build_env: false
                        test: false
                      close:
                        publish_master: false
                        uninstall_tools: false
      responses:
        201:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this branch
              schema:
                type: string
                format: url
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /branches/{branch}/locales:
    get:
      tags:
        - Locales
      summary: Gathers the loales of the given branch
      description: Gathers the locales of the given branch
      x-swagger-router-controller: locales
      operationId: getLocales
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: locales object for branch
                example:
                  # example
                  branch: 'branch-name'
                  'authentication-api':
                    de-de: "{\n    \"authentication:AWC.authenticator-error.description\": [\n        \"Bei der Authentifizierung ist ein Fehler aufgetreten. Bitte versuche es später noch einmal\"\n    ],\n"
                    es-cr: "{\n    \"authentication:A1004.authenticator-error.description\": [\n        \"Parece que has olvidado tu usuario o contraseña de acceso a Mi Movistar.\"\n    ]"
                  'aura-bot-alfred-library':
                    de-de: "{\n    \"alfred:AWC.greetings.text\": [\n        \"Ich kann dir mit diesen Themen helfen\"\n    ],\n "
                    es-cr: "{\n    \"alfred:AWC.greetings.text\": [\n        \"Ich kann dir mit diesen Themen helfen\"\n    ],\n "

          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"

    delete:
      tags:
        - Locales
      summary: Remove locales of branch by branch name
      description: Remove the locales of branch by branch name
      x-swagger-router-controller: locales
      operationId: deleteLocales
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"
    patch:
      tags:
        - Locales
      summary: Updates the given fields of the locales of branch
      description: Updates the given fields of the locales of branch
      x-swagger-router-controller: locales
      operationId: updateLocales
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
            example:
              # example
              branch: 'branch-name'
              'authentication-api':
                de-de: "{\n    \"authentication:AWC.authenticator-error.description\": [\n        \"Bei der Authentifizierung ist ein Fehler aufgetreten. Bitte versuche es später noch einmal\"\n    ],\n"
                es-cr: "{\n    \"authentication:A1004.authenticator-error.description\": [\n        \"Parece que has olvidado tu usuario o contraseña de acceso a Mi Movistar.\"\n    ]"
              'aura-bot-alfred-library':
                de-de: "{\n    \"alfred:AWC.greetings.text\": [\n        \"Ich kann dir mit diesen Themen helfen\"\n    ],\n "
                es-cr: "{\n    \"alfred:AWC.greetings.text\": [\n        \"Ich kann dir mit diesen Themen helfen\"\n    ],\n "
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - Locales
      summary: Creates the locales for the given branch
      description: Creates the locales for the given branch
      x-swagger-router-controller: locales
      operationId: createLocales
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Branch status object
              example:
              # example
                branch: 'branch-name'
                'authentication-api':
                  de-de: "{\n    \"authentication:AWC.authenticator-error.description\": [\n        \"Bei der Authentifizierung ist ein Fehler aufgetreten. Bitte versuche es später noch einmal\"\n    ],\n"
                  es-cr: "{\n    \"authentication:A1004.authenticator-error.description\": [\n        \"Parece que has olvidado tu usuario o contraseña de acceso a Mi Movistar.\"\n    ]"
                'aura-bot-alfred-library':
                  de-de: "{\n    \"alfred:AWC.greetings.text\": [\n        \"Ich kann dir mit diesen Themen helfen\"\n    ],\n "
                  es-cr: "{\n    \"alfred:AWC.greetings.text\": [\n        \"Ich kann dir mit diesen Themen helfen\"\n    ],\n "
      responses:
        201:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this branch
              schema:
                type: string
                format: url
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /branches/{branch}/locales/{package}:
    get:
      tags:
        - Locales
      summary: Gathers the loales of the given branch and package
      description: Gathers the locales of the given branch and package
      x-swagger-router-controller: locales
      operationId: getLocalesPackage
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
        - name: package
          in: path
          description: Package name of locales stored.
          required: true
          schema:
            type: string
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: object
                description: locales object for package
                example:
                  # example
                  de-de: "{\n    \"authentication:AWC.authenticator-error.description\": [\n        \"Bei der Authentifizierung ist ein Fehler aufgetreten. Bitte versuche es später noch einmal\"\n    ],\n"
                  es-cr: "{\n    \"authentication:A1004.authenticator-error.description\": [\n        \"Parece que has olvidado tu usuario o contraseña de acceso a Mi Movistar.\"\n    ]"

          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  /branches/{branch}/{base}/packagelist:
    get:
      tags:
        - PackageList
      summary: Cache for packagelist 
      description: Cache for packageList
      x-swagger-router-controller: packageList
      operationId: getPackageList
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of package list stored in encoded format.
          required: true
          schema:
            type: string
        - name: base
          in: path
          description: Base branch used to generate package list.
          required: true
          schema:
            type: string
        - name: expires
          in: query
          description: Time in seconds to expire the cache
          required: false
          schema:
            type: integer
      responses:
        200:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items: 
                  type: object
                description: Array with the package list
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"

    delete:
      tags:
        - PackageList
      summary: Remove PackageList of branch by branch name and base branch
      description: Remove PackageList of branch by branch name and base branch
      x-swagger-router-controller: packageList
      operationId: deletePackageList
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
        - name: base
          in: path
          description: Base branch used to generate package list.
          required: true
          schema:
            type: string
      responses:
        204:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        500:
          $ref: "#/components/responses/InternalError"
    post:
      tags:
        - PackageList
      summary: Creates PackageList from given branch and base
      description: Creates PackageList from given branch and base
      x-swagger-router-controller: packageList
      operationId: createPackageList
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
        - name: branch
          in: path
          description: Branch name of locales stored.
          required: true
          schema:
            type: string
        - name: base
          in: path
          description: Base branch used to generate package list.
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: Branch status object
      responses:
        201:
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this branch
              schema:
                type: string
                format: url
        400:
          $ref: "#/components/responses/InvalidRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        404:
          $ref: "#/components/responses/NotFound"
        500:
          $ref: "#/components/responses/InternalError"
  
  /healthz:
    get:
      tags:
        - Monitoring
      summary: Healthcheck endpoint to validate if the server is up and running
      description: Healthcheck enpoint to validate if the server is up and running
      x-swagger-router-controller: monitoring
      operationId: healthz
      security:
        - apiKeyHeader: []
      responses:
        204:
          description: Successful status
          headers:
            correlator:
              description: Correlation id for the different services. The same one of the request.
              schema:
                type: string
        500:
          description: Internal server error
          $ref: "#/components/responses/InternalError"

servers:
  - url: https://localhost:3000/aura-releases/v1
components:
  responses:
    InvalidRequest:
      description: Incoming HTTP request format is not valid
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Unauthorized:
      description: Incoming HTTP request authorization is not valid
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Conflict:
      description:
        The request could not be completed due to a conflict with the current
        state of the target resource.
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    InternalError:
      description: Unexpected internal error
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    NotFound:
      description: Request resource not found
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
  securitySchemes:
    apiKeyHeader:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    Error:
      type: object
      description: Error response
      properties:
        code:
          type: string
          description: Unique id of the error
        message:
          type: string
          description: Specific and descriptive text of the error
