openapi: 3.0.3

info:
  title: IONOS DBaaS MariaDB REST API
  description: |
    An enterprise-grade Database is provided as a Service (DBaaS) solution that
    can be managed through a browser-based "Data Center Designer" (DCD) tool or
    via an easy to use API.

    The API allows you to create additional MariaDB database clusters or modify existing
    ones. It is designed to allow users to leverage the same power and
    flexibility found within the DCD visual tool. Both tools are consistent with
    their concepts and lend well to making the experience smooth and intuitive.
  version: 0.1.0

servers:
- url: https://mariadb.de-fra.ionos.com
  description: Frankfurt, Germany
- url: https://mariadb.de-txl.ionos.com
  description: Berlin, Germany
- url: https://mariadb.es-vit.ionos.com
  description: Logroño, Spain
- url: https://mariadb.fr-par.ionos.com
  description: Paris, France
- url: https://mariadb.gb-lhr.ionos.com
  description: London, Great Britain
- url: https://mariadb.us-ewr.ionos.com
  description: Newark, USA
- url: https://mariadb.us-las.ionos.com
  description: Las Vegas, USA
- url: https://mariadb.us-mci.ionos.com
  description: Lenexa, USA

security:
- tokenAuth: []

tags:
- name: Clusters
  description: Everything about MariaDB clusters.
- name: Backups
  description: Everything about backups of MariaDB clusters.
- name: Restore
  description: Everything about restoring MariaDB clusters from a backup.

paths:
  /clusters:
    get:
      operationId: clustersGet
      summary: List clusters
      description: Retrieves a list of MariaDB clusters.
      security:
      - tokenAuth: []
      tags:
      - Clusters
      parameters:
      - $ref: '#/components/parameters/PaginationLimitParameter'
      - $ref: '#/components/parameters/PaginationOffsetParameter'
      - $ref: '#/components/parameters/ClusterNameQuery'
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterList'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

    post:
      operationId: clustersPost
      summary: Create a cluster
      description: |
        Creates a new MariaDB cluster.
      security:
      - tokenAuth: []
      tags:
      - Clusters
      requestBody:
        description: The cluster to be created.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateClusterRequest'
        required: true
      responses:
        '200':
          description: |
            The created cluster is returned with `metadata.state` set to "BUSY".
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

  /clusters/{clusterId}:
    get:
      operationId: clustersFindById
      summary: Fetch a cluster
      description: |
        You can retrieve a MariaDB cluster by using its ID. This value can be
        found in the response body when a MariaDB cluster is created or when
        you GET a list of MariaDB clusters.
      security:
      - tokenAuth: []
      tags:
      - Clusters
      parameters:
      - $ref: '#/components/parameters/ClusterIDPath'
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

    patch:
      operationId: clustersPatch
      summary: Update a cluster
      description: Updates mutable attributes on a MariaDB cluster.
      security:
      - tokenAuth: []
      tags:
      - Clusters
      parameters:
      - $ref: '#/components/parameters/ClusterIDPath'
      requestBody:
        description: Attributes of the cluster which should be modified.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchClusterRequest'
        required: true
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

    delete:
      operationId: clustersDelete
      summary: Delete a cluster
      description: Delete a MariaDB cluster.
      security:
      - tokenAuth: []
      tags:
      - Clusters
      parameters:
      - $ref: '#/components/parameters/ClusterIDPath'
      responses:
        '200':
          description: |
            The deleted cluster with `metadata.state` set to "DESTROYING".
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

  /clusters/{clusterId}/backups:
    get:
      operationId: clusterBackupsGet
      summary: List backups of cluster
      description: |
        Retrieves a list of all backups of the given MariaDB cluster.
      security:
        - tokenAuth: []
      tags:
        - Backups
      parameters:
        - $ref: '#/components/parameters/ClusterIDPath'
        - $ref: '#/components/parameters/PaginationLimitParameter'
        - $ref: '#/components/parameters/PaginationOffsetParameter'
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackupList'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

  /clusters/{clusterId}/restore:
    post:
      operationId: clustersRestore
      summary: In-place restore of a cluster.
      description: |-
        Restore a MariaDB cluster from a backup.

        Conditions:
         - The backup must belong to the MariaDB cluster to
           be restored.
         - The cluster must be in the state "AVAILABLE".
      parameters:
        - $ref: '#/components/parameters/ClusterIDPath'
      security:
        - tokenAuth: []
      tags:
        - Restore
      requestBody:
        description: The backup to restore from.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestoreRequest'
        required: true
      responses:
        '202':
          description: Successful operation.
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

  /backups:
    get:
      operationId: backupsGet
      summary: List of backups.
      description: |
        Retrieves all lists of backups for all MariaDB clusters in this contract.
      security:
      - tokenAuth: []
      tags:
      - Backups
      parameters:
      - $ref: '#/components/parameters/PaginationLimitParameter'
      - $ref: '#/components/parameters/PaginationOffsetParameter'
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackupList'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

  /backups/{backupId}:
    get:
      operationId: backupsFindById
      summary: Fetch backups
      description: |
        Retrieve a MariaDB backup by ID. This value can be
        found when you GET the list of MariaDB backups.
      security:
      - tokenAuth: []
      tags:
      - Backups
      parameters:
      - $ref: '#/components/parameters/BackupIDPath'
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackupResponse'
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '404':
          $ref: '#/components/responses/Error404'
        '405':
          $ref: '#/components/responses/Error405'
        '415':
          $ref: '#/components/responses/Error415'
        '422':
          $ref: '#/components/responses/Error422'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
        '503':
          $ref: '#/components/responses/Error503'

