{
  "swagger": "2.0",
  "info": {
    "title": "TiDB Cloud Open API",
    "description": "TiDB Cloud Open API",
    "version": "v1beta2"
  },
  "tags": [
    {
      "name": "TidbService"
    }
  ],
  "host": "cloud.tidbapi.com",
  "basePath": "/v1beta2",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/tidbs": {
      "get": {
        "summary": "List Tidbs",
        "operationId": "TidbService_ListTidbs",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2ListTidbsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "servicePlan",
            "description": "If specified, only clusters belonging to the specified service plan will be returned.",
            "in": "query",
            "required": false,
            "type": "string",
            "enum": [
              "Starter",
              "Essential",
              "Premium",
              "BYOC",
              "Dedicated"
            ]
          },
          {
            "name": "regionIds",
            "description": "If specified, only tidbs in the specified regions will be returned.",
            "in": "query",
            "required": false,
            "type": "array",
            "items": {
              "type": "string"
            },
            "collectionFormat": "multi"
          },
          {
            "name": "name",
            "description": "If specified, only tidbs with the specified name will be returned.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "tidbIds",
            "in": "query",
            "required": false,
            "type": "array",
            "items": {
              "type": "string"
            },
            "collectionFormat": "multi"
          },
          {
            "name": "pageSize",
            "description": "The maximum number of clusters to return. The service may return fewer than this value.\nIf unspecified, at most X clusters will be returned.\nThe maximum value is X; values above X will be coerced to X.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageToken",
            "description": "A page token, received from a previous `ListClusters` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListClusters` must match\nthe call that provided the page token.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "skip",
            "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "TidbService"
        ]
      },
      "post": {
        "summary": "Create a Tidb",
        "operationId": "TidbService_CreateTidb",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidb",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          },
          {
            "name": "validateOnly",
            "description": "If true, the request will be validated but not executed.",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}": {
      "get": {
        "summary": "Get a Tidb",
        "operationId": "TidbService_GetTidb",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      },
      "delete": {
        "summary": "Delete a Tidb",
        "operationId": "TidbService_DeleteTidb",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "validateOnly",
            "description": "If true, the request will be validated but not executed.",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidb.tidbId}": {
      "patch": {
        "summary": "Update a Tidb",
        "operationId": "TidbService_UpdateTidb",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidb.tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "tidb",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "displayName": {
                  "type": "string",
                  "example": "foo-bar",
                  "maxLength": 64,
                  "minLength": 4,
                  "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$"
                },
                "minRcu": {
                  "type": "string",
                  "format": "int64",
                  "description": "Deprecated: min_rcu is now automatically managed.\nAny value provided here will be ignored in favor of max(5000, max_rcu / 4).",
                  "readOnly": true
                },
                "maxRcu": {
                  "type": "string",
                  "format": "int64"
                }
              },
              "required": [
                "tidb"
              ]
            }
          },
          {
            "name": "validateOnly",
            "description": "If true, the request will be validated but not executed.",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}:resetRootPassword": {
      "post": {
        "summary": "Set root password for a Tidb",
        "operationId": "TidbService_ResetRootPassword",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2ResetRootPasswordResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1beta2TidbServiceResetRootPasswordBody"
            }
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}/cloudProviderInfo": {
      "get": {
        "summary": "Get cloud provider info for Tidb",
        "operationId": "TidbService_GetCloudProviderInfo",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1beta2CloudProviderInfo"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs:estimatePrice": {
      "post": {
        "summary": "Calculate fee for a Tidb",
        "operationId": "TidbService_EstimatePrice",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2EstimatePriceResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2EstimatePriceRequest"
            }
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}/backupPolicies": {
      "get": {
        "summary": "List all backup policies that offer to a specific TiDB cluster",
        "operationId": "TidbService_ListBackupPolicies",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2ListBackupPoliciesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}/backupSetting": {
      "get": {
        "summary": "Get backup setting for a specific TiDB cluster",
        "operationId": "TidbService_GetBackupSetting",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2BackupSetting"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{backupSetting.tidbId}/backupSetting": {
      "patch": {
        "summary": "Update backup setting for a specific TiDB cluster",
        "operationId": "TidbService_UpdateBackupSetting",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2BackupSetting"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "backupSetting.tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "backupSetting",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "backupPolicy": {
                  "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicyTier"
                },
                "pitrStartTime": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true
                },
                "pitrEndTime": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true
                },
                "lastModifyTime": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true
                }
              },
              "required": [
                "backupSetting"
              ]
            }
          },
          {
            "name": "validateOnly",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}/backups": {
      "get": {
        "summary": "List backups for a specific TiDB cluster",
        "operationId": "TidbService_ListTidbBackups",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1beta2ListTidbBackupsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "description": "Filter by tidb",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "states",
            "description": "Filter backups by state",
            "in": "query",
            "required": false,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "UNKNOWN",
                "PENDING",
                "RUNNING",
                "SUCCEEDED",
                "FAILED",
                "CANCELLED"
              ]
            },
            "collectionFormat": "multi"
          },
          {
            "name": "regionIds",
            "description": "Filter backups by region_id",
            "in": "query",
            "required": false,
            "type": "array",
            "items": {
              "type": "string"
            },
            "collectionFormat": "multi"
          },
          {
            "name": "triggerTypes",
            "description": "Filter Backups by trigger type",
            "in": "query",
            "required": false,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "AUTO",
                "MANUAL"
              ]
            },
            "collectionFormat": "multi"
          },
          {
            "name": "startTime",
            "description": "Filter by time range",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "endTime",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "pageSize",
            "description": "The maximum number of backups to return. The service may return fewer than this value.\nIf unspecified, at most X backups will be returned.\nThe maximum value is X; values above X will be coerced to X.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageToken",
            "description": "A page token, received from a previous `ListTidbBackups` call.\nProvide this to retrieve the subsequent page.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "skip",
            "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}/backups/{backupId}": {
      "delete": {
        "summary": "Delete a backup for a specific TiDB cluster",
        "operationId": "TidbService_DeleteTidbBackup",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "object",
              "properties": {}
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "backupId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs:restore": {
      "post": {
        "summary": "Restore from a backup",
        "operationId": "TidbService_RestoreTidb",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1beta2RestoreTidbResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1beta2RestoreTidbRequest"
            }
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}:restoreStatus": {
      "get": {
        "summary": "Get restore status for a TiDB cluster",
        "operationId": "TidbService_RestoreStatus",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2RestoreStatusResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs:validateClassicBackup": {
      "post": {
        "summary": "Validate classic backup before restore",
        "operationId": "TidbService_ValidateClassicBackup",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1beta2ValidateClassicBackupResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1beta2ValidateClassicBackupRequest"
            }
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    },
    "/tidbs/{tidbId}/caCertificateUrl": {
      "get": {
        "summary": "Get ca certificate download url for a TiDB cluster",
        "operationId": "TidbService_GetCaCertificateDownloadUrl",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2CaCertificateDownloadUrl"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TidbService"
        ]
      }
    }
  },
  "definitions": {
    "commonv1beta1ClusterState": {
      "type": "string",
      "enum": [
        "CREATING",
        "DELETING",
        "ACTIVE",
        "RESTORING",
        "MAINTENANCE",
        "DELETED",
        "INACTIVE",
        "UPGRADING",
        "IMPORTING",
        "MODIFYING",
        "PAUSING",
        "PAUSED",
        "RESUMING"
      ],
      "description": "Enum of possible states of a cluster.\n\n - CREATING: Cluster is being created.\n - DELETING: Cluster is being deleted.\n - ACTIVE: Cluster is active for use.\n - RESTORING: Cluster data is being restored.\n - MAINTENANCE: Cluster is under maintenance.\n - DELETED: Cluster has been deleted.\n - INACTIVE: Cluster is not active, but not being deleted.\n - UPGRADING: Cluster is being updated.\nOnly for Dedicated Cluster.\n - IMPORTING: Cluster is being imported.\nOnly for Dedicated Cluster.\n - MODIFYING: Cluster is being modified.\nOnly for Dedicated Cluster.\n - PAUSING: Cluster is being paused.\nOnly for Dedicated Cluster.\n - PAUSED: Cluster is paused.\nOnly for Dedicated Cluster.\n - RESUMING: Cluster is resuming.\nOnly for Dedicated Cluster."
    },
    "commonv1beta1ServicePlan": {
      "type": "string",
      "enum": [
        "Starter",
        "Essential",
        "Premium",
        "BYOC",
        "Dedicated"
      ]
    },
    "googlerpcStatus": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32",
          "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
        },
        "message": {
          "type": "string",
          "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client."
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/protobufAny"
          },
          "description": "A list of messages that carry the error details.  There is a common set of\nmessage types for APIs to use."
        }
      },
      "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)."
    },
    "nextgenv1beta2Backup": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "title": "The unique identifier of the backup",
          "readOnly": true
        },
        "tidbId": {
          "type": "string",
          "title": "The ID of the TiDB cluster this backup belongs to",
          "readOnly": true
        },
        "organizationId": {
          "type": "string",
          "title": "The ID of the TiDB cluster this backup belongs to",
          "readOnly": true
        },
        "servicePlan": {
          "title": "The service plan of the backup",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/commonv1beta1ServicePlan"
            }
          ]
        },
        "displayName": {
          "type": "string",
          "title": "The name of the backup",
          "readOnly": true
        },
        "description": {
          "type": "string",
          "title": "Description of the backup"
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "title": "Timestamp when the backup was created",
          "readOnly": true
        },
        "sizeBytes": {
          "type": "string",
          "format": "int64",
          "title": "The size of the backup in bytes",
          "readOnly": true
        },
        "state": {
          "title": "The state of the backup",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupState"
            }
          ]
        },
        "type": {
          "title": "The type of backup (snapshot / copied backup)",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupType"
            }
          ]
        },
        "triggerType": {
          "title": "The trigger type of the backup",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupTriggerType"
            }
          ]
        },
        "expirationTime": {
          "type": "string",
          "format": "date-time",
          "title": "Timestamp when the backup expires",
          "readOnly": true
        },
        "backupTs": {
          "type": "string",
          "title": "The backup tso",
          "readOnly": true
        },
        "regionId": {
          "type": "string",
          "title": "The region ID where the backup is stored",
          "readOnly": true
        }
      }
    },
    "nextgenv1beta2BackupSetting": {
      "type": "object",
      "properties": {
        "tidbId": {
          "type": "string"
        },
        "backupPolicy": {
          "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicyTier"
        },
        "pitrStartTime": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "pitrEndTime": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "lastModifyTime": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        }
      },
      "required": [
        "tidbId"
      ]
    },
    "nextgenv1beta2BackupSettingBackupPolicy": {
      "type": "object",
      "properties": {
        "name": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicyTier"
            }
          ]
        },
        "description": {
          "type": "string",
          "readOnly": true
        },
        "pitr": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicyPiTRPolicy"
            }
          ]
        },
        "hourlyBackup": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicyHourlyPolicy"
            }
          ]
        },
        "dailyBackup": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicyDailyPolicy"
            }
          ]
        }
      }
    },
    "nextgenv1beta2BackupSettingBackupPolicyDailyPolicy": {
      "type": "object",
      "properties": {
        "retentionDays": {
          "type": "integer",
          "format": "int32"
        },
        "startTimeUtc": {
          "type": "string"
        }
      }
    },
    "nextgenv1beta2BackupSettingBackupPolicyHourlyPolicy": {
      "type": "object",
      "properties": {
        "retentionDays": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "nextgenv1beta2BackupSettingBackupPolicyPiTRPolicy": {
      "type": "object",
      "properties": {
        "retentionDays": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "nextgenv1beta2BackupSettingBackupPolicyTier": {
      "type": "string",
      "enum": [
        "TIER1",
        "TIER2",
        "TIER3"
      ]
    },
    "nextgenv1beta2BackupState": {
      "type": "string",
      "enum": [
        "UNKNOWN",
        "PENDING",
        "RUNNING",
        "SUCCEEDED",
        "FAILED",
        "CANCELLED"
      ],
      "title": "State enum for backup operations"
    },
    "nextgenv1beta2BackupStorageAuth": {
      "type": "object",
      "properties": {
        "accessKeyId": {
          "type": "string"
        },
        "accessKeySecret": {
          "type": "string"
        }
      },
      "required": [
        "accessKeyId",
        "accessKeySecret"
      ]
    },
    "nextgenv1beta2BackupTriggerType": {
      "type": "string",
      "enum": [
        "AUTO",
        "MANUAL"
      ],
      "title": "TriggerType enum for backup operations"
    },
    "nextgenv1beta2BackupType": {
      "type": "string",
      "enum": [
        "SNAPSHOT",
        "COPIED"
      ],
      "title": "Type enum for backup operations"
    },
    "nextgenv1beta2CaCertificateDownloadUrl": {
      "type": "object",
      "properties": {
        "uri": {
          "type": "string",
          "readOnly": true
        }
      }
    },
    "nextgenv1beta2ClassicBackupStorage": {
      "type": "object",
      "properties": {
        "cloudProvider": {
          "$ref": "#/definitions/v1beta1RegionCloudProvider"
        },
        "regionId": {
          "type": "string",
          "title": "only required when cloud_provider=alicloud"
        },
        "bucketUri": {
          "type": "string"
        },
        "auth": {
          "$ref": "#/definitions/nextgenv1beta2BackupStorageAuth"
        }
      },
      "title": "ClassicBackupStorage is the storage info of classic_backup_storage",
      "required": [
        "cloudProvider",
        "bucketUri",
        "auth"
      ]
    },
    "nextgenv1beta2CmekAccessIamPrincipalAwsCmekPrincipal": {
      "type": "object",
      "properties": {
        "accountId": {
          "type": "string",
          "readOnly": true
        }
      }
    },
    "nextgenv1beta2ConnectionReachability": {
      "type": "object",
      "properties": {
        "reachable": {
          "type": "boolean",
          "readOnly": true
        },
        "detail": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ConnectionReachabilityDetail"
            }
          ]
        }
      }
    },
    "nextgenv1beta2ConnectionReachabilityDetail": {
      "type": "object",
      "properties": {
        "serviceActive": {
          "type": "boolean",
          "readOnly": true
        },
        "endpointActive": {
          "type": "boolean",
          "readOnly": true
        },
        "dnsReachable": {
          "type": "boolean",
          "readOnly": true
        },
        "message": {
          "type": "string",
          "readOnly": true
        }
      }
    },
    "nextgenv1beta2CustomerManagedEncryptionKey": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "title": "Format: cmeks/{cmek_id}",
          "readOnly": true
        },
        "customerManagedEncryptionKeyId": {
          "type": "string",
          "format": "uint64",
          "readOnly": true
        },
        "regionId": {
          "type": "string"
        },
        "cloudProvider": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta1RegionCloudProvider"
            }
          ]
        },
        "servicePlan": {
          "$ref": "#/definitions/commonv1beta1ServicePlan"
        },
        "awsKms": {
          "$ref": "#/definitions/nextgenv1beta2CustomerManagedEncryptionKeyAwsKms"
        },
        "awsPrincipal": {
          "$ref": "#/definitions/nextgenv1beta2CmekAccessIamPrincipalAwsCmekPrincipal"
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        }
      },
      "required": [
        "regionId",
        "servicePlan"
      ]
    },
    "nextgenv1beta2CustomerManagedEncryptionKeyAwsKms": {
      "type": "object",
      "properties": {
        "kmsKeyArn": {
          "type": "string"
        }
      },
      "required": [
        "kmsKeyArn"
      ]
    },
    "nextgenv1beta2EstimatePriceRequest": {
      "type": "object",
      "properties": {
        "regionId": {
          "type": "string",
          "title": "Required. Region where the tidb will be created.\nFormat: {cloud_provider}-{region_code}"
        },
        "minRcu": {
          "type": "string",
          "format": "int64"
        },
        "maxRcu": {
          "type": "string",
          "format": "int64"
        },
        "servicePlan": {
          "$ref": "#/definitions/commonv1beta1ServicePlan"
        },
        "rowStorageSize": {
          "type": "string",
          "format": "int64"
        },
        "columnStorageSize": {
          "type": "string",
          "format": "int64"
        }
      },
      "required": [
        "regionId",
        "minRcu",
        "maxRcu",
        "servicePlan",
        "rowStorageSize",
        "columnStorageSize"
      ]
    },
    "nextgenv1beta2EstimatePriceResponse": {
      "type": "object",
      "properties": {
        "costs": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1beta2EstimatePriceResponseComponentCost"
          }
        }
      }
    },
    "nextgenv1beta2ListBackupPoliciesResponse": {
      "type": "object",
      "properties": {
        "backupPolicies": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/nextgenv1beta2BackupSettingBackupPolicy"
          }
        }
      }
    },
    "nextgenv1beta2ResetRootPasswordResponse": {
      "type": "object"
    },
    "nextgenv1beta2RestoreMode": {
      "type": "string",
      "enum": [
        "SNAPSHOT",
        "PITR",
        "DEDICATED_SNAPSHOT",
        "CLASSIC_SNAPSHOT"
      ],
      "title": "RestoreMode enum for restore operations"
    },
    "nextgenv1beta2RestoreState": {
      "type": "string",
      "enum": [
        "UNKNOWN",
        "PENDING",
        "RUNNING",
        "SUCCEEDED",
        "FAILED",
        "CANCELLED"
      ],
      "title": "RestoreState enum for restore operations"
    },
    "nextgenv1beta2RestoreStatusResponse": {
      "type": "object",
      "properties": {
        "state": {
          "title": "The status of the restore operation",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2RestoreState"
            }
          ]
        },
        "message": {
          "type": "string",
          "title": "Error message provided if the restore failed",
          "readOnly": true
        },
        "progress": {
          "type": "integer",
          "format": "int32",
          "title": "Progress percentage (0-100)",
          "readOnly": true
        }
      }
    },
    "protobufAny": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string",
          "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n  value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n  URL, or have them precompiled into a binary to avoid any\n  lookup. Therefore, binary compatibility needs to be preserved\n  on changes to types. (Use versioned type names to manage\n  breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics."
        }
      },
      "additionalProperties": {},
      "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n    Foo foo = ...;\n    Any any;\n    any.PackFrom(foo);\n    ...\n    if (any.UnpackTo(\u0026foo)) {\n      ...\n    }\n\nExample 2: Pack and unpack a message in Java.\n\n    Foo foo = ...;\n    Any any = Any.pack(foo);\n    ...\n    if (any.is(Foo.class)) {\n      foo = any.unpack(Foo.class);\n    }\n    // or ...\n    if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n      foo = any.unpack(Foo.getDefaultInstance());\n    }\n\n Example 3: Pack and unpack a message in Python.\n\n    foo = Foo(...)\n    any = Any()\n    any.Pack(foo)\n    ...\n    if any.Is(Foo.DESCRIPTOR):\n      any.Unpack(foo)\n      ...\n\n Example 4: Pack and unpack a message in Go\n\n     foo := \u0026pb.Foo{...}\n     any, err := anypb.New(foo)\n     if err != nil {\n       ...\n     }\n     ...\n     foo := \u0026pb.Foo{}\n     if err := any.UnmarshalTo(foo); err != nil {\n       ...\n     }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n    package google.profile;\n    message Person {\n      string first_name = 1;\n      string last_name = 2;\n    }\n\n    {\n      \"@type\": \"type.googleapis.com/google.profile.Person\",\n      \"firstName\": \u003cstring\u003e,\n      \"lastName\": \u003cstring\u003e\n    }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n    {\n      \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n      \"value\": \"1.212s\"\n    }"
    },
    "tidb_cloud_open_apinextgenv1beta2ListTidbsResponse": {
      "type": "object",
      "properties": {
        "tidbs": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
          }
        },
        "totalSize": {
          "type": "integer",
          "format": "int32",
          "description": "The total number of clusters that matched the query."
        },
        "nextPageToken": {
          "type": "string",
          "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages."
        }
      }
    },
    "tidb_cloud_open_apinextgenv1beta2Tidb": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "readOnly": true
        },
        "tidbId": {
          "type": "string",
          "readOnly": true
        },
        "displayName": {
          "type": "string",
          "example": "foo-bar",
          "maxLength": 64,
          "minLength": 4,
          "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$"
        },
        "regionId": {
          "type": "string",
          "title": "Required. Region where the tidb will be created.\nFormat: {cloud_provider}-{region_code}"
        },
        "cloudProvider": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta1RegionCloudProvider"
            }
          ]
        },
        "regionDisplayName": {
          "type": "string",
          "readOnly": true
        },
        "state": {
          "description": "Output_only. The current state of the cluster.",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/commonv1beta1ClusterState"
            }
          ]
        },
        "rootPassword": {
          "type": "string",
          "example": "my-shining-password",
          "maxLength": 64,
          "minLength": 8,
          "pattern": "^.{8,64}$"
        },
        "minRcu": {
          "type": "string",
          "format": "int64",
          "description": "[Output Only] This field is server-generated and any input value will be ignored.\nIt is calculated as: max(5000, max_rcu / 4).",
          "title": "min resource capacity unit",
          "readOnly": true
        },
        "maxRcu": {
          "type": "string",
          "format": "int64",
          "title": "max resource capacity unit"
        },
        "servicePlan": {
          "$ref": "#/definitions/commonv1beta1ServicePlan"
        },
        "highAvailabilityType": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta2TidbHighAvailabilityType"
            }
          ]
        },
        "annotations": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "OUTPUT_ONLY. The annotations for the cluster.\ntidb.cloud/has-set-password. The annotation for whether the cluster has set password.\ntidb.cloud/available-features. The annotation for the available features of the cluster."
        },
        "labels": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "creator": {
          "type": "string",
          "description": "The email address or public api key of the creator of the cluster.",
          "readOnly": true
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp when the cluster was created.",
          "readOnly": true
        },
        "updateTime": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp when the cluster was last updated.",
          "readOnly": true
        },
        "endpoints": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1beta2TidbEndpoint"
          },
          "readOnly": true
        },
        "dualLayerDataEncryption": {
          "$ref": "#/definitions/v1beta2TidbDualLayerDataEncryption"
        }
      },
      "required": [
        "displayName",
        "regionId",
        "maxRcu",
        "servicePlan"
      ]
    },
    "v1beta1RegionCloudProvider": {
      "type": "string",
      "enum": [
        "aws",
        "gcp",
        "azure",
        "alicloud"
      ],
      "description": "Enum of cloud provider names.\n\n - aws: Amazon Web Services.\n - gcp: Google Cloud Platform.\n - azure: Microsoft Azure.\n - alicloud: Alibaba Cloud"
    },
    "v1beta2ClassicBackupInfo": {
      "type": "object",
      "properties": {
        "cloudProvider": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta1RegionCloudProvider"
            }
          ]
        },
        "regionId": {
          "type": "string",
          "readOnly": true
        },
        "version": {
          "type": "string",
          "readOnly": true
        },
        "backupTime": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "sizeBytes": {
          "type": "string",
          "format": "int64",
          "readOnly": true
        }
      }
    },
    "v1beta2CloudProviderInfo": {
      "type": "object",
      "properties": {
        "tidbId": {
          "type": "string"
        },
        "cloudProvider": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta1RegionCloudProvider"
            }
          ]
        },
        "tidbCloudAccountId": {
          "type": "string",
          "title": "provider iam id",
          "readOnly": true
        },
        "tidbCloudAccountExternalId": {
          "type": "string",
          "title": "tidbCloudAccountExternalId",
          "readOnly": true
        }
      },
      "required": [
        "tidbId"
      ]
    },
    "v1beta2EstimatePriceResponseComponentCost": {
      "type": "object",
      "properties": {
        "componentType": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta2EstimatePriceResponseComponentType"
            }
          ]
        },
        "min": {
          "type": "number",
          "format": "double",
          "readOnly": true
        },
        "max": {
          "type": "number",
          "format": "double",
          "readOnly": true
        },
        "budgetLimit": {
          "type": "number",
          "format": "double",
          "readOnly": true
        },
        "rowStorage": {
          "type": "number",
          "format": "double",
          "readOnly": true
        },
        "columnStorage": {
          "type": "number",
          "format": "double",
          "readOnly": true
        }
      }
    },
    "v1beta2EstimatePriceResponseComponentType": {
      "type": "string",
      "enum": [
        "RU_COST",
        "STORAGE_COST"
      ]
    },
    "v1beta2ListTidbBackupsResponse": {
      "type": "object",
      "properties": {
        "backups": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/nextgenv1beta2Backup"
          }
        },
        "totalSize": {
          "type": "integer",
          "format": "int32",
          "description": "The total number of backups that matched the query."
        },
        "nextPageToken": {
          "type": "string",
          "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages."
        }
      }
    },
    "v1beta2RestoreTidbRequest": {
      "type": "object",
      "properties": {
        "tidb": {
          "title": "new tidb spec",
          "allOf": [
            {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          ]
        },
        "sourceTidbId": {
          "type": "string",
          "title": "tidb id of the backup data"
        },
        "restoreMode": {
          "title": "Required. The restore mode",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2RestoreMode"
            }
          ]
        },
        "backupId": {
          "type": "string",
          "title": "The ID of the backup to restore from. Required when the restore_mode is SNAPSHOT or DEDICATED_SNAPSHOT"
        },
        "pointInTime": {
          "type": "string",
          "format": "date-time",
          "title": "The time point which data will be restored. Required when the restore_mode is PITR"
        },
        "classicBackupStorage": {
          "title": "storage info of backup data when restore_mode is CLASSIC_SNAPSHOT",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ClassicBackupStorage"
            }
          ]
        },
        "validateOnly": {
          "type": "boolean",
          "description": "If true, the request will be validated but not executed."
        }
      },
      "required": [
        "tidb",
        "restoreMode"
      ]
    },
    "v1beta2RestoreTidbResponse": {
      "type": "object",
      "properties": {
        "tidb": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/tidb_cloud_open_apinextgenv1beta2Tidb"
            }
          ]
        }
      }
    },
    "v1beta2TidbDualLayerDataEncryption": {
      "type": "object",
      "properties": {
        "noEncryption": {
          "type": "object",
          "properties": {}
        },
        "defaultKey": {
          "type": "object",
          "properties": {}
        },
        "cmek": {
          "$ref": "#/definitions/nextgenv1beta2CustomerManagedEncryptionKey"
        }
      }
    },
    "v1beta2TidbEndpoint": {
      "type": "object",
      "properties": {
        "host": {
          "type": "string",
          "description": "When endpoint's type is `PRIVATE_ENDPOINT`, the `host` field behave differently across cloud providers:\nFor AWS clusters, the `host` field is available right after the private link service is ready.\nFor GCP and Azure clusters, the `host` field is available after the user creates a `PrivateEndpointConnection`.",
          "readOnly": true
        },
        "port": {
          "type": "integer",
          "format": "int32",
          "readOnly": true
        },
        "connectionType": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta2TidbEndpointConnectionType"
            }
          ]
        },
        "connectionReachability": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ConnectionReachability"
            }
          ]
        }
      }
    },
    "v1beta2TidbEndpointConnectionType": {
      "type": "string",
      "enum": [
        "PUBLIC",
        "PRIVATE_ENDPOINT",
        "VPC_PEERING"
      ],
      "description": " - PUBLIC: The endpoint is a public endpoint.\n - PRIVATE_ENDPOINT: The endpoint is a private link endpoint.\n - VPC_PEERING: The endpoint is a VPC peering endpoint."
    },
    "v1beta2TidbHighAvailabilityType": {
      "type": "string",
      "enum": [
        "REGIONAL",
        "ZONAL"
      ]
    },
    "v1beta2TidbServiceResetRootPasswordBody": {
      "type": "object",
      "properties": {
        "rootPassword": {
          "type": "string",
          "example": "my-shining-password",
          "maxLength": 64,
          "minLength": 8,
          "pattern": "^.{8,64}$"
        }
      },
      "required": [
        "rootPassword"
      ]
    },
    "v1beta2UpdateTidbRequestTidb": {
      "type": "object",
      "properties": {
        "tidbId": {
          "type": "string"
        },
        "displayName": {
          "type": "string",
          "example": "foo-bar",
          "maxLength": 64,
          "minLength": 4,
          "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$"
        },
        "minRcu": {
          "type": "string",
          "format": "int64",
          "description": "Deprecated: min_rcu is now automatically managed.\nAny value provided here will be ignored in favor of max(5000, max_rcu / 4).",
          "readOnly": true
        },
        "maxRcu": {
          "type": "string",
          "format": "int64"
        }
      },
      "required": [
        "tidbId"
      ]
    },
    "v1beta2ValidateClassicBackupRequest": {
      "type": "object",
      "properties": {
        "classicBackupStorage": {
          "$ref": "#/definitions/nextgenv1beta2ClassicBackupStorage"
        },
        "servicePlan": {
          "$ref": "#/definitions/commonv1beta1ServicePlan"
        }
      },
      "required": [
        "classicBackupStorage",
        "servicePlan"
      ]
    },
    "v1beta2ValidateClassicBackupResponse": {
      "type": "object",
      "properties": {
        "classicBackupInfo": {
          "title": "only return when validate pass",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1beta2ClassicBackupInfo"
            }
          ]
        }
      }
    }
  }
}
