Tower Environments API

The Environments API from Tower — 2 operation(s) for environments.

OpenAPI Specification

tower-environments-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: hello@tower.dev
    name: Tower Computing GmbH
    url: https://tower.dev
  description: REST API to interact with Tower Services.
  termsOfService: https://tower.dev/terms
  title: Tower Accounts Environments API
  version: v0.11.16
servers:
- url: https://api.tower.dev/v1
tags:
- name: Environments
paths:
  /environments:
    get:
      description: List all environments in your account.
      operationId: list-environments
      parameters:
      - description: The page number to fetch.
        explode: false
        in: query
        name: page
        schema:
          default: 1
          description: The page number to fetch.
          format: int64
          type: integer
      - description: The number of records to fetch on each page.
        explode: false
        in: query
        name: page_size
        schema:
          default: 20
          description: The number of records to fetch on each page.
          format: int64
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListEnvironmentsResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - envs:read
      - APIKeyAuth:
        - envs:read
      summary: List environments
      tags:
      - Environments
    post:
      description: Create a new environment for an app.
      operationId: create-environment
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEnvironmentParams'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateEnvironmentResponse'
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - envs:create
      - APIKeyAuth:
        - envs:create
      summary: Create environment
      tags:
      - Environments
  /environments/{name}:
    delete:
      description: Delete an environment by name
      operationId: delete-environment
      parameters:
      - description: The name of the environment to delete.
        in: path
        name: name
        required: true
        schema:
          description: The name of the environment to delete.
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteEnvironmentResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - envs:delete
      - APIKeyAuth:
        - envs:delete
      summary: Delete environment
      tags:
      - Environments
    get:
      description: Describe an environment and counts of its resources
      operationId: describe-environment
      parameters:
      - description: The name of the environment.
        in: path
        name: name
        required: true
        schema:
          description: The name of the environment.
          type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DescribeEnvironmentResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - envs:read
      - APIKeyAuth:
        - envs:read
      summary: Describe environment
      tags:
      - Environments
    put:
      description: Rename your environment
      operationId: update-environment
      parameters:
      - description: The current name of the environment to update.
        in: path
        name: name
        required: true
        schema:
          description: The current name of the environment to update.
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEnvironmentParams'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateEnvironmentResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - envs:update
      - APIKeyAuth:
        - envs:update
      summary: Update environment
      tags:
      - Environments
components:
  schemas:
    CreateEnvironmentResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/CreateEnvironmentResponse.json
          format: uri
          readOnly: true
          type: string
        environment:
          $ref: '#/components/schemas/Environment'
      required:
      - environment
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    CreateEnvironmentParams:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/CreateEnvironmentParams.json
          format: uri
          readOnly: true
          type: string
        name:
          description: The name of the environment
          maxLength: 100
          minLength: 1
          type: string
      required:
      - name
      type: object
    ListEnvironmentsResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/ListEnvironmentsResponse.json
          format: uri
          readOnly: true
          type: string
        environments:
          items:
            $ref: '#/components/schemas/Environment'
          type: array
        pages:
          $ref: '#/components/schemas/Pagination'
      required:
      - environments
      - pages
      type: object
    Environment:
      additionalProperties: false
      properties:
        is_deletable:
          description: If this environment is able to be deleted.
          type: boolean
        name:
          description: The human readable name for the environment
          type: string
      required:
      - name
      - is_deletable
      type: object
    DeleteEnvironmentResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/DeleteEnvironmentResponse.json
          format: uri
          readOnly: true
          type: string
        environment:
          $ref: '#/components/schemas/Environment'
      required:
      - environment
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/ErrorModel.json
          format: uri
          readOnly: true
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          examples:
          - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          examples:
          - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
          - 400
          format: int64
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          examples:
          - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
          - https://example.com/errors/example
          format: uri
          type: string
      type: object
    DescribeEnvironmentResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/DescribeEnvironmentResponse.json
          format: uri
          readOnly: true
          type: string
        environment:
          $ref: '#/components/schemas/Environment'
        number_catalogs:
          format: int64
          type: integer
        number_schedules:
          format: int64
          type: integer
        number_secrets:
          format: int64
          type: integer
      required:
      - environment
      - number_secrets
      - number_schedules
      - number_catalogs
      type: object
    UpdateEnvironmentResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/UpdateEnvironmentResponse.json
          format: uri
          readOnly: true
          type: string
        environment:
          $ref: '#/components/schemas/Environment'
      required:
      - environment
      type: object
    Pagination:
      additionalProperties: false
      properties:
        num_pages:
          format: int64
          type: integer
        page:
          format: int64
          type: integer
        page_size:
          format: int64
          type: integer
        total:
          format: int64
          type: integer
      required:
      - page
      - total
      - num_pages
      - page_size
      type: object
    UpdateEnvironmentParams:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/UpdateEnvironmentParams.json
          format: uri
          readOnly: true
          type: string
        new_name:
          description: The desired new name of the environment
          type: string
      required:
      - new_name
      type: object
  securitySchemes:
    APIKeyAuth:
      description: API key created by a Tower user or Tower service account to authenticate an API request.
      in: header
      name: X-API-Key
      type: apiKey
    AccessTokenAuth:
      description: Access token authentication scheme which uses an access token provided by the Tower API as part of a Tower session (see documentation about creating sessions).
      scheme: Bearer
      type: http