components:
  responses:

    Error400:
      description: Parse error.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 400
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error401:
      description: Authentication error.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 401
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error402:
      description: Trial access error.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 402
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error403:
      description: Unauthorized.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 403
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error404:
      description: Not Found.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 404
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error405:
      description: Unsupported HTTP method.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 405
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error415:
      description: Unsupported content type.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 415
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error422:
      description: Validation error.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 422
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error429:
      description: Request rate limit exceeded.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 429
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error500:
      description: Server error.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 500
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

    Error503:
      description: Maintenance.
      content:
        application/json:
          schema:
            properties:
              httpStatus:
                type: integer
                description: The HTTP status code of the operation.
                example: 503
              messages:
                type: array
                items:
                  $ref: '#/components/schemas/ErrorMessage'
            required:
              - httpStatus
              - messages
            type: object

  parameters:
    ClusterNameQuery:
      name: filter.name
      in: query
      description: |
        Response filter to list only the MariaDB clusters that contain
        the specified name. The value is case insensitive and matched on the
        'displayName' field.
      required: false
      schema:
        type: string

    ClusterIDPath:
      name: clusterId
      in: path
      description: The unique ID of the cluster.
      required: true
      schema:
        type: string
      example: 498ae72f-411f-11eb-9d07-046c59cc737e

    BackupIDPath:
      name: backupId
      in: path
      description: The unique ID of the backup.
      required: true
      schema:
        type: string
      example: 498ae72f-411f-11eb-9d07-046c59cc737e

    PaginationLimitParameter:
      name: limit
      in: query
      description: The maximum number of elements to return. Use together with 'offset' for pagination.
      required: false
      schema:
        type: integer
        default: 100
        maximum: 1000
        minimum: 1
        example: 100

    PaginationOffsetParameter:
      name: offset
      in: query
      description: The first element to return. Use together with 'limit' for pagination.
      required: false
      schema:
        type: integer
        default: 0
        example: 200

  schemas:
    ErrorMessage:
      properties:
        errorCode:
          type: string
          description: |
            Application internal error code
          example: dbaas-err-api-123
        message:
          type: string
          description: |
            A human readable explanation specific to this occurrence of the
            problem.
          example: Error message example
      type: object

    ResourceID:
      type: string
      description: The unique ID of the resource.
      example: 498ae72f-411f-11eb-9d07-046c59cc737e

    ResourceHref:
      type: string
      description: Absolute URL of the resource.

    MariadbVersion:
      type: string
      description: The MariaDB version of your cluster.
      enum:
      - '10.6'
      - '10.11'
      example: '10.6'

    Instances:
      type: integer
      description: |
        The total number of instances in the cluster (one primary and n-1
        secondary).
      example: 3
      minimum: 1
      maximum: 5

    Cores:
      type: integer
      description: The number of CPU cores per instance.
      example: 4
      minimum: 1

    Ram:
      type: integer
      description: The amount of memory per instance in gigabytes (GB).
      example: 4
      minimum: 4

    StorageSize:
      type: integer
      description: The amount of storage per instance in gigabytes (GB).
      example: 10
      minimum: 10
      maximum: 2000

    DisplayName:
      type: string
      description: The friendly name of your cluster.
      maxLength: 63
      example: MariaDB cluster
      pattern: '^(\w|:|\-|\ |.)+$'

    DNSName:
      type: string
      description: The DNS name pointing to your cluster.
      example: ma-yourcluster.mariadb.region.ionos.com

    CreateClusterRequest:
      description: |
        Request payload with all data needed to create a new MariaDB cluster.
      properties:
        properties:
          $ref: '#/components/schemas/CreateClusterProperties'
      type: object

    CreateClusterProperties:
      description: |
        Properties with all data needed to create a new MariaDB cluster.
      required:
      - mariadbVersion
      - instances
      - cores
      - ram
      - storageSize
      - connections
      - displayName
      - credentials
      properties:
        mariadbVersion:
          $ref: '#/components/schemas/MariadbVersion'
        instances:
          $ref: '#/components/schemas/Instances'
        cores:
          $ref: '#/components/schemas/Cores'
        ram:
          $ref: '#/components/schemas/Ram'
        storageSize:
          $ref: '#/components/schemas/StorageSize'
        connections:
          type: array
          minItems: 1
          maxItems: 1
          description: |
            The network connection for your cluster. Only one connection is
            allowed.
          items:
            $ref: '#/components/schemas/Connection'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        maintenanceWindow:
          $ref: '#/components/schemas/MaintenanceWindow'
        backup:
          $ref: '#/components/schemas/BackupProperties'
        credentials:
          $ref: '#/components/schemas/DBUser'
        fromBackup:
          $ref: '#/components/schemas/RestoreRequest'
      type: object

    PatchClusterRequest:
      description: Request payload to change a cluster.
      properties:
        metadata:
          $ref: '#/components/schemas/ClusterMetadata'
        properties:
          $ref: '#/components/schemas/PatchClusterProperties'
      type: object

    PatchClusterProperties:
      description: |
        Properties of the payload to change a cluster:
        - instances can only be increased (3, 5, 7),
        - mariadbVersion can only be increased (no downgrade)
        - storageSize can only be increased,
        - ram and cores can be both increased and decreased.
      properties:
        mariadbVersion:
          $ref: '#/components/schemas/MariadbVersion'
        instances:
          $ref: '#/components/schemas/Instances'
        cores:
          $ref: '#/components/schemas/Cores'
        ram:
          $ref: '#/components/schemas/Ram'
        storageSize:
          $ref: '#/components/schemas/StorageSize'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        maintenanceWindow:
          $ref: '#/components/schemas/MaintenanceWindow'
      type: object

    DBUser:
      description: Credentials for the database user to be created.
      properties:
        username:
          $ref: '#/components/schemas/InitialDBUsername'
        password:
          $ref: '#/components/schemas/DBPassword'
      required:
      - username
      - password
      type: object

    Connection:
      description: Details about the network connection for your cluster.
      properties:
        datacenterId:
          description: The datacenter to connect your cluster to.
          type: string
          example: '5a029f4a-72e5-11ec-90d6-0242ac120003'
        lanId:
          description: The numeric LAN ID to connect your cluster to.
          type: string
          example: '2'
        cidr:
          type: string
          description: |
            The IP and subnet for your cluster.
            Note the following unavailable IP ranges:
            10.233.64.0/18
            10.233.0.0/18
            10.233.114.0/24
          example: 192.168.1.100/24
      required:
      - datacenterId
      - lanId
      - cidr
      type: object

    ClusterMetadata:
      description: Metadata of the resource.
      properties:
        createdDate:
          type: string
          format: date-time
          description: The ISO 8601 creation timestamp.
          example: '2020-12-10T13:37:50+01:00'
        createdBy:
          type: string
          example: john.doe@example.com
        createdByUserId:
          type: string
          example: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3
        lastModifiedDate:
          type: string
          format: date-time
          description: The ISO 8601 modified timestamp.
          example: '2020-12-11T13:37:50+01:00'
        lastModifiedBy:
          type: string
          example: jane.doe@example.com
        lastModifiedByUserId:
          type: string
          example: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3
        state:
          $ref: '#/components/schemas/State'

    State:
      description: The current status reported back by the cluster.
      type: string
      enum:
      - AVAILABLE
      - BUSY
      - CREATING
      - UPDATING
      - RESTORING
      - DESTROYING
      - DEGRADED
      - FAILED
      - UNKNOWN
      example: AVAILABLE

    ClusterResponse:
      description: A database cluster.
      properties:
        id:
          $ref: '#/components/schemas/ResourceID'
        metadata:
          $ref: '#/components/schemas/ClusterMetadata'
        properties:
          $ref: '#/components/schemas/ClusterProperties'
      type: object

    ClusterProperties:
      description: Properties of a database cluster.
      properties:
        displayName:
          $ref: '#/components/schemas/DisplayName'
        mariadbVersion:
          $ref: '#/components/schemas/MariadbVersion'
        dnsName:
          $ref: '#/components/schemas/DNSName'
        instances:
          $ref: '#/components/schemas/Instances'
        ram:
          $ref: '#/components/schemas/Ram'
        cores:
          $ref: '#/components/schemas/Cores'
        storageSize:
          $ref: '#/components/schemas/StorageSize'
        connections:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/Connection'
        maintenanceWindow:
          $ref: '#/components/schemas/MaintenanceWindow'
        backup:
          $ref: '#/components/schemas/BackupProperties'
      type: object

    BackupResponse:
      description: A database backup.
      properties:
        id:
          $ref: '#/components/schemas/ResourceID'
        properties:
          $ref: '#/components/schemas/Backup'
      type: object

    Backup:
      description: A backup object.
      properties:
        clusterId:
          type: string
          description: The unique ID of the cluster that was backed up.
          example: 498ae72f-411f-11eb-9d07-046c59cc737e
        location:
          $ref: '#/components/schemas/BackupLocation'
        earliestRecoveryTargetTime:
          type: string
          format: date-time
          description: The oldest available timestamp to which you can restore.
          example: '2021-10-23T01:21:10Z'
        size:
          type: integer
          description: |
            Size of all base backups in MiB. This is at least the sum of
            all base backup sizes.
          example: 2052
        baseBackups:
          type: array
          items:
            $ref: '#/components/schemas/BaseBackup'
      type: object

    BaseBackup:
      description: A single base backup.
      properties:
        created:
          type: string
          format: date-time
          description: The ISO 8601 creation timestamp.
          example: '2020-12-10T13:37:50+01:00'
        size:
          type: integer
          description: |
            The size of the backup in MiB. This is the
            size of the binary backup file that was stored.
          example: 543
      type: object

    MaintenanceWindow:
      description: |
        A weekly 4 hour-long window, during which maintenance might occur.
      properties:
        time:
          type: string
          description: Start of the maintenance window in UTC time.
          example: '16:30:59'
          pattern: '^(2[0-3]|[01]?[0-9]):([0-5]?[0-9]):([0-5]?[0-9])$'
        dayOfTheWeek:
          $ref: '#/components/schemas/DayOfTheWeek'
      required:
      - time
      - dayOfTheWeek
      type: object

    DayOfTheWeek:
      description: The name of the week day.
      type: string
      enum:
      - Sunday
      - Monday
      - Tuesday
      - Wednesday
      - Thursday
      - Friday
      - Saturday
      example: Monday

    BackupProperties:
      description: |
        Properties configuring the backup of the cluster.
      properties:
        location:
          $ref: '#/components/schemas/BackupLocation'
      type: object

    BackupLocation:
      type: string
      description: The S3 location where the backups will be stored.
      example: de

    Pagination:
      description: Pagination information in list responses.
      type: object
      properties:
        offset:
          $ref: '#/components/schemas/PaginationOffset'
        limit:
          $ref: '#/components/schemas/PaginationLimit'
        total:
          $ref: '#/components/schemas/PaginationTotal'
        _links:
          $ref: '#/components/schemas/PaginationLinks'

    PaginationOffset:
      description: |
        The offset specified in the request (if none was specified, the default
        offset is 0).
      type: integer
      example: 200
      minimum: 0
      default: 0

    PaginationLimit:
      description: |
        The limit specified in the request (if none was specified, the default
        limit is 100).
      type: integer
      example: 100
      minimum: 0
      default: 100
      maximum: 1000

    PaginationTotal:
      description: |
        The total number of elements matching the request (without pagination).
      type: integer
      example: 200
      minimum: 0
      default: 0

    PaginationLinks:
      description: |
        URLs to navigate the different pages.
      type: object
      properties:
        prev:
          description: |
            URL (with offset and limit parameters) of the previous page; only
            present if offset is greater than 0.
          type: string
          format: uri
          example: <PREVIOUS-PAGE-URI>
          readOnly: true
        self:
          description: |
            URL (with offset and limit parameters) of the current page.
          type: string
          format: uri
          example: <THIS-PAGE-URI>
          readOnly: true
        next:
          description: |
            URL (with offset and limit parameters) of the next page; only
            present if offset + limit is less than the total number of elements.
          type: string
          format: uri
          example: <NEXT-PAGE-URI>
          readOnly: true

    ClusterList:
      description: List of clusters.
      allOf:
      - type: object
        properties:
          id:
            $ref: '#/components/schemas/ResourceID'
          items:
            type: array
            items:
              $ref: '#/components/schemas/ClusterResponse'
      - $ref: '#/components/schemas/Pagination'
      type: object

    BackupList:
      description: List of backups.
      allOf:
      - type: object
        properties:
          id:
            $ref: '#/components/schemas/ResourceID'
          items:
            type: array
            items:
              $ref: '#/components/schemas/BackupResponse'
      - $ref: '#/components/schemas/Pagination'
      type: object

    InitialDBUsername:
      description: |
        The username for the initial MariaDB user. Some system usernames
        are restricted (e.g. "mariadb", "admin", "standby").

        The username should be compliant with the following rules:
        - Must not exceed 16 characters
        - Must start with a letter
        - Must contain only letters, numbers, or underscores
      example: cluster_admin
      minLength: 1
      maxLength: 16
      type: string
      pattern: '^[a-zA-Z]([a-zA-Z0-9]+_)*[a-zA-Z0-9]+$'

    DBPassword:
      type: string
      description: The password for a MariaDB user.
      writeOnly: true
      minLength: 10
      maxLength: 63
      example: my-t0p-secret-password

    RestoreRequest:
      type: object
      required:
        - backupId
      description: |
        Request payload to restore a cluster from a backup.
      properties:
        backupId:
          $ref: '#/components/schemas/ResourceID'
        recoveryTargetTime:
          type: string
          format: date-time
          example: '2020-12-10T13:37:50+01:00'
          description: |
            The timestamp to which the cluster should be restored.
            If empty, the backup will be applied to the latest
            timestamp.

            This value must be supplied as ISO 8601 timestamp, the
            backup will be replayed up until the given timestamp.
            If empty, the backup will be applied completely.

            Must be within the earliestRecoveryTargetTime and now.

            The earliestRecoveryTargetTime can be looked up in the
            backup object.

  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        Please provide header value as 'Bearer <token>' and don't forget to add
        'Bearer' HTTP Authorization Scheme before the token.
