{ "swagger": "2.0", "info": { "title": "TiDB Cloud API", "description": "*TiDB Cloud API is in beta.*\n\n# Overview\n\nThe TiDB Cloud API is a [REST interface](https://en.wikipedia.org/wiki/Representational_state_transfer) that provides you with programmatic access to manage administrative objects within TiDB Cloud. Through this API, you can manage resources automatically and efficiently:\n\n* Projects\n* Clusters\n* Backups\n* Restores\n* Imports (Deprecated)\n\nThe API has the following features:\n\n- **JSON entities.** All entities are expressed in JSON.\n- **HTTPS-only.** You can only access the API via HTTPS, ensuring all the data sent over the network is encrypted with TLS.\n- **Key-based access and digest authentication.** Before you access TiDB Cloud API, you must generate an API key. All requests are authenticated through [HTTP Digest Authentication](https://en.wikipedia.org/wiki/Digest_access_authentication), ensuring the API key is never sent over the network.\n\n# Get Started\n\nThis guide helps you make your first API call to TiDB Cloud API. You'll learn how to authenticate a request, build a request, and interpret the response. The [List all accessible projects](#tag/Project/operation/ListProjects) endpoint is used in this guide as an example.\n\n## Prerequisites\n\nTo complete this guide, you need to perform the following tasks:\n\n- Create a [TiDB Cloud account](https://tidbcloud.com/free-trial)\n- Install [curl](https://curl.se/)\n\n## Step 1. Create an API key\n\nTo create an API key, log in to your TiDB Cloud console. Navigate to the [**API Keys**](https://tidbcloud.com/org-settings/api-keys) page, and create an API key.\n\nAn API key contains a public key and a private key. Copy and save them in a secure location. You will need to use the API key later in this guide.\n\nFor more details about creating an API key, refer to [API Key Management](#section/Authentication/API-Key-Management).\n\n## Step 2. Make your first API call\n\n### Build an API call\n\nTiDB Cloud API call consists of the following components:\n\n- **A host.** The host for TiDB Cloud API is .\n- **An API Key**. The public key and the private key are required for authentication.\n- **A request.** When submitting data to a resource via `POST`, `PATCH`, or `PUT`, you must submit your payload in JSON.\n\nIn this guide, you call the [List all accessible projects](#tag/Project/operation/ListProjects) endpoint. For the detailed description of the endpoint, see the [API reference](#tag/Project/operation/ListProjects).\n\n### Call an API endpoint\n\nTo get all projects in your organization, run the following command in your terminal. Remember to change `YOUR_PUBLIC_KEY` to your public key and `YOUR_PRIVATE_KEY` to your private key.\n\n```shell\ncurl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects\n```\n\n## Step 3. Check the response\n\nAfter making the API call, if the status code in response is `200` and you see details about all the projects in your organization, your request is successful. Here is an example of a successful response.\n\n```log\n{\n \"items\": [\n {\n \"id\": \"{project_id}\",\n \"org_id\": \"{org_id}\",\n \"name\": \"MyProject\",\n \"cluster_count\": 3,\n \"user_count\": 1,\n \"create_timestamp\": \"1652407748\"\n }\n ],\n \"total\": 1\n}\n```\n\nIf your API call is not successful, you will receive a status code other than `200` and the response looks similar to the following example. To troubleshoot the failed call, you can check the `message` in the response.\n\n```log\n{\n \"code\": 49900001,\n \"message\": \"public_key not found\",\n \"details\": []\n}\n```\n\n## Code samples\n\nThis section walks you through the quickest way to get started with TiDB Cloud API using programming languages. In these examples, you will learn how to use Python to create a cluster, backup and restore data, and scale out a cluster.\n\nYou can view the [full code examples](https://github.com/tidbcloud/tidbcloud-api-samples) of Python and Golang on GitHub or clone the repository to your local machine.\n\n```git\ngit clone https://github.com/tidbcloud/tidbcloud-api-samples.git\n```\n\n### Create and connect to a TiDB cluster\n\nThe following code examples show how to create a TiDB cluster and connect to the cluster. The whole process takes five steps:\n\n1. Get all projects.\n2. Get the cloud providers, regions and specifications.\n3. Create a cluster in your specified project.\n4. Get the new cluster information.\n5. Connect to the cluster using a MySQL client.\n\n#### Step 1: Get all projects\n\nBefore you create a cluster, you need to get the ID of the project that you want to create a cluster in.\n\nTo view the information of all available projects, you can use the [List all accessible projects](#tag/Project/operation/ListProjects) endpoint.\n\n```python\nimport requests\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef get_all_projects(public_key: str, private_key: str) -> dict:\n \"\"\"\n Get all projects\n :param public_key: Your public key\n :param private_key: Your private key\n :return: Projects detail\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects\"\n resp = requests.get(url=url, auth=HTTPDigestAuth(public_key, private_key))\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY and YOUR_PRIVATE_KEY\n project = get_all_projects(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\")\n print(project)\n```\n\nFor more details about the request and response, see [List all accessible projects](#tag/Project/operation/ListProjects).\n\n#### Step 2: Get the cloud providers, regions and specifications\n\nBefore you create a cluster, you need to get the list of available cloud providers, regions, and specifications.\n\n```python\nimport requests\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef get_provider_regions_specifications(public_key: str, private_key: str) -> dict:\n \"\"\"\n Get cloud providers, regions and available specifications.\n :param public_key: Your public key\n :param private_key: Your private key\n :return: List the cloud providers, regions and available specifications.\n \"\"\"\n url = f\"{HOST}/api/v1beta/clusters/provider/regions\"\n resp = requests.get(url=url, auth=HTTPDigestAuth(public_key, private_key))\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY and YOUR_PRIVATE_KEY\n provider_regions_specifications = get_provider_regions_specifications(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\")\n print(provider_regions_specifications)\n```\n\nFor more details about the request and response, see [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n#### Step 3: Create a cluster in your specified project and cloud provider\n\nThe following example uses the [Create a cluster](#tag/Cluster/operation/CreateCluster) endpoint to create a TiDB Cloud Dedicated cluster. A configuration example is provided in the code; you can replace the parameters using the information you get in the previous two steps.\n\n```python\nimport requests\nimport time\nimport json\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef create_dedicated_cluster(public_key: str, private_key: str, project_id: str) -> dict:\n \"\"\"\n Create a dedicated cluster in your specified project.\n `data_config` below is a demo. You should fill in the field according to\n your own situation\n :param public_key: Your public key\n :param private_key: Your private key\n :param project_id: The project id\n :return: Dedicated cluster id\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/clusters\"\n ts = int(time.time())\n data_config = \\\n {\n \"name\": f\"tidbcloud-sample-{ts}\",\n \"cluster_type\": \"DEDICATED\",\n \"cloud_provider\": \"AWS\",\n \"region\": \"us-west-2\",\n \"config\":\n {\n \"root_password\": \"input_your_password\",\n \"port\": 4000,\n \"components\":\n {\n \"tidb\":\n {\n \"node_size\": \"8C16G\",\n \"node_quantity\": 1\n },\n \"tikv\":\n {\"node_size\": \"8C32G\",\n \"storage_size_gib\": 500,\n \"node_quantity\": 3\n }\n },\n \"ip_access_list\":\n [\n {\n \"cidr\": \"0.0.0.0/0\",\n \"description\": \"Allow Access from Anywhere.\"\n }\n ]\n\n }\n }\n data_config_json = json.dumps(data_config)\n resp = requests.post(url=url,\n auth=HTTPDigestAuth(public_key, private_key),\n data=data_config_json)\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY and YOUR_PROJECT_ID\n cluster = create_dedicated_cluster(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\")\n print(cluster)\n```\n\nThis request returns the ID of the cluster that you just created. For more details about the request and response, see [Create a cluster](#tag/Cluster/operation/CreateCluster).\n\n#### Step 4: Get the new cluster information\n\nAfter you successfully create a cluster, you can use the [Get cluster by ID](#tag/Cluster/operation/GetCluster) endpoint to get the information of the cluster.\n\n```python\nimport requests\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef get_cluster_by_id(public_key: str, private_key: str, project_id: str, cluster_id: str) -> dict:\n \"\"\"\n Get the cluster detail.\n You will get `connection_strings` from the response after the cluster's status is`AVAILABLE`.\n Then, you can connect to TiDB using the default user, host, and port in `connection_strings`\n :param public_key: Your public key\n :param private_key: Your private key\n :param project_id: The project id\n :param cluster_id: The cluster id\n :return: The cluster detail\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/clusters/{cluster_id}\"\n resp = requests.get(url=url,\n auth=HTTPDigestAuth(public_key, private_key))\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY, YOUR_PROJECT_ID and YOUR_CLUSTER_ID\n cluster = get_cluster_by_id(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\",\n \"{YOUR_CLUSTER_ID}\")\n print(cluster)\n```\n\nIn the response, you can see the `connection_strings` field, which will be used later for connecting to the TiDB cluster. However, if your cluster status is `CREATING`, the `connection_strings` field might be empty. In such cases, you need to wait a while until the cluster status becomes `AVAILABLE` so that you can move on to the next step.\n\nFor more details about the request and response, see [Get a cluster by ID](#tag/Cluster/operation/GetCluster).\n\n#### Step 5: Connect to the cluster using a MySQL client\n\nAfter the cluster becomes `AVAILABLE`, you can get the connection strings. With the connection strings, you can connect to the cluster using a MySQL client.\n\nThe connection strings contain three fields:\n\n- `default_user`, the username you use to connect to TiDB.\n- `standard` connection string. In this guide, you'll use the `standard` connection.\n- `vpc_peering` connection string.\n\nThe `standard` connection string contains a `host` and a `port`. In the following command, replace `${default_user}` and `${host}` with the actual values in the connection strings. Run the command to connect to the TiDB cluster.\n\n```shell\nmysql --connect-timeout 15 -u ${default_user} -h ${host} -P 4000 -D test -p\n```\n\nFor more details on connection, see [Connect to TiDB Cluster](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster).\n\n### Manage backups for your clusters\n\nThe following example shows how to create a manual backup and restore the last backup data to a new cluster.\n\n#### Step 1: Create a manual backup\n\nTo create a manual backup, you can use the [Create a backup for a cluster](#tag/Backup/operation/CreateBackup) endpoint.\n\n```python\nimport requests\nimport json\nimport datetime\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef create_manual_backup(public_key: str, private_key: str, project_id: str, cluster_id: str) -> dict:\n \"\"\"\n Create manual backup\n `data_for_backup` below is a demo. You should fill in the field according to\n your own situation\n :param public_key: Your public key\n :param private_key: Your private key\n :param project_id: The project id\n :param cluster_id: The dedicated cluster id\n :return: The backup id\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups\"\n cur_date = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n data_for_backup = {\"name\": f\"tidbcloud-backup-{cur_date}\", \"description\": f\"tidbcloud-backup-{cur_date}\"}\n data_for_backup_json = json.dumps(data_for_backup)\n resp = requests.post(url=url,\n data=data_for_backup_json,\n auth=HTTPDigestAuth(public_key, private_key))\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY, YOUR_PROJECT_ID and YOUR_CLUSTER_ID\n backup = create_manual_backup(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\",\n \"{YOUR_CLUSTER_ID}\")\n print(backup)\n```\n\n#### Step 2: Restore the last backup data to a new cluster\n\nTo restore the last backup data to a new cluster, you can use the [Create a restore task](#tag/Restore/operation/CreateRestoreTask) endpoint.\n\n```python\nimport requests\nimport json\nimport datetime\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef create_restore_task(public_key: str, private_key: str, project_id: str, back_up_id: str) -> dict:\n \"\"\"\n Create restore task\n `data_for_restore` below is a demo. You should fill in the field according to\n your own situation\n :param private_key: Your public key\n :param public_key: Your private key\n :param project_id: The project id\n :param back_up_id: The backup id\n :return: The restore task id\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/restores\"\n cur_date = datetime.datetime.now().strftime(\"%Y-%m-%d\")\n data_for_restore = \\\n {\n \"backup_id\": f\"{back_up_id}\",\n \"name\": f\"tidbcloud-restore-{cur_date}\",\n \"config\":\n {\n \"root_password\": \"input_your_password\",\n \"port\": 4000,\n \"components\":\n {\n \"tidb\":\n {\n \"node_size\": \"8C16G\",\n \"node_quantity\": 1\n },\n \"tikv\":\n {\n \"node_size\": \"8C32G\",\n \"storage_size_gib\": 500,\n \"node_quantity\": 3\n }\n },\n \"ip_access_list\":\n [\n {\n \"cidr\": \"0.0.0.0/0\",\n \"description\": \"Allow Access from Anywhere.\"\n }\n ]\n\n }\n }\n data_for_restore_json = json.dumps(data_for_restore)\n resp = requests.post(url=url,\n auth=HTTPDigestAuth(public_key, private_key),\n data=data_for_restore_json)\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY, YOUR_PROJECT_ID and YOUR_BACKUP_ID\n restore = create_restore_task(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\",\n \"{YOUR_BACKUP_ID}\")\n print(restore)\n```\n\n#### Step 3: Get the restored cluster information\n\nTo get the information of the restored cluster, you can use the [Get a cluster by ID](#tag/Cluster/operation/GetCluster) endpoint.\n\n```python\nimport requests\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef get_cluster_by_id(public_key: str, private_key: str, project_id: str, cluster_id: str) -> dict:\n \"\"\"\n Get the cluster detail.\n You will get `connection_strings` from the response after the cluster's status is`AVAILABLE`.\n Then, you can connect to TiDB using the default user, host, and port in `connection_strings`\n :param public_key: Your public key\n :param private_key: Your private key\n :param project_id: The project id\n :param cluster_id: The cluster id\n :return: The cluster detail\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/clusters/{cluster_id}\"\n resp = requests.get(url=url,\n auth=HTTPDigestAuth(public_key, private_key))\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY, YOUR_PROJECT_ID and YOUR_CLUSTER_ID\n cluster = get_cluster_by_id(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\",\n \"{YOUR_CLUSTER_ID}\")\n print(cluster)\n```\n\n### Scale out one TiFlash node for an existing cluster\n\nThe following example shows how to scale out one TiFlash node for an existing cluster.\n\n#### Step 1: Add one TiFlash node for the specified cluster\n\nTo add a TiFlash node for the TiDB Cloud Dedicated cluster, you can use the [Modify a TiDB Cloud Dedicated cluster](#tag/Cluster/operation/UpdateCluster) endpoint.\n\n```python\nimport requests\nimport json\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef modify_cluster(public_key: str, private_key: str, project_id: str, cluster_id: str, tiflash_num: int) -> dict:\n \"\"\"\n Add one TiFlash node for specified cluster\n If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n `data_add_tiflash` below is a demo. You should fill in the field according to\n your own situation\n :param public_key: Your public key\n :param private_key: Your private key\n :param project_id: The project id\n :param cluster_id: The cluster id\n :param tiflash_num: The tiflash num\n :return: If success, return None. Else, return message\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/clusters/{cluster_id}\"\n data_add_tiflash = \\\n {\n \"config\":\n {\n \"components\":\n {\n \"tidb\":\n {\n \"node_quantity\": 1\n },\n \"tikv\":\n {\n \"node_quantity\": 3\n },\n \"tiflash\":\n {\n \"node_quantity\": f\"{tiflash_num}\",\n \"node_size\": \"8C64G\",\n \"storage_size_gib\": 500\n }\n }\n }\n }\n data_add_tiflash_json = json.dumps(data_add_tiflash)\n resp = requests.patch(url=url,\n auth=HTTPDigestAuth(public_key, private_key),\n data=data_add_tiflash_json)\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY, YOUR_PROJECT_ID, YOUR_CLUSTER_ID and MODIFY_TIFLASH_NUM\n modify_cluster(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\",\n \"{YOUR_CLUSTER_ID}\", \"{MODIFY_TIFLASH_NUM}\")\n```\n\n#### Step 2: View the scale-out progress\n\nTo view the scale-out progress, you can use the [Get a cluster by ID](#tag/Cluster/operation/GetCluster) endpoint.\n\n```python\nimport requests\nfrom requests.auth import HTTPDigestAuth\n\nHOST = \"https://api.tidbcloud.com\"\n\n\ndef get_cluster_by_id(public_key: str, private_key: str, project_id: str, cluster_id: str) -> dict:\n \"\"\"\n Get the cluster detail.\n You will get `connection_strings` from the response after the cluster's status is`AVAILABLE`.\n Then, you can connect to TiDB using the default user, host, and port in `connection_strings`\n :param public_key: Your public key\n :param private_key: Your private key\n :param project_id: The project id\n :param cluster_id: The cluster id\n :return: The cluster detail\n \"\"\"\n url = f\"{HOST}/api/v1beta/projects/{project_id}/clusters/{cluster_id}\"\n resp = requests.get(url=url,\n auth=HTTPDigestAuth(public_key, private_key))\n if resp.status_code != 200:\n print(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n raise Exception(f\"request invalid, code : {resp.status_code}, message : {resp.text}\")\n return resp.json()\n\n\nif __name__ == \"__main__\":\n # Replace YOUR_PUBLIC_KEY, YOUR_PRIVATE_KEY, YOUR_PROJECT_ID and YOUR_CLUSTER_ID\n cluster = get_cluster_by_id(\"{YOUR_PUBLIC_KEY}\", \"{YOUR_PRIVATE_KEY}\", \"{YOUR_PROJECT_ID}\",\n \"{YOUR_CLUSTER_ID}\")\n print(cluster)\n```\n\n# Authentication\n\nThe TiDB Cloud API uses [HTTP Digest Authentication](https://en.wikipedia.org/wiki/Digest_access_authentication). It protects your private key from being sent over the network. For more details about HTTP Digest Authentication, refer to the [IETF RFC](https://datatracker.ietf.org/doc/html/rfc7616).\n\n## API key overview\n\n- The API key contains a public key and a private key, which act as the username and password required in the HTTP Digest Authentication. The private key only displays upon the key creation.\n- The API key belongs to your organization and acts as the `Organization Owner` role. You can check [permissions of owner](https://docs.pingcap.com/tidbcloud/manage-user-access#configure-member-roles).\n- You must provide the correct API key in every request. Otherwise, the TiDB Cloud responds with a `401` error.\n\n## API key management\n\n### Create an API key\n\nOnly the **owner** of an organization can create an API key.\n\nTo create an API key in an organization, perform the following steps:\n\n1. In the [TiDB Cloud console](https://tidbcloud.com), switch to your target organization using the combo box in the upper-left corner.\n2. In the left navigation pane, click **Organization Settings** > **API Keys**.\n3. On the **API Keys** page, click **Create API Key**.\n4. Enter a description for your API key.\n5. Configure the role and scope for the API key. For more information about the permissions of a role, see [User roles](https://docs.pingcap.com/tidbcloud/manage-user-access/#user-roles).\n6. Click **Generate API Key**. Copy and save the public key and the private key.\n7. Make sure that you have copied and saved the private key in a secure location. The private key only displays upon the creation. After leaving this page, you will not be able to get the full private key again.\n8. Click **Done**.\n\n### View details of an API key\n\nTo view details of an API key, perform the following steps:\n\n1. In the [TiDB Cloud console](https://tidbcloud.com), switch to your target organization using the combo box in the upper-left corner.\n2. In the left navigation pane, click **Organization Settings** > **API Keys**.\n3. You can view the details of the API keys on the page.\n\n### Edit an API key\n\nOnly the **owner** of an organization can modify an API key.\n\nTo edit an API key in an organization, perform the following steps:\n\n1. In the [TiDB Cloud console](https://tidbcloud.com), switch to your target organization using the combo box in the upper-left corner.\n2. In the left navigation pane, click **Organization Settings** > **API Keys**.\n3. On the **API Keys** page, click **...** in the API key row that you want to change, and then click **Update Role**.\n4. You can update the description and role of the API key.\n5. Click **Update**.\n\n### Delete an API key\n\nOnly the **owner** of an organization can delete an API key.\n\nTo delete an API key in an organization, perform the following steps:\n\n1. In the [TiDB Cloud console](https://tidbcloud.com), switch to your target organization using the combo box in the upper-left corner.\n2. In the left navigation pane, click **Organization Settings** > **API Keys**.\n3. On the **API Keys** page, click **...** in the API key row that you want to delete, and then click **Delete**.\n4. Click **I understand, delete it.**\n\n# Rate Limiting\n\nThe TiDB Cloud API allows up to 100 requests per minute per API key. If you exceed the rate limit, the API returns a `429` error. For more quota, you can [submit a request](https://support.pingcap.com/hc/en-us/requests/new?ticket_form_id=7800003722519) to contact our support team.\n\nEach API request returns the following headers about the limit.\n\n- `X-Ratelimit-Limit-Minute`: The number of requests allowed per minute. It is 100 currently.\n- `X-Ratelimit-Remaining-Minute`: The number of remaining requests in the current minute. When it reaches `0`, the API returns a `429` error and indicates that you exceed the rate limit.\n- `X-Ratelimit-Reset`: The time in seconds at which the current rate limit resets.\n\nIf you exceed the rate limit, an error response returns like this.\n\n```\n> HTTP/2 429\n> date: Fri, 22 Jul 2022 05:28:37 GMT\n> content-type: application/json\n> content-length: 66\n> x-ratelimit-reset: 23\n> x-ratelimit-remaining-minute: 0\n> x-ratelimit-limit-minute: 100\n> x-kong-response-latency: 2\n> server: kong/2.8.1\n\n> {\"details\":[],\"code\":49900007,\"message\":\"The request exceeded the limit of 100 times per apikey per minute. For more quota, please contact us: https://support.pingcap.com/hc/en-us/requests/new?ticket_form_id=7800003722519\"}\n```\n\n# API Changelog\n\nThis changelog lists all changes to the TiDB Cloud API.\n\n\n\n## 20260414\n\n- Add a `type` field to the [List all accessible projects](#tag/Project/operation/ListProjects) endpoint.\n\n - If your application only reads the `id` and `name` fields from project responses, no changes are required.\n - If you need to distinguish between [project types](https://docs.pingcap.com/tidbcloud/tidbx-instance-move-faq/?plan=starter#what-project-types-are-available-in-tidb-cloud) (for example, to filter dedicated projects, TiDB X projects, or the TiDB X virtual project), start reading the `type` field. For more information, see [Project API Migration Guide for TiDB Cloud Starter and Essential](https://docs.pingcap.com/tidbcloud/tidbx-starter-essential-project-api-migration-guide).\n\n- Rename TiDB Cloud Starter clusters to TiDB Cloud Starter instances. This is only a terminology change in the API descriptions, which does not affect your API usage.\n\n## 20250812\n\n- Rename the cloud product option \"TiDB Cloud Serverless\" to \"TiDB Cloud Starter\".\n\n## 20240910\n\n- Rename the two cloud product options as follows:\n\n - \"TiDB Serverless\" is renamed to \"TiDB Cloud Serverless\".\n - \"TiDB Dedicated\" is renamed to \"TiDB Cloud Dedicated\".\n\n## 20240416\n\n- Update the OpenAPI specification to indicate that all optional fields can accept null values. This change improves flexibility by allowing the omission of a parameter when it is not required.\n\n## 20230905\n\n- Add six new endpoints for managing the private endpoint service and private endpoints:\n\n - [Create a private endpoint service for a cluster](#tag/Cluster/operation/CreatePrivateEndpointService)\n - [Retrieve the private endpoint service information for a cluster](#tag/Cluster/operation/GetPrivateEndpointService)\n - [Create a private endpoint for a cluster](#tag/Cluster/operation/CreatePrivateEndpoint)\n - [List all private endpoints for a cluster](#tag/Cluster/operation/ListPrivateEndpoints)\n - [List all private endpoints in a project](#tag/Cluster/operation/ListPrivateEndpointsOfProject)\n - [Delete a private endpoint for a cluster](#tag/Cluster/operation/DeletePrivateEndpoint)\n\n## 20230801\n\n- Add one cluster status: `\"PAUSING\"`.\n\n## 20230602\n\n- Rename the two tier options as follows:\n\n - \"Serverless Tier\" is renamed to \"TiDB Serverless\".\n - \"Dedicated Tier\" is renamed to \"TiDB Dedicated\".\n\n## 20230328\n\n- Add three new endpoints:\n\n - [Create a project](#tag/Project/operation/CreateProject)\n - [List AWS Customer-Managed Encryption Keys for a project](#tag/Cluster/operation/ListAwsCmek)\n - [Configure AWS Customer-Managed Encryption Keys for a project](#tag/Cluster/operation/CreateAwsCmek)\n\n## 20230321\n\n- Update three fields of the [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoint. These fields now support decreasing the size of TiDB, TiKV, or TiFlash nodes.\n\n - `config.components.tidb.node_size`\n - `config.components.tikv.node_size`\n - `config.components.tiflash.node_size`\n\n## 20230228\n\n- Add the `imports` resource, including the following endpoints:\n\n - [List all import tasks for a cluster](#tag/Import/operation/ListImportTasks)\n - [Get an import task](#tag/Import/operation/GetImportTask)\n - [Create an import task](#tag/Import/operation/CreateImportTask)\n - [Update an import task](#tag/Import/operation/UpdateImportTask)\n - [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)\n - [Preview data before starting an import task](#tag/Import/operation/PreviewImportData)\n - [Retrieve the role information for import tasks on a cluster](#tag/Import/operation/GetImportTaskRoleInfo)\n\n## 20230214\n\n- Update two fields of the [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoint. These fields now support decreasing TiKV or TiFlash nodes.\n\n - `config.components.tikv.node_quantity`\n - `config.components.tiflash.node_quantity`\n\n## 20230104\n\n- Add three fields to the [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoint. These fields support scaling up node sizes, but not scaling down.\n\n - `config.components.tidb.node_size`\n - `config.components.tikv.node_size`\n - `config.components.tiflash.node_size`\n\n## 20221028\n\n- [Developer Tier is upgraded to Serverless Tier](https://docs.pingcap.com/tidbcloud/release-notes-2022#october-28-2022). Serverless Tier is still in beta and free to use.\n\n [Creating a cluster](#tag/Cluster/operation/CreateCluster) with the `cluster_type` field set to `DEVELOPER` creates a Serverless Tier cluster now.\n\n## 20220920\n\n- The API is now in public beta and available to all users.\n\n## 20220906\n\n- Add a `config.components.tikv.storage_size_gib` field to the [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoint.\n- Modify the `config.components.tikv.node_quantity` and `config.components.tiflash.node_quantity` fields from `required` to `optional` for the [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoint.\n- Remove the \"Can not modify `storage_size_gib` of an existing cluster\" limitation of the `config.components.tiflash.storage_size_gib` field for the [Create a cluster](#tag/Cluster/operation/CreateCluster) and [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoints.\n\n## 20220823\n\n- Add a `config.paused` field to the [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster) endpoint.\n- Add two cluster statuses: `\"IMPORTING\"` and `\"UNAVAILABLE\"`.\n\n## 20220809\n\n- Initial release of the TiDB Cloud API (v1beta) in private beta, including the following resources and endpoints:\n\n - Project:\n\n - [List all accessible projects](#tag/Project/operation/ListProjects)\n\n - Cluster:\n - [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)\n - [List all clusters in a project](/#tag/Cluster/operation/ListClustersOfProject)\n - [Create a cluster](#tag/Cluster/operation/CreateCluster)\n - [Get a cluster by ID](#tag/Cluster/operation/GetCluster)\n - [Delete a cluster](#tag/Cluster/operation/DeleteCluster)\n - [Modify a Dedicated Tier cluster](#tag/Cluster/operation/UpdateCluster)\n - Backup:\n - [List all backups for a cluster](#tag/Backup/operation/ListBackUpOfCluster)\n - [Create a backup for a cluster](#tag/Backup/operation/CreateBackup)\n - [Get a backup for a cluster](#tag/Backup/operation/GetBackupOfCluster)\n - [Delete a backup for a cluster](#tag/Backup/operation/DeleteBackup)\n - Restore:\n - [List the restore tasks in a project](#tag/Restore/operation/ListRestoreTasks)\n - [Create a restore task](#tag/Restore/operation/CreateRestoreTask)\n - [Get a restore task](#tag/Restore/operation/GetRestoreTask)\n", "version": "v1-beta", "x-logo": { "url": "https://download.pingcap.com/tidbcloud-logo-for-api-docs.png", "altText": "TiDB Cloud Logo", "href": "https://docs.pingcap.com/tidbcloud/" } }, "tags": [ { "name": "Project", "description": "List projects." }, { "name": "Cluster", "description": "Create, get, modify, and delete TiDB clusters." }, { "name": "Backup", "description": "Create, get, modify, and delete backups for TiDB clusters.\n\nFor TiDB Cloud Starter instances, you cannot create or manage backups via API. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as backups." }, { "name": "Import", "description": "Create, get, update import tasks for TiDB clusters. **Warning:** The following import-related endpoints are deprecated.", "x-displayName": "Import (Deprecated)" }, { "name": "Restore", "description": "Get and create restore tasks for TiDB clusters. You can only restore data to a new cluster.\n\nFor more information on restoration on TiDB Cloud, refer to [Restore](https://docs.pingcap.com/tidbcloud/backup-and-restore#restore).\n\nFor TiDB Cloud Starter instances, you cannot manage restore tasks via API." } ], "host": "api.tidbcloud.com", "schemes": [ "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/api/v1beta/clusters/provider/regions": { "get": { "summary": "List the cloud providers, regions and available specifications.", "operationId": "ListProviderRegions", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "format": "array", "example": [ { "cluster_type": "DEDICATED", "cloud_provider": "AWS", "region": "us-west-2", "tidb": [ { "node_size": "8C16G", "node_quantity_range": { "min": 1, "step": 1 } } ], "tikv": [ { "node_size": "8C32G", "node_quantity_range": { "min": 3, "step": 3 }, "storage_size_gib_range": { "min": 500, "max": 4096 } } ], "tiflash": [ { "node_size": "8C64G", "node_quantity_range": { "min": 0, "step": 1 }, "storage_size_gib_range": { "min": 500, "max": 2048 } } ] }, { "cluster_type": "DEVELOPER", "cloud_provider": "AWS", "region": "us-west-2", "tidb": [ { "node_size": "Shared0", "node_quantity_range": { "min": 1, "step": 1 } } ], "tikv": [ { "node_size": "Shared0", "node_quantity_range": { "min": 1, "step": 1 }, "storage_size_gib_range": { "min": 1, "max": 1 } } ], "tiflash": [ { "node_size": "Shared0", "node_quantity_range": { "min": 1, "step": 1 }, "storage_size_gib_range": { "min": 1, "max": 1 } } ] } ], "items": { "type": "object", "properties": { "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type.\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "The region in which your TiDB cluster is hosted.\n\nFor the detailed information on each region, refer to the documentation of the corresponding cloud provider ([AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) | [GCP](https://cloud.google.com/about/locations#americas)).\n\nFor example, `\"us-west-2\"` refers to Oregon for AWS." }, "tidb": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiDB component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } } } }, "description": "The list of TiDB specifications in the region." }, "tikv": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "description": "The list of TiKV specifications in the region." }, "tiflash": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "description": "The list of TiFlash specifications in the region." } }, "description": "ListProviderRegionsItem is the item of provider regions.", "title": "ListProviderRegionsItem" }, "description": "Items of provider regions." } }, "description": "GetProviderRegionsResp is the response for getting provider regions.", "title": "GetProviderRegionsResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/clusters/provider/regions" } ] } }, "/api/v1beta/projects": { "get": { "summary": "List all accessible projects.", "operationId": "ListProjects", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "org_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the TiDB Cloud organization to which the project belongs." }, "name": { "type": "string", "example": "default_project", "description": "The name of the project." }, "cluster_count": { "type": "integer", "format": "int64", "example": 4, "description": "The number of TiDB Cloud clusters deployed in the project." }, "user_count": { "type": "integer", "format": "int64", "example": 10, "description": "The number of users in the project." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "aws_cmek_enabled": { "type": "boolean", "example": false, "default": false, "description": "Flag that indicates whether to enable AWS Customer-Managed Encryption Keys (CMEK). For more information, see [Encryption at Rest using CMEK](https://docs.pingcap.com/tidbcloud/tidb-cloud-encrypt-cmek).\n\n**Note:** Currently, this feature is only available upon request. If you need to try out this feature, contact [support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support)." }, "type": { "type": "string", "example": "dedicated", "description": "The type of the project. For more information, see [Project Migration FAQ for TiDB X Instances](https://docs.pingcap.com/tidbcloud/tidbx-instance-move-faq/?plan=starter#what-project-types-are-available-in-tidb-cloud). Possible values are:\n- `dedicated`: a project for TiDB Cloud Dedicated clusters.\n- `tidbx`: a project for TiDB X instances.\n- `tidbx_virtual`: a virtual project for TiDB X instances not grouped in any TiDB X project." } }, "description": "ListProjectItem is the item of projects.", "title": "ListProjectItem" }, "description": "The items of accessible projects." }, "total": { "type": "integer", "format": "int64", "example": 1, "description": "The total number of accessible projects." } }, "description": "GetProjectsResp is the response for getting accessible projects.", "title": "GetProjectsResp", "required": [ "total", "items" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "page", "description": "The number of pages.", "in": "query", "required": false, "type": "integer", "format": "int64", "default": 1 }, { "name": "page_size", "description": "The size of a page.", "in": "query", "required": false, "type": "integer", "format": "int64", "default": 10 } ], "tags": [ "Project" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://api.tidbcloud.com/api/v1beta/projects?page=1&page_size=10'" } ] }, "post": { "summary": "Create a project.", "operationId": "CreateProject", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." } }, "description": "CreateProjectResp is the response for creating project.", "title": "CreateProjectResp", "required": [ "id" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "body", "description": "CreateProjectReq is the request for creating project.", "in": "body", "required": true, "schema": { "type": "object", "properties": { "name": { "type": "string", "example": "Project0", "description": "The name of the project." }, "aws_cmek_enabled": { "type": "boolean", "x-nullable": true, "example": false, "default": false, "description": "Flag that indicates whether to enable AWS Customer-Managed Encryption Keys.\n\nCurrently this feature is only available upon request. If you need to try out this feature, contact [support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support)." } }, "description": "CreateProjectReq is the request for creating project.", "title": "CreateProjectReq", "required": [ "name" ] } } ], "tags": [ "Project" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"Project0\",\"aws_cmek_enabled\":false}'" } ] } }, "/api/v1beta/projects/{project_id}/aws-cmek": { "get": { "summary": "List AWS Customer-Managed Encryption Keys for a project.", "description": "Customer-Managed Encryption Keys (CMEK) lets you protect your static data in a TiDB Cloud Dedicated cluster using a cryptographic key that is completely controlled by you. To create a project with CMEK enabled, use the [Create a project](#tag/Project/operation/CreateProject) endpoint and configure `aws_cmek_enabled` to `true`.\n\nFor more information, see [Encryption at Rest using CMEK](https://docs.pingcap.com/tidbcloud/tidb-cloud-encrypt-cmek).", "operationId": "ListAwsCmek", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "format": "array", "items": { "type": "object", "properties": { "region": { "type": "string", "example": "us-west-2", "description": "The region name of the AWS CMEK. The region value should match the cloud provider's region code.\n\nYou can get the complete list of available regions from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\nFor the detailed information on each region, refer to the documentation of the [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) cloud provider." }, "kms_arn": { "type": "string", "example": "arn:aws:kms:example", "description": "The KMS ARN of the AWS CMEK." } }, "description": "AwsCmekSpec is the specification of the AWS CMEK.", "title": "AwsCmekSpec", "required": [ "region", "kms_arn" ] }, "description": "The specifications of the AWS CMEK." } }, "description": "ListAwsCmekResp is the response for getting AWS Customer-Managed Encryption Keys for a project.", "title": "ListAwsCmekResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/aws-cmek" } ] }, "post": { "summary": "Configure AWS Customer-Managed Encryption Keys for a project.", "description": "Before using this API, make sure that the `aws_cmek_enabled` field is set to `true` when creating the project using the [Create a Project](#tag/Project/operation/CreateProject) endpoint. For more information, see [Encryption at Rest using CMEK](https://docs.pingcap.com/tidbcloud/tidb-cloud-encrypt-cmek).\n\nCurrently, this feature is only available upon request. If you need to try out this feature, contact [support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support).", "operationId": "CreateAwsCmek", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "specs": { "type": "array", "items": { "type": "object", "properties": { "region": { "type": "string", "example": "us-west-2", "description": "The region name of the AWS CMEK. The region value should match the cloud provider's region code.\n\nYou can get the complete list of available regions from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\nFor the detailed information on each region, refer to the documentation of the [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) cloud provider." }, "kms_arn": { "type": "string", "example": "arn:aws:kms:example", "description": "The KMS ARN of the AWS CMEK." } }, "description": "AwsCmekSpec is the specification of the AWS CMEK.", "title": "AwsCmekSpec", "required": [ "region", "kms_arn" ] }, "description": "The specification of the AWS CMEK. You can configure multiple AWS CMEKs.\n\nFor a particular project, CMEK can only be configured for one AWS region. Once configured, you cannot create clusters in other regions in the same project." } }, "description": "CreateAwsCmekReq is the request for configuring AWS Customer-Managed Encryption Keys for a project.", "title": "CreateAwsCmekReq", "required": [ "specs" ] } } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/aws-cmek \\\n --header 'content-type: application/json' \\\n --data '{\"specs\":[{\"region\":\"us-west-2\",\"kms_arn\":\"arn:aws:kms:example\"}]}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters": { "get": { "summary": "List all clusters in a project.", "operationId": "ListClustersOfProject", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the cluster." }, "project_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "name": { "type": "string", "example": "Cluster0", "description": "The name of the cluster.", "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" }, "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type:\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "Region of the cluster." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "config": { "example": { "port": 4000, "components": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } } }, "description": "The configuration of the cluster.", "type": "object", "properties": { "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] } } }, "status": { "description": "The status of the cluster.", "type": "object", "properties": { "tidb_version": { "type": "string", "example": "v6.1.0", "description": "TiDB version." }, "cluster_status": { "format": "enum", "example": "AVAILABLE", "description": "Status of the cluster.", "type": "string", "enum": [ "AVAILABLE", "CREATING", "MODIFYING", "PAUSED", "RESUMING", "UNAVAILABLE", "IMPORTING", "MAINTAINING", "PAUSING" ] }, "node_map": { "description": "Node map. The `node_map` is returned only when the `cluster_status` is `\"AVAILABLE\"` or `\"MODIFYING\"`.", "type": "object", "properties": { "tidb": { "type": "array", "example": [ { "node_name": "tidb-0", "availability_zone": "us-west-2a", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tidb-1", "availability_zone": "us-west-2b", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiDB node map." }, "tikv": { "type": "array", "example": [ { "node_name": "tikv-0", "availability_zone": "us-west-2a", "node_size": "8C32G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-2", "availability_zone": "us-west-2c", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiKV node map." }, "tiflash": { "type": "array", "example": [ { "node_name": "tiflash-0", "availability_zone": "us-west-2a", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tiflash-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiFlash node map." } }, "required": [ "tidb", "tikv" ] }, "connection_strings": { "description": "Connection strings.", "type": "object", "properties": { "default_user": { "type": "string", "example": "root", "description": "The default TiDB user for connection." }, "standard": { "description": "Standard connection string.\n\nYou must configure the [IP Access List](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection) for the cluster you created on [TiDB Cloud console](https://tidbcloud.com/) before connecting to this connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "vpc_peering": { "description": "[VPC peering](https://docs.pingcap.com/tidbcloud/tidb-cloud-glossary#vpc-peering) connection string.\n\nYou must [Set up VPC peering connections](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections) for the project before connecting to this private connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } } } } }, "title": "ClusterItemStatus" } }, "description": "ClusterItem is the information of cluster.", "title": "ClusterItem", "required": [ "id", "project_id" ] }, "description": "The items of clusters in the project." }, "total": { "type": "integer", "format": "int64", "example": 1, "description": "The total number of clusters in the project." } }, "description": "GetClustersOfProjectResp is the response for getting clusters of project.", "title": "GetClustersOfProjectResp", "required": [ "total", "items" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "page", "description": "The number of pages.", "in": "query", "required": false, "type": "integer", "format": "int64", "default": 1 }, { "name": "page_size", "description": "The size of a page.", "in": "query", "required": false, "type": "integer", "format": "int64", "default": 10 } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters?page=1&page_size=10'" } ] }, "post": { "summary": "Create a cluster.", "description": "Before creating a TiDB Cloud Dedicated cluster, you must [set a Project CIDR](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections#prerequisite-set-a-project-cidr) on [TiDB Cloud console](https://tidbcloud.com/).", "operationId": "CreateCluster", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the cluster." } }, "description": "CreateClusterResp is the response for creating cluster.", "title": "CreateClusterResp", "required": [ "id" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "name": { "type": "string", "example": "Cluster0", "description": "The name of the cluster. The name must be 4-64 characters that can only include numbers, letters, and hyphens, and the first and last character must be a letter or number.", "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" }, "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type.\n- `\"DEVELOPER\"`: create a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: create a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster. Before creating a TiDB Cloud Dedicated cluster, you must [set a Project CIDR](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections#prerequisite-set-a-project-cidr) on [TiDB Cloud console](https://tidbcloud.com/).", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "The region value should match the cloud provider's region code.\nYou can get the complete list of available regions from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\nFor the detailed information on each region, refer to the documentation of the corresponding cloud provider ([AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) | [GCP](https://cloud.google.com/about/locations#americas)).\n\nFor example, if you want to deploy the cluster in the Oregon region for AWS, set the value to `\"us-west-2\"`." }, "config": { "description": "The configuration of the cluster.", "type": "object", "properties": { "root_password": { "type": "string", "example": "password_example", "description": "The root password to access the cluster. It must be 8-64 characters.", "maxLength": 64, "minLength": 8 }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.\n\n**Limitations**:\n- For a TiDB Cloud Dedicated cluster, the `components` parameter is **required**.\n- For a TiDB Cloud Starter instance, the `components` value is **ignored**. Setting this configuration does not have any effects.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] }, "ip_access_list": { "type": "array", "items": { "type": "object", "properties": { "cidr": { "type": "string", "example": "8.8.8.8/32", "description": "The IP address or CIDR range that you want to add to the cluster's IP access list." }, "description": { "type": "string", "example": "My Current IP Address", "description": "Description that explains the purpose of the entry." } }, "required": [ "cidr" ] }, "description": "A list of IP addresses and Classless Inter-Domain Routing (CIDR) addresses that are allowed to access the TiDB Cloud cluster via [standard connection](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection)." } }, "required": [ "root_password" ] } }, "description": "CreateClusterReq is the request for creating cluster.", "title": "CreateClusterReq", "required": [ "name", "cluster_type", "cloud_provider", "region", "config" ] } } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl for TiDB Cloud Dedicated", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"Cluster0\",\"cluster_type\":\"DEDICATED\",\"cloud_provider\":\"AWS\",\"region\":\"us-west-2\",\"config\":{\"root_password\":\"password_example\",\"port\":4000,\"components\":{\"tidb\":{\"node_size\":\"8C16G\",\"node_quantity\":2},\"tikv\":{\"node_size\":\"8C32G\",\"storage_size_gib\":1024,\"node_quantity\":3}},\"ip_access_list\":[{\"cidr\":\"8.8.8.8/32\",\"description\":\"My Current IP Address\"}]}}'" }, { "lang": "curl for TiDB Cloud Starter", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"Cluster0\",\"cluster_type\":\"DEVELOPER\",\"cloud_provider\":\"AWS\",\"region\":\"us-west-2\",\"config\":{\"root_password\":\"password_example\",\"ip_access_list\":[{\"cidr\":\"8.8.8.8/32\",\"description\":\"My IP Address\"}]}}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}": { "get": { "summary": "Get a cluster by ID.", "operationId": "GetCluster", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the cluster." }, "project_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "name": { "type": "string", "example": "Cluster0", "description": "The name of the cluster.", "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" }, "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type:\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "Region of the cluster." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "config": { "example": { "port": 4000, "components": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } } }, "description": "The configuration of the cluster.", "type": "object", "properties": { "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] } } }, "status": { "description": "The status of the cluster.", "type": "object", "properties": { "tidb_version": { "type": "string", "example": "v6.1.0", "description": "TiDB version." }, "cluster_status": { "format": "enum", "example": "AVAILABLE", "description": "Status of the cluster.", "type": "string", "enum": [ "AVAILABLE", "CREATING", "MODIFYING", "PAUSED", "RESUMING", "UNAVAILABLE", "IMPORTING", "MAINTAINING", "PAUSING" ] }, "node_map": { "description": "Node map. The `node_map` is returned only when the `cluster_status` is `\"AVAILABLE\"` or `\"MODIFYING\"`.", "type": "object", "properties": { "tidb": { "type": "array", "example": [ { "node_name": "tidb-0", "availability_zone": "us-west-2a", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tidb-1", "availability_zone": "us-west-2b", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiDB node map." }, "tikv": { "type": "array", "example": [ { "node_name": "tikv-0", "availability_zone": "us-west-2a", "node_size": "8C32G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-2", "availability_zone": "us-west-2c", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiKV node map." }, "tiflash": { "type": "array", "example": [ { "node_name": "tiflash-0", "availability_zone": "us-west-2a", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tiflash-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiFlash node map." } }, "required": [ "tidb", "tikv" ] }, "connection_strings": { "description": "Connection strings.", "type": "object", "properties": { "default_user": { "type": "string", "example": "root", "description": "The default TiDB user for connection." }, "standard": { "description": "Standard connection string.\n\nYou must configure the [IP Access List](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection) for the cluster you created on [TiDB Cloud console](https://tidbcloud.com/) before connecting to this connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "vpc_peering": { "description": "[VPC peering](https://docs.pingcap.com/tidbcloud/tidb-cloud-glossary#vpc-peering) connection string.\n\nYou must [Set up VPC peering connections](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections) for the project before connecting to this private connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } } } } }, "title": "ClusterItemStatus" } }, "description": "ClusterItem is the information of cluster.", "title": "ClusterItem", "required": [ "id", "project_id" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}" } ] }, "delete": { "summary": "Delete a cluster.", "operationId": "DeleteCluster", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}" } ] }, "patch": { "summary": "Modify a TiDB Cloud Dedicated cluster.", "description": "With this endpoint, you can modify the components of a cluster using the `config.components` parameter, or pause or resume a cluster using the `config.paused` parameter.", "operationId": "UpdateCluster", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "config": { "example": { "components": { "tidb": { "node_size": "16C32G", "node_quantity": 3 }, "tikv": { "node_size": "16C64G", "storage_size_gib": 2048, "node_quantity": 6 }, "tiflash": { "node_size": "16C128G", "storage_size_gib": 2048, "node_quantity": 2 } } }, "description": "The configuration of the cluster. You can modify the components of the cluster using `components`, or pause or resume the cluster using `paused`.\n\n You cannot change the cluster components and cluster status at the same time. That is, `components` and `paused` cannot be set at the same time.", "type": "object", "properties": { "components": { "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C32G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiKV.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiKV, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 6, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } } }, "tiflash": { "description": "The TiFlash component of the cluster.\n\nIf you want to add TiFlash nodes to a cluster that does not have one before (increase the node_quantity of `\"TIFLASH\"` from 0), you must specify the `node_size`, `storage_size_gib` and `node_quantity` of TiFlash nodes.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C128G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiFlash.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiFlash, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } } } }, "paused": { "type": "boolean", "x-nullable": true, "description": "Flag that indicates whether the cluster is paused. `true` means to pause the cluster, and `false` means to resume the cluster. For more details, refer to [Pause or Resume a TiDB Cluster](https://docs.pingcap.com/tidbcloud/pause-or-resume-tidb-cluster).\n\n**Limitations:**\n - The cluster can be paused only when the `cluster_status` is `\"AVAILABLE\"`.\n- The cluster can be resumed only when the `cluster_status` is `\"PAUSED\"`." } }, "title": "UpdateClusterComponents" } }, "description": "UpdateClusterReq is the request for updating cluster.", "title": "UpdateClusterReq", "required": [ "config" ] } } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id} \\\n --header 'content-type: application/json' \\\n --data '{\"config\":{\"components\":{\"tidb\":{\"node_size\":\"16C32G\",\"node_quantity\":3},\"tikv\":{\"node_size\":\"16C64G\",\"storage_size_gib\":2048,\"node_quantity\":6},\"tiflash\":{\"node_size\":\"16C128G\",\"storage_size_gib\":2048,\"node_quantity\":2}}}}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups": { "get": { "summary": "List all backups for a cluster.", "description": "For TiDB Cloud Starter instances, you cannot manage backups via API. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as backups.", "operationId": "ListBackUpOfCluster", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup. It is generated by TiDB Cloud." }, "name": { "type": "string", "example": "backup-1", "description": "The name of the backup." }, "description": { "type": "string", "example": "backup for cluster upgrade in 2022/06/07", "description": "The description of the backup. It is specified by the user when taking a manual type backup. It helps you add additional information to the backup." }, "type": { "example": "MANUAL", "description": "The type of backup. TiDB Cloud only supports manual and auto backup. For more information, see [TiDB Cloud Documentation](https://docs.pingcap.com/tidbcloud/backup-and-restore#backup).", "type": "string", "enum": [ "MANUAL", "AUTO" ] }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC. The time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "size": { "type": "string", "format": "uint64", "example": "102400", "description": "The bytes of the backup." }, "status": { "example": "SUCCESS", "description": "The status of backup.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] } }, "description": "The item of backup list.", "title": "ListBackupItem" }, "description": "The items of all backups." }, "total": { "type": "integer", "format": "int64", "example": 10, "description": "The total number of backups in the project." } }, "description": "The response for listing backups of a cluster.", "title": "ListBackupOfClusterResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [Get all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "page", "description": "The number of pages.", "in": "query", "required": false, "type": "integer", "format": "int32", "default": 1 }, { "name": "page_size", "description": "The size of a page.", "in": "query", "required": false, "type": "integer", "format": "int32", "default": 10 } ], "tags": [ "Backup" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups?page=1&page_size=10'" } ] }, "post": { "summary": "Create a backup for a cluster.", "description": "- For TiDB Cloud Dedicated clusters, you can create as many manual backups as you need.\n- For TiDB Cloud Starter instances, you cannot create backups via API. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as backups.", "operationId": "CreateBackup", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." } }, "description": "This response for creating a MANUAL type backup.", "title": "CreateBackupResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster that you want to take a manual backup. You can get the cluster ID from the response of [Get all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "name": { "type": "string", "example": "backup-1", "description": "Specify the name for a manual backup. It is recommended that you use a unique name, so that it is easy to distinguish the backup when you query the backups." }, "description": { "type": "string", "x-nullable": true, "example": "backup-1", "description": "The description of the backup. It helps you add additional information to the backup. Allows up to 256 characters." } }, "description": "This request for creating a MANUAL type backup.", "title": "CreateBackupReq", "required": [ "name" ] } } ], "tags": [ "Backup" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"backup-1\",\"description\":\"backup-1\"}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups/{backup_id}": { "get": { "summary": "Get a backup for a cluster.", "description": "For TiDB Cloud Starter instances, you cannot manage backups via API. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as backups.", "operationId": "GetBackupOfCluster", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "name": { "type": "string", "example": "backup-1", "description": "The name of the backup." }, "description": { "type": "string", "example": "backup for cluster upgrade in 2022/06/07", "description": "The description of the backup. It is specified by the user when taking a manual type backup. It helps you add additional information to the backup." }, "type": { "example": "MANUAL", "description": "The type of backup. TiDB Cloud only supports manual and auto backup. For more information, see [TiDB Cloud Documentation](https://docs.pingcap.com/tidbcloud/backup-and-restore#backup).", "type": "string", "enum": [ "MANUAL", "AUTO" ] }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC. The time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "size": { "type": "string", "format": "uint64", "example": "102400", "description": "The bytes of the backup." }, "status": { "example": "SUCCESS", "description": "The status of backup.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] } }, "description": "This response for getting backup of a cluster.", "title": "GetBackupOfClusterResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [Get all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "backup_id", "description": "The ID of the backup.", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Backup" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups/{backup_id}" } ] }, "delete": { "summary": "Delete a backup for a cluster.", "description": "For TiDB Cloud Starter instances, you cannot manage backups via API. You can use [Dumpling](https://docs.pingcap.com/tidb/stable/dumpling-overview) to export your data as backups.", "operationId": "DeleteBackup", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [Get all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "backup_id", "description": "The ID of the backup. You can get the backup ID from the response of [List all backups for a cluster](#tag/Project/operation/ListBackUpOfCluster).", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Backup" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups/{backup_id}" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports": { "get": { "summary": "List all import tasks for a cluster.", "operationId": "ListImportTasks", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "metadata": { "description": "The metadata of the import task.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the import task." }, "name": { "type": "string", "example": "my_import", "description": "The name of the import task." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The creation time of the import task in Unix timestamp seconds (epoch time)." } }, "title": "ImportMetadata", "required": [ "id", "create_timestamp" ] }, "spec": { "description": "The specification of the import task.", "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "title": "ImportSpec", "required": [ "source", "target" ] }, "status": { "description": "The status of the import task.", "type": "object", "properties": { "phase": { "example": "IMPORTING", "description": "The current phase that the import task is in.", "type": "string", "enum": [ "PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED" ] }, "error_message": { "type": "string", "example": "some error occurs", "description": "The error message of the import task." }, "start_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The start timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)" }, "end_timestamp": { "type": "string", "format": "timestamp", "example": "1676450897", "description": "The end timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)." }, "progress": { "description": "The progress of the import task.", "type": "object", "properties": { "import_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall importing progress of the import task.", "maximum": 100 }, "validation_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall validation progress of the import task after the data has been imported into the target cluster.", "maximum": 100 } }, "title": "ImportProgress", "required": [ "import_progress", "validation_progress" ] }, "source_total_size_bytes": { "type": "string", "format": "uint64", "example": "10737418240", "description": "The total size of the import task's data source. The unit is bytes." } }, "title": "ImportStatus", "required": [ "phase" ] } }, "description": "ImportItem represents the information of a single import task.", "title": "ImportItem" }, "description": "The import tasks in the cluster in the request page area." }, "total": { "type": "integer", "format": "int64", "example": 20, "description": "The total number of import tasks in the cluster." } }, "description": "ListImportTasksResp is the response for listing the import tasks of a cluster.", "title": "ListImportTasksResp", "required": [ "items", "total" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "page", "description": "The number of pages.", "in": "query", "required": false, "type": "integer", "format": "int64", "default": 1 }, { "name": "page_size", "description": "The size of a page.", "in": "query", "required": false, "type": "integer", "format": "int64", "default": 10 } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports?page=1&page_size=10'" } ] }, "post": { "summary": "Create an import task.", "operationId": "CreateImportTask", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "12345", "description": "The ID of the import task." } }, "description": "CreateImportTaskResp is the response to the creation of an import task.", "title": "CreateImportTaskResp", "required": [ "id" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster that you want to start an import job. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "name": { "type": "string", "example": "import_2023-01-01T00:00:30Z", "description": "The name of an import task. The maximum length of the name is 64 characters.\n\nIt is recommended that you use a unique name, so that you can easily identify the import task when you list all import tasks. If the name is not provided, a default name is generated with an `import_` prefix followed by a time string representing the creation time of the import task. For example, `import_2023-01-01T00:00:30Z`.", "maxLength": 64 }, "spec": { "description": "The specifications of the import task.", "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "title": "ImportSpec", "required": [ "source", "target" ] }, "options": { "description": "The additional options for creating an import task.", "type": "object", "properties": { "pre_create_tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The database name of the table." }, "table_name": { "type": "string", "example": "table01", "description": "The table name of the table." }, "schema": { "description": "The schema for the table.", "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "title": "TableSchema", "required": [ "column_definitions" ] } }, "description": "TableDefinition is the definition of a table so that the table can be created with this information.", "title": "TableDefinition", "required": [ "database_name", "table_name", "schema" ] }, "description": "The table definition of pre-created tables.\n\n**Note**: The name of the pre-created tables should match one of the target tables. Otherwise, the table will be ignored and won't be created" } }, "title": "CreateImportTaskOptions" } }, "description": "CreateImportTaskReq is the request to create an import task for a cluster.", "title": "CreateImportTaskReq", "required": [ "spec" ] } } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports \\\n --header 'content-type: application/json' \\\n --data '{\"name\":\"import_2023-01-01T00:00:30Z\",\"spec\":{\"source\":{\"type\":\"S3\",\"uri\":\"s3://example-bucket/example-source-data/\",\"aws_assume_role_access\":{\"assume_role\":\"arn:aws:iam::999999999999:role/sample-role\"},\"aws_key_access\":{\"access_key_id\":\"YOUR_ACCESS_KEY_ID\",\"secret_access_key\":\"YOUR_SECRET_ACCESS_KEY\"},\"format\":{\"type\":\"CSV\",\"csv_config\":{\"delimiter\":\",\",\"quote\":\"\\\"\",\"backslash_escape\":true,\"has_header_row\":true}}},\"target\":{\"tables\":[{\"database_name\":\"db01\",\"table_name\":\"table01\",\"file_name_pattern\":\"data/db01/table01.*.csv\"}]}},\"options\":{\"pre_create_tables\":[{\"database_name\":\"db01\",\"table_name\":\"table01\",\"schema\":{\"column_definitions\":[{\"column_name\":\"id\",\"column_type\":\"INTEGER\"},{\"column_name\":\"column01\",\"column_type\":\"VARCHAR(255)\"}],\"primary_key_columns\":[\"id\"]}}]}}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/preview": { "post": { "summary": "Preview data before starting an import task.", "description": "Before you create an import task, you can preview the data using this endpoint and make sure that the import task is configured as intended. The preview result is organized by tables.", "operationId": "PreviewImportData", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "table_previews": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The database name of the preview table." }, "table_name": { "type": "string", "example": "table01", "description": "The table name of the preview table." }, "schema_preview": { "description": "The schema for the preview table.", "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "title": "TableSchema", "required": [ "column_definitions" ] }, "data_preview": { "description": "The data sample for the preview table.", "type": "object", "properties": { "column_names": { "type": "array", "example": [ "id", "column01" ], "items": { "type": "string" }, "description": "The column names for the following data samples from a table." }, "rows": { "type": "array", "items": { "type": "object", "properties": { "columns": { "type": "array", "example": [ "1", "abc" ], "items": { "type": "string" }, "description": "The columns extracted from a table row." } }, "description": "TableDataRow is a single row in a table.", "title": "TableDataRow", "required": [ "columns" ] }, "description": "The rows sampled from a table." } }, "title": "TableData", "required": [ "rows" ] } }, "description": "TablePreview is the preview result for a single table.", "title": "TablePreview", "required": [ "database_name", "table_name", "data_preview" ] }, "description": "The preview results for each target table from the import task specification." } }, "description": "PreviewImportDataResp is the response of the source data preview before starting an import task.", "title": "PreviewImportDataResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster that you want to start an import task. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "spec": { "description": "The specifications of the import task.\n\n**Note:** Currently, you can only preview locally uploaded files. This means that only data sources with the `LOCAL_FILE` source type are supported. If you specify a data source other than `LOCAL_FILE`, errors will occur.", "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "title": "ImportSpec", "required": [ "source", "target" ] }, "limit_rows_count": { "type": "integer", "format": "int64", "x-nullable": true, "example": 10, "default": 10, "description": "The maximum number of rows to preview for each table.", "maximum": 20, "minimum": 1 } }, "description": "PreviewImportDataReq is the request to preview the source data before starting an import task for a cluster.", "title": "PreviewImportDataReq", "required": [ "spec" ] } } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/preview \\\n --header 'content-type: application/json' \\\n --data '{\"spec\":{\"source\":{\"type\":\"S3\",\"uri\":\"s3://example-bucket/example-source-data/\",\"aws_assume_role_access\":{\"assume_role\":\"arn:aws:iam::999999999999:role/sample-role\"},\"aws_key_access\":{\"access_key_id\":\"YOUR_ACCESS_KEY_ID\",\"secret_access_key\":\"YOUR_SECRET_ACCESS_KEY\"},\"format\":{\"type\":\"CSV\",\"csv_config\":{\"delimiter\":\",\",\"quote\":\"\\\"\",\"backslash_escape\":true,\"has_header_row\":true}}},\"target\":{\"tables\":[{\"database_name\":\"db01\",\"table_name\":\"table01\",\"file_name_pattern\":\"data/db01/table01.*.csv\"}]}},\"limit_rows_count\":10}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/role_info": { "get": { "summary": "Retrieve the role information for import tasks on a cluster.", "description": "Retrieve the role information for import tasks on a cluster, so that you can configure the access for the import tasks to retrieve the data from the data source. For more information on how to configure the access for the import tasks, refer to [Configure Amazon S3 Access and GCS Access](https://docs.pingcap.com/tidbcloud/config-s3-and-gcs-access).", "operationId": "GetImportTaskRoleInfo", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "aws_import_role": { "description": "The import role information for an AWS cluster. Only TiDB clusters on AWS return this information. If the TiDB cluster is deployed on GCP, this field is not returned.", "type": "object", "properties": { "account_id": { "type": "string", "example": "999999999999", "description": "The account ID under which the import tasks for this cluster are running." }, "external_id": { "type": "string", "example": "abcdefghijklmnopqrstuvwxyz0123456789xxxxxxxxxxxxxx", "description": "The unique external ID that binds to the cluster, which is a long string. When an import task starts and attempts to assume a specified role, it automatically attaches this external ID. This means that you can configure this external ID in the assumed role's trust relationship, so that only the import task of that specified cluster can access the data by assuming the role. This can provide additional security." } }, "title": "AwsImportTaskRoleInfo", "required": [ "account_id", "external_id" ] }, "gcp_import_role": { "description": "The import role information for a GCP cluster. Only TiDB clusters on GCP return this information. If the TiDB cluster is deployed on AWS, this field is not returned.", "type": "object", "properties": { "account_id": { "type": "string", "example": "example-account@example.com", "description": "The account ID under which the import tasks for this cluster are running." } }, "title": "GcpImportTaskRoleInfo", "required": [ "account_id" ] } }, "description": "ImportTaskRoleInfo is the role information for import tasks on a cluster. You can use this information to configure the access for the import tasks to retrieve the data from the data source.", "title": "ImportTaskRoleInfo" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/role_info" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/upload_file": { "post": { "summary": "Upload a local file for an import task.", "description": "If you need to import data from a local file, you must first upload the file using this endpoint before you create an import task using the [Create an import task](#tag/Import/operation/CreateImportTask) endpoint.\n\nUploading a local file is only available for TiDB Cloud Starter instances.", "operationId": "UploadLocalFile", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "upload_stub_id": { "type": "string", "format": "uint64", "example": "123", "description": "The stub ID for the uploaded file. You can use this stub ID to [create an import task](#tag/Import/operation/CreateImportTask)." } }, "description": "UploadLocalFileResp is the response to upload an import task.", "title": "UploadLocalFileResp", "required": [ "upload_stub_id" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "local_file_name": { "type": "string", "example": "test.csv", "description": "The local file name to be uploaded. Only CSV files are supported. The maximum length of the file name is 255 characters.\n\n**Note:**\n* Provide only the basename of the file. For example, instead of specifying `/foo/bar/example_file.csv`, specify only `example_file.csv`. If you do specify a full file path, this endpoint will only use the basename as the file name.\n* The directory name is not supported. For example: `/foobar/` is invalid.", "maxLength": 255 }, "payload": { "description": "The payload to upload the local file content for an import task.", "type": "object", "properties": { "total_size_bytes": { "type": "string", "format": "uint64", "example": "83", "description": "The total size of the **ACTUAL** local file contents, not the total size of the `content` field.\n\nThe unit is byte, and the maximum value is `52428800` (50 MiB). If the given value of `total_size_bytes` exceeds the maximum value, an error will be reported.", "maximum": 52428800 }, "content": { "type": "string", "format": "byte", "example": "H4sIABbP9mMAAyXHOwoAIQwFwN5jvPoh5neggI2w9Z7fSJqBOZt/fvLQIURmLgFlrqE9BbVmPQOt5j0HvRa9AKN2AUwss6dTAAAA", "description": "The base64-encoded content of the local file to be imported. The maximum size of the file should be 52428800 (50 MiB).\n\n**Note:** Before providing the content, process the file by taking the following steps:\n1. Compress the file using the **gzip** algorithm.\n2. Encode the compressed data using the **base64** algorithm.", "maxLength": 52428800 } }, "title": "LocalFilePayload", "required": [ "total_size_bytes", "content" ] } }, "description": "UploadLocalFileReq is the request to upload an import task.", "title": "UploadLocalFileReq", "required": [ "local_file_name", "payload" ] } } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/upload_file \\\n --header 'content-type: application/json' \\\n --data '{\"local_file_name\":\"test.csv\",\"payload\":{\"total_size_bytes\":\"83\",\"content\":\"H4sIABbP9mMAAyXHOwoAIQwFwN5jvPoh5neggI2w9Z7fSJqBOZt/fvLQIURmLgFlrqE9BbVmPQOt5j0HvRa9AKN2AUwss6dTAAAA\"}}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/{import_id}": { "get": { "summary": "Get an import task.", "operationId": "GetImportTask", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "metadata": { "description": "The metadata of the import task.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the import task." }, "name": { "type": "string", "example": "my_import", "description": "The name of the import task." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The creation time of the import task in Unix timestamp seconds (epoch time)." } }, "title": "ImportMetadata", "required": [ "id", "create_timestamp" ] }, "spec": { "description": "The specification of the import task.", "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "title": "ImportSpec", "required": [ "source", "target" ] }, "status": { "description": "The status of the import task.", "type": "object", "properties": { "phase": { "example": "IMPORTING", "description": "The current phase that the import task is in.", "type": "string", "enum": [ "PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED" ] }, "error_message": { "type": "string", "example": "some error occurs", "description": "The error message of the import task." }, "start_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The start timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)" }, "end_timestamp": { "type": "string", "format": "timestamp", "example": "1676450897", "description": "The end timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)." }, "progress": { "description": "The progress of the import task.", "type": "object", "properties": { "import_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall importing progress of the import task.", "maximum": 100 }, "validation_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall validation progress of the import task after the data has been imported into the target cluster.", "maximum": 100 } }, "title": "ImportProgress", "required": [ "import_progress", "validation_progress" ] }, "source_total_size_bytes": { "type": "string", "format": "uint64", "example": "10737418240", "description": "The total size of the import task's data source. The unit is bytes." } }, "title": "ImportStatus", "required": [ "phase" ] } }, "description": "ImportItem represents the information of a single import task.", "title": "ImportItem" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "import_id", "description": "The ID of your import task. You can get the import ID from the response of [List import tasks for a cluster](#tag/Project/operation/ListImportTasks).", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/{import_id}" } ] }, "patch": { "summary": "Update an import task.", "description": "Update an import task from a cluster. Currently, this endpoint only supports canceling the import task if the current phase of the import task is `PREPARING` or `IMPORTING`.", "operationId": "UpdateImportTask", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of your cluster. You can get the cluster ID from the response of [List all clusters in a project](#tag/Cluster/operation/ListClustersOfProject).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "import_id", "description": "The ID of the import task. You can get the import ID from the response of [List import tasks for a cluster](#tag/Project/operation/ListImportTasks).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "action": { "example": "CANCEL", "description": "The action to apply to the import task.\n\n**Limitation:**\nCurrently, only `CANCEL` is supported when the import task is in the `PREPARING` or `IMPORTING` phase, meaning that the import task will be cancelled.", "type": "string", "enum": [ "CANCEL" ] } }, "description": "UpdateImportTaskReq is the request to update an import task.", "title": "UpdateImportTaskReq", "required": [ "action" ] } } ], "tags": [ "Import" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/imports/{import_id} \\\n --header 'content-type: application/json' \\\n --data '{\"action\":\"CANCEL\"}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoint_service": { "get": { "summary": "Retrieve the private endpoint service information for a cluster.", "description": "- For TiDB Cloud Dedicated clusters, you can retrieve the private endpoint service information for a cluster.\n- For TiDB Cloud Starter instances, you cannot create or manage private endpoint service via API.", "operationId": "GetPrivateEndpointService", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "private_endpoint_service": { "description": "The private endpoint service resource of the cluster.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "The name of the private endpoint service, which is used for connection." }, "status": { "format": "enum", "example": "ACTIVE", "description": "The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "dns_name": { "type": "string", "format": "string", "example": "privatelink-tidb.01234567890.clusters.tidb-cloud.com", "description": "The DNS name of the private endpoint service." }, "port": { "type": "integer", "format": "int32", "example": 4000, "description": "The port of the private endpoint service." }, "az_ids": { "type": "array", "format": "array", "example": [ "usw2-az2", "usw2-az1" ], "items": { "type": "string" }, "description": "Availability zones for the private endpoint service. This field is only applicable when the `cloud_provider` is `\"AWS\"`." } } } }, "description": "GetPrivateEndpointServiceResp is the response for getting private endpoint service for a cluster.", "title": "GetPrivateEndpointServiceResp", "required": [ "private_endpoint_service" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoint_service" } ] }, "post": { "summary": "Create a private endpoint service for a cluster.", "description": "- For TiDB Cloud Dedicated clusters, you can create the [AWS PrivateLink](https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc) or [Google Cloud Private Service Connect](https://cloud.google.com/vpc/docs/private-service-connect) service depending on where your cluster is hosted.\n- For TiDB Cloud Starter instances, you cannot create or manage private endpoint service via API.", "operationId": "CreatePrivateEndpointService", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "private_endpoint_service": { "description": "The newly created private endpoint service resource.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "The name of the private endpoint service, which is used for connection." }, "status": { "format": "enum", "example": "ACTIVE", "description": "The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "dns_name": { "type": "string", "format": "string", "example": "privatelink-tidb.01234567890.clusters.tidb-cloud.com", "description": "The DNS name of the private endpoint service." }, "port": { "type": "integer", "format": "int32", "example": 4000, "description": "The port of the private endpoint service." }, "az_ids": { "type": "array", "format": "array", "example": [ "usw2-az2", "usw2-az1" ], "items": { "type": "string" }, "description": "Availability zones for the private endpoint service. This field is only applicable when the `cloud_provider` is `\"AWS\"`." } } } }, "description": "CreatePrivateEndpointServiceResp is the response for creating private endpoint service for a cluster.", "title": "CreatePrivateEndpointServiceResp", "required": [ "private_endpoint_service" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "description": "CreatePrivateEndpointServiceReq is the request for creating a private endpoint service for a cluster.", "title": "CreatePrivateEndpointServiceReq" } } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoint_service \\\n --header 'content-type: application/json' \\\n --data '{}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoints": { "get": { "summary": "List all private endpoints for a cluster.", "operationId": "ListPrivateEndpoints", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "endpoints": { "type": "array", "format": "array", "items": { "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } }, "description": "The private endpoints for the cluster." } }, "description": "ListPrivateEndpointsResp is the response for listing private endpoints for a cluster.", "title": "ListPrivateEndpointsResp", "required": [ "endpoints" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoints" } ] }, "post": { "summary": "Create a private endpoint for a cluster.", "description": "When creating a private endpoint, only the `endpoint_name` is required.\n- For TiDB Cloud Dedicated clusters, you can create a private endpoint resource in TiDB Cloud after you create the [AWS PrivateLink](https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc) or [Google Cloud Private Service Connect](https://cloud.google.com/vpc/docs/private-service-connect) endpoint depending on where your cluster is hosted. In this way, TiDB Cloud accepts connection requests from your endpoint.\n- For TiDB Cloud Starter instances, you cannot create or manage private endpoint via API.", "operationId": "CreatePrivateEndpoint", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "private_endpoint": { "description": "The newly endpoint created resource.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } } }, "description": "CreatePrivateEndpointResp is the response for creating a private endpoint for a private endpoint service.", "title": "CreatePrivateEndpointResp", "required": [ "private_endpoint" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "private_endpoint", "in": "body", "required": true, "schema": { "example": { "endpoint_name": "vpce-01234567890123456" }, "description": "The endpoint resource to be created. Only the endpoint_name is required.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } } } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoints \\\n --header 'content-type: application/json' \\\n --data '{\"endpoint_name\":\"vpce-01234567890123456\"}'" } ] } }, "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoints/{endpoint_id}": { "delete": { "summary": "Delete a private endpoint for a cluster.", "description": "- For TiDB Cloud Dedicated clusters, you can delete a private endpoint for a cluster.\n- For TiDB Cloud Starter instances, you cannot create or manage private endpoint via API.", "operationId": "DeletePrivateEndpoint", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": {} } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "cluster_id", "description": "The ID of the cluster.", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "endpoint_id", "description": "The ID of the private endpoint to be deleted. You can get the ID from the `endpoints.id` field in the response of [List all private endpoints in a project](#tag/Cluster/operation/ListPrivateEndpoints).", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/clusters/{cluster_id}/private_endpoints/{endpoint_id}" } ] } }, "/api/v1beta/projects/{project_id}/private_endpoints": { "get": { "summary": "List all private endpoints in a project.", "operationId": "ListPrivateEndpointsOfProject", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "endpoints": { "type": "array", "format": "array", "items": { "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } }, "description": "The private endpoints in the project." } }, "description": "ListPrivateEndpointsOfProjectResp is the response for listing private endpoints for a project.", "title": "ListPrivateEndpointsOfProjectResp", "required": [ "endpoints" ] } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Cluster" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/private_endpoints" } ] } }, "/api/v1beta/projects/{project_id}/restores": { "get": { "summary": "List the restore tasks in a project.", "description": "\nFor TiDB Cloud Starter instances, you cannot create or manage restore tasks via API.", "operationId": "ListRestoreTasks", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC.\n\nThe time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "backup_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The cluster ID of the backup." }, "status": { "example": "PENDING", "description": "The status of the restore task.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "cluster": { "description": "The information of the restored cluster. The restored cluster is the new cluster your backup data is restored to.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "name": { "type": "string", "example": "cluster-1", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "status": { "type": "string", "example": "AVAILABLE", "description": "The status of the restored cluster. Possible values are `\"AVAILABLE\"`, `\"CREATING\"`, `\"MODIFYING\"`, `\"PAUSED\"`, `\"RESUMING\"`, `\"UNAVAILABLE\"`, `\"IMPORTING\"`, and `\"CLEARED\"`." } }, "title": "ClusterInfoOfRestore" }, "error_message": { "type": "string", "example": "Please contact support.", "description": "The error message of restore if failed." } }, "description": "The items of all restore tasks.", "title": "ListRestoreRespItem" }, "description": "The items of all restore tasks." }, "total": { "type": "integer", "format": "int64", "example": 10, "description": "The total number of restore tasks in the project." } }, "description": "This response for list restore.", "title": "ListRestoreResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "page", "description": "The number of pages.", "in": "query", "required": false, "type": "integer", "format": "int32", "default": 1 }, { "name": "page_size", "description": "The size of a page.", "in": "query", "required": false, "type": "integer", "format": "int32", "default": 10 } ], "tags": [ "Restore" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://api.tidbcloud.com/api/v1beta/projects/{project_id}/restores?page=1&page_size=10'" } ] }, "post": { "summary": "Create a restore task.", "description": "You can use this endpoint to restore data from a previously created backup file to a new cluster. In this endpoint, you must specify the configuration of the new cluster you want to restore data to.\n\n**Limitations:**\n\n- For TiDB Cloud Dedicated clusters, you can only restore data from a smaller node size to a larger node size.\n\n- You cannot restore data from a TiDB Cloud Dedicated cluster to a TiDB Cloud Starter instance.\n\nFor TiDB Cloud Starter instances, you cannot create restore tasks via API.", "operationId": "CreateRestoreTask", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." } }, "description": "CreateRestoreResp is the response for restoring backup to a new cluster.", "title": "CreateRestoreResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "body", "in": "body", "required": true, "schema": { "type": "object", "properties": { "backup_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "name": { "type": "string", "example": "Cluster0", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to.\n\n- The name must be 4-64 characters that only contain numbers, letters, and hyphens. The first and last character must be a letter or number.\n- This must be different from the name of the existing cluster.", "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" }, "config": { "description": "The configuration of the cluster.", "type": "object", "properties": { "root_password": { "type": "string", "example": "password_example", "description": "The root password to access the cluster. It must be 8-64 characters.", "maxLength": 64, "minLength": 8 }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.\n\n**Limitations**:\n- For a TiDB Cloud Dedicated cluster, the `components` parameter is **required**.\n- For a TiDB Cloud Starter instance, the `components` value is **ignored**. Setting this configuration does not have any effects.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] }, "ip_access_list": { "type": "array", "items": { "type": "object", "properties": { "cidr": { "type": "string", "example": "8.8.8.8/32", "description": "The IP address or CIDR range that you want to add to the cluster's IP access list." }, "description": { "type": "string", "example": "My Current IP Address", "description": "Description that explains the purpose of the entry." } }, "required": [ "cidr" ] }, "description": "A list of IP addresses and Classless Inter-Domain Routing (CIDR) addresses that are allowed to access the TiDB Cloud cluster via [standard connection](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection)." } }, "required": [ "root_password" ] } }, "description": "CreateRestoreReq is the request for restoring backup to a new cluster.", "title": "CreateRestoreReq", "required": [ "backup_id", "name", "cluster_spec" ] } } ], "tags": [ "Restore" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/restores \\\n --header 'content-type: application/json' \\\n --data '{\"backup_id\":\"1\",\"name\":\"Cluster0\",\"config\":{\"root_password\":\"password_example\",\"port\":4000,\"components\":{\"tidb\":{\"node_size\":\"8C16G\",\"node_quantity\":2},\"tikv\":{\"node_size\":\"8C32G\",\"storage_size_gib\":1024,\"node_quantity\":3}},\"ip_access_list\":[{\"cidr\":\"8.8.8.8/32\",\"description\":\"My Current IP Address\"}]}}'" } ] } }, "/api/v1beta/projects/{project_id}/restores/{restore_id}": { "get": { "summary": "Get a restore task.", "description": "\nFor TiDB Cloud Starter instances, you cannot manage restore tasks via API.", "operationId": "GetRestoreTask", "responses": { "200": { "description": "A successful response.", "schema": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC.\n\nThe time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "backup_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The cluster ID of the backup." }, "status": { "example": "PENDING", "description": "The status of the restore task.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "cluster": { "description": "The information of the restored cluster. The restored cluster is the new cluster your backup data is restored to.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "name": { "type": "string", "example": "cluster-1", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "status": { "type": "string", "example": "AVAILABLE", "description": "The status of the restored cluster. Possible values are `\"AVAILABLE\"`, `\"CREATING\"`, `\"MODIFYING\"`, `\"PAUSED\"`, `\"RESUMING\"`, `\"UNAVAILABLE\"`, `\"IMPORTING\"`, and `\"CLEARED\"`." } }, "title": "ClusterInfoOfRestore" }, "error_message": { "type": "string", "example": "Please contact support.", "description": "The error message of restore if failed." } }, "description": "The response for get restore.", "title": "GetRestoreResp" } }, "400": { "description": "A request field is invalid.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "401": { "description": "The API key cannot be authenticated.", "schema": {} }, "403": { "description": "The API key does not have permission to access the resource.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "404": { "description": "The requested resource does not exist.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "429": { "description": "You have exceed the rate limit.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "500": { "description": "Server error.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } } }, "default": { "description": "An unexpected error response.", "schema": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } } } }, "parameters": [ { "name": "project_id", "description": "The ID of your project. You can get the project ID from the response of [List all accessible projects.](#tag/Project/operation/ListProjects).", "in": "path", "required": true, "type": "string", "format": "uint64" }, { "name": "restore_id", "description": "The ID of the restore task.", "in": "path", "required": true, "type": "string", "format": "uint64" } ], "tags": [ "Restore" ], "x-code-samples": [ { "lang": "curl", "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url https://api.tidbcloud.com/api/v1beta/projects/{project_id}/restores/{restore_id}" } ] } } }, "definitions": { "ErrorResponse": { "type": "object", "properties": { "code": { "type": "integer", "format": "integer", "description": "Error code returned with this error.", "title": "code" }, "message": { "type": "string", "description": "Error message returned with this error.", "title": "message" }, "details": { "type": "array", "items": { "type": "string" }, "description": "Error details returned with this error.", "title": "details" } } }, "ImportSourceFormatImportSourceFormatType": { "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "ImportSourceImportSourceType": { "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "ImportStatusImportTaskPhase": { "type": "string", "enum": [ "PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED" ] }, "UpdateImportTaskReqImportTaskAction": { "type": "string", "enum": [ "CANCEL" ] }, "googlerpcStatus": { "type": "object", "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" }, "details": { "type": "array", "items": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } } } }, "openapiAwsAssumeRoleAccess": { "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "description": "AwsAssumeRoleAccess represents the settings to access the Amazon S3 source by assuming to a specific AWS role.", "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "openapiAwsCmekSpec": { "type": "object", "properties": { "region": { "type": "string", "example": "us-west-2", "description": "The region name of the AWS CMEK. The region value should match the cloud provider's region code.\n\nYou can get the complete list of available regions from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\nFor the detailed information on each region, refer to the documentation of the [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) cloud provider." }, "kms_arn": { "type": "string", "example": "arn:aws:kms:example", "description": "The KMS ARN of the AWS CMEK." } }, "description": "AwsCmekSpec is the specification of the AWS CMEK.", "title": "AwsCmekSpec", "required": [ "region", "kms_arn" ] }, "openapiAwsImportTaskRoleInfo": { "type": "object", "properties": { "account_id": { "type": "string", "example": "999999999999", "description": "The account ID under which the import tasks for this cluster are running." }, "external_id": { "type": "string", "example": "abcdefghijklmnopqrstuvwxyz0123456789xxxxxxxxxxxxxx", "description": "The unique external ID that binds to the cluster, which is a long string. When an import task starts and attempts to assume a specified role, it automatically attaches this external ID. This means that you can configure this external ID in the assumed role's trust relationship, so that only the import task of that specified cluster can access the data by assuming the role. This can provide additional security." } }, "description": "AwsImportTaskRoleInfo is the role information for import tasks on an AWS cluster.", "title": "AwsImportTaskRoleInfo", "required": [ "account_id", "external_id" ] }, "openapiAwsKeyAccess": { "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "description": "AwsKeyAccess represents the settings to access the Amazon S3 source by using access keys.", "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "openapiBackupTypeEnum": { "type": "string", "enum": [ "MANUAL", "AUTO" ] }, "openapiCloudProvider": { "type": "string", "enum": [ "AWS", "GCP" ] }, "openapiClusterComponents": { "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] }, "openapiClusterConfig": { "type": "object", "properties": { "root_password": { "type": "string", "example": "password_example", "description": "The root password to access the cluster. It must be 8-64 characters.", "maxLength": 64, "minLength": 8 }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.\n\n**Limitations**:\n- For a TiDB Cloud Dedicated cluster, the `components` parameter is **required**.\n- For a TiDB Cloud Starter instance, the `components` value is **ignored**. Setting this configuration does not have any effects.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] }, "ip_access_list": { "type": "array", "items": { "type": "object", "properties": { "cidr": { "type": "string", "example": "8.8.8.8/32", "description": "The IP address or CIDR range that you want to add to the cluster's IP access list." }, "description": { "type": "string", "example": "My Current IP Address", "description": "Description that explains the purpose of the entry." } }, "required": [ "cidr" ] }, "description": "A list of IP addresses and Classless Inter-Domain Routing (CIDR) addresses that are allowed to access the TiDB Cloud cluster via [standard connection](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection)." } }, "required": [ "root_password" ] }, "openapiClusterConnectionStrings": { "type": "object", "properties": { "default_user": { "type": "string", "example": "root", "description": "The default TiDB user for connection." }, "standard": { "description": "Standard connection string.\n\nYou must configure the [IP Access List](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection) for the cluster you created on [TiDB Cloud console](https://tidbcloud.com/) before connecting to this connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "vpc_peering": { "description": "[VPC peering](https://docs.pingcap.com/tidbcloud/tidb-cloud-glossary#vpc-peering) connection string.\n\nYou must [Set up VPC peering connections](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections) for the project before connecting to this private connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } } } }, "openapiClusterInfoOfRestore": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "name": { "type": "string", "example": "cluster-1", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "status": { "type": "string", "example": "AVAILABLE", "description": "The status of the restored cluster. Possible values are `\"AVAILABLE\"`, `\"CREATING\"`, `\"MODIFYING\"`, `\"PAUSED\"`, `\"RESUMING\"`, `\"UNAVAILABLE\"`, `\"IMPORTING\"`, and `\"CLEARED\"`." } }, "description": "The information of the restored cluster. The restored cluster is the new cluster your backup data is restored to.", "title": "ClusterInfoOfRestore" }, "openapiClusterItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the cluster." }, "project_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "name": { "type": "string", "example": "Cluster0", "description": "The name of the cluster.", "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" }, "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type:\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "Region of the cluster." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "config": { "example": { "port": 4000, "components": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } } }, "description": "The configuration of the cluster.", "type": "object", "properties": { "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] } } }, "status": { "description": "The status of the cluster.", "type": "object", "properties": { "tidb_version": { "type": "string", "example": "v6.1.0", "description": "TiDB version." }, "cluster_status": { "format": "enum", "example": "AVAILABLE", "description": "Status of the cluster.", "type": "string", "enum": [ "AVAILABLE", "CREATING", "MODIFYING", "PAUSED", "RESUMING", "UNAVAILABLE", "IMPORTING", "MAINTAINING", "PAUSING" ] }, "node_map": { "description": "Node map. The `node_map` is returned only when the `cluster_status` is `\"AVAILABLE\"` or `\"MODIFYING\"`.", "type": "object", "properties": { "tidb": { "type": "array", "example": [ { "node_name": "tidb-0", "availability_zone": "us-west-2a", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tidb-1", "availability_zone": "us-west-2b", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiDB node map." }, "tikv": { "type": "array", "example": [ { "node_name": "tikv-0", "availability_zone": "us-west-2a", "node_size": "8C32G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-2", "availability_zone": "us-west-2c", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiKV node map." }, "tiflash": { "type": "array", "example": [ { "node_name": "tiflash-0", "availability_zone": "us-west-2a", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tiflash-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiFlash node map." } }, "required": [ "tidb", "tikv" ] }, "connection_strings": { "description": "Connection strings.", "type": "object", "properties": { "default_user": { "type": "string", "example": "root", "description": "The default TiDB user for connection." }, "standard": { "description": "Standard connection string.\n\nYou must configure the [IP Access List](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection) for the cluster you created on [TiDB Cloud console](https://tidbcloud.com/) before connecting to this connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "vpc_peering": { "description": "[VPC peering](https://docs.pingcap.com/tidbcloud/tidb-cloud-glossary#vpc-peering) connection string.\n\nYou must [Set up VPC peering connections](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections) for the project before connecting to this private connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } } } } }, "title": "ClusterItemStatus" } }, "description": "ClusterItem is the information of cluster.", "title": "ClusterItem", "required": [ "id", "project_id" ] }, "openapiClusterItemStatus": { "type": "object", "properties": { "tidb_version": { "type": "string", "example": "v6.1.0", "description": "TiDB version." }, "cluster_status": { "format": "enum", "example": "AVAILABLE", "description": "Status of the cluster.", "type": "string", "enum": [ "AVAILABLE", "CREATING", "MODIFYING", "PAUSED", "RESUMING", "UNAVAILABLE", "IMPORTING", "MAINTAINING", "PAUSING" ] }, "node_map": { "description": "Node map. The `node_map` is returned only when the `cluster_status` is `\"AVAILABLE\"` or `\"MODIFYING\"`.", "type": "object", "properties": { "tidb": { "type": "array", "example": [ { "node_name": "tidb-0", "availability_zone": "us-west-2a", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tidb-1", "availability_zone": "us-west-2b", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiDB node map." }, "tikv": { "type": "array", "example": [ { "node_name": "tikv-0", "availability_zone": "us-west-2a", "node_size": "8C32G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-2", "availability_zone": "us-west-2c", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiKV node map." }, "tiflash": { "type": "array", "example": [ { "node_name": "tiflash-0", "availability_zone": "us-west-2a", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tiflash-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiFlash node map." } }, "required": [ "tidb", "tikv" ] }, "connection_strings": { "description": "Connection strings.", "type": "object", "properties": { "default_user": { "type": "string", "example": "root", "description": "The default TiDB user for connection." }, "standard": { "description": "Standard connection string.\n\nYou must configure the [IP Access List](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection) for the cluster you created on [TiDB Cloud console](https://tidbcloud.com/) before connecting to this connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "vpc_peering": { "description": "[VPC peering](https://docs.pingcap.com/tidbcloud/tidb-cloud-glossary#vpc-peering) connection string.\n\nYou must [Set up VPC peering connections](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections) for the project before connecting to this private connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } } } } }, "description": "ClusterItemStatus is the status of cluster.", "title": "ClusterItemStatus" }, "openapiClusterNodeMap": { "type": "object", "properties": { "tidb": { "type": "array", "example": [ { "node_name": "tidb-0", "availability_zone": "us-west-2a", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tidb-1", "availability_zone": "us-west-2b", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiDB node map." }, "tikv": { "type": "array", "example": [ { "node_name": "tikv-0", "availability_zone": "us-west-2a", "node_size": "8C32G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-2", "availability_zone": "us-west-2c", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiKV node map." }, "tiflash": { "type": "array", "example": [ { "node_name": "tiflash-0", "availability_zone": "us-west-2a", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tiflash-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiFlash node map." } }, "required": [ "tidb", "tikv" ] }, "openapiClusterStatus": { "type": "string", "enum": [ "AVAILABLE", "CREATING", "MODIFYING", "PAUSED", "RESUMING", "UNAVAILABLE", "IMPORTING", "MAINTAINING", "PAUSING" ] }, "openapiClusterType": { "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "openapiColumnDefinition": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "openapiCreateBackupResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." } }, "description": "This response for creating a MANUAL type backup.", "title": "CreateBackupResp" }, "openapiCreateClusterResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the cluster." } }, "description": "CreateClusterResp is the response for creating cluster.", "title": "CreateClusterResp", "required": [ "id" ] }, "openapiCreateImportTaskOptions": { "type": "object", "properties": { "pre_create_tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The database name of the table." }, "table_name": { "type": "string", "example": "table01", "description": "The table name of the table." }, "schema": { "description": "The schema for the table.", "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "title": "TableSchema", "required": [ "column_definitions" ] } }, "description": "TableDefinition is the definition of a table so that the table can be created with this information.", "title": "TableDefinition", "required": [ "database_name", "table_name", "schema" ] }, "description": "The table definition of pre-created tables.\n\n**Note**: The name of the pre-created tables should match one of the target tables. Otherwise, the table will be ignored and won't be created" } }, "description": "CreateImportTaskOptions is the optional configuration for creating an import task.", "title": "CreateImportTaskOptions" }, "openapiCreateImportTaskResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "12345", "description": "The ID of the import task." } }, "description": "CreateImportTaskResp is the response to the creation of an import task.", "title": "CreateImportTaskResp", "required": [ "id" ] }, "openapiCreatePrivateEndpointResp": { "type": "object", "properties": { "private_endpoint": { "description": "The newly endpoint created resource.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } } }, "description": "CreatePrivateEndpointResp is the response for creating a private endpoint for a private endpoint service.", "title": "CreatePrivateEndpointResp", "required": [ "private_endpoint" ] }, "openapiCreatePrivateEndpointServiceResp": { "type": "object", "properties": { "private_endpoint_service": { "description": "The newly created private endpoint service resource.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "The name of the private endpoint service, which is used for connection." }, "status": { "format": "enum", "example": "ACTIVE", "description": "The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "dns_name": { "type": "string", "format": "string", "example": "privatelink-tidb.01234567890.clusters.tidb-cloud.com", "description": "The DNS name of the private endpoint service." }, "port": { "type": "integer", "format": "int32", "example": 4000, "description": "The port of the private endpoint service." }, "az_ids": { "type": "array", "format": "array", "example": [ "usw2-az2", "usw2-az1" ], "items": { "type": "string" }, "description": "Availability zones for the private endpoint service. This field is only applicable when the `cloud_provider` is `\"AWS\"`." } } } }, "description": "CreatePrivateEndpointServiceResp is the response for creating private endpoint service for a cluster.", "title": "CreatePrivateEndpointServiceResp", "required": [ "private_endpoint_service" ] }, "openapiCreateProjectReq": { "type": "object", "properties": { "name": { "type": "string", "example": "Project0", "description": "The name of the project." }, "aws_cmek_enabled": { "type": "boolean", "x-nullable": true, "example": false, "default": false, "description": "Flag that indicates whether to enable AWS Customer-Managed Encryption Keys.\n\nCurrently this feature is only available upon request. If you need to try out this feature, contact [support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support)." } }, "description": "CreateProjectReq is the request for creating project.", "title": "CreateProjectReq", "required": [ "name" ] }, "openapiCreateProjectResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." } }, "description": "CreateProjectResp is the response for creating project.", "title": "CreateProjectResp", "required": [ "id" ] }, "openapiCreateRestoreResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." } }, "description": "CreateRestoreResp is the response for restoring backup to a new cluster.", "title": "CreateRestoreResp" }, "openapiGcpImportTaskRoleInfo": { "type": "object", "properties": { "account_id": { "type": "string", "example": "example-account@example.com", "description": "The account ID under which the import tasks for this cluster are running." } }, "description": "GcpImportTaskRoleInfo is the role information for import tasks on a GCP cluster.", "title": "GcpImportTaskRoleInfo", "required": [ "account_id" ] }, "openapiGetBackupOfClusterResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "name": { "type": "string", "example": "backup-1", "description": "The name of the backup." }, "description": { "type": "string", "example": "backup for cluster upgrade in 2022/06/07", "description": "The description of the backup. It is specified by the user when taking a manual type backup. It helps you add additional information to the backup." }, "type": { "example": "MANUAL", "description": "The type of backup. TiDB Cloud only supports manual and auto backup. For more information, see [TiDB Cloud Documentation](https://docs.pingcap.com/tidbcloud/backup-and-restore#backup).", "type": "string", "enum": [ "MANUAL", "AUTO" ] }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC. The time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "size": { "type": "string", "format": "uint64", "example": "102400", "description": "The bytes of the backup." }, "status": { "example": "SUCCESS", "description": "The status of backup.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] } }, "description": "This response for getting backup of a cluster.", "title": "GetBackupOfClusterResp" }, "openapiGetBackupOfClusterRespStatusEnum": { "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "openapiGetClusterConfig": { "type": "object", "properties": { "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] } } }, "openapiGetPrivateEndpointServiceResp": { "type": "object", "properties": { "private_endpoint_service": { "description": "The private endpoint service resource of the cluster.", "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "The name of the private endpoint service, which is used for connection." }, "status": { "format": "enum", "example": "ACTIVE", "description": "The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "dns_name": { "type": "string", "format": "string", "example": "privatelink-tidb.01234567890.clusters.tidb-cloud.com", "description": "The DNS name of the private endpoint service." }, "port": { "type": "integer", "format": "int32", "example": 4000, "description": "The port of the private endpoint service." }, "az_ids": { "type": "array", "format": "array", "example": [ "usw2-az2", "usw2-az1" ], "items": { "type": "string" }, "description": "Availability zones for the private endpoint service. This field is only applicable when the `cloud_provider` is `\"AWS\"`." } } } }, "description": "GetPrivateEndpointServiceResp is the response for getting private endpoint service for a cluster.", "title": "GetPrivateEndpointServiceResp", "required": [ "private_endpoint_service" ] }, "openapiGetRestoreResp": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC.\n\nThe time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "backup_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The cluster ID of the backup." }, "status": { "example": "PENDING", "description": "The status of the restore task.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "cluster": { "description": "The information of the restored cluster. The restored cluster is the new cluster your backup data is restored to.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "name": { "type": "string", "example": "cluster-1", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "status": { "type": "string", "example": "AVAILABLE", "description": "The status of the restored cluster. Possible values are `\"AVAILABLE\"`, `\"CREATING\"`, `\"MODIFYING\"`, `\"PAUSED\"`, `\"RESUMING\"`, `\"UNAVAILABLE\"`, `\"IMPORTING\"`, and `\"CLEARED\"`." } }, "title": "ClusterInfoOfRestore" }, "error_message": { "type": "string", "example": "Please contact support.", "description": "The error message of restore if failed." } }, "description": "The response for get restore.", "title": "GetRestoreResp" }, "openapiGetRestoreRespStatusEnum": { "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "openapiImportItem": { "type": "object", "properties": { "metadata": { "description": "The metadata of the import task.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the import task." }, "name": { "type": "string", "example": "my_import", "description": "The name of the import task." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The creation time of the import task in Unix timestamp seconds (epoch time)." } }, "title": "ImportMetadata", "required": [ "id", "create_timestamp" ] }, "spec": { "description": "The specification of the import task.", "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "title": "ImportSpec", "required": [ "source", "target" ] }, "status": { "description": "The status of the import task.", "type": "object", "properties": { "phase": { "example": "IMPORTING", "description": "The current phase that the import task is in.", "type": "string", "enum": [ "PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED" ] }, "error_message": { "type": "string", "example": "some error occurs", "description": "The error message of the import task." }, "start_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The start timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)" }, "end_timestamp": { "type": "string", "format": "timestamp", "example": "1676450897", "description": "The end timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)." }, "progress": { "description": "The progress of the import task.", "type": "object", "properties": { "import_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall importing progress of the import task.", "maximum": 100 }, "validation_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall validation progress of the import task after the data has been imported into the target cluster.", "maximum": 100 } }, "title": "ImportProgress", "required": [ "import_progress", "validation_progress" ] }, "source_total_size_bytes": { "type": "string", "format": "uint64", "example": "10737418240", "description": "The total size of the import task's data source. The unit is bytes." } }, "title": "ImportStatus", "required": [ "phase" ] } }, "description": "ImportItem represents the information of a single import task.", "title": "ImportItem" }, "openapiImportMetadata": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the import task." }, "name": { "type": "string", "example": "my_import", "description": "The name of the import task." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The creation time of the import task in Unix timestamp seconds (epoch time)." } }, "description": "ImportMetadata represents some basic metadata about an import task.", "title": "ImportMetadata", "required": [ "id", "create_timestamp" ] }, "openapiImportProgress": { "type": "object", "properties": { "import_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall importing progress of the import task.", "maximum": 100 }, "validation_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall validation progress of the import task after the data has been imported into the target cluster.", "maximum": 100 } }, "description": "ImportProgress represents the progress information of an import task.", "title": "ImportProgress", "required": [ "import_progress", "validation_progress" ] }, "openapiImportSource": { "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "description": "ImportSource represents the data source settings of an import task.", "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "openapiImportSourceCSVConfig": { "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "description": "ImportSourceCSVConfig represents the settings for parsing the CSV source data of an import task.", "title": "ImportSourceCSVConfig" }, "openapiImportSourceFormat": { "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "description": "ImportSourceFormat represents the settings for reading and parsing source data in the correct format.", "title": "ImportSourceFormat", "required": [ "type" ] }, "openapiImportSpec": { "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "description": "ImportSpec represents the settings and specifications of an import task.", "title": "ImportSpec", "required": [ "source", "target" ] }, "openapiImportStatus": { "type": "object", "properties": { "phase": { "example": "IMPORTING", "description": "The current phase that the import task is in.", "type": "string", "enum": [ "PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED" ] }, "error_message": { "type": "string", "example": "some error occurs", "description": "The error message of the import task." }, "start_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The start timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)" }, "end_timestamp": { "type": "string", "format": "timestamp", "example": "1676450897", "description": "The end timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)." }, "progress": { "description": "The progress of the import task.", "type": "object", "properties": { "import_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall importing progress of the import task.", "maximum": 100 }, "validation_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall validation progress of the import task after the data has been imported into the target cluster.", "maximum": 100 } }, "title": "ImportProgress", "required": [ "import_progress", "validation_progress" ] }, "source_total_size_bytes": { "type": "string", "format": "uint64", "example": "10737418240", "description": "The total size of the import task's data source. The unit is bytes." } }, "description": "ImportStatus represents the status of an import task.", "title": "ImportStatus", "required": [ "phase" ] }, "openapiImportTarget": { "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "description": "ImportTarget represents the target settings of an import task.", "title": "ImportTarget" }, "openapiImportTargetTable": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "openapiImportTaskRoleInfo": { "type": "object", "properties": { "aws_import_role": { "description": "The import role information for an AWS cluster. Only TiDB clusters on AWS return this information. If the TiDB cluster is deployed on GCP, this field is not returned.", "type": "object", "properties": { "account_id": { "type": "string", "example": "999999999999", "description": "The account ID under which the import tasks for this cluster are running." }, "external_id": { "type": "string", "example": "abcdefghijklmnopqrstuvwxyz0123456789xxxxxxxxxxxxxx", "description": "The unique external ID that binds to the cluster, which is a long string. When an import task starts and attempts to assume a specified role, it automatically attaches this external ID. This means that you can configure this external ID in the assumed role's trust relationship, so that only the import task of that specified cluster can access the data by assuming the role. This can provide additional security." } }, "title": "AwsImportTaskRoleInfo", "required": [ "account_id", "external_id" ] }, "gcp_import_role": { "description": "The import role information for a GCP cluster. Only TiDB clusters on GCP return this information. If the TiDB cluster is deployed on AWS, this field is not returned.", "type": "object", "properties": { "account_id": { "type": "string", "example": "example-account@example.com", "description": "The account ID under which the import tasks for this cluster are running." } }, "title": "GcpImportTaskRoleInfo", "required": [ "account_id" ] } }, "description": "ImportTaskRoleInfo is the role information for import tasks on a cluster. You can use this information to configure the access for the import tasks to retrieve the data from the data source.", "title": "ImportTaskRoleInfo" }, "openapiIpAccessListItem": { "type": "object", "properties": { "cidr": { "type": "string", "example": "8.8.8.8/32", "description": "The IP address or CIDR range that you want to add to the cluster's IP access list." }, "description": { "type": "string", "example": "My Current IP Address", "description": "Description that explains the purpose of the entry." } }, "required": [ "cidr" ] }, "openapiListAwsCmekResp": { "type": "object", "properties": { "items": { "type": "array", "format": "array", "items": { "type": "object", "properties": { "region": { "type": "string", "example": "us-west-2", "description": "The region name of the AWS CMEK. The region value should match the cloud provider's region code.\n\nYou can get the complete list of available regions from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\nFor the detailed information on each region, refer to the documentation of the [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) cloud provider." }, "kms_arn": { "type": "string", "example": "arn:aws:kms:example", "description": "The KMS ARN of the AWS CMEK." } }, "description": "AwsCmekSpec is the specification of the AWS CMEK.", "title": "AwsCmekSpec", "required": [ "region", "kms_arn" ] }, "description": "The specifications of the AWS CMEK." } }, "description": "ListAwsCmekResp is the response for getting AWS Customer-Managed Encryption Keys for a project.", "title": "ListAwsCmekResp" }, "openapiListBackupItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup. It is generated by TiDB Cloud." }, "name": { "type": "string", "example": "backup-1", "description": "The name of the backup." }, "description": { "type": "string", "example": "backup for cluster upgrade in 2022/06/07", "description": "The description of the backup. It is specified by the user when taking a manual type backup. It helps you add additional information to the backup." }, "type": { "example": "MANUAL", "description": "The type of backup. TiDB Cloud only supports manual and auto backup. For more information, see [TiDB Cloud Documentation](https://docs.pingcap.com/tidbcloud/backup-and-restore#backup).", "type": "string", "enum": [ "MANUAL", "AUTO" ] }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC. The time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "size": { "type": "string", "format": "uint64", "example": "102400", "description": "The bytes of the backup." }, "status": { "example": "SUCCESS", "description": "The status of backup.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] } }, "description": "The item of backup list.", "title": "ListBackupItem" }, "openapiListBackupItemStatusEnum": { "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "openapiListBackupOfClusterResp": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup. It is generated by TiDB Cloud." }, "name": { "type": "string", "example": "backup-1", "description": "The name of the backup." }, "description": { "type": "string", "example": "backup for cluster upgrade in 2022/06/07", "description": "The description of the backup. It is specified by the user when taking a manual type backup. It helps you add additional information to the backup." }, "type": { "example": "MANUAL", "description": "The type of backup. TiDB Cloud only supports manual and auto backup. For more information, see [TiDB Cloud Documentation](https://docs.pingcap.com/tidbcloud/backup-and-restore#backup).", "type": "string", "enum": [ "MANUAL", "AUTO" ] }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC. The time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "size": { "type": "string", "format": "uint64", "example": "102400", "description": "The bytes of the backup." }, "status": { "example": "SUCCESS", "description": "The status of backup.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] } }, "description": "The item of backup list.", "title": "ListBackupItem" }, "description": "The items of all backups." }, "total": { "type": "integer", "format": "int64", "example": 10, "description": "The total number of backups in the project." } }, "description": "The response for listing backups of a cluster.", "title": "ListBackupOfClusterResp" }, "openapiListClustersOfProjectResp": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the cluster." }, "project_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "name": { "type": "string", "example": "Cluster0", "description": "The name of the cluster.", "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" }, "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type:\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "Region of the cluster." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "config": { "example": { "port": 4000, "components": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } } }, "description": "The configuration of the cluster.", "type": "object", "properties": { "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.", "maximum": 65535, "minimum": 1024 }, "components": { "example": { "tidb": { "node_size": "8C16G", "node_quantity": 2 }, "tikv": { "node_size": "8C32G", "storage_size_gib": 1024, "node_quantity": 3 } }, "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "tiflash": { "description": "The TiFlash component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] } }, "required": [ "tidb", "tikv" ] } } }, "status": { "description": "The status of the cluster.", "type": "object", "properties": { "tidb_version": { "type": "string", "example": "v6.1.0", "description": "TiDB version." }, "cluster_status": { "format": "enum", "example": "AVAILABLE", "description": "Status of the cluster.", "type": "string", "enum": [ "AVAILABLE", "CREATING", "MODIFYING", "PAUSED", "RESUMING", "UNAVAILABLE", "IMPORTING", "MAINTAINING", "PAUSING" ] }, "node_map": { "description": "Node map. The `node_map` is returned only when the `cluster_status` is `\"AVAILABLE\"` or `\"MODIFYING\"`.", "type": "object", "properties": { "tidb": { "type": "array", "example": [ { "node_name": "tidb-0", "availability_zone": "us-west-2a", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tidb-1", "availability_zone": "us-west-2b", "node_size": "8C16G", "vcpu_num": 8, "ram_bytes": "17179869184", "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiDB node map." }, "tikv": { "type": "array", "example": [ { "node_name": "tikv-0", "availability_zone": "us-west-2a", "node_size": "8C32G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tikv-2", "availability_zone": "us-west-2c", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiKV node map." }, "tiflash": { "type": "array", "example": [ { "node_name": "tiflash-0", "availability_zone": "us-west-2a", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" }, { "node_name": "tiflash-1", "availability_zone": "us-west-2b", "node_size": "8C64G", "vcpu_num": 8, "ram_bytes": "68719476736", "storage_size_gib": 1024, "status": "NODE_STATUS_AVAILABLE" } ], "items": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "description": "TiFlash node map." } }, "required": [ "tidb", "tikv" ] }, "connection_strings": { "description": "Connection strings.", "type": "object", "properties": { "default_user": { "type": "string", "example": "root", "description": "The default TiDB user for connection." }, "standard": { "description": "Standard connection string.\n\nYou must configure the [IP Access List](https://docs.pingcap.com/tidbcloud/connect-to-tidb-cluster#connect-via-standard-connection) for the cluster you created on [TiDB Cloud console](https://tidbcloud.com/) before connecting to this connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "vpc_peering": { "description": "[VPC peering](https://docs.pingcap.com/tidbcloud/tidb-cloud-glossary#vpc-peering) connection string.\n\nYou must [Set up VPC peering connections](https://docs.pingcap.com/tidbcloud/set-up-vpc-peering-connections) for the project before connecting to this private connection string.", "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } } } } }, "title": "ClusterItemStatus" } }, "description": "ClusterItem is the information of cluster.", "title": "ClusterItem", "required": [ "id", "project_id" ] }, "description": "The items of clusters in the project." }, "total": { "type": "integer", "format": "int64", "example": 1, "description": "The total number of clusters in the project." } }, "description": "GetClustersOfProjectResp is the response for getting clusters of project.", "title": "GetClustersOfProjectResp", "required": [ "total", "items" ] }, "openapiListImportTasksResp": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "metadata": { "description": "The metadata of the import task.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the import task." }, "name": { "type": "string", "example": "my_import", "description": "The name of the import task." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The creation time of the import task in Unix timestamp seconds (epoch time)." } }, "title": "ImportMetadata", "required": [ "id", "create_timestamp" ] }, "spec": { "description": "The specification of the import task.", "type": "object", "properties": { "source": { "description": "The data source settings of the import task.", "type": "object", "properties": { "type": { "example": "S3", "description": "The data source type of an import task.\n\n- `\"S3\"`: import data from Amazon S3\n- `\"GCS\"`: import data from Google Cloud Storage (only available for [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) clusters)\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) clusters). Before you import from a local file, you need to first upload the file using the [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile) endpoint.\n\n**Note:** Currently, if this import spec is used for a [preview](#tag/Import/operation/PreviewImportData) request, only the `LOCAL_FILE` source type is supported.", "type": "string", "enum": [ "S3", "GCS", "LOCAL_FILE" ] }, "uri": { "type": "string", "example": "s3://example-bucket/example-source-data/", "description": "The data source URI of an import task. The URI scheme must match the data source type. Here are the scheme of each source type:\n* `S3`: `s3://`\n* `GCS`: `gs://`\n* `LOCAL_FILE`: `file://`.\n\n**Note:** If the import source type is `LOCAL_FILE`, just provide the `upload_stub_id` of the uploaded file from the response of [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile), and make it as the data source folder. For example: `file://12345/`.\n\n**Limitation**: If the import source type is `LOCAL_FILE`, only the `CSV` source format type is supported." }, "aws_assume_role_access": { "description": "The settings to access the S3 data by assuming a specific AWS role. This field is only needed if you need to access S3 data by assuming an AWS role.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "assume_role": { "type": "string", "example": "arn:aws:iam::999999999999:role/sample-role", "description": "The specific AWS role ARN that needs to be assumed to access the Amazon S3 data source." } }, "title": "AwsAssumeRoleAccess", "required": [ "assume_role" ] }, "aws_key_access": { "description": "The settings to access the S3 data with an access key. This field is only needed if you want to access the S3 data with an access key.\n\n**Note:** Provide only one of `aws_assume_role_access` and `aws_key_access`. If both `aws_assume_role_access` and `aws_key_access` are provided, an error will be reported.", "type": "object", "properties": { "access_key_id": { "type": "string", "example": "YOUR_ACCESS_KEY_ID", "description": "The access key ID of the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." }, "secret_access_key": { "type": "string", "example": "YOUR_SECRET_ACCESS_KEY", "description": "The secret access key for the account to access the data. This information will be redacted when it is retrieved to obtain the import task information." } }, "title": "AwsKeyAccess", "required": [ "access_key_id", "secret_access_key" ] }, "format": { "description": "The format settings of the import data source.", "type": "object", "properties": { "type": { "example": "CSV", "description": "The format type of an import source.", "type": "string", "enum": [ "CSV", "PARQUET", "SQL", "AURORA_SNAPSHOT" ] }, "csv_config": { "description": "The CSV format settings to parse the source CSV files. This field is only needed if the source format is CSV.", "type": "object", "properties": { "delimiter": { "type": "string", "default": ",", "description": "The delimiter character used to separate fields in the CSV data." }, "quote": { "type": "string", "default": "\"", "description": "The character used to quote the fields in the CSV data." }, "backslash_escape": { "type": "boolean", "default": true, "description": "Whether a backslash (`\\`) symbol followed by a character should be combined as a whole and treated as an escape sequence in a CSV field. For example, if this parameter is set to `true`, `\\n` will be treated as a 'new-line' character. If it is set to `false`, `\\n` will be treated as two separate characters: backslash and `n`.\n\nCurrently, these are several supported escape sequences: `\\0`, `\\b`, `\\n`, `\\r`, `\\t`, and `\\Z`. If the parameter is set to `true`, but the backslash escape sequence is not recognized, the backslash character is ignored." }, "has_header_row": { "type": "boolean", "default": true, "description": "Whether the CSV data has a header row, which is not part of the data. If it is set to `true`, the import task will use the column names in the header row to match the column names in the target table." } }, "title": "ImportSourceCSVConfig" } }, "title": "ImportSourceFormat", "required": [ "type" ] } }, "title": "ImportSource", "required": [ "type", "uri", "format" ] }, "target": { "description": "The target settings of the import task.", "type": "object", "properties": { "tables": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The target database name." }, "table_name": { "type": "string", "example": "table01", "description": "The target table name." }, "file_name_pattern": { "type": "string", "example": "data/db01/table01.*.csv", "description": "The filename pattern used to map the files in the data source to this target table. The pattern should be a simple glob pattern. Here are some examples:\n* `my-data?.csv`: all CSV files starting with `my-data` and one character (such as `my-data1.csv` and `my-data2.csv`) will be imported into the same target table.\n* `my-data*.csv`: all CSV files starting with `my-data` will be imported into the same target table.\n\nIf no pattern is specified, a default pattern is used. The default pattern will try to find files with this naming convention as the data files for this table: `${db_name}.${table_name}.[numeric_index].${format_suffix}`.\n\nHere are some examples of filenames that can be matched as data files for the table `db01.table01`: `db01.table01.csv`, `db01.table01.00001.csv`.\n\nFor more information about the custom file pattern and the default pattern, refer to [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Note:** For `LOCAL_FILE` import tasks, use the local file name for this field. The local file name must match the local file name in [Upload a local file for an import task](#tag/Import/operation/UploadLocalFile)." } }, "description": "ImportTargetTable represents the settings for importing source data into a single target table of an import task.", "title": "ImportTargetTable", "required": [ "database_name", "table_name" ] }, "description": "The settings for each target table that is being imported for the import task. If you leave it empty, the system will scan all the files in the data source using the default file patterns and collect all the tables to import. The files include data files, table schema files, and DB schema files. If you provide a list of tables, only those tables will be imported. For more information about the default file pattern, see [Import CSV Files from Amazon S3 or GCS into TiDB Cloud](https://docs.pingcap.com/tidbcloud/import-csv-files).\n\n**Limitations:**\n* Currently, if you want to use a custom filename pattern, you can only specify one table. If all the tables use the default filename pattern, you can specify more than one target table in `tables`.\n* It is recommended that you pre-create the target tables before creating an import task. You can do this either by executing the `CREATE TABLE` statement in the cluster or by specifying the table definition in the table creation options.\n* If a target table is not created, the import module tries to find a **TABLE SCHEMA FILE** containing the `CREATE TABLE` statement of the table in the data source folder with the name `${db_name}.${table_name}-schema.sql` (for example, `db01.tbl01-schema.sql`). If this file is found, the `CREATE TABLE` statement is automatically executed if the table doesn't exist before the actual import process starts. If the table is still missing after this pre-create step, an error will occur." } }, "title": "ImportTarget" } }, "title": "ImportSpec", "required": [ "source", "target" ] }, "status": { "description": "The status of the import task.", "type": "object", "properties": { "phase": { "example": "IMPORTING", "description": "The current phase that the import task is in.", "type": "string", "enum": [ "PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED" ] }, "error_message": { "type": "string", "example": "some error occurs", "description": "The error message of the import task." }, "start_timestamp": { "type": "string", "format": "timestamp", "example": "1676450597", "description": "The start timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)" }, "end_timestamp": { "type": "string", "format": "timestamp", "example": "1676450897", "description": "The end timestamp of the import task. The format is Unix timestamp (the seconds elapsed since the Unix epoch)." }, "progress": { "description": "The progress of the import task.", "type": "object", "properties": { "import_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall importing progress of the import task.", "maximum": 100 }, "validation_progress": { "type": "number", "format": "double", "example": 59, "description": "The overall validation progress of the import task after the data has been imported into the target cluster.", "maximum": 100 } }, "title": "ImportProgress", "required": [ "import_progress", "validation_progress" ] }, "source_total_size_bytes": { "type": "string", "format": "uint64", "example": "10737418240", "description": "The total size of the import task's data source. The unit is bytes." } }, "title": "ImportStatus", "required": [ "phase" ] } }, "description": "ImportItem represents the information of a single import task.", "title": "ImportItem" }, "description": "The import tasks in the cluster in the request page area." }, "total": { "type": "integer", "format": "int64", "example": 20, "description": "The total number of import tasks in the cluster." } }, "description": "ListImportTasksResp is the response for listing the import tasks of a cluster.", "title": "ListImportTasksResp", "required": [ "items", "total" ] }, "openapiListPrivateEndpointsOfProjectResp": { "type": "object", "properties": { "endpoints": { "type": "array", "format": "array", "items": { "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } }, "description": "The private endpoints in the project." } }, "description": "ListPrivateEndpointsOfProjectResp is the response for listing private endpoints for a project.", "title": "ListPrivateEndpointsOfProjectResp", "required": [ "endpoints" ] }, "openapiListPrivateEndpointsResp": { "type": "object", "properties": { "endpoints": { "type": "array", "format": "array", "items": { "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } }, "description": "The private endpoints for the cluster." } }, "description": "ListPrivateEndpointsResp is the response for listing private endpoints for a cluster.", "title": "ListPrivateEndpointsResp", "required": [ "endpoints" ] }, "openapiListProjectItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "org_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the TiDB Cloud organization to which the project belongs." }, "name": { "type": "string", "example": "default_project", "description": "The name of the project." }, "cluster_count": { "type": "integer", "format": "int64", "example": 4, "description": "The number of TiDB Cloud clusters deployed in the project." }, "user_count": { "type": "integer", "format": "int64", "example": 10, "description": "The number of users in the project." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "aws_cmek_enabled": { "type": "boolean", "example": false, "default": false, "description": "Flag that indicates whether to enable AWS Customer-Managed Encryption Keys (CMEK). For more information, see [Encryption at Rest using CMEK](https://docs.pingcap.com/tidbcloud/tidb-cloud-encrypt-cmek).\n\n**Note:** Currently, this feature is only available upon request. If you need to try out this feature, contact [support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support)." }, "type": { "type": "string", "example": "dedicated", "description": "The type of the project. For more information, see [Project Migration FAQ for TiDB X Instances](https://docs.pingcap.com/tidbcloud/tidbx-instance-move-faq/?plan=starter#what-project-types-are-available-in-tidb-cloud). Possible values are:\n- `dedicated`: a project for TiDB Cloud Dedicated clusters.\n- `tidbx`: a project for TiDB X instances.\n- `tidbx_virtual`: a virtual project for TiDB X instances not grouped in any TiDB X project." } }, "description": "ListProjectItem is the item of projects.", "title": "ListProjectItem" }, "openapiListProjectsResp": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the project." }, "org_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the TiDB Cloud organization to which the project belongs." }, "name": { "type": "string", "example": "default_project", "description": "The name of the project." }, "cluster_count": { "type": "integer", "format": "int64", "example": 4, "description": "The number of TiDB Cloud clusters deployed in the project." }, "user_count": { "type": "integer", "format": "int64", "example": 10, "description": "The number of users in the project." }, "create_timestamp": { "type": "string", "format": "timestamp", "example": "1656991448", "description": "The creation time of the cluster in Unix timestamp seconds (epoch time)." }, "aws_cmek_enabled": { "type": "boolean", "example": false, "default": false, "description": "Flag that indicates whether to enable AWS Customer-Managed Encryption Keys (CMEK). For more information, see [Encryption at Rest using CMEK](https://docs.pingcap.com/tidbcloud/tidb-cloud-encrypt-cmek).\n\n**Note:** Currently, this feature is only available upon request. If you need to try out this feature, contact [support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support)." }, "type": { "type": "string", "example": "dedicated", "description": "The type of the project. For more information, see [Project Migration FAQ for TiDB X Instances](https://docs.pingcap.com/tidbcloud/tidbx-instance-move-faq/?plan=starter#what-project-types-are-available-in-tidb-cloud). Possible values are:\n- `dedicated`: a project for TiDB Cloud Dedicated clusters.\n- `tidbx`: a project for TiDB X instances.\n- `tidbx_virtual`: a virtual project for TiDB X instances not grouped in any TiDB X project." } }, "description": "ListProjectItem is the item of projects.", "title": "ListProjectItem" }, "description": "The items of accessible projects." }, "total": { "type": "integer", "format": "int64", "example": 1, "description": "The total number of accessible projects." } }, "description": "GetProjectsResp is the response for getting accessible projects.", "title": "GetProjectsResp", "required": [ "total", "items" ] }, "openapiListProviderRegionsItem": { "type": "object", "properties": { "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type.\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "The region in which your TiDB cluster is hosted.\n\nFor the detailed information on each region, refer to the documentation of the corresponding cloud provider ([AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) | [GCP](https://cloud.google.com/about/locations#americas)).\n\nFor example, `\"us-west-2\"` refers to Oregon for AWS." }, "tidb": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiDB component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } } } }, "description": "The list of TiDB specifications in the region." }, "tikv": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "description": "The list of TiKV specifications in the region." }, "tiflash": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "description": "The list of TiFlash specifications in the region." } }, "description": "ListProviderRegionsItem is the item of provider regions.", "title": "ListProviderRegionsItem" }, "openapiListProviderRegionsResp": { "type": "object", "properties": { "items": { "type": "array", "format": "array", "example": [ { "cluster_type": "DEDICATED", "cloud_provider": "AWS", "region": "us-west-2", "tidb": [ { "node_size": "8C16G", "node_quantity_range": { "min": 1, "step": 1 } } ], "tikv": [ { "node_size": "8C32G", "node_quantity_range": { "min": 3, "step": 3 }, "storage_size_gib_range": { "min": 500, "max": 4096 } } ], "tiflash": [ { "node_size": "8C64G", "node_quantity_range": { "min": 0, "step": 1 }, "storage_size_gib_range": { "min": 500, "max": 2048 } } ] }, { "cluster_type": "DEVELOPER", "cloud_provider": "AWS", "region": "us-west-2", "tidb": [ { "node_size": "Shared0", "node_quantity_range": { "min": 1, "step": 1 } } ], "tikv": [ { "node_size": "Shared0", "node_quantity_range": { "min": 1, "step": 1 }, "storage_size_gib_range": { "min": 1, "max": 1 } } ], "tiflash": [ { "node_size": "Shared0", "node_quantity_range": { "min": 1, "step": 1 }, "storage_size_gib_range": { "min": 1, "max": 1 } } ] } ], "items": { "type": "object", "properties": { "cluster_type": { "format": "enum", "example": "DEDICATED", "description": "The cluster type.\n- `\"DEVELOPER\"`: a [TiDB Cloud Starter](https://docs.pingcap.com/tidbcloud/select-cluster-tier/#tidb-cloud-serverless) cluster\n- `\"DEDICATED\"`: a [TiDB Cloud Dedicated](https://docs.pingcap.com/tidbcloud/select-cluster-tier#tidb-cloud-dedicated) cluster.", "type": "string", "enum": [ "DEDICATED", "DEVELOPER" ] }, "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which your TiDB cluster is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "region": { "type": "string", "example": "us-west-2", "description": "The region in which your TiDB cluster is hosted.\n\nFor the detailed information on each region, refer to the documentation of the corresponding cloud provider ([AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html) | [GCP](https://cloud.google.com/about/locations#americas)).\n\nFor example, `\"us-west-2\"` refers to Oregon for AWS." }, "tidb": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiDB component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } } } }, "description": "The list of TiDB specifications in the region." }, "tikv": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "description": "The list of TiKV specifications in the region." }, "tiflash": { "type": "array", "items": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "description": "The list of TiFlash specifications in the region." } }, "description": "ListProviderRegionsItem is the item of provider regions.", "title": "ListProviderRegionsItem" }, "description": "Items of provider regions." } }, "description": "GetProviderRegionsResp is the response for getting provider regions.", "title": "GetProviderRegionsResp" }, "openapiListRestoreOfProjectResp": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC.\n\nThe time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "backup_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The cluster ID of the backup." }, "status": { "example": "PENDING", "description": "The status of the restore task.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "cluster": { "description": "The information of the restored cluster. The restored cluster is the new cluster your backup data is restored to.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "name": { "type": "string", "example": "cluster-1", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "status": { "type": "string", "example": "AVAILABLE", "description": "The status of the restored cluster. Possible values are `\"AVAILABLE\"`, `\"CREATING\"`, `\"MODIFYING\"`, `\"PAUSED\"`, `\"RESUMING\"`, `\"UNAVAILABLE\"`, `\"IMPORTING\"`, and `\"CLEARED\"`." } }, "title": "ClusterInfoOfRestore" }, "error_message": { "type": "string", "example": "Please contact support.", "description": "The error message of restore if failed." } }, "description": "The items of all restore tasks.", "title": "ListRestoreRespItem" }, "description": "The items of all restore tasks." }, "total": { "type": "integer", "format": "int64", "example": 10, "description": "The total number of restore tasks in the project." } }, "description": "This response for list restore.", "title": "ListRestoreResp" }, "openapiListRestoreRespItem": { "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restore task." }, "create_timestamp": { "type": "string", "format": "date-time", "example": "2020-01-01T00:00:00Z", "description": "The creation time of the backup in UTC.\n\nThe time format follows the [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) standard, which is `YYYY-MM-DD` (year-month-day) + T +`HH:MM:SS` (hour-minutes-seconds) + Z. For example, `2020-01-01T00:00:00Z`." }, "backup_id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the backup." }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "The cluster ID of the backup." }, "status": { "example": "PENDING", "description": "The status of the restore task.", "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "cluster": { "description": "The information of the restored cluster. The restored cluster is the new cluster your backup data is restored to.", "type": "object", "properties": { "id": { "type": "string", "format": "uint64", "example": "1", "description": "The ID of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "name": { "type": "string", "example": "cluster-1", "description": "The name of the restored cluster. The restored cluster is the new cluster your backup data is restored to." }, "status": { "type": "string", "example": "AVAILABLE", "description": "The status of the restored cluster. Possible values are `\"AVAILABLE\"`, `\"CREATING\"`, `\"MODIFYING\"`, `\"PAUSED\"`, `\"RESUMING\"`, `\"UNAVAILABLE\"`, `\"IMPORTING\"`, and `\"CLEARED\"`." } }, "title": "ClusterInfoOfRestore" }, "error_message": { "type": "string", "example": "Please contact support.", "description": "The error message of restore if failed." } }, "description": "The items of all restore tasks.", "title": "ListRestoreRespItem" }, "openapiListRestoreRespItemStatusEnum": { "type": "string", "enum": [ "PENDING", "RUNNING", "FAILED", "SUCCESS" ] }, "openapiLocalFilePayload": { "type": "object", "properties": { "total_size_bytes": { "type": "string", "format": "uint64", "example": "83", "description": "The total size of the **ACTUAL** local file contents, not the total size of the `content` field.\n\nThe unit is byte, and the maximum value is `52428800` (50 MiB). If the given value of `total_size_bytes` exceeds the maximum value, an error will be reported.", "maximum": 52428800 }, "content": { "type": "string", "format": "byte", "example": "H4sIABbP9mMAAyXHOwoAIQwFwN5jvPoh5neggI2w9Z7fSJqBOZt/fvLQIURmLgFlrqE9BbVmPQOt5j0HvRa9AKN2AUwss6dTAAAA", "description": "The base64-encoded content of the local file to be imported. The maximum size of the file should be 52428800 (50 MiB).\n\n**Note:** Before providing the content, process the file by taking the following steps:\n1. Compress the file using the **gzip** algorithm.\n2. Encode the compressed data using the **base64** algorithm.", "maxLength": 52428800 } }, "description": "LocalFilePayload represents the payload to upload a local file content for importing.", "title": "LocalFilePayload", "required": [ "total_size_bytes", "content" ] }, "openapiNodeQuantityRange": { "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "openapiNodeStatus": { "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] }, "openapiNodeStorageSizeRange": { "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } }, "openapiPreviewImportDataResp": { "type": "object", "properties": { "table_previews": { "type": "array", "items": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The database name of the preview table." }, "table_name": { "type": "string", "example": "table01", "description": "The table name of the preview table." }, "schema_preview": { "description": "The schema for the preview table.", "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "title": "TableSchema", "required": [ "column_definitions" ] }, "data_preview": { "description": "The data sample for the preview table.", "type": "object", "properties": { "column_names": { "type": "array", "example": [ "id", "column01" ], "items": { "type": "string" }, "description": "The column names for the following data samples from a table." }, "rows": { "type": "array", "items": { "type": "object", "properties": { "columns": { "type": "array", "example": [ "1", "abc" ], "items": { "type": "string" }, "description": "The columns extracted from a table row." } }, "description": "TableDataRow is a single row in a table.", "title": "TableDataRow", "required": [ "columns" ] }, "description": "The rows sampled from a table." } }, "title": "TableData", "required": [ "rows" ] } }, "description": "TablePreview is the preview result for a single table.", "title": "TablePreview", "required": [ "database_name", "table_name", "data_preview" ] }, "description": "The preview results for each target table from the import task specification." } }, "description": "PreviewImportDataResp is the response of the source data preview before starting an import task.", "title": "PreviewImportDataResp" }, "openapiPrivateEndpoint": { "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "[Output Only] The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "cluster_id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of the cluster." }, "cluster_name": { "type": "string", "example": "Cluster0", "description": "[Output Only] The name of the cluster." }, "region_name": { "type": "string", "example": "Oregon", "description": "[Output Only] The region where the private endpoint is hosted, such as Oregon in AWS." }, "endpoint_name": { "type": "string", "format": "string", "example": "vpce-01234567890123456", "description": "The format of the private endpoint name varies by cloud provider: `\"vpce-xxxx\"` for AWS and `\"projects/xxx/regions/xxx/forwardingRules/xxx\"` for Google Cloud." }, "status": { "format": "enum", "example": "FAILED", "description": "[Output Only] The status of the private endpoint.", "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "message": { "type": "string", "format": "enum", "example": "The endpoint does not exist.", "description": "[Output Only] The detailed message when the `status` is \"FAILED\"." }, "service_name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "[Output Only] The service name of the private endpoint." }, "service_status": { "format": "enum", "example": "ACTIVE", "description": "[Output Only] The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "id": { "type": "string", "format": "uint64", "example": "1", "description": "[Output Only] The ID of private endpoint. It is used when you [deleting the endpoint](#tag/Cluster/operation/DeletePrivateEndpoint)." } } }, "openapiPrivateEndpointService": { "type": "object", "properties": { "cloud_provider": { "format": "string", "example": "AWS", "description": "The cloud provider on which the private endpoint service is hosted.\n- `\"AWS\"`: the Amazon Web Services cloud provider\n- `\"GCP\"`: the Google Cloud cloud provider", "type": "string", "enum": [ "AWS", "GCP" ] }, "name": { "type": "string", "format": "string", "example": "com.amazonaws.vpce.us-west-2.vpce-svc-01234567890123456", "description": "The name of the private endpoint service, which is used for connection." }, "status": { "format": "enum", "example": "ACTIVE", "description": "The status of the private endpoint service.", "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "dns_name": { "type": "string", "format": "string", "example": "privatelink-tidb.01234567890.clusters.tidb-cloud.com", "description": "The DNS name of the private endpoint service." }, "port": { "type": "integer", "format": "int32", "example": 4000, "description": "The port of the private endpoint service." }, "az_ids": { "type": "array", "format": "array", "example": [ "usw2-az2", "usw2-az1" ], "items": { "type": "string" }, "description": "Availability zones for the private endpoint service. This field is only applicable when the `cloud_provider` is `\"AWS\"`." } } }, "openapiPrivateEndpointServiceStatus": { "type": "string", "enum": [ "CREATING", "ACTIVE", "DELETING" ] }, "openapiPrivateEndpointStatus": { "type": "string", "enum": [ "PENDING", "ACTIVE", "DELETING", "FAILED" ] }, "openapiStandardConnection": { "type": "object", "properties": { "host": { "type": "string", "example": "tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of standard connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "openapiTableData": { "type": "object", "properties": { "column_names": { "type": "array", "example": [ "id", "column01" ], "items": { "type": "string" }, "description": "The column names for the following data samples from a table." }, "rows": { "type": "array", "items": { "type": "object", "properties": { "columns": { "type": "array", "example": [ "1", "abc" ], "items": { "type": "string" }, "description": "The columns extracted from a table row." } }, "description": "TableDataRow is a single row in a table.", "title": "TableDataRow", "required": [ "columns" ] }, "description": "The rows sampled from a table." } }, "description": "TableData represents some data samples from a table.", "title": "TableData", "required": [ "rows" ] }, "openapiTableDataRow": { "type": "object", "properties": { "columns": { "type": "array", "example": [ "1", "abc" ], "items": { "type": "string" }, "description": "The columns extracted from a table row." } }, "description": "TableDataRow is a single row in a table.", "title": "TableDataRow", "required": [ "columns" ] }, "openapiTableDefinition": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The database name of the table." }, "table_name": { "type": "string", "example": "table01", "description": "The table name of the table." }, "schema": { "description": "The schema for the table.", "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "title": "TableSchema", "required": [ "column_definitions" ] } }, "description": "TableDefinition is the definition of a table so that the table can be created with this information.", "title": "TableDefinition", "required": [ "database_name", "table_name", "schema" ] }, "openapiTablePreview": { "type": "object", "properties": { "database_name": { "type": "string", "example": "db01", "description": "The database name of the preview table." }, "table_name": { "type": "string", "example": "table01", "description": "The table name of the preview table." }, "schema_preview": { "description": "The schema for the preview table.", "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "title": "TableSchema", "required": [ "column_definitions" ] }, "data_preview": { "description": "The data sample for the preview table.", "type": "object", "properties": { "column_names": { "type": "array", "example": [ "id", "column01" ], "items": { "type": "string" }, "description": "The column names for the following data samples from a table." }, "rows": { "type": "array", "items": { "type": "object", "properties": { "columns": { "type": "array", "example": [ "1", "abc" ], "items": { "type": "string" }, "description": "The columns extracted from a table row." } }, "description": "TableDataRow is a single row in a table.", "title": "TableDataRow", "required": [ "columns" ] }, "description": "The rows sampled from a table." } }, "title": "TableData", "required": [ "rows" ] } }, "description": "TablePreview is the preview result for a single table.", "title": "TablePreview", "required": [ "database_name", "table_name", "data_preview" ] }, "openapiTableSchema": { "type": "object", "properties": { "column_definitions": { "type": "array", "example": [ { "column_name": "id", "column_type": "INTEGER" }, { "column_name": "column01", "column_type": "VARCHAR(255)" } ], "items": { "type": "object", "properties": { "column_name": { "type": "string", "example": "column01", "description": "The column name." }, "column_type": { "type": "string", "example": "VARCHAR(255)", "description": "The column type." } }, "description": "ColumnDefinition is the definition of a column in a table.", "title": "ColumnDefinition", "required": [ "column_name", "column_type" ] }, "description": "The column definition for each column in the table." }, "primary_key_columns": { "type": "array", "example": [ "id" ], "items": { "type": "string" }, "description": "The primary key column names for the table. This is optional. The primary key is taken into account when the table is pre-created before an import task is started." } }, "description": "TableSchema is the schema definition of a single table.", "title": "TableSchema", "required": [ "column_definitions" ] }, "openapiTiDBComponent": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "node_quantity": { "type": "integer", "format": "int32", "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" } }, "required": [ "node_size", "node_quantity" ] }, "openapiTiDBNodeMap": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tidb-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "17179869184", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "openapiTiDBProfile": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C16G", "description": "The size of the TiDB component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiDB component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } } } }, "openapiTiFlashComponent": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n" }, "node_quantity": { "type": "integer", "format": "int32", "example": 1, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "openapiTiFlashNodeMap": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tiflash-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "openapiTiFlashProfile": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiFlash component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiFlash component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "openapiTiKVComponent": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." }, "node_quantity": { "type": "integer", "format": "int32", "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } }, "required": [ "node_size", "storage_size_gib", "node_quantity" ] }, "openapiTiKVNodeMap": { "type": "object", "properties": { "node_name": { "type": "string", "example": "tikv-0", "description": "The name of a node in the cluster." }, "availability_zone": { "type": "string", "example": "us-west-2a", "description": "The availability zone of a node in the cluster." }, "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "vcpu_num": { "type": "integer", "format": "int32", "example": 8, "description": "The total vCPUs of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `vcpu_num` is always 0." }, "ram_bytes": { "type": "string", "format": "int64", "example": "68719476736", "description": "The RAM size of a node in the cluster. If the `cluster_type` is `\"DEVELOPER\"`, `ram_bytes` is always 0." }, "storage_size_gib": { "type": "integer", "format": "int32", "example": 1024, "description": "The storage size of a node in the cluster." }, "status": { "example": "NODE_STATUS_AVAILABLE", "description": "The status of a node in the cluster.", "type": "string", "enum": [ "NODE_STATUS_AVAILABLE", "NODE_STATUS_UNAVAILABLE", "NODE_STATUS_CREATING", "NODE_STATUS_DELETING" ] } } }, "openapiTiKVProfile": { "type": "object", "properties": { "node_size": { "type": "string", "example": "8C32G", "description": "The size of the TiKV component in the cluster." }, "node_quantity_range": { "description": "The range and step of node quantity of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum node quantity of the component in the cluster." }, "step": { "type": "integer", "format": "int32", "description": "The step of node quantity of the component in the cluster." } } }, "storage_size_gib_range": { "description": "The storage size range for each node of the TiKV component in the cluster.", "type": "object", "properties": { "min": { "type": "integer", "format": "int32", "description": "The minimum storage size for each node of the component in the cluster." }, "max": { "type": "integer", "format": "int32", "description": "The maximum storage size for each node of the component in the cluster." } } } } }, "openapiUpdateClusterComponents": { "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C32G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiKV.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiKV, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 6, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } } }, "tiflash": { "description": "The TiFlash component of the cluster.\n\nIf you want to add TiFlash nodes to a cluster that does not have one before (increase the node_quantity of `\"TIFLASH\"` from 0), you must specify the `node_size`, `storage_size_gib` and `node_quantity` of TiFlash nodes.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C128G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiFlash.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiFlash, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } } } }, "openapiUpdateClusterConfig": { "type": "object", "properties": { "components": { "description": "The components of the cluster.", "type": "object", "properties": { "tidb": { "description": "The TiDB component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C32G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } }, "tikv": { "description": "The TiKV component of the cluster.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiKV.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiKV, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 6, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } } }, "tiflash": { "description": "The TiFlash component of the cluster.\n\nIf you want to add TiFlash nodes to a cluster that does not have one before (increase the node_quantity of `\"TIFLASH\"` from 0), you must specify the `node_size`, `storage_size_gib` and `node_quantity` of TiFlash nodes.", "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C128G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiFlash.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiFlash, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } } } }, "paused": { "type": "boolean", "x-nullable": true, "description": "Flag that indicates whether the cluster is paused. `true` means to pause the cluster, and `false` means to resume the cluster. For more details, refer to [Pause or Resume a TiDB Cluster](https://docs.pingcap.com/tidbcloud/pause-or-resume-tidb-cluster).\n\n**Limitations:**\n - The cluster can be paused only when the `cluster_status` is `\"AVAILABLE\"`.\n- The cluster can be resumed only when the `cluster_status` is `\"PAUSED\"`." } }, "description": "UpdateClusterComponents is the request for updating cluster components.", "title": "UpdateClusterComponents" }, "openapiUpdateTiDBComponent": { "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C32G", "description": "The size of the TiDB component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 3, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } }, "openapiUpdateTiFlashComponent": { "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C128G", "description": "The size of the TiFlash component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiFlash.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiFlash, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions)." } } }, "openapiUpdateTiKVComponent": { "type": "object", "properties": { "node_size": { "type": "string", "x-nullable": true, "example": "16C64G", "description": "The size of the TiKV component in the cluster. You can get the available node size of each region from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Additional combination rules**:\n- If the vCPUs of TiDB or TiKV component is 4, then their vCPUs need to be the same.\n- If the vCPUs of TiDB or TiKV component is 4, then the cluster does not support TiFlash.\n\n**Limitations**:\n- See [Change node size](https://docs.pingcap.com/tidbcloud/scale-tidb-cluster#change-node-size)." }, "storage_size_gib": { "type": "integer", "format": "int32", "x-nullable": true, "example": 2048, "description": "The storage size of a node in the cluster. You can get the minimum and maximum of storage size from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- You cannot decrease storage size for TiKV.\n- If your TiDB cluster is hosted by AWS, after changing the storage size of TiKV, you must wait at least six hours before you can change it again." }, "node_quantity": { "type": "integer", "format": "int32", "x-nullable": true, "example": 6, "description": "The number of nodes in the cluster. You can get the minimum and step of a node quantity from the response of [List the cloud providers, regions and available specifications](#tag/Cluster/operation/ListProviderRegions).\n\n**Limitations**:\n- The `node_quantity` of TiKV must be a multiple of 3." } } }, "openapiUploadLocalFileResp": { "type": "object", "properties": { "upload_stub_id": { "type": "string", "format": "uint64", "example": "123", "description": "The stub ID for the uploaded file. You can use this stub ID to [create an import task](#tag/Import/operation/CreateImportTask)." } }, "description": "UploadLocalFileResp is the response to upload an import task.", "title": "UploadLocalFileResp", "required": [ "upload_stub_id" ] }, "openapiVPCPeeringConnection": { "type": "object", "properties": { "host": { "type": "string", "example": "private-tidb.f69f3808.acea1f2a.us-east-1.shared.aws.tidbcloud.com", "description": "The host of VPC peering connection." }, "port": { "type": "integer", "format": "int32", "example": 4000, "default": 4000, "description": "The TiDB port for connection. The port must be in the range of 1024-65535 except 10080.\n\n**Limitations**:\n- For a TiDB Cloud Starter instance, only port `4000` is available.", "maximum": 65535, "minimum": 1024 } } }, "protobufAny": { "type": "object", "properties": { "@type": { "type": "string" } }, "additionalProperties": {} } }, "x-tagGroups": [ { "name": "Endpoints", "tags": [ "Project", "Cluster", "Backup", "Import", "Restore" ] } ] }