openapi: 3.0.3

info:
  title: IONOS DBaaS MongoDB REST API
  description: |
    With IONOS Cloud Database as a Service, you have the ability to quickly set up and manage a MongoDB database. You can also delete clusters, manage backups, and users through the API.

    MongoDB is an open source, cross-platform, document-oriented database program. Classified as a NoSQL database program, it uses JSON-like documents with optional schemas.

    The MongoDB API allows you to create additional database clusters or modify existing ones. Both tools, the [Data Center Designer (DCD)](https://docs.ionos.com/cloud/set-up-ionos-cloud/data-center-designer) and the API use the same concepts consistently and are well suited for smooth and intuitive use.
  version: 1.0.0
externalDocs:
 url: https://docs.ionos.com/cloud/databases/mongodb
 description: IONOS Cloud - MongoDB User Guide
servers:
- url: https://api.ionos.com/databases/mongodb
  description: Production

security:
- basicAuth: []
- tokenAuth: []

tags:
- name: Clusters
  description: A cluster, in this context, describes a grouping of multiple MongoDB instances into a *replica set* or a *sharded cluster*.
- name: Metadata
  description: Metadata about the API, such as versions.
- name: Users
  description: How to manage users of a database cluster.
- name: Logs
  description: How to manage or fetch logs of a database cluster.
- name: Snapshots
  description: Get snapshot information of a database cluster.
- name: Restores
  description: Using the snapshot information to restore a database cluster.
- name: Templates
  description: Templates define a list of 'CUBE' compute resources to be used by Business Edition database clusters.

paths:
  /clusters:
    get:
      operationId: clustersGet
      summary: Get Clusters
      description: Retrieves a list of MongoDB clusters.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Clusters
      parameters:
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationOffset'
        - $ref: '#/components/parameters/ClusterNameQuery'
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterList'
        default:
          $ref: '#/components/responses/ApiError'
    post:
      operationId: clustersPost
      summary: Create a Cluster
      description: |
        Creates a new MongoDB cluster.
      security:
        - basicAuth: []
        - 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 and is automatically set to `state = BUSY`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}:
    get:
      operationId: clustersFindById
      summary: Get a Cluster by ID
      description:  Returns the cluster by ID.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Clusters
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        default:
          $ref: '#/components/responses/ApiError'
    patch:
      operationId: clustersPatch
      summary: Patch a Cluster
      description: Patch attributes of a MongoDB cluster.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Clusters
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
      requestBody:
        description: Part 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'
        default:
          $ref: '#/components/responses/ApiError'
    delete:
      operationId: clustersDelete
      summary: Delete a Cluster
      description: Deletes a MongoDB cluster.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Clusters
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
      responses:
        "200":
          description: |
            The cluster to be deleted is automatically set to `state = DESTROYING`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterResponse'
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}/users:
    get:
      operationId: clustersUsersGet
      summary: Get all Cluster Users
      description: Retrieves a list of MongoDB users.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Users
      parameters:
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationOffset'
        - $ref: '#/components/parameters/ClusterIdPath'
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsersList'
        default:
          $ref: '#/components/responses/ApiError'
    post:
      operationId: clustersUsersPost
      summary: Create a MongoDB User
      description: |
        Creates a MongoDB user.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Users
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
      requestBody:
        description: The user to be created.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostUserRequest'
        required: true
      responses:
        "200":
          description: |
                The created user is returned with metadata indicating when the user was created and by whom.

          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}/users/{username}:
    get:
      operationId: clustersUsersFindById
      summary: Get a MongoDB User by ID
      description: Retrieves the MongoDB user identified by the username.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Users
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
        - $ref: '#/components/parameters/UsernamePath'
      responses:
        "200":
          description: |
            The user identified by the username and database parameters is returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        default:
          $ref: '#/components/responses/ApiError'
    patch:
      operationId: clustersUsersPatch
      summary: Patch a MongoDB User by ID
      description: Patches a MongoDB user specified by its ID.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Users
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
        - $ref: '#/components/parameters/UsernamePath'
      requestBody:
        description: Part of the MongoDB user which should be modified.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchUserRequest'
        required: true
      responses:
        "200":
          description: |
            The user identified by the username and database parameters will be patched.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        default:
          $ref: '#/components/responses/ApiError'

    delete:
      operationId: clustersUsersDelete
      summary: Delete a MongoDB User by ID
      description: Deletes a MongoDB user specified by its ID.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Users
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
        - $ref: '#/components/parameters/UsernamePath'
      responses:
        "200":
          description: |
            The user identified by the username and database parameters will be deleted from the cluster.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}/logs:
    get:
      operationId: clustersLogsGet
      summary: Get Cluster Logs
      description: Retrieves MongoDB logs based on the given parameters.
      security:
      - basicAuth: []
      - tokenAuth: []
      tags:
      - Logs
      parameters:
      - $ref: '#/components/parameters/ClusterIdPath'
      - name: start
        in: query
        description: The start time for the query in 'RFC3339' format. Must not be more than 30 days ago but, before the end parameter. The default is 30 days ago.
        required: false
        schema:
          type: string
          format: date-time
      - name: end
        in: query
        description: The end time for the query in 'RFC3339' format. Must not be greater than now. The default is the current timestamp.
        required: false
        schema:
          type: string
          format: date-time
      - name: direction
        in: query
        description: The direction in which to scan through the logs. The logs are returned in order of the direction.
        schema:
          type: string
          default: BACKWARD
          enum:
          - BACKWARD
          - FORWARD
      - name: limit
        in: query
        description: The maximal number of log lines to return. If the maximum limit is reached, then log lines will be cut at the end, depending on which direction MongoDB is scanning the log.
        required: false
        schema:
          type: integer
          default: 100
          minimum: 1
          maximum: 5000
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClusterLogs'
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}/snapshots:
    get:
      operationId: clustersSnapshotsGet
      summary: Get Cluster Snapshots
      description: Retrieves MongoDB snapshots.
      security:
      - basicAuth: []
      - tokenAuth: []
      tags:
      - Snapshots
      parameters:
      - $ref: '#/components/parameters/PaginationLimit'
      - $ref: '#/components/parameters/PaginationOffset'
      - $ref: '#/components/parameters/ClusterIdPath'
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapshotList'
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}/restore:
    post:
      operationId: clustersRestorePost
      summary: In-place Cluster Restore
      description: Triggers an in-place restore of the given MongoDB cluster.
      security:
      - basicAuth: []
      - tokenAuth: []
      tags:
      - Restores
      parameters:
      - $ref: '#/components/parameters/ClusterIdPath'
      requestBody:
        description: The restore request to create.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRestoreRequest'
        required: true
      responses:
        "202":
          description: Successful operation.
        default:
          $ref: '#/components/responses/ApiError'

  /clusters/{clusterId}/versions:
    get:
      operationId: clustersVersionsGet
      summary: Get available MongoDB versions for this cluster
      description: Retrieves all MongoDB versions currently selectable for this cluster.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Clusters
      parameters:
        - $ref: '#/components/parameters/ClusterIdPath'
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MongoDBVersionList'
        default:
          $ref: '#/components/responses/ApiError'

  /versions:
    get:
      operationId: versionsGet
      summary: Get Available MongoDB Versions
      description: Retrieves all MongoDB versions available for new MongoDB clusters.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Metadata
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MongoDBVersionList'
        default:
          $ref: '#/components/responses/ApiError'


  /templates:
    get:
      operationId: templatesGet
      summary: Get Templates
      description: |
        Retrieves a list of valid templates. These templates can be used to create MongoDB clusters; they contain properties, such as number of cores, RAM, and the storage size.
      security:
        - basicAuth: []
        - tokenAuth: []
      tags:
        - Templates
      parameters:
        - $ref: '#/components/parameters/PaginationLimit'
        - $ref: '#/components/parameters/PaginationOffset'
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateList'
        default:
          $ref: '#/components/responses/ApiError'

  /infos/version:
    get:
      operationId: infosVersionGet
      summary: Get API Version
      description: Retrieves the current version of the responding API.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Metadata
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIVersion'
        default:
          $ref: '#/components/responses/ApiError'

  /infos/versions:
    get:
      operationId: infosVersionsGet
      summary: Get All API Versions
      description: Retrieves all available versions of the responding API.
      security:
        - basicAuth: [ ]
        - tokenAuth: [ ]
      tags:
        - Metadata
      responses:
        "200":
          description: Successful operation.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/APIVersion'
        default:
          $ref: '#/components/responses/ApiError'

components:

  responses:
    ApiError:
      description: |
        Any erroneous status code: 400 (parse error), 401 (authorization error),
        402 (trial access), 403 (insufficient permissions), 404 (not found),
        405 (unsupported HTTP method), 415 (unsupported content type),
        422 (validation error), 429 (request rate limit exceeded),
        500 (server error), 503 (maintenance)
      headers:
        Content-Type:
          description: The content type of the response.
          schema:
            type: string
            default: application/problem+json
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

  parameters:
    ClusterNameQuery:
      name: filter.name
      in: query
      description: |
        Response filter to list only the MongoDB 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

    UsernamePath:
      name: username
      in: path
      description: The authentication username.
      required: true
      schema:
        type: string

    PaginationLimit:
      x-go-name: 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

    PaginationOffset:
      x-go-name: 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:
    ErrorResponse:
      properties:
        httpStatus:
          type: integer
          description: The HTTP status code of the operation.
          example: 400
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ErrorMessage'
      type: object

    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

    APIVersion:
      properties:
        name:
          type: string
          example: v2.1
        swaggerUrl:
          type: string
          example: https://api.ionos.com/databases/mongodb/infos/assets/swagger-v2.1.yml
      type: object

    UsersList:
      description: List of cluster users.
      properties:
        type:
          $ref: '#/components/schemas/ResourceType'
        id:
          $ref: '#/components/schemas/ResourceId'
        items:
          type: array
          items:
            $ref: '#/components/schemas/User'
      type: object

    UserProperties:
      description: Mongodb user properties.
      required:
        - username
      properties:
        username:
          type: string
        roles:
          type: array
          items:
            $ref: '#/components/schemas/UserRoles'

    User:
      description: MongoDB database user.
      properties:
        type:
          allOf:
          - $ref: '#/components/schemas/ResourceType'
          example: user
        metadata:
          $ref: '#/components/schemas/UserMetadata'
        properties:
          $ref: '#/components/schemas/UserProperties'
      type: object

    PostUserRequest:
      description: MongoDB database user post request.
      properties:
        metadata:
          $ref: '#/components/schemas/UserMetadata'
        properties:
          $ref: '#/components/schemas/PostUserProperties'

    PostUserProperties:
      description: MongoDB database user post request properties.
      allOf:
        - $ref: '#/components/schemas/UserProperties'
        - type: object
          required:
            - password
          properties:
            password:
              type: string
              writeOnly: true
              minLength: 10

    PatchUserRequest:
      description: MongoDB database user patch request.
      properties:
        metadata:
          $ref: '#/components/schemas/UserMetadata'
        properties:
          $ref: '#/components/schemas/PatchUserProperties'

    PatchUserProperties:
      description: MongoDB database user patch request properties.
      properties:
        password:
          type: string
          writeOnly: true
          minLength: 10
        roles:
          type: array
          items:
            $ref: '#/components/schemas/UserRoles'

    UserRoles:
      description: a list of mongodb user role.
      properties:
        role:
          type: string
          enum:
          - read
          - readWrite
          - dbAdmin
          - clusterMonitor
          - readAnyDatabase
          - readWriteAnyDatabase
          - dbAdminAnyDatabase
          - enableSharding
          example: read
        database:
          type: string
      type: object

    SnapshotList:
      description: List of snapshots.
      allOf:
      - type: object
        properties:
          type:
            $ref: '#/components/schemas/ResourceType'
          id:
            $ref: '#/components/schemas/ResourceId'
          items:
            type: array
            items:
              $ref: '#/components/schemas/SnapshotResponse'
      - $ref: '#/components/schemas/DeprecatedPagination'
      type: object

    SnapshotResponse:
      description: A database snapshot.
      properties:
        type:
          allOf:
          - $ref: '#/components/schemas/ResourceType'
          example: snapshot
        id:
          $ref: '#/components/schemas/ResourceId'
        properties:
          $ref: '#/components/schemas/SnapshotProperties'
      type: object

    SnapshotProperties:
      description: Properties of a snapshot.
      properties:
        version:
          type: string
          description: The MongoDB version this backup was created from.
          example: "5.0"
        size:
          type: integer
          description: The size of the snapshot in Mebibytes.
          example: 150
        creationTime:
          type: string
          format: date-time
          description: The date the resource was created.
          example: "2020-12-10T13:37:50+01:00"
      type: object

    CreateRestoreRequest:
      description: The restore request.
      properties:
        snapshotId:
          type: string
          example: dcd31531-3ac8-11eb-9feb-046c59cc737e
          description: The unique ID of the snapshot you want to restore.

        recoveryTargetTime:
          type: string
          format: date-time
          description: |
            If this value is supplied as ISO 8601 timestamp, the backup will be
            replayed up until the given timestamp.
          example: "2023-04-21T13:37:50+01:00"
      type: object

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

    ClusterResponse:
      description: A database cluster.
      properties:
        type:
          allOf:
          - $ref: '#/components/schemas/ResourceType'
          example: cluster
        id:
          $ref: '#/components/schemas/ResourceId'
        metadata:
          $ref: '#/components/schemas/Metadata'
        properties:
          $ref: '#/components/schemas/ClusterProperties'
      type: object

    ResourceType:
      description: The resource type.
      type: string
      enum:
      - collection
      - cluster
      - user
      - snapshot
      - template

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

    ClusterProperties:
      description: Properties of a database cluster.
      properties:
        type:
          $ref: '#/components/schemas/Type'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        mongoDBVersion:
          $ref: '#/components/schemas/MongoDBVersion'
        location:
          $ref: '#/components/schemas/Location'
        backup:
          $ref: '#/components/schemas/BackupProperties'
        instances:
          $ref: '#/components/schemas/Instances'
        shards:
          $ref: '#/components/schemas/Shards'
        connections:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/Connection'
        maintenanceWindow:
          $ref: '#/components/schemas/MaintenanceWindow'
        templateID:
          $ref: '#/components/schemas/TemplateID'
        connectionString:
          $ref: '#/components/schemas/ConnectionString'
        biConnector:
          $ref: '#/components/schemas/BiConnectorProperties'
        edition:
          $ref: '#/components/schemas/Edition'
        cores:
          $ref: '#/components/schemas/Cores'
        ram:
          $ref: '#/components/schemas/Ram'
        storageSize:
          $ref: '#/components/schemas/StorageSize'
        storageType:
          $ref: '#/components/schemas/StorageType'
      type: object

    BiConnectorProperties:
      properties:
        enabled:
          type: boolean
          description: |
            The MongoDB Connector for Business Intelligence allows you to query a MongoDB database
            using SQL commands to aid in data analysis.
          default: false
        host:
          type: string
          description: |
            The host where this new BI Connector is installed.
          readOnly: true
        port:
          type: string
          description: |
            Port number used when connecting to this new BI Connector.
          readOnly: true

    DeprecatedPagination:
      description: Pagination information in list responses. DEPRECATED because of misspelled _links attribute.
      type: object
      properties:
        offset:
          $ref: '#/components/schemas/PaginationOffset'
        limit:
          $ref: '#/components/schemas/PaginationLimit'
        links:
          $ref: '#/components/schemas/PaginationLinks'

    Pagination:
      description: Pagination information in list responses.
      type: object
      properties:
        offset:
          $ref: '#/components/schemas/PaginationOffset'
        limit:
          $ref: '#/components/schemas/PaginationLimit'
        _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

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

    CreateClusterRequest:
      description: |
        The request payload with all data needed to create a new MongoDB cluster.
      properties:
        metadata:
          $ref: '#/components/schemas/Metadata'
        properties:
          $ref: '#/components/schemas/CreateClusterProperties'
      type: object

    UserMetadata:
      description: The metadata of the resource.
      properties:
        createdDate:
          type: string
          format: date-time
          description: The date the resource was created.
          example: "2020-12-10T13:37:50+01:00"
        createdBy:
          type: string
          description: The user who created the resource.
          example: john.doe@example.com
        createdByUserId:
          type: string
          description: The ID of the user who created the resource.
          example: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3

    Metadata:
      description: The metadata of the resource.
      properties:
        createdDate:
          type: string
          format: date-time
          description: The date the resource was created.
          example: "2020-12-10T13:37:50+01:00"
        createdBy:
          type: string
          description: The user who created the resource.
          example: john.doe@example.com
        createdByUserId:
          type: string
          description: The ID of the user who created the resource.
          example: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3
        lastModifiedDate:
          type: string
          format: date-time
          description: The date the resource was last modified.
          example: "2020-12-11T13:37:50+01:00"
        lastModifiedBy:
          type: string
          description: The last user who modified the resource.
          example: jane.doe@example.com
        lastModifiedByUserId:
          type: string
          description: The ID of the user who last modified the resource.
          example: 87f9a82e-b28d-49ed-9d04-fba2c0459cd3
        state:
          $ref: '#/components/schemas/State'
        health:
          $ref: '#/components/schemas/Health'

    State:
      description: |
        The current status reported by the cluster.
        * **AVAILABLE** Resources for this cluster exist and are healthy.
        * **BUSY** Resources for this cluster are being created or updated.
        * **DESTROYING** Delete cluster command was issued, the cluster is being deleted.
        * **FAILED** Failed to get the cluster status.
        * **UNKNOWN** The state is unknown.
        * **UPGRADING** The cluster is upgrading to a different edition.
      type: string
      enum:
      - AVAILABLE
      - BUSY
      - DESTROYING
      - FAILED
      - UNKNOWN
      - UPGRADING
      example: AVAILABLE

    Health:
      description: |
        The current health status reported by the cluster.
        * **HEALTHY** Primary exists and number of replicas is equal to specified.
        * **UNHEALTHY** Primary does not exist or cluster doesn't have majority.
        * **DEGRADED** Primary exists and number of replicas is less than specified.
        * **UNKNOWN** The health status is unknown.
      type: string
      enum:
      - HEALTHY
      - UNHEALTHY
      - DEGRADED
      - UNKNOWN
      example: HEALTHY

    CreateClusterProperties:
      description: |
        The properties with all the data needed to create a new MongoDB cluster.
      required:
      - mongoDBVersion
      - instances
      - connections
      - location
      - displayName

      properties:
        type:
          $ref: '#/components/schemas/Type'
        templateID:
          $ref: '#/components/schemas/TemplateID'
        mongoDBVersion:
          $ref: '#/components/schemas/MongoDBVersion'
        instances:
          $ref: '#/components/schemas/Instances'
        shards:
          $ref: '#/components/schemas/Shards'
        connections:
          type: array
          minItems: 1
          maxItems: 1
          items:
            $ref: '#/components/schemas/Connection'
        location:
          $ref: '#/components/schemas/Location'
        backup:
          $ref: '#/components/schemas/BackupProperties'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        maintenanceWindow:
          $ref: '#/components/schemas/MaintenanceWindow'
        biConnector:
          $ref: '#/components/schemas/BiConnectorProperties'
        fromBackup:
          $ref: '#/components/schemas/CreateRestoreRequest'
        edition:
          $ref: '#/components/schemas/Edition'
        cores:
          $ref: '#/components/schemas/Cores'
        ram:
          $ref: '#/components/schemas/Ram'
        storageSize:
          $ref: '#/components/schemas/StorageSize'
        storageType:
          $ref: '#/components/schemas/StorageType'
      type: object

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

    PatchClusterProperties:
      description: Properties of the payload to change a cluster.
      properties:
        type:
          $ref: '#/components/schemas/Type'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        maintenanceWindow:
          $ref: '#/components/schemas/MaintenanceWindow'
        instances:
          $ref: '#/components/schemas/Instances'
        shards:
          $ref: '#/components/schemas/Shards'
        backup:
          $ref: '#/components/schemas/BackupProperties'
        biConnector:
          $ref: '#/components/schemas/BiConnectorProperties'
        connections:
          type: array
          minItems: 0
          maxItems: 1
          items:
            $ref: '#/components/schemas/Connection'
        templateID:
          $ref: '#/components/schemas/TemplateID'
        mongoDBVersion:
          $ref: '#/components/schemas/MongoDBVersion'
        edition:
          $ref: '#/components/schemas/Edition'
        cores:
          $ref: '#/components/schemas/Cores'
        ram:
          $ref: '#/components/schemas/Ram'
      type: object

    TemplateID:
      type: string
      description: |
        The unique ID of the template, which specifies the number of cores, storage size, and memory.
        You cannot downgrade to a smaller template or minor edition; for example, downgrading from *Business* to *Playground* is not possible.
        To get a list of all templates to confirm the changes, use the '/templates' endpoint.

      example: 498ae72f-411f-11eb-9d07-046c59cc737e

    ClusterLogs:
      description: The logs of the MongoDB cluster.
      properties:
        instances:
          type: array
          items:
            properties:
              name:
                description: The name of the MongoDB instance.
                type: string
                example: mongodb-cluster-0
              messages:
                type: array
                items:
                  type: object
                  properties:
                    time:
                      type: string
                      format: date-time
                      example: "2021-09-06T10:00:38.253+02:00"
                    message:
                      type: string
                      example: Hello World

            type: object
      type: object

    Edition:
      type: string
      description: The cluster edition.
      example: "playground"
      x-extensible-enum:
        - "playground"
        - "business"
        - "enterprise"

    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 megabytes. Has to be a multiple of 1024.
      multipleOf: 1024
      example: 2048
      minimum: 2048

    StorageSize:
      type: integer
      description: The amount of storage per instance in megabytes.
      example: 5000
      minimum: 2048
      maximum: 2097152

    StorageType:
      description: The storage type used in your cluster.
      type: string
      example: HDD
      enum:
        - HDD
        - SSD Standard
        - SSD Premium

    MongoDBVersionList:
      description: List of MongoDB versions.
      properties:
        data:
          type: array
          items:
            properties:
              name:
                $ref: '#/components/schemas/MongoDBVersion'
            type: object
      type: object

    MongoDBVersion:
      type: string
      description: The MongoDB version of your cluster.
      example: "6.0"
      x-extensible-enum:
        - "7.0"
        - "6.0"

    ConnectionString:
      type: string
      description: The connection string for your cluster.
      example: "mongo+srv://m-498ae72f-411f-11eb-9d07-046c59cc737e.mongodb.de-txl.ionos.com"

    Shards:
      type: integer
      description: |
        The total number of shards in the cluster.
      example: 2

    Type:
      type: string
      description: |
        The cluster type, either `replicaset` or `sharded-cluster`.
      example: replicaset
      x-extensible-enum:
        - replicaset
        - sharded-cluster

    Instances:
      type: integer
      description: |
        The total number of instances in the cluster (one primary and n-1 secondaries).
      example: 3
      x-extensible-enum:
        - 1
        - 3
        - 5
        - 7

    BackupProperties:
      type: object
      description: |
        Backup related properties.
      properties:
        location:
          type: string
          description: |
            The location where the cluster backups will be stored. If not set, the backup is stored in the nearest location of the cluster.
          example: de
          x-extensible-enum:
            - de
            - eu-south-2
            - eu-central-3

    Location:
      type: string
      description: |
        The physical location where the cluster will be created. This is the location where all your instances will be located. This property is immutable.
      example: de/txl
      x-extensible-enum:
        - de/fra
        - de/txl
        - gb/lhr
        - gb/bhx
        - es/vit
        - us/ewr
        - us/mci
        - fr/par

    Connection:
      description: The network connection  details for your cluster.
      properties:
        datacenterId:
          description: The datacenter to which your cluster will be connected.
          type: string
          example: "5a029f4a-72e5-11ec-90d6-0242ac120003"
        lanId:
          description: The numeric LAN ID with which you connect your cluster.
          type: string
          example: "2"
        cidrList:
          type: array
          items:
            type: string
          description: |
            The list of IPs for your cluster.
            All IPs must be in a /24 network.
            Note the following unavailable IP ranges:
            10.233.114.0/24
          example: [192.168.1.100/24, 192.168.1.101/24]

      required:
        - datacenterId
        - lanId
        - cidrList
      type: object

    DisplayName:
      type: string
      description: The name of your cluster.
      example: MongoDB cluster

    MaintenanceWindow:
      description: |
        A weekly window of 4 hours during which maintenance work can be performed.
      properties:
        time:
          type: string
          example: "16:30:59"
        dayOfTheWeek:
          $ref: '#/components/schemas/DayOfTheWeek'
      required:
      - time
      - dayOfTheWeek
      type: object

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

    TemplateList:
      description: List of MongoDB templates.
      allOf:
      - type: object
        properties:
          type:
            $ref: '#/components/schemas/ResourceType'
          id:
            $ref: '#/components/schemas/ResourceId'
          items:
            type: array
            items:
              $ref: '#/components/schemas/TemplateResponse'
      - $ref: '#/components/schemas/DeprecatedPagination'
      type: object

    TemplateResponse:
      description: A MongoDB template.
      properties:
        type:
          allOf:
          - $ref: '#/components/schemas/ResourceType'
          example: template
        id:
          $ref: '#/components/schemas/ResourceId'
        metadata:
          $ref: '#/components/schemas/Metadata'
        properties:
          $ref: '#/components/schemas/TemplateProperties'
      type: object

    TemplateProperties:
      description: The properties of a MongoDB template.
      properties:
        name:
          type: string
          description: The name of the template.
          example: MongoDB Community 4XL
        edition:
          type: string
          description: The edition of the template (e.g. enterprise)
          example: enterprise
        cores:
          type: integer
          description: The number of CPU cores.
          example: 1
        ram:
          type: integer
          description: The amount of memory in MB.
          example: 2048
        storageSize:
          type: integer
          description: The amount of storage size in GB.
          example: 30

  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: |
        For 'Basic' authentication, take your credentials by first combining the username and password with a colon (``username:password``) and then encoding the resulting string in base64 (``YWxhZGRpbjpvcGVuc2VzYW1l``).

        **Example Request Header**

        ``Authorization: Basic YWxhZGRpbjpvcGVuc2Vzl``

        More details: https://en.wikipedia.org/wiki/Basic_access_authentication

    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: |
        Authorization is granted when a valid proof of identity is provided along with an API request for data. This proof of identity is in the form of a JSON web access token, a unique string that identifies a user.

        **Example Request Header**

        ``Authorization: Bearer ACCESS_TOKEN``
