From 43ca592859676ada349dddbbf5b96271f112e1f5 Mon Sep 17 00:00:00 2001 From: Suhaha Date: Mon, 9 Dec 2024 14:25:39 +0800 Subject: [PATCH] fix: oai resource (#562) --- ...tidbcloud-oas-v1beta1-billing.swagger.json | 727 + ...cloud-oas-v1beta1-dataservice.swagger.json | 2310 ++ .../tidbcloud-oas-v1beta1-iam.swagger.json | 2310 ++ static/openapi/tidbcloud-oas-v1beta1-msp.json | 685 + static/openapi/tidbcloud-oas.json | 18669 ++++++++++++++++ 5 files changed, 24701 insertions(+) create mode 100644 static/openapi/tidbcloud-oas-v1beta1-billing.swagger.json create mode 100644 static/openapi/tidbcloud-oas-v1beta1-dataservice.swagger.json create mode 100644 static/openapi/tidbcloud-oas-v1beta1-iam.swagger.json create mode 100644 static/openapi/tidbcloud-oas-v1beta1-msp.json create mode 100644 static/openapi/tidbcloud-oas.json diff --git a/static/openapi/tidbcloud-oas-v1beta1-billing.swagger.json b/static/openapi/tidbcloud-oas-v1beta1-billing.swagger.json new file mode 100644 index 000000000..2ddbced36 --- /dev/null +++ b/static/openapi/tidbcloud-oas-v1beta1-billing.swagger.json @@ -0,0 +1,727 @@ +{ + "swagger": "2.0", + "info": { + "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.\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.\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 **Organization Settings** 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 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 have 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://billing.tidbapi.com/v1beta1/bills/2023-09\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 \"overview\": {\n \"billedMonth\": \"2023-09\",\n \"credits\": \"0.00\",\n \"discounts\": \"0.00\",\n \"runningTotal\": \"0.00\",\n \"totalCost\": \"0.00\"\n },\n \"summaryByProject\": {\n \"otherCharges\": [\n {\n \"credits\": \"0.00\",\n \"discounts\": \"0.00\",\n \"otherName\": \"Support Plan\",\n \"runningTotal\": \"0.00\",\n \"totalCost\": \"0.00\"\n }\n ],\n \"projects\": [\n {\n \"credits\": \"0.00\",\n \"discounts\": \"0.00\",\n \"projectName\": \"prod-project\",\n \"runningTotal\": \"0.00\",\n \"totalCost\": \"0.00\"\n }\n ]\n },\n \"summaryByService\": [\n {\n \"credits\": \"0.00\",\n \"discounts\": \"0.00\",\n \"runningTotal\": \"0.00\",\n \"serviceCosts\": [\n {}\n ],\n \"serviceName\": \"TiDB Dedicated\",\n \"totalCost\": \"0.00\"\n }\n ]\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 `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. Click **Organization** in the lower-left corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab and then click **Create API Key**.\n4. Enter a description for your API key. The role of the API key is always `Owner` currently.\n5. Click **Next**. Copy and save the public key and the private key.\n6. 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.\n7. Click **Done**.\n\n### View details of an API key\n\nTo view details of an API key, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. You can view the details of the API keys in the menu.\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. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Edit** in the API key row that you want to change.\n4. You can update the API key description.\n5. Click **Done**.\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. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Delete** in the API key row that you want to delete.\n5. Click **I understand the consequences, delete this API Key.**\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## 2024-05-23\n\n- Add the [Return the monthly bill with daily usage details](#tag/Billing/paths/~1billsDetails~1%7BbilledMonth%7D/get) endpoint.\n- Add the [Return the usage details according to a cost explorer query](#tag/Billing/paths/~1billsCostExplorer/post) endpoint.\n- Add the [Return basic info of a specific organization](#tag/Billing/paths/~1billsCostExplorer~1args/get) endpoint.\n## 2023-09-28\n\n- Add the [Return monthly bill](#tag/bills/paths/~1bills~1%7BYYYY-MM%7D/get) endpoint.\n", + "title": "Billing System OPENAPI", + "contact": {}, + "version": "v1beta1" + }, + "x-tagGroups": [ + { + "name": "Endpoints", + "tags": ["Billing"] + } + ], + "host": "billing.tidbapi.com", + "basePath": "/v1beta1", + "paths": { + "/bills/{billedMonth}": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://billing.tidbapi.com/v1beta1/bills/{billedMonth}'" + } + ], + "description": "This endpoint retrieves the bill for the given month of a specific organization. You can query a bill up to 6 months prior to the current month. The bill is returned in JSON format.To use this resource, the requesting API Key must have the Organization Billing Admin or Organization Owner role.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return organization monthly bills", + "parameters": [ + { + "type": "string", + "description": "The month of this bill happens for the specified organization, format is YYYY-MM, for example '2023-08'.", + "name": "billedMonth", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/forms.BillsExplorer" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + }, + "/billsCostExplorer": { + "post": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://billing.tidbapi.com/v1beta1/billsCostExplorer'" + } + ], + "description": "This endpoint executes a cost explorer query and returns the usage details. Cost Explorer query:", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return the usage details according to a cost explorer query", + "parameters": [ + { + "description": "args", + "name": "args", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/forms.TrendsInput" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/forms.BillsCostExplorer" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + }, + "/billsCostExplorer/args": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://billing.tidbapi.com/v1beta1/billsCostExplorer/args'" + } + ], + "description": "This endpoint retrieves the basic info for a specific organization, including service info, cloud provider info, project info, and cluster info.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return basic info of a specific organization, which contains the key info to execute a cost explorer query", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/forms.TrendsArgs" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + }, + "/billsDetails/{billedMonth}": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://billing.tidbapi.com/v1beta1/billsDetails/{billedMonth}'" + } + ], + "description": "This endpoint retrieves the bill for the given month of a specific organization with daily usage details. You can query a bill up to 6 months prior to the current month. The bill is returned in JSON format. To use this resource, the requesting API Key must have the Organization Billing Admin or Organization Owner role.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return the monthly bill of the organization with daily usage details", + "parameters": [ + { + "type": "string", + "description": "The month of this bill happens for the specified organization. The format is `YYYY-MM`, for example '2024-05'.", + "name": "billedMonth", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/forms.BillsDetails" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + } + }, + "definitions": { + "billing_errors.BaseError": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "error": {}, + "msgPrefix": { + "type": "string" + }, + "status": { + "type": "integer" + } + } + }, + "forms.BillsCostExplorer": { + "type": "object", + "properties": { + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsCostExplorerElements" + } + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsCostExplorerBreakdown": { + "type": "object", + "properties": { + "billedDate": { + "type": "string" + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "detailKey": { + "type": "string" + }, + "detailName": { + "type": "string" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsCostExplorerElements": { + "type": "object", + "properties": { + "billedDate": { + "type": "string" + }, + "breakdown": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsCostExplorerBreakdown" + } + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsDetail": { + "type": "object", + "properties": { + "billedDate": { + "description": "The date when this bill happens.", + "type": "string" + }, + "clusterName": { + "description": "Name of the cluster.", + "type": "string" + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "projectName": { + "description": "Name of the project.", + "type": "string" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "servicePathName": { + "description": "Name of the service.", + "type": "string" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsDetails": { + "type": "object", + "properties": { + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsDetail" + } + } + } + }, + "forms.BillsExplorer": { + "type": "object", + "properties": { + "overview": { + "description": "The overall information for a bill in the specified organization.", + "allOf": [ + { + "$ref": "#/definitions/forms.BillsOverview" + } + ] + }, + "summaryByProject": { + "description": "A breakdown of the bill by project.", + "allOf": [ + { + "$ref": "#/definitions/forms.SummaryByProject" + } + ] + }, + "summaryByService": { + "description": "A breakdown of the bill by service.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsServiceCosts" + } + } + } + }, + "forms.BillsOtherName": { + "type": "object", + "properties": { + "chargeName": { + "type": "string", + "example": "Support Plan" + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsOverview": { + "type": "object", + "properties": { + "billedMonth": { + "description": "The month in which this bill is generated for the specified organization.", + "type": "string", + "example": "2023-09" + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsProjects": { + "type": "object", + "properties": { + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "projectName": { + "description": "The name of a project in the specified organization.", + "type": "string", + "example": "prod-project" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.BillsServiceCosts": { + "type": "object", + "properties": { + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "discounts": { + "description": "The total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "runningTotal": { + "description": "The sum of services that the specified organization has consumed during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "string", + "example": "0.00" + }, + "serviceCosts": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsServiceCosts" + } + }, + "serviceName": { + "description": "The name of services provided by TiDB Cloud.", + "type": "string", + "example": "TiDB Dedicated" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay for this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "string", + "example": "0.00" + } + } + }, + "forms.ClusterOpenAPI": { + "type": "object", + "properties": { + "ProjectID": { + "type": "string", + "example": "0" + }, + "id": { + "type": "string", + "example": "0" + }, + "name": { + "type": "string" + }, + "regionName": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "forms.CostExplorerProvider": { + "type": "object", + "properties": { + "name": { + "description": "Name of Cloud provider.", + "type": "string" + }, + "regions": { + "description": "Name of region.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "forms.CostExplorerService": { + "type": "object", + "properties": { + "category": { + "description": "2nd level of service.", + "type": "string" + }, + "component": { + "description": "3rd level of service.", + "type": "string" + }, + "product": { + "description": "1st level of service.", + "type": "string" + }, + "service": { + "type": "string" + } + } + }, + "forms.CostExplorerTrendsBreakdownKey": { + "type": "string", + "enum": [ + "service", + "product", + "project", + "cluster", + "provider", + "region" + ], + "x-enum-varnames": [ + "CostExploreTrendsBreakdownKeyService", + "CostExploreTrendsBreakdownKeyProduct", + "CostExploreTrendsBreakdownKeyProject", + "CostExploreTrendsBreakdownKeyCluster", + "CostExploreTrendsBreakdownKeyProvider", + "CostExploreTrendsBreakdownKeyRegion" + ] + }, + "forms.CostExplorerTrendsTimeGroup": { + "type": "string", + "enum": ["day", "month", "total"], + "x-enum-varnames": [ + "CostExploreTrendsTimeGroupDay", + "CostExploreTrendsTimeGroupMonth", + "CostExploreTrendsTimeGroupTotal" + ] + }, + "forms.Groups": { + "type": "object", + "properties": { + "groupBy": { + "description": "Group cost explorer query results by category. The category includes:\n 1. \"service\": Group query results by service type\n 2. \"product\": Group query results by product type (TiDB Dedicated, TiDB Serverless, or Support Plan)\n 3. \"project\": Group query results by Project IDs\n 4. \"cluster\": Group query results by Cluster IDs\n 5. \"provider\": Group query results by Cloud Provider\n 6. \"region\": Group query results by cloud provider region", + "type": "array", + "items": { + "$ref": "#/definitions/forms.CostExplorerTrendsBreakdownKey" + } + }, + "timeGranularity": { + "description": "Time Granularity determines how the cost explorer query results are organized daily, monthly, or in total.\n 1. \"day\": Query results are organized daily\n 2. \"month\": Query results are organized monthly\n 3. \"total\": Query results are organized in total", + "allOf": [ + { + "$ref": "#/definitions/forms.CostExplorerTrendsTimeGroup" + } + ] + } + } + }, + "forms.ProjectOpenAPI": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "0" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "forms.Provider": { + "type": "object", + "properties": { + "name": { + "description": "Name of the cloud provider", + "type": "string" + }, + "regions": { + "description": "Name of the region", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "forms.SummaryByProject": { + "type": "object", + "properties": { + "otherCharges": { + "description": "These charges occur not only within a project but also across the entire organization.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsOtherName" + } + }, + "projects": { + "description": "The projects in the specified organization.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsProjects" + } + } + } + }, + "forms.TimeRange": { + "type": "object", + "properties": { + "endDate": { + "description": "End date of the time range.", + "type": "string" + }, + "startDate": { + "description": "Start date of the time range.", + "type": "string" + } + } + }, + "forms.TrendsArgs": { + "type": "object", + "properties": { + "clusters": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.ClusterOpenAPI" + } + }, + "projects": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.ProjectOpenAPI" + } + }, + "providers": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.Provider" + } + }, + "services": { + "description": "The Identifier of TiDB Cloud services consists of 3 levels. For example, \"service\": \"TiDB Dedicated - Node Compute - TiFlash\" consists of the following 3 levels.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.CostExplorerService" + } + } + } + }, + "forms.TrendsFilter": { + "type": "object", + "properties": { + "clusters": { + "type": "array", + "items": { + "type": "string" + } + }, + "projects": { + "type": "array", + "items": { + "type": "string" + } + }, + "providers": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.CostExplorerProvider" + } + }, + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.CostExplorerService" + } + }, + "timeRange": { + "$ref": "#/definitions/forms.TimeRange" + } + } + }, + "forms.TrendsInput": { + "type": "object", + "properties": { + "filter": { + "$ref": "#/definitions/forms.TrendsFilter" + }, + "groups": { + "$ref": "#/definitions/forms.Groups" + } + } + } + } +} diff --git a/static/openapi/tidbcloud-oas-v1beta1-dataservice.swagger.json b/static/openapi/tidbcloud-oas-v1beta1-dataservice.swagger.json new file mode 100644 index 000000000..8fde65d26 --- /dev/null +++ b/static/openapi/tidbcloud-oas-v1beta1-dataservice.swagger.json @@ -0,0 +1,2310 @@ +{ + "swagger": "2.0", + "info": { + "title": "TiDB Cloud Data Service OPENAPI", + "description": "# Overview\n\nThe TiDB Cloud Data Service API provides a [RESTful interface](https://en.wikipedia.org/wiki/Representational_state_transfer) for programmatically managing administrative objects within the [TiDB Cloud Data Service](https://docs.pingcap.com/tidbcloud/data-service-overview). Through this API, you can manage the following resources automatically and efficiently:\n\n* **Data App**: a collection of endpoints that you can use to access data for a specific application.\n* **Data Source**: clusters linked to Data Apps for data manipulation and retrieval.\n* **Endpoint**: a web API that you can customize to execute SQL statements. You can specify parameters for the SQL statements, such as the value used in the `WHERE` clause. When a client calls an endpoint and provides values for the parameters in a request URL, the endpoint executes the SQL statement with the provided parameters and returns the results as part of the HTTP response.\n* **Deployment**: the process of deploying Data Apps.\n* **Data API Key**: used for secure endpoint access. This key is used to access data in the TiDB Cloud clusters, whereas the TiDB Cloud organization API key is used to manage resources such as projects, clusters, Data Apps, and endpoints.\n* **OpenAPI Specification**: Data Service supports generating the OpenAPI Specification 3.0 for each Data App, which enables you to interact with your endpoints in a standardized format. You can use this specification to generate standardized OpenAPI documentation, client SDKs, and server stubs.\n\n# Get Started\n\nThis guide helps you make your first API call to TiDB Cloud Data Service API. You'll learn how to authenticate a request, build a request, and interpret the response. The [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps) 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 organization API key\n\nTo create an organization API key, log in to your TiDB Cloud console. Navigate to the **Organization Settings** page, and create an API key.\n\nAn organization 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 organization 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 Data Service API call have the following components:\n\n- **A host.** The host for TiDB Cloud Data Service API is .\n- **An organization 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 Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps) endpoint. For a detailed description of the endpoint, see the [API reference](#tag/Data-App/operation/DataApp_ListDataApps).\n\n### Call an API endpoint\n\nTo get all Data Apps in your project, run the following command in your terminal. Replace `YOUR_PUBLIC_KEY`, `YOUR_PRIVATE_KEY`, and `YOUR_PROJECT_ID` with your actual values. To get the project ID, you can call the [List all accessible projects](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project/operation/ListProjects) endpoint.\n\n```bash\ncurl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps?projectId=YOUR_PROJECT_ID'\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 Data Apps in your project, your request is successful. Here is an example of a successful response.\n\n```log\n{\n \"dataApps\": [\n {\n \"dataAppId\": \"{data_app_id}\",\n \"name\": \"dataApps/{data_app_id}\",\n \"version\": \"\",\n \"projectId\": \"{project_id}\",\n \"clusterIds\": [],\n \"appType\": \"DATAAPP\",\n \"displayName\": \"New Data App\",\n \"description\": \"\",\n \"createdAt\": \"2023-06-03T06:52:08Z\",\n \"updatedAt\": \"2023-06-03T06:52:08Z\"\n },\n {\n \"dataAppId\": \"{data_app_id}\",\n \"name\": \"dataApps/{data_app_id}\",\n \"version\": \"\",\n \"projectId\": \"{project_id}\",\n \"clusterIds\": [],\n \"appType\": \"CHAT2QUERY\",\n \"displayName\": \"New App\",\n \"description\": \"\",\n \"createdAt\": \"2023-06-03T06:52:08Z\",\n \"updatedAt\": \"2023-06-03T06:52:08Z\"\n }\n ],\n \"nextPageToken\": \"\"\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\": 403,\n \"message\": \"Request error, projectId not exist\",\n \"details\": []\n}\n```\n\n# Call a Deployed Data Service Endpoint\n\nIf you have deployed a Data Service endpoint, you can call it using the Data API key. To begin, follow these steps:\n\n1. Generate a Data API key by calling the [Create an API key for a Data App](#tag/Data-API-Key/operation/APIKey_CreateApiKey) endpoint. You can run the following `curl` command and replace `YOUR_PUBLIC_KEY`, `YOUR_PRIVATE_KEY`, and `YOUR_DATAAPP_ID` with your actual values. Note that `YOUR_PUBLIC_KEY` and `YOUR_PRIVATE_KEY` are [organization API keys](#section/Authentication/Organization-API-key-overview).\n\n ```bash\n curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/YOUR_DATAAPP_ID/apiKeys'\\\n --header 'Content-Type: application/json' \\\n --data '{\n \"description\": \"A new API Key\",\n \"role\": \"READ_AND_WRITE\",\n \"rateLimitRpm\": 100\n }'\n ```\n\n2. Call the deployed endpoint. Suppose that you have created a `GET` endpoint named `/hello`, with the request URL as `https://data.tidbcloud.com/api/v1beta/app/DATAAPP_ID/endpoint/hello`. To call this endpoint, replace `YOUR_DATAAPP_PUBLIC_KEY` and `YOUR_DATAAPP_PRIVATE_KEY` with the values obtained from the response in step 1, and replace `YOUR_DATAAPP_ID` with the actual Data App ID in the following command:\n\n ```bash\n curl --location-trusted --digest \\\n --user 'YOUR_DATAAPP_PUBLIC_KEY:YOUR_DATAAPP_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://data.tidbcloud.com/api/v1beta/app/YOUR_DATAAPP_ID/endpoint/hello'\n ```\n \n For improved performance, you can call the endpoint using the regional domain name. Replace `REGION` with the specific region name to which the cluster belongs, such as `us-west-2`.\n \n ```bash\n curl --digest \\\n --user 'YOUR_DATAAPP_PUBLIC_KEY:YOUR_DATAAPP_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://REGION.data.tidbcloud.com/api/v1beta/app/DATAAPP_ID/endpoint/hello'\n ```\n\n# Authentication\n\nThe TiDB Cloud Data Service 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## Organization API key overview\n\n- The organization 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 organization API key belongs to your organization and acts as the `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 organization API key in every request. Otherwise, the TiDB Cloud responds with a `401` error.\n\n## Organization API key management\n\n### Create an organization API key\n\nOnly the **owner** of an organization can create an organization API key.\n\nTo create an organization API key in an organization, perform the following steps:\n\n1. Click **Organization** in the lower-left corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab and then click **Create API Key**.\n4. Enter a description for your API key. The role of the API key is always `Owner` currently.\n5. Click **Next**. Copy and save the public key and the private key.\n6. 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.\n7. Click **Done**.\n\n### View details of an organization API key\n\nTo view details of an organization API key, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. You can view the details of the API keys in the menu.\n\n### Edit an organization API key\n\nOnly the **owner** of an organization can modify an organization API key.\n\nTo edit an organization API key in an organization, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Edit** in the API key row that you want to change.\n4. You can update the API key description.\n5. Click **Done**.\n\n### Delete an organization API key\n\nOnly the **owner** of an organization can delete an organization API key.\n\nTo delete an organization API key in an organization, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Delete** in the API key row that you want to delete.\n5. Click **I understand the consequences, delete this API Key.**\n\n# Rate Limiting\n\nThe TiDB Cloud Data Service 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 Data Service API.\n\n\n\n## 20240910\n\n- The [Update Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings) endpoint removes the support for the `gpt-3.5-turbo` model and adds support for `gpt-4o` and `gpt-4o-mini` models.\n\n- \"TiDB Serverless\" is renamed to \"TiDB Cloud Serverless\".\n- \"TiDB Dedicated\" is renamed to \"TiDB Cloud Dedicated\".\n\n## 20240806\n\n- Add the [List all system endpoints in a Data App](#tag/Data-App/operation/DataAppsService_GetSystemEndpointConfig) endpoint.\n\n- Add the [Update the configuration of system endpoints](#tag/Data-App/operation/DataAppsService_UpdateSystemEndpointConfig) endpoint.\n\n## 20240716\n\n- The [Update Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings) endpoint removes the support for Claude models.\n\n## 20240528\n\n- Initial release of the TiDB Cloud Data Service API, including the following resources and endpoints:\n\n - Data App:\n - [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps)\n - [Create a Data App](#tag/Data-App/operation/DataApp_CreateDataApp)\n - [Get Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_GetChat2QuerySettings)\n - [Update Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings)\n - [Update a Data App](#tag/Data-App/operation/DataApp_UpdateDataApp)\n - [Get a Data App by ID](#tag/Data-App/operation/DataApp_GetDataApp)\n - [Delete a Data App](#tag/Data-App/operation/DataApp_DeleteDataApp)\n - Data Source:\n - [List all data sources in a Data App](#tag/Data-Source/operation/DataSource_ListDataSources)\n - [Create a data source for a Data App](#tag/Data-Source/operation/DataSource_CreateDataSource)\n - [Get a data source by ID](#tag/Data-Source/operation/DataSource_GetDataSource)\n - [Delete a data source for a Data App](#tag/Data-Source/operation/DataSource_DeleteDataSource)\n - Endpoint:\n - [List all endpoints in a Data App](#tag/Deployment/operation/Deployment_ListDeployments)\n - [Create an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_CreateEndpoint)\n - [Update an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_UpdateEndpoint)\n - [Get an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_GetEndpoint)\n - [Delete an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_DeleteEndpoint)\n - [Test an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_TestEndpoint)\n - Deployment:\n - [List all deployments for a Data App](#tag/Deployment/operation/Deployment_ListDeployments)\n - [Create a deployment for a Data App](#tag/Deployment/operation/Deployment_CreateDeployment)\n - [Get a deployment by ID](#tag/Deployment/operation/Deployment_GetDeployment)\n - Data API Key:\n - [List all API keys for a Data App](#tag/Data-API-Key/operation/APIKey_ListApiKeys)\n - [Create an API key for a Data App](#tag/Data-API-Key/operation/APIKey_CreateApiKey)\n - [Update an API key for a Data App](#tag/Data-API-Key/operation/APIKey_UpdateApiKey)\n - [Get an API key by ID](#tag/Data-API-Key/operation/APIKey_GetApiKey)\n - [Delete an API key for a Data App](#tag/Data-API-Key/operation/APIKey_DeleteApiKey)\n - OpenAPI Specification:\n - [Get the OpenAPI Specification of a Data App](#tag/OpenAPI-Specification/operation/APISpecification_GetApiSpec)\n", + "version": "v1beta1" + }, + "tags": [ + { + "name": "Data App", + "description": "Create, get, update, delete, and list Data Apps." + }, + { + "name": "Data Source", + "description": "Create, get, delete, and list data sources of a Data App." + }, + { + "name": "Endpoint", + "description": "Create, get, delete, list, and test endpoints of a Data App." + }, + { + "name": "Deployment", + "description": "Create, get, and list deployments of a Data App." + }, + { + "name": "Data API Key", + "description": "Create, get, update, delete, and list Data API keys of a Data App. The Data API key in Data Service is different from the key used in the [TiDB Cloud API](https://docs.pingcap.com/tidbcloud/api/v1beta#section/Authentication). The Data API key is used to access data in the TiDB Cloud clusters, whereas the TiDB Cloud API key is used to manage resources such as projects, clusters, Data Apps, and endpoints." + }, + { + "name": "OpenAPI Specification", + "description": "Get the OpenAPI specification of a Data App." + } + ], + "x-tagGroups": [ + { + "name": "Endpoints", + "tags": [ + "Data App", + "Data Source", + "Endpoint", + "Deployment", + "Data API Key", + "OpenAPI Specification" + ] + } + ], + "host": "dataservice.tidbapi.com", + "schemes": ["https"], + "consumes": ["application/json"], + "produces": ["application/json"], + "paths": { + "/v1beta1/dataApps": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps?projectId={projectId}&pageSize=5'" + } + ], + "summary": "List all Data Apps in a project.", + "operationId": "DataApp_ListDataApps", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ListDataAppsResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "The ID of the project that the Data App belongs to. You can get the project ID from the response of [List all accessible projects](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project/operation/ListProjects).", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Data App"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"version\": \"1.0.0\", \n \"projectId\": \"{projectId}\", \n \"clusterIds\": [\n \"{clusterIds}\"\n ], \n \"appType\": \"DATAAPP\", \n \"displayName\": \"app-01\", \n \"description\": \"A new data app\" \n }'" + } + ], + "summary": "Create a Data App.", + "operationId": "DataApp_CreateDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataAppRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataApp", + "description": "DataApp", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1DataApp" + } + } + ], + "tags": ["Data App"] + } + }, + "/v1beta1/dataApps/{dataAppId}/systemEndpointConfig": { + "get": { + "summary": "List all system endpoints in a Data App.", + "description": "TiDB Cloud Data Service provides an endpoint library with predefined system endpoints that you can directly add to your Data App, reducing the effort in your endpoint development.\n\nFor example, the `POST:/system/query` system endpoint enables you to execute any SQL statement by simply passing the statement in the predefined `sql` parameter. This endpoint facilitates the immediate execution of SQL queries, enhancing flexibility and efficiency.", + "operationId": "DataAppsService_GetSystemEndpointConfig", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/systemEndpointConfig'" + } + ], + "tags": ["Data App"] + }, + "patch": { + "summary": "Update the configuration of system endpoints.", + "description": "With this endpoint, you can enable or disable the system endpoints in a Data App.", + "operationId": "DataAppsService_UpdateSystemEndpointConfig", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/systemEndpointConfig' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"items\": {\n \"type\": \"system-data\", \n \"key\": \"POST:/system/query\", \n \"enabled\": true \n }\n }'" + } + ], + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "systemEndpointConfig", + "description": "To update the configuration of system endpoints in a Data App, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigItem" + }, + "description": "The configuration items of system endpoints in a Data App.", + "required": ["items"] + } + }, + "title": "System Endpoint Config", + "required": ["items"] + } + } + ], + "tags": ["Data App"] + } + }, + "/v1beta1/dataApps/{dataAppId}/chat2querySettings": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/chat2querySettings'" + } + ], + "summary": "Get Chat2Query Data App settings by ID.", + "description": "With this endpoint, you can get the settings of a Chat2Query Data App, such as `name`, `llmApiKey`, `languageCode`, and `llmModel`. To get basic information, such as `version`, `projectId`, and `clusterIds`, use the [Get a Data App by ID](#tag/Data-App/operation/DataApp_GetDataApp) endpoint instead.", + "operationId": "DataApp_GetChat2QuerySettings", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1Chat2QuerySettingsRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data App", "Chat2Query"] + }, + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/chat2querySettings' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"llmModel\": \"gpt-4\", \n \"llmApiKey\": \"sk-projxxxx\", \n \"languageCode\": \"English\" \n }'" + } + ], + "summary": "Update Chat2Query Data App settings by ID.", + "description": "With this endpoint, you can update the `llmApiKey`, `languageCode`, or `llmModel` settings of a Chat2Query Data App. To update the version, name, or description, use the [Update a Data App](#tag/Data-App/operation/DataApp_UpdateDataApp) endpoint instead.", + "operationId": "DataApp_UpdateChat2QuerySettings", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1Chat2QuerySettingsRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "chat2querySettings", + "description": "To update the settings of a Chat2Query App, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "llmApiKey": { + "type": "string", + "description": "The access key required to use your large language model (LLM) service. Leaving this blank limits you to 100 queries per day. To bypass the query limit, specify your access key of [OpenAI models](https://platform.openai.com/docs/models) in the `sk-xxxx` format.", + "required": ["llmApiKey"] + }, + "languageCode": { + "type": "string", + "description": "The language to use for this Chat2Query Data App. Value options: `\"English\"` or `\"Chinese\"`.", + "required": ["languageCode"] + }, + "llmModel": { + "type": "string", + "description": "The LLM model to use for this Chat2Query Data App.\n**Note:** You cannot use the `gpt-4` or `gpt-4o` model without a valid `llmApiKey`. Value options: `gpt-4`, `gpt-4o`, `gpt-4o-mini`.", + "required": ["llmModel"] + } + }, + "title": "Define your fields as needed for updating a Chat2Query App Settings" + } + } + ], + "tags": ["Data App", "Chat2Query"] + } + }, + "/v1beta1/dataApps/{dataAppId}": { + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"version\": \"1.0.1\", \n \"displayName\": \"app-02\", \n \"description\": \"Update a data app\" \n }'" + } + ], + "summary": "Update a Data App.", + "description": "With this endpoint, you can update the `version`, `name`, or `description` of a Data App. To update the `llmApiKey`, `languageCode`, or `llmModel` settings of a Chat2Query App, use the [Update Chat2Query App settings by Data App ID](#tag/Data-App/operation/DataApp_GetChat2QuerySettings) endpoint instead.", + "operationId": "DataApp_UpdateDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataAppRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "dataApp", + "description": "To update a Data App, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "The user-defined version number of the Data App, in the format of `x.x.x`.", + "pattern": "^[1-9]\\.[0-9]\\.[0-9]$", + "example": "1.0.0", + "default": "1.0.0" + }, + "displayName": { + "type": "string", + "description": "The user-defined name of the Data App.", + "maxLength": 32, + "minLength": 1 + }, + "description": { + "type": "string", + "description": "The user-defined description of the Data App.", + "maxLength": 0, + "minLength": 1000 + } + }, + "title": "Define your fields as needed for updating a Data App" + } + } + ], + "tags": ["Data App"] + }, + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}'" + } + ], + "summary": "Get a Data App by ID.", + "description": "With this endpoint, you can get the basic information of a Data App, such as `name`, `version`, `projectId`, and `clusterIds`. To get the `llmApiKey`, `languageCode`, and `llmModel` of a Chat2Query Data App, use the [Get Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings) endpoint instead.", + "operationId": "DataApp_GetDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataAppRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data App"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}'" + } + ], + "summary": "Delete a Data App.", + "operationId": "DataApp_DeleteDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "properties": {} + } + }, + "default": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data App"] + } + }, + "/v1beta1/dataApps/{dataAppId}/dataSources": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources?pageSize=5'" + } + ], + "summary": "List all data sources in a Data App.", + "operationId": "DataSource_ListDataSources", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ListDataSourcesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Data Source"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"clusterId\": \"{clusterId}\"\n }'" + } + ], + "summary": "Create a data source for a Data App.", + "description": "With this endpoint, you can link a cluster to a Data App. Then, the Data App can access and manipulate data in the cluster.", + "operationId": "DataSource_CreateDataSource", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataSource" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "dataSource", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "clusterId": { + "type": "string", + "description": "The ID of the cluster that needs to be linked to the Data App." + } + }, + "required": ["clusterId"] + } + } + ], + "tags": ["Data Source"] + } + }, + "/v1beta1/dataApps/{dataAppId}/dataSources/{clusterId}": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources/{clusterId}'" + } + ], + "summary": "Get a data source by ID.", + "operationId": "DataSource_GetDataSource", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataSource" + } + }, + "default": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "description": "The ID of the cluster that is linked to the Data App.", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data Source"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources/{clusterId}'" + } + ], + "summary": "Delete a data source for a Data App.", + "description": "With this endpoint, you can unlink a cluster from a Data App. Then, the existing endpoints in the Data App cannot access the cluster anymore.", + "operationId": "DataSource_DeleteDataSource", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "properties": {} + } + }, + "default": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "description": "The ID of the cluster that is linked to the Data App.", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data Source"] + } + }, + "/v1beta1/dataApps/{dataAppId}/endpoints": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/endpoints?pageSize=5'" + } + ], + "summary": "List all endpoints in a Data App.", + "operationId": "Endpoint_ListEndpoints", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ListEndpointsResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Endpoint"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/endpoints' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"displayName\": \"/v1/hello\", \n \"description\": \"/v1/hello endpoint\", \n \"path\": \"/v1/hello\", \n \"method\": \"GET\", \n \"clusterId\": \"{clusterId}\", \n \"settings\": {\n \"timeout\": 30000, \n \"rowLimit\": 2000, \n \"paginationEnabled\": false, \n \"cacheEnabled\": false\n }, \n \"tag\": \"Default\", \n \"sqlTemplate\": \"select 'Hello World';\" \n }'" + } + ], + "summary": "Create an endpoint for a Data App.", + "operationId": "Endpoint_CreateEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1EndpointRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "endpoint", + "description": "Endpoint", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1Endpoint" + } + } + ], + "tags": ["Endpoint"] + } + }, + "/v1beta1/dataApps/{endpoint.name}": { + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"displayName\": \"/v2/hello\", \n \"description\": \"/v2/hello endpoint\", \n \"path\": \"/v2/hello\", \n \"method\": \"GET\", \n \"clusterId\": \"{clusterId}\", \n \"settings\": {\n \"timeout\": 30000, \n \"rowLimit\": 2000, \n \"paginationEnabled\": false, \n \"cacheEnabled\": false\n }, \n \"tag\": \"V2\", \n \"sqlTemplate\": \"select 'Hello World New';\" \n }'" + } + ], + "summary": "Update an endpoint for a Data App.", + "operationId": "Endpoint_UpdateEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1EndpointRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + }, + { + "name": "endpoint", + "description": "To update an endpoint, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1Endpoint" + } + } + ], + "tags": ["Endpoint"] + }, + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}'" + } + ], + "summary": "Get an endpoint for a Data App.", + "operationId": "Endpoint_GetEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1EndpointRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + } + ], + "tags": ["Endpoint"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}'" + } + ], + "summary": "Delete an endpoint for a Data App.", + "description": "Before you delete an endpoint, make sure that the endpoint is not online. Otherwise, the endpoint cannot be deleted.", + "operationId": "Endpoint_DeleteEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + } + ], + "tags": ["Endpoint"] + } + }, + "/v1beta1/{endpoint.name}/test": { + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}/test' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"args\": [\n {\n \"items\": {}\n }\n ] \n }'" + } + ], + "summary": "Test an endpoint for a Data App.", + "operationId": "Endpoint_TestEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1TestEndpointResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + }, + { + "name": "endpoint.param", + "description": "The parameter values used for testing the endpoint.", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointArgs" + } + } + }, + "required": ["args"] + } + } + ], + "tags": ["Endpoint"] + } + }, + "/v1beta1/dataApps/{dataAppId}/apiKeys": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys?pageSize=5'" + } + ], + "summary": "List all API keys for a Data App.", + "operationId": "APIKey_ListApiKeys", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ListApiKeysResponse" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Data API Key"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"description\": \"A new API Key.\",\n \"role\": \"READ_AND_WRITE\",\n \"rateLimitRpm\": 100\n }'" + } + ], + "summary": "Create an API key for a Data App.", + "description": "For each Data App, you can create up to **100** API keys.", + "operationId": "APIKey_CreateApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKey", + "description": "Data API Key", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + } + ], + "tags": ["Data API Key"] + } + }, + "/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}": { + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"description\": \"Update a API Key.\",\n \"role\": \"READ_AND_WRITE\",\n \"rateLimitRpm\": 50\n }'" + } + ], + "summary": "Update an API key for a Data App.", + "description": "With this endpoint, you can update the description, role, rate limit, or expiration time of an API key.\n\n**Note:** You cannot update an expired key.", + "operationId": "APIKey_UpdateApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + }, + "default": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKeyId", + "description": "The ID of the API key, which is returned when you [create an API key](#tag/Data-API-Key/operation/APIKey_CreateApiKey).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKey", + "description": "Data API Key", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + } + ], + "tags": ["Data API Key"] + }, + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}'" + } + ], + "summary": "Get an API key by ID.", + "operationId": "APIKey_GetApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKeyId", + "description": "The ID of the API key, which is returned when you [Create an API key](#tag/Data-API-Key/operation/APIKey_CreateApiKey).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data API Key"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}'" + } + ], + "summary": "Delete an API key for a Data App.", + "description": "Before you delete an API key, make sure that the API key is not used by any Data App.", + "operationId": "APIKey_DeleteApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKeyId", + "description": "The ID of the API key, which is returned when you [Create an API key](#tag/Data-API-Key/operation/APIKey_CreateApiKey).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data API Key"] + } + }, + "/v1beta1/dataApps/{dataAppId}/deployments": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/deployments?pageSize=5'" + } + ], + "summary": "List all deployments for a Data App.", + "operationId": "Deployment_ListDeployments", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ListDeploymentsResponse" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Deployment"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/deployments' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"description\": \"Deploy a data app.\"\n }'" + } + ], + "summary": "Create a deployment for a Data App.", + "operationId": "Deployment_CreateDeployment", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1Deployment" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deployment", + "description": "Deployment", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The description of the deployment." + } + } + } + } + ], + "tags": ["Deployment"] + } + }, + "/v1beta1/dataApps/{dataAppId}/deployments/{deploymentId}": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/deployments/{deploymentId}'" + } + ], + "summary": "Get a deployment by ID.", + "operationId": "Deployment_GetDeployment", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1Deployment" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentId", + "description": "The ID of the deployment, which is returned when you [Create a deployment](#tag/Deployment/operation/Deployment_CreateDeployment).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Deployment"] + } + }, + "/v1beta1/dataApps/{dataAppId}/apiSpec": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiSpec'" + } + ], + "summary": "Get the OpenAPI Specification of a Data App.", + "description": "TiDB Cloud Data Service supports generating the OpenAPI Specification 3.0 for each Data App, which enables you to interact with your endpoints in a standardized format. You can use this specification to generate standardized OpenAPI documentation, client SDKs, and server stubs.", + "operationId": "APISpecification_GetApiSpec", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ApiSpec" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "format", + "description": "The format of the generated OpenAPI Specification.", + "in": "query", + "required": false, + "type": "string", + "enum": ["JSON", "YAML"], + "default": "JSON" + } + ], + "tags": ["OpenAPI Specification"] + } + } + }, + "definitions": { + "ApiKeyApiKeyExpireSetting": { + "type": "object", + "properties": { + "expireOption": { + "$ref": "#/definitions/ApiKeyExpireOption", + "default": "EXPIRE_OPTION_NEVER_EXPIRE" + }, + "apiKeyTtl": { + "type": "integer", + "format": "int64", + "description": "The expiration time for the key, in minutes.\nThe filed is only available when `expireOption` is set to `EXPIRE_OPTION_SET_TTL`.", + "minimum": 1, + "maximum": 525600 + } + }, + "description": "The expiration settings for the API key." + }, + "ApiKeyExpireOption": { + "type": "string", + "enum": ["EXPIRE_OPTION_NEVER_EXPIRE", "EXPIRE_OPTION_SET_TTL"], + "default": "EXPIRE_OPTION_NEVER_EXPIRE", + "description": "The method used to determine the API key's expiration:\n- `EXPIRE_OPTION_NEVER_EXPIRE`: this key will never expire\n - `EXPIRE_OPTION_SET_TTL`: this key will expire after the time specified by `apikeyTtl`" + }, + "ApiKeyExpireState": { + "type": "string", + "enum": [ + "EXPIRE_STATE_NEVER_EXPIRE", + "EXPIRE_STATE_EXPIRED", + "EXPIRE_STATE_NOT_EXPIRE" + ], + "default": "EXPIRE_STATE_NEVER_EXPIRE", + "description": "The expiration state of the API key:\n- `EXPIRE_STATE_NEVER_EXPIRE`: this API key never expires\n - `EXPIRE_STATE_EXPIRED`: this API key has expired\n - `EXPIRE_STATE_NOT_EXPIRE`: this API key is currently active" + }, + "ApiKeyRole": { + "type": "string", + "enum": ["READ_AND_WRITE", "READ_ONLY"], + "default": "READ_ONLY", + "description": "Controls whether the API key can read or write data to the clusters linked to the Data App.\n- `READ_AND_WRITE`: allows the API key to read and write data. You can use this API key to execute all SQL statements, such as DML and DDL statements.\n - `READ_ONLY`: only allows the API key to read data, such as `SELECT`, `SHOW`, `USE`, `DESC`, and `EXPLAIN` statements." + }, + "DeploymentOriginInfo": { + "type": "object", + "properties": { + "commit": { + "type": "string", + "description": "The commit ID associated with the deployment.", + "readOnly": true + }, + "diffUrl": { + "type": "string", + "description": "The URL to view the diff of the changes in the commit.", + "readOnly": true + } + }, + "description": "If the `origin` is `\"GitHub\"`, this filed displays the corresponding commit information." + }, + "GetApiSpecRequestFormat": { + "type": "string", + "enum": ["FORMAT_UNSPECIFIED", "JSON", "YAML"], + "default": "FORMAT_UNSPECIFIED", + "description": "- FORMAT_UNSPECIFIED: Unspecified. Do not use\n - JSON: Json format\n - YAML: Yaml format", + "title": "Api specification content format" + }, + "TestEndpointResponseColumn": { + "type": "object", + "properties": { + "col": { + "type": "string", + "description": "The column name of the requested data table." + }, + "dataType": { + "type": "string", + "description": "The column type of the requested data table." + }, + "nullable": { + "type": "boolean", + "description": "Whether the column of the requested data table supports null values." + } + } + }, + "TestEndpointResponseData": { + "type": "object", + "properties": { + "columns": { + "type": "array", + "items": { + "$ref": "#/definitions/TestEndpointResponseColumn" + }, + "description": "Returns the columns and columns' details of the requested data table of the endpoint." + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/definitions/TestEndpointResponseRow" + }, + "description": "Return the columns and data results of the requested data table of the endpoint." + }, + "result": { + "$ref": "#/definitions/TestEndpointResponseResult" + } + }, + "title": "Endpoint request data" + }, + "TestEndpointResponseResult": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "description": "HTTPS status code of the request." + }, + "message": { + "type": "string", + "description": "HTTPS result message of the request. If the status code returned by the request is 200, OK is returned here. If there is an error in the request, the specific reason for the error is returned." + }, + "startMs": { + "type": "string", + "format": "int64", + "description": "The request's start timestamp. For example: 1704871891280" + }, + "endMs": { + "type": "string", + "format": "int64", + "description": "The request's end timestamp. For example: 1704871891474" + }, + "latency": { + "type": "string", + "description": "The request latency. For example: 194ms" + }, + "rowCount": { + "type": "integer", + "format": "int32", + "description": "The number of rows that the request should return. Sometimes the maximum number of returned rows set by the user is exceeded. But in the end, only the number of rows returned is the minimum of these two values." + }, + "rowAffect": { + "type": "integer", + "format": "int32", + "description": "When executing non-query SQL statements, the number of rows affected." + }, + "limit": { + "type": "integer", + "format": "int32", + "description": "The maximum number of returned rows set by the request." + } + }, + "description": "Return basic information about request execution. For example: whether the execution is successful, execution time, number of items returned, etc." + }, + "TestEndpointResponseRow": { + "type": "object", + "properties": { + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The columns and data results of the requested data table of the endpoint." + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1beta1ApiKeyRes": { + "type": "object", + "properties": { + "apiKeyId": { + "type": "string", + "format": "uint64", + "description": "The ID of the API key." + }, + "name": { + "type": "string", + "description": "The unique identifier for the API key, which is generated by the API and follows the format `dataApps/{dataAppId}/apiKeys/{apiKey}`." + }, + "publicKey": { + "type": "string", + "description": "The public key for the API key." + }, + "privateKey": { + "type": "string", + "description": "The private key for the API key. This is only fully displayed when the key is initially created. For security reasons, subsequent requests will obscure most of the key, revealing only the last four characters." + }, + "description": { + "type": "string", + "description": "The description of the API key." + }, + "role": { + "$ref": "#/definitions/ApiKeyRole", + "description": "The role of the API key." + }, + "rateLimitRpm": { + "type": "integer", + "format": "int32", + "description": "The maximum number of API requests allowed per minute using this key." + }, + "expireState": { + "$ref": "#/definitions/ApiKeyExpireState", + "description": "Expire state of the API Key" + }, + "expireTime": { + "type": "string", + "description": "The time at which the API key will expire. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + }, + "apiKeyExpireSetting": { + "$ref": "#/definitions/ApiKeyApiKeyExpireSetting", + "description": "The expiration settings for the API key." + } + }, + "description": "An API key of a Data App" + }, + "v1beta1ApiKey": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The description of the API key." + }, + "role": { + "$ref": "#/definitions/ApiKeyRole", + "description": "Role of the API Key" + }, + "rateLimitRpm": { + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 1000, + "description": "The maximum number of API requests allowed per minute using this key. For Chat2Query Data Apps, you cannot modify this field." + }, + "apiKeyExpireSetting": { + "$ref": "#/definitions/ApiKeyApiKeyExpireSetting", + "description": "The API Key expire setting" + } + }, + "description": "An API key of a Data App. ", + "required": ["description", "role", "rateLimitRpm"] + }, + "v1beta1ApiSpec": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the OpenAPI Specification, which is generated by the API and follows the format `dataApps/{dataAppId}/apiSpec`." + }, + "content": { + "type": "string", + "description": "The content of the OpenAPI Specification for the Data App." + } + }, + "title": "ApiSpec resource" + }, + "v1beta1DataApp": { + "type": "object", + "properties": { + "dataAppId": { + "type": "string", + "description": "The ID of the Data App.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "The unique identifier for the Data App, which is generated by the API and follows the format `dataApps/{dataAppId}`", + "readOnly": true + }, + "projectId": { + "type": "string", + "description": "The ID of the project that the Data App belongs to. You can get the project ID from the response of [List all accessible projects](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project/operation/ListProjects).", + "required": ["projectId"] + }, + "clusterIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The IDs of the clusters that the Data App's data source is linked to." + }, + "appType": { + "$ref": "#/definitions/v1beta1DataAppType", + "description": "The type of the Data App.\n - `DATAAPP`: standard Data APP\n - `CHAT2QUERY`: Chat2Query Data App" + }, + "version": { + "type": "string", + "description": "The user-defined version number of the Data App, in the format of `x.x.x`.", + "pattern": "^[1-9]\\.[0-9]\\.[0-9]$", + "example": "1.0.0", + "default": "1.0.0", + "required": ["version"] + }, + "displayName": { + "type": "string", + "description": "The user-defined name of the Data App.", + "minLength": 1, + "maxLength": 32, + "required": ["displayName"] + }, + "description": { + "type": "string", + "description": "The user-defined description of the Data App.", + "minLength": 0, + "maxLength": 1000, + "required": ["description"] + }, + "createdAt": { + "type": "string", + "title": "The timestamp when the Data App was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + }, + "updatedAt": { + "type": "string", + "title": "The timestamp when the Data App was last updated. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + } + } + }, + "v1beta1DataAppType": { + "type": "string", + "enum": ["DATAAPP", "CHAT2QUERY"], + "description": "The type of the Data App.\n - `DATAAPP`: standard Data APP\n - `CHAT2QUERY`: Chat2Query Data App" + }, + "v1beta1SystemEndpointConfigRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the system endpoint configurations in a Data App, which is generated by the API and follows the format `dataApps/{data_app}/systemEndpointConfig`." + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigItem" + }, + "description": "The configuration items of system endpoints in a Data App.", + "required": ["items"] + } + }, + "title": "Response for UpdateSystemEndpointConfig", + "required": ["items"] + }, + "v1beta1SystemEndpointConfigItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of the system endpoint.", + "example": "system-data", + "required": ["type"] + }, + "key": { + "type": "string", + "description": "The key of the system endpoint, combining the HTTP method and endpoint path. For example: `\"POST:/system/query\"`.", + "example": "POST:/system/query", + "required": ["key"] + }, + "enabled": { + "type": "boolean", + "description": "Controls whether to enable the system endpoint in a Data App.", + "required": ["enabled"] + } + }, + "required": ["type", "key", "enabled"] + }, + "v1beta1Chat2QuerySettingsRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the Chat2Query Data App settings, which is generated by the API and follows the format `dataApps/{data_app}/chat2querySettings`." + }, + "llmApiKey": { + "type": "string", + "description": "The access key required to use your large language model (LLM) service.", + "required": ["llmApiKey"] + }, + "languageCode": { + "type": "string", + "description": "The language to use for this Chat2Query Data App.", + "required": ["languageCode"] + }, + "llmModel": { + "type": "string", + "description": "The LLM model to use for this Chat2Query Data App.", + "required": ["llmModel"] + } + }, + "required": ["llmApiKey", "languageCode", "llmModel"] + }, + "v1beta1DataAppRes": { + "type": "object", + "properties": { + "dataAppId": { + "type": "string", + "description": "The ID of the Data App.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "The unique identifier for the Data App, which is generated by the API and follows the format `dataApps/{data_app_id}`." + }, + "version": { + "type": "string", + "description": "The user-defined version number of the Data App.", + "default": "1.0.0" + }, + "projectId": { + "type": "string", + "description": "The ID of the project that the Data App belongs to." + }, + "clusterIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The IDs of the clusters that the Data App's data source is linked to." + }, + "appType": { + "$ref": "#/definitions/v1beta1DataAppType", + "description": "The type of the Data App.\n - `DATAAPP`: standard Data APP\n - `CHAT2QUERY`: Chat2Query Data App" + }, + "displayName": { + "type": "string", + "description": "The user-defined name of the Data App." + }, + "description": { + "type": "string", + "description": "The user-defined description of the Data App." + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the Data App was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + }, + "updatedAt": { + "type": "string", + "description": "The timestamp when the Data App was last updated. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + } + } + }, + "v1beta1DataSource": { + "type": "object", + "properties": { + "clusterId": { + "type": "string", + "description": "The IDs of the clusters that the Data App's data source is linked to." + }, + "name": { + "type": "string", + "description": "The unique identifier for the data source, which is generated by the API and follows the format `dataApps/{dataAppId}/dataSources/{clusterId}`." + }, + "clusterDisplay": { + "type": "string", + "description": "The name of the cluster." + }, + "clusterType": { + "type": "string", + "description": "The cluster type:\n- `\"Serverless\"`: a [TiDB Cloud Serverless](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" + }, + "clusterProvider": { + "type": "string", + "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", + "example": "AWS" + }, + "clusterRegion": { + "type": "string", + "description": "The region code of the cluster.", + "example": "us-east-1" + }, + "clusterRegionDisplay": { + "type": "string", + "description": "The name of the cluster region as shown in the TiDB Cloud console.", + "example": "N. Virginia (us-east-1)" + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the Data App was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + } + } + }, + "v1beta1Deployment": { + "type": "object", + "properties": { + "deploymentId": { + "type": "string", + "description": "The ID of the deployment.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "The unique identifier for the deployment, which is generated by the API and follows the format `dataApps/{dataAppId}/deployments/{deploymentId}`." + }, + "description": { + "type": "string", + "description": "The description of the deployment." + }, + "origin": { + "type": "string", + "description": "The source of the deployment:\n- `\"UI\"`: the deployment is submitted through this API or [TiDB Cloud console](https://tidbcloud.com)\n- `\"GitHub\"`: the deployment is [submitted through GitHub](https://docs.pingcap.com/tidbcloud/data-service-manage-github-connection)", + "readOnly": true + }, + "originInfo": { + "$ref": "#/definitions/DeploymentOriginInfo", + "description": "If the `origin` is `\"GitHub\"`, this filed displays the corresponding commit information." + }, + "createdBy": { + "type": "string", + "description": "The creator of the deployment.", + "readOnly": true + }, + "status": { + "type": "string", + "description": "The status of the deployment: `\"success\"` or `\"failed\"`.", + "readOnly": true + }, + "statusErrorMessage": { + "type": "string", + "description": "If the deployment failed, this filed displays the error message.", + "readOnly": true + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the deployment was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + }, + "deployedAt": { + "type": "string", + "description": "The timestamp when the deployment was deployed. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + }, + "finishedAt": { + "type": "string", + "description": "The timestamp when the deployment was finished. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + } + } + }, + "v1beta1EndpointRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the endpoint, which is generated by the API and follows the format `dataApps/{dataAppId}/endpoints/{endpointId}`." + }, + "status": { + "type": "string", + "description": "The deployment status of the endpoint:\n- `\"deployed\"`: the endpoint has been successfully deployed\n- `\"draft\"`: the endpoint is currently a draft and has not been deployed yet" + }, + "displayName": { + "type": "string", + "description": "The name of the endpoint. By default, it is the same as the `path` value. You can update the name using [Update an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_UpdateEndpoint)." + }, + "description": { + "type": "string", + "description": "The user-defined description of the endpoint." + }, + "path": { + "type": "string", + "description": "The user-defined HTTP path of the endpoint in the Data App. A path must start with a slash (`/`). For example: `/v1/hello`." + }, + "method": { + "type": "string", + "description": "The user-defined HTTP method of the endpoint. The supported HTTP methods are: `GET`, `POST`, `PUT`, and `DELETE`." + }, + "clusterId": { + "type": "string", + "description": "The ID of the TiDB cluster that is linked to the endpoint." + }, + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointParamsRes" + }, + "description": "The parameters used in the endpoint." + }, + "settings": { + "$ref": "#/definitions/v1beta1EndpointSettingsRes", + "description": "The settings used in the endpoint." + }, + "tag": { + "type": "string", + "description": "The tag used for identifying a group of endpoints.", + "default": "Default" + }, + "batchOperation": { + "type": "boolean", + "description": "Controls whether to enable the endpoint to operate in batch mode. When it is set to `true`, you can operate on multiple rows in a single request." + }, + "sqlTemplate": { + "type": "string", + "description": "Specifies the SQL statements to query data through the endpoint." + }, + "type": { + "type": "string", + "description": "The type of the endpoint, which cannot be set by the user.", + "default": "sql_endpoint" + }, + "returnType": { + "type": "string", + "description": "The response format of the endpoint. Currently, only JSON is supported, represented by the value \"json\". There is no need for user configuration." + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the endpoint was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + }, + "updatedAt": { + "type": "string", + "description": "The timestamp when the endpoint was last updated. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + } + } + }, + "v1beta1Endpoint": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "The name of the endpoint. By default, it is the same as the `path` value.", + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_\\-\\/\\[\\]]+$" + }, + "description": { + "type": "string", + "description": "The user-defined description of the endpoint.", + "minLength": 0, + "maxLength": 2000 + }, + "path": { + "type": "string", + "description": "The user-defined HTTP path of the endpoint in the Data App. A path must start with a slash (`/`). For example: `\"/v1/hello\"`.", + "pattern": "^\\/([a-zA-Z0-9_]+\\/)*[a-zA-Z0-9_]+$", + "minLength": 2, + "maxLength": 64 + }, + "method": { + "type": "string", + "description": "The user-defined HTTP method of the endpoint. The supported HTTP methods are: `GET`, `POST`, `PUT`, and `DELETE`." + }, + "clusterId": { + "type": "string", + "description": "The ID of the TiDB cluster that is linked to the endpoint." + }, + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointParams" + }, + "description": "The parameters used in the endpoint." + }, + "settings": { + "$ref": "#/definitions/v1beta1EndpointSettings", + "description": "The settings used in the endpoint." + }, + "tag": { + "type": "string", + "description": "The tag used for identifying a group of endpoints.", + "default": "Default" + }, + "batchOperation": { + "type": "boolean", + "description": "Controls whether to enable the endpoint to operate in batch mode. When it is set to `true`, you can operate on multiple rows in a single request." + }, + "sqlTemplate": { + "type": "string", + "description": "Specifies the SQL statements to query data through the endpoint." + } + }, + "required": [ + "displayName", + "path", + "method", + "clusterId", + "settings", + "tag", + "sqlTemplate" + ] + }, + "v1beta1EndpointArgs": { + "type": "object", + "properties": { + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The key-value pairs used as parameters for endpoint testing, in the format of `key:value`. All values are of the string type. For example: `\"limit\":\"2\"`" + } + }, + "required": ["items"] + }, + "v1beta1EndpointParamsRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The user-defined name of the parameter." + }, + "type": { + "$ref": "#/definitions/v1beta1EndpointParamsType", + "description": "The user-defined data type of the parameter. \n - `string`\n - `number`\n - `integer`\n - `bool`\n - `array`" + }, + "itemType": { + "type": "#/definitions/v1beta1EndpointParamsItemType", + "description": "The item type of an array type parameter. \n - `string`\n - `number`\n - `integer`" + }, + "required": { + "type": "boolean", + "description": "Specifies whether the parameter is required in the request." + }, + "defaultValue": { + "type": "string", + "description": "The default value of the parameter. Make sure that the value matches the type of parameter you specified. Otherwise, the endpoint returns an error." + }, + "description": { + "type": "string", + "description": "The description of the parameter." + }, + "enum": { + "type": "string", + "description": "Specifies the value options of the parameter. To specify multiple values, you can separate them with a comma (`,`). For example: `\"1,2\"`." + } + } + }, + "v1beta1EndpointParamsType": { + "type": "string", + "enum": ["string", "number", "integer", "bool", "array"], + "description": "The user-defined data type of the parameter. \n - `string`\n - `number`\n - `integer`\n - `bool`\n - `array`" + }, + "v1beta1EndpointParamsItemType": { + "type": "string", + "enum": ["string", "number", "integer"], + "description": "The item type of an array type parameter. \n - `string`\n - `number`\n - `integer`" + }, + "v1beta1EndpointParams": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The user-defined name of the parameter." + }, + "type": { + "$ref": "#/definitions/v1beta1EndpointParamsType", + "description": "The user-defined data type of the parameter. \n - `string`\n - `number`\n - `integer`\n - `bool`\n - `array`" + }, + "itemType": { + "type": "#/definitions/v1beta1EndpointParamsItemType", + "description": "The item type of an array type parameter. \n - `string`\n - `number`\n - `integer`" + }, + "required": { + "type": "boolean", + "description": "Specifies whether the parameter is required in the request." + }, + "defaultValue": { + "type": "string", + "description": "The default value of the parameter. Make sure that the value matches the type of parameter you specified. Otherwise, the endpoint returns an error." + }, + "description": { + "type": "string", + "description": "The description of the parameter." + }, + "enum": { + "type": "string", + "description": "Specifies the value options of the parameter. To specify multiple values, you can separate them with a comma (`,`). For example: `\"1,2\"`." + } + }, + "required": ["name", "type"] + }, + "v1beta1EndpointSettingsRes": { + "type": "object", + "properties": { + "timeout": { + "type": "integer", + "format": "int32", + "description": "The user-defined timeout for the endpoint in milliseconds.", + "minimum": 1, + "maximum": 60000 + }, + "rowLimit": { + "type": "integer", + "format": "int32", + "description": "The maximum number of rows that the endpoint can operate or return.", + "minimum": 1, + "maximum": 2000 + }, + "paginationEnabled": { + "type": "boolean", + "description": "Controls whether to enable the pagination for the results returned by the `GET` request. When pagination is enabled, you can paginate the results by specifying `page` and `page_size` as query parameters when calling the endpoint." + }, + "cacheEnabled": { + "type": "boolean", + "description": "Controls whether to cache the response returned by your `GET` requests within a specified time-to-live (TTL) period." + }, + "cacheTtl": { + "type": "integer", + "format": "int32", + "description": "The time-to-live (TTL) period in seconds for cached response when `cacheEnabled` is set to `true`.", + "minimum": 30, + "maximum": 600 + } + }, + "description": "The settings used in the endpoint." + }, + "v1beta1EndpointSettings": { + "type": "object", + "properties": { + "timeout": { + "type": "integer", + "format": "int32", + "description": "The user-defined timeout for the endpoint in milliseconds.", + "minimum": 1, + "maximum": 60000 + }, + "rowLimit": { + "type": "integer", + "format": "int32", + "description": "The maximum number of rows that the endpoint can operate or return.", + "minimum": 1, + "maximum": 2000 + }, + "paginationEnabled": { + "type": "boolean", + "description": "Controls whether to enable the pagination for the results returned by the `GET` request. When pagination is enabled, you can paginate the results by specifying `page` and `page_size` as query parameters when calling the endpoint." + }, + "cacheEnabled": { + "type": "boolean", + "description": "Controls whether to cache the response returned by your `GET` requests within a specified time-to-live (TTL) period." + }, + "cacheTtl": { + "type": "integer", + "format": "int32", + "description": "The time-to-live (TTL) period in seconds for cached response when `cacheEnabled` is set to `true`.", + "minimum": 30, + "maximum": 600 + } + }, + "required": [ + "timeout", + "rowLimit", + "paginationEnabled", + "cacheEnabled", + "cacheTtl" + ], + "description": "The settings used in the endpoint." + }, + "v1beta1ListApiKeysResponse": { + "type": "object", + "properties": { + "apiKeys": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1ApiKeyRes" + }, + "description": "The items of API keys in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListApiKeys" + }, + "v1beta1ListDataAppsResponse": { + "type": "object", + "properties": { + "dataApps": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1DataAppRes" + }, + "description": "The items of Data Apps in the project." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListDataApps" + }, + "v1beta1ListDataSourcesResponse": { + "type": "object", + "properties": { + "dataSources": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1DataSource" + }, + "description": "The items of data sources in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListDataSources" + }, + "v1beta1ListDeploymentsResponse": { + "type": "object", + "properties": { + "deployments": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1Deployment" + }, + "description": "The items of deployments in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListDeployments" + }, + "v1beta1ListEndpointsResponse": { + "type": "object", + "properties": { + "endpoints": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointRes" + }, + "description": "The items of endpoints in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListEndpoint" + }, + "v1beta1TestEndpointResponse": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Endpoint's type." + }, + "data": { + "$ref": "#/definitions/TestEndpointResponseData", + "description": "The response of testing the endpoint." + } + }, + "title": "Response for TestEndpoint" + } + } +} diff --git a/static/openapi/tidbcloud-oas-v1beta1-iam.swagger.json b/static/openapi/tidbcloud-oas-v1beta1-iam.swagger.json new file mode 100644 index 000000000..8fde65d26 --- /dev/null +++ b/static/openapi/tidbcloud-oas-v1beta1-iam.swagger.json @@ -0,0 +1,2310 @@ +{ + "swagger": "2.0", + "info": { + "title": "TiDB Cloud Data Service OPENAPI", + "description": "# Overview\n\nThe TiDB Cloud Data Service API provides a [RESTful interface](https://en.wikipedia.org/wiki/Representational_state_transfer) for programmatically managing administrative objects within the [TiDB Cloud Data Service](https://docs.pingcap.com/tidbcloud/data-service-overview). Through this API, you can manage the following resources automatically and efficiently:\n\n* **Data App**: a collection of endpoints that you can use to access data for a specific application.\n* **Data Source**: clusters linked to Data Apps for data manipulation and retrieval.\n* **Endpoint**: a web API that you can customize to execute SQL statements. You can specify parameters for the SQL statements, such as the value used in the `WHERE` clause. When a client calls an endpoint and provides values for the parameters in a request URL, the endpoint executes the SQL statement with the provided parameters and returns the results as part of the HTTP response.\n* **Deployment**: the process of deploying Data Apps.\n* **Data API Key**: used for secure endpoint access. This key is used to access data in the TiDB Cloud clusters, whereas the TiDB Cloud organization API key is used to manage resources such as projects, clusters, Data Apps, and endpoints.\n* **OpenAPI Specification**: Data Service supports generating the OpenAPI Specification 3.0 for each Data App, which enables you to interact with your endpoints in a standardized format. You can use this specification to generate standardized OpenAPI documentation, client SDKs, and server stubs.\n\n# Get Started\n\nThis guide helps you make your first API call to TiDB Cloud Data Service API. You'll learn how to authenticate a request, build a request, and interpret the response. The [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps) 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 organization API key\n\nTo create an organization API key, log in to your TiDB Cloud console. Navigate to the **Organization Settings** page, and create an API key.\n\nAn organization 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 organization 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 Data Service API call have the following components:\n\n- **A host.** The host for TiDB Cloud Data Service API is .\n- **An organization 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 Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps) endpoint. For a detailed description of the endpoint, see the [API reference](#tag/Data-App/operation/DataApp_ListDataApps).\n\n### Call an API endpoint\n\nTo get all Data Apps in your project, run the following command in your terminal. Replace `YOUR_PUBLIC_KEY`, `YOUR_PRIVATE_KEY`, and `YOUR_PROJECT_ID` with your actual values. To get the project ID, you can call the [List all accessible projects](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project/operation/ListProjects) endpoint.\n\n```bash\ncurl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps?projectId=YOUR_PROJECT_ID'\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 Data Apps in your project, your request is successful. Here is an example of a successful response.\n\n```log\n{\n \"dataApps\": [\n {\n \"dataAppId\": \"{data_app_id}\",\n \"name\": \"dataApps/{data_app_id}\",\n \"version\": \"\",\n \"projectId\": \"{project_id}\",\n \"clusterIds\": [],\n \"appType\": \"DATAAPP\",\n \"displayName\": \"New Data App\",\n \"description\": \"\",\n \"createdAt\": \"2023-06-03T06:52:08Z\",\n \"updatedAt\": \"2023-06-03T06:52:08Z\"\n },\n {\n \"dataAppId\": \"{data_app_id}\",\n \"name\": \"dataApps/{data_app_id}\",\n \"version\": \"\",\n \"projectId\": \"{project_id}\",\n \"clusterIds\": [],\n \"appType\": \"CHAT2QUERY\",\n \"displayName\": \"New App\",\n \"description\": \"\",\n \"createdAt\": \"2023-06-03T06:52:08Z\",\n \"updatedAt\": \"2023-06-03T06:52:08Z\"\n }\n ],\n \"nextPageToken\": \"\"\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\": 403,\n \"message\": \"Request error, projectId not exist\",\n \"details\": []\n}\n```\n\n# Call a Deployed Data Service Endpoint\n\nIf you have deployed a Data Service endpoint, you can call it using the Data API key. To begin, follow these steps:\n\n1. Generate a Data API key by calling the [Create an API key for a Data App](#tag/Data-API-Key/operation/APIKey_CreateApiKey) endpoint. You can run the following `curl` command and replace `YOUR_PUBLIC_KEY`, `YOUR_PRIVATE_KEY`, and `YOUR_DATAAPP_ID` with your actual values. Note that `YOUR_PUBLIC_KEY` and `YOUR_PRIVATE_KEY` are [organization API keys](#section/Authentication/Organization-API-key-overview).\n\n ```bash\n curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/YOUR_DATAAPP_ID/apiKeys'\\\n --header 'Content-Type: application/json' \\\n --data '{\n \"description\": \"A new API Key\",\n \"role\": \"READ_AND_WRITE\",\n \"rateLimitRpm\": 100\n }'\n ```\n\n2. Call the deployed endpoint. Suppose that you have created a `GET` endpoint named `/hello`, with the request URL as `https://data.tidbcloud.com/api/v1beta/app/DATAAPP_ID/endpoint/hello`. To call this endpoint, replace `YOUR_DATAAPP_PUBLIC_KEY` and `YOUR_DATAAPP_PRIVATE_KEY` with the values obtained from the response in step 1, and replace `YOUR_DATAAPP_ID` with the actual Data App ID in the following command:\n\n ```bash\n curl --location-trusted --digest \\\n --user 'YOUR_DATAAPP_PUBLIC_KEY:YOUR_DATAAPP_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://data.tidbcloud.com/api/v1beta/app/YOUR_DATAAPP_ID/endpoint/hello'\n ```\n \n For improved performance, you can call the endpoint using the regional domain name. Replace `REGION` with the specific region name to which the cluster belongs, such as `us-west-2`.\n \n ```bash\n curl --digest \\\n --user 'YOUR_DATAAPP_PUBLIC_KEY:YOUR_DATAAPP_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://REGION.data.tidbcloud.com/api/v1beta/app/DATAAPP_ID/endpoint/hello'\n ```\n\n# Authentication\n\nThe TiDB Cloud Data Service 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## Organization API key overview\n\n- The organization 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 organization API key belongs to your organization and acts as the `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 organization API key in every request. Otherwise, the TiDB Cloud responds with a `401` error.\n\n## Organization API key management\n\n### Create an organization API key\n\nOnly the **owner** of an organization can create an organization API key.\n\nTo create an organization API key in an organization, perform the following steps:\n\n1. Click **Organization** in the lower-left corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab and then click **Create API Key**.\n4. Enter a description for your API key. The role of the API key is always `Owner` currently.\n5. Click **Next**. Copy and save the public key and the private key.\n6. 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.\n7. Click **Done**.\n\n### View details of an organization API key\n\nTo view details of an organization API key, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. You can view the details of the API keys in the menu.\n\n### Edit an organization API key\n\nOnly the **owner** of an organization can modify an organization API key.\n\nTo edit an organization API key in an organization, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Edit** in the API key row that you want to change.\n4. You can update the API key description.\n5. Click **Done**.\n\n### Delete an organization API key\n\nOnly the **owner** of an organization can delete an organization API key.\n\nTo delete an organization API key in an organization, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Delete** in the API key row that you want to delete.\n5. Click **I understand the consequences, delete this API Key.**\n\n# Rate Limiting\n\nThe TiDB Cloud Data Service 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 Data Service API.\n\n\n\n## 20240910\n\n- The [Update Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings) endpoint removes the support for the `gpt-3.5-turbo` model and adds support for `gpt-4o` and `gpt-4o-mini` models.\n\n- \"TiDB Serverless\" is renamed to \"TiDB Cloud Serverless\".\n- \"TiDB Dedicated\" is renamed to \"TiDB Cloud Dedicated\".\n\n## 20240806\n\n- Add the [List all system endpoints in a Data App](#tag/Data-App/operation/DataAppsService_GetSystemEndpointConfig) endpoint.\n\n- Add the [Update the configuration of system endpoints](#tag/Data-App/operation/DataAppsService_UpdateSystemEndpointConfig) endpoint.\n\n## 20240716\n\n- The [Update Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings) endpoint removes the support for Claude models.\n\n## 20240528\n\n- Initial release of the TiDB Cloud Data Service API, including the following resources and endpoints:\n\n - Data App:\n - [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps)\n - [Create a Data App](#tag/Data-App/operation/DataApp_CreateDataApp)\n - [Get Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_GetChat2QuerySettings)\n - [Update Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings)\n - [Update a Data App](#tag/Data-App/operation/DataApp_UpdateDataApp)\n - [Get a Data App by ID](#tag/Data-App/operation/DataApp_GetDataApp)\n - [Delete a Data App](#tag/Data-App/operation/DataApp_DeleteDataApp)\n - Data Source:\n - [List all data sources in a Data App](#tag/Data-Source/operation/DataSource_ListDataSources)\n - [Create a data source for a Data App](#tag/Data-Source/operation/DataSource_CreateDataSource)\n - [Get a data source by ID](#tag/Data-Source/operation/DataSource_GetDataSource)\n - [Delete a data source for a Data App](#tag/Data-Source/operation/DataSource_DeleteDataSource)\n - Endpoint:\n - [List all endpoints in a Data App](#tag/Deployment/operation/Deployment_ListDeployments)\n - [Create an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_CreateEndpoint)\n - [Update an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_UpdateEndpoint)\n - [Get an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_GetEndpoint)\n - [Delete an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_DeleteEndpoint)\n - [Test an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_TestEndpoint)\n - Deployment:\n - [List all deployments for a Data App](#tag/Deployment/operation/Deployment_ListDeployments)\n - [Create a deployment for a Data App](#tag/Deployment/operation/Deployment_CreateDeployment)\n - [Get a deployment by ID](#tag/Deployment/operation/Deployment_GetDeployment)\n - Data API Key:\n - [List all API keys for a Data App](#tag/Data-API-Key/operation/APIKey_ListApiKeys)\n - [Create an API key for a Data App](#tag/Data-API-Key/operation/APIKey_CreateApiKey)\n - [Update an API key for a Data App](#tag/Data-API-Key/operation/APIKey_UpdateApiKey)\n - [Get an API key by ID](#tag/Data-API-Key/operation/APIKey_GetApiKey)\n - [Delete an API key for a Data App](#tag/Data-API-Key/operation/APIKey_DeleteApiKey)\n - OpenAPI Specification:\n - [Get the OpenAPI Specification of a Data App](#tag/OpenAPI-Specification/operation/APISpecification_GetApiSpec)\n", + "version": "v1beta1" + }, + "tags": [ + { + "name": "Data App", + "description": "Create, get, update, delete, and list Data Apps." + }, + { + "name": "Data Source", + "description": "Create, get, delete, and list data sources of a Data App." + }, + { + "name": "Endpoint", + "description": "Create, get, delete, list, and test endpoints of a Data App." + }, + { + "name": "Deployment", + "description": "Create, get, and list deployments of a Data App." + }, + { + "name": "Data API Key", + "description": "Create, get, update, delete, and list Data API keys of a Data App. The Data API key in Data Service is different from the key used in the [TiDB Cloud API](https://docs.pingcap.com/tidbcloud/api/v1beta#section/Authentication). The Data API key is used to access data in the TiDB Cloud clusters, whereas the TiDB Cloud API key is used to manage resources such as projects, clusters, Data Apps, and endpoints." + }, + { + "name": "OpenAPI Specification", + "description": "Get the OpenAPI specification of a Data App." + } + ], + "x-tagGroups": [ + { + "name": "Endpoints", + "tags": [ + "Data App", + "Data Source", + "Endpoint", + "Deployment", + "Data API Key", + "OpenAPI Specification" + ] + } + ], + "host": "dataservice.tidbapi.com", + "schemes": ["https"], + "consumes": ["application/json"], + "produces": ["application/json"], + "paths": { + "/v1beta1/dataApps": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps?projectId={projectId}&pageSize=5'" + } + ], + "summary": "List all Data Apps in a project.", + "operationId": "DataApp_ListDataApps", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ListDataAppsResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "The ID of the project that the Data App belongs to. You can get the project ID from the response of [List all accessible projects](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project/operation/ListProjects).", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Data App"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"version\": \"1.0.0\", \n \"projectId\": \"{projectId}\", \n \"clusterIds\": [\n \"{clusterIds}\"\n ], \n \"appType\": \"DATAAPP\", \n \"displayName\": \"app-01\", \n \"description\": \"A new data app\" \n }'" + } + ], + "summary": "Create a Data App.", + "operationId": "DataApp_CreateDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataAppRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataApp", + "description": "DataApp", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1DataApp" + } + } + ], + "tags": ["Data App"] + } + }, + "/v1beta1/dataApps/{dataAppId}/systemEndpointConfig": { + "get": { + "summary": "List all system endpoints in a Data App.", + "description": "TiDB Cloud Data Service provides an endpoint library with predefined system endpoints that you can directly add to your Data App, reducing the effort in your endpoint development.\n\nFor example, the `POST:/system/query` system endpoint enables you to execute any SQL statement by simply passing the statement in the predefined `sql` parameter. This endpoint facilitates the immediate execution of SQL queries, enhancing flexibility and efficiency.", + "operationId": "DataAppsService_GetSystemEndpointConfig", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/systemEndpointConfig'" + } + ], + "tags": ["Data App"] + }, + "patch": { + "summary": "Update the configuration of system endpoints.", + "description": "With this endpoint, you can enable or disable the system endpoints in a Data App.", + "operationId": "DataAppsService_UpdateSystemEndpointConfig", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/systemEndpointConfig' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"items\": {\n \"type\": \"system-data\", \n \"key\": \"POST:/system/query\", \n \"enabled\": true \n }\n }'" + } + ], + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "systemEndpointConfig", + "description": "To update the configuration of system endpoints in a Data App, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigItem" + }, + "description": "The configuration items of system endpoints in a Data App.", + "required": ["items"] + } + }, + "title": "System Endpoint Config", + "required": ["items"] + } + } + ], + "tags": ["Data App"] + } + }, + "/v1beta1/dataApps/{dataAppId}/chat2querySettings": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/chat2querySettings'" + } + ], + "summary": "Get Chat2Query Data App settings by ID.", + "description": "With this endpoint, you can get the settings of a Chat2Query Data App, such as `name`, `llmApiKey`, `languageCode`, and `llmModel`. To get basic information, such as `version`, `projectId`, and `clusterIds`, use the [Get a Data App by ID](#tag/Data-App/operation/DataApp_GetDataApp) endpoint instead.", + "operationId": "DataApp_GetChat2QuerySettings", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1Chat2QuerySettingsRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data App", "Chat2Query"] + }, + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/chat2querySettings' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"llmModel\": \"gpt-4\", \n \"llmApiKey\": \"sk-projxxxx\", \n \"languageCode\": \"English\" \n }'" + } + ], + "summary": "Update Chat2Query Data App settings by ID.", + "description": "With this endpoint, you can update the `llmApiKey`, `languageCode`, or `llmModel` settings of a Chat2Query Data App. To update the version, name, or description, use the [Update a Data App](#tag/Data-App/operation/DataApp_UpdateDataApp) endpoint instead.", + "operationId": "DataApp_UpdateChat2QuerySettings", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1Chat2QuerySettingsRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "chat2querySettings", + "description": "To update the settings of a Chat2Query App, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "llmApiKey": { + "type": "string", + "description": "The access key required to use your large language model (LLM) service. Leaving this blank limits you to 100 queries per day. To bypass the query limit, specify your access key of [OpenAI models](https://platform.openai.com/docs/models) in the `sk-xxxx` format.", + "required": ["llmApiKey"] + }, + "languageCode": { + "type": "string", + "description": "The language to use for this Chat2Query Data App. Value options: `\"English\"` or `\"Chinese\"`.", + "required": ["languageCode"] + }, + "llmModel": { + "type": "string", + "description": "The LLM model to use for this Chat2Query Data App.\n**Note:** You cannot use the `gpt-4` or `gpt-4o` model without a valid `llmApiKey`. Value options: `gpt-4`, `gpt-4o`, `gpt-4o-mini`.", + "required": ["llmModel"] + } + }, + "title": "Define your fields as needed for updating a Chat2Query App Settings" + } + } + ], + "tags": ["Data App", "Chat2Query"] + } + }, + "/v1beta1/dataApps/{dataAppId}": { + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"version\": \"1.0.1\", \n \"displayName\": \"app-02\", \n \"description\": \"Update a data app\" \n }'" + } + ], + "summary": "Update a Data App.", + "description": "With this endpoint, you can update the `version`, `name`, or `description` of a Data App. To update the `llmApiKey`, `languageCode`, or `llmModel` settings of a Chat2Query App, use the [Update Chat2Query App settings by Data App ID](#tag/Data-App/operation/DataApp_GetChat2QuerySettings) endpoint instead.", + "operationId": "DataApp_UpdateDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataAppRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "dataApp", + "description": "To update a Data App, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "The user-defined version number of the Data App, in the format of `x.x.x`.", + "pattern": "^[1-9]\\.[0-9]\\.[0-9]$", + "example": "1.0.0", + "default": "1.0.0" + }, + "displayName": { + "type": "string", + "description": "The user-defined name of the Data App.", + "maxLength": 32, + "minLength": 1 + }, + "description": { + "type": "string", + "description": "The user-defined description of the Data App.", + "maxLength": 0, + "minLength": 1000 + } + }, + "title": "Define your fields as needed for updating a Data App" + } + } + ], + "tags": ["Data App"] + }, + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}'" + } + ], + "summary": "Get a Data App by ID.", + "description": "With this endpoint, you can get the basic information of a Data App, such as `name`, `version`, `projectId`, and `clusterIds`. To get the `llmApiKey`, `languageCode`, and `llmModel` of a Chat2Query Data App, use the [Get Chat2Query Data App settings by ID](#tag/Data-App/operation/DataApp_UpdateChat2QuerySettings) endpoint instead.", + "operationId": "DataApp_GetDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataAppRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data App"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}'" + } + ], + "summary": "Delete a Data App.", + "operationId": "DataApp_DeleteDataApp", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "properties": {} + } + }, + "default": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data App"] + } + }, + "/v1beta1/dataApps/{dataAppId}/dataSources": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources?pageSize=5'" + } + ], + "summary": "List all data sources in a Data App.", + "operationId": "DataSource_ListDataSources", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ListDataSourcesResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Data Source"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"clusterId\": \"{clusterId}\"\n }'" + } + ], + "summary": "Create a data source for a Data App.", + "description": "With this endpoint, you can link a cluster to a Data App. Then, the Data App can access and manipulate data in the cluster.", + "operationId": "DataSource_CreateDataSource", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataSource" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "dataSource", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "clusterId": { + "type": "string", + "description": "The ID of the cluster that needs to be linked to the Data App." + } + }, + "required": ["clusterId"] + } + } + ], + "tags": ["Data Source"] + } + }, + "/v1beta1/dataApps/{dataAppId}/dataSources/{clusterId}": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources/{clusterId}'" + } + ], + "summary": "Get a data source by ID.", + "operationId": "DataSource_GetDataSource", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1DataSource" + } + }, + "default": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "description": "The ID of the cluster that is linked to the Data App.", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data Source"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/dataSources/{clusterId}'" + } + ], + "summary": "Delete a data source for a Data App.", + "description": "With this endpoint, you can unlink a cluster from a Data App. Then, the existing endpoints in the Data App cannot access the cluster anymore.", + "operationId": "DataSource_DeleteDataSource", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "properties": {} + } + }, + "default": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "description": "The ID of the cluster that is linked to the Data App.", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data Source"] + } + }, + "/v1beta1/dataApps/{dataAppId}/endpoints": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/endpoints?pageSize=5'" + } + ], + "summary": "List all endpoints in a Data App.", + "operationId": "Endpoint_ListEndpoints", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ListEndpointsResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Endpoint"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/endpoints' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"displayName\": \"/v1/hello\", \n \"description\": \"/v1/hello endpoint\", \n \"path\": \"/v1/hello\", \n \"method\": \"GET\", \n \"clusterId\": \"{clusterId}\", \n \"settings\": {\n \"timeout\": 30000, \n \"rowLimit\": 2000, \n \"paginationEnabled\": false, \n \"cacheEnabled\": false\n }, \n \"tag\": \"Default\", \n \"sqlTemplate\": \"select 'Hello World';\" \n }'" + } + ], + "summary": "Create an endpoint for a Data App.", + "operationId": "Endpoint_CreateEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1EndpointRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "endpoint", + "description": "Endpoint", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1Endpoint" + } + } + ], + "tags": ["Endpoint"] + } + }, + "/v1beta1/dataApps/{endpoint.name}": { + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"displayName\": \"/v2/hello\", \n \"description\": \"/v2/hello endpoint\", \n \"path\": \"/v2/hello\", \n \"method\": \"GET\", \n \"clusterId\": \"{clusterId}\", \n \"settings\": {\n \"timeout\": 30000, \n \"rowLimit\": 2000, \n \"paginationEnabled\": false, \n \"cacheEnabled\": false\n }, \n \"tag\": \"V2\", \n \"sqlTemplate\": \"select 'Hello World New';\" \n }'" + } + ], + "summary": "Update an endpoint for a Data App.", + "operationId": "Endpoint_UpdateEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1EndpointRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + }, + { + "name": "endpoint", + "description": "To update an endpoint, specify the following fields as needed:", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1Endpoint" + } + } + ], + "tags": ["Endpoint"] + }, + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}'" + } + ], + "summary": "Get an endpoint for a Data App.", + "operationId": "Endpoint_GetEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1EndpointRes" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + } + ], + "tags": ["Endpoint"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}'" + } + ], + "summary": "Delete an endpoint for a Data App.", + "description": "Before you delete an endpoint, make sure that the endpoint is not online. Otherwise, the endpoint cannot be deleted.", + "operationId": "Endpoint_DeleteEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + } + ], + "tags": ["Endpoint"] + } + }, + "/v1beta1/{endpoint.name}/test": { + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/{endpoint.name}/test' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"args\": [\n {\n \"items\": {}\n }\n ] \n }'" + } + ], + "summary": "Test an endpoint for a Data App.", + "operationId": "Endpoint_TestEndpoint", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1TestEndpointResponse" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "endpoint.name", + "description": "The unique identifier for the endpoint. For example: `dataApps/dataapp-yxNzAuFP/endpoints/1874778`. You can get the value from the response of [List all endpoints in a Data App](#tag/Endpoint/operation/Endpoint_ListEndpoints).", + "in": "path", + "required": true, + "type": "string", + "pattern": "dataApps/[^/]+/endpoints/[^/]+" + }, + { + "name": "endpoint.param", + "description": "The parameter values used for testing the endpoint.", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "args": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointArgs" + } + } + }, + "required": ["args"] + } + } + ], + "tags": ["Endpoint"] + } + }, + "/v1beta1/dataApps/{dataAppId}/apiKeys": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys?pageSize=5'" + } + ], + "summary": "List all API keys for a Data App.", + "operationId": "APIKey_ListApiKeys", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ListApiKeysResponse" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Data API Key"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"description\": \"A new API Key.\",\n \"role\": \"READ_AND_WRITE\",\n \"rateLimitRpm\": 100\n }'" + } + ], + "summary": "Create an API key for a Data App.", + "description": "For each Data App, you can create up to **100** API keys.", + "operationId": "APIKey_CreateApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKey", + "description": "Data API Key", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + } + ], + "tags": ["Data API Key"] + } + }, + "/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}": { + "patch": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request PATCH \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"description\": \"Update a API Key.\",\n \"role\": \"READ_AND_WRITE\",\n \"rateLimitRpm\": 50\n }'" + } + ], + "summary": "Update an API key for a Data App.", + "description": "With this endpoint, you can update the description, role, rate limit, or expiration time of an API key.\n\n**Note:** You cannot update an expired key.", + "operationId": "APIKey_UpdateApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + }, + "default": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKeyId", + "description": "The ID of the API key, which is returned when you [create an API key](#tag/Data-API-Key/operation/APIKey_CreateApiKey).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKey", + "description": "Data API Key", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + } + ], + "tags": ["Data API Key"] + }, + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}'" + } + ], + "summary": "Get an API key by ID.", + "operationId": "APIKey_GetApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ApiKey" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKeyId", + "description": "The ID of the API key, which is returned when you [Create an API key](#tag/Data-API-Key/operation/APIKey_CreateApiKey).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data API Key"] + }, + "delete": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request DELETE \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiKeys/{apiKeyId}'" + } + ], + "summary": "Delete an API key for a Data App.", + "description": "Before you delete an API key, make sure that the API key is not used by any Data App.", + "operationId": "APIKey_DeleteApiKey", + "responses": { + "200": { + "description": "OK.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "apiKeyId", + "description": "The ID of the API key, which is returned when you [Create an API key](#tag/Data-API-Key/operation/APIKey_CreateApiKey).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Data API Key"] + } + }, + "/v1beta1/dataApps/{dataAppId}/deployments": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/deployments?pageSize=5'" + } + ], + "summary": "List all deployments for a Data App.", + "operationId": "Deployment_ListDeployments", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1ListDeploymentsResponse" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of items to return. If it is not set or set to `0`, the default value `100` will be used.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 100 + }, + { + "name": "pageToken", + "description": "The identifier of the current page, used to retrieve the next page of results. You can get this value from the `nextPageToken` field in the previous response. To access the first page of data, omit this field.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": ["Deployment"] + }, + "post": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/deployments' \\\n --header 'Content-Type: application/json' \\\n --data-raw '{\n \"description\": \"Deploy a data app.\"\n }'" + } + ], + "summary": "Create a deployment for a Data App.", + "operationId": "Deployment_CreateDeployment", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1Deployment" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deployment", + "description": "Deployment", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The description of the deployment." + } + } + } + } + ], + "tags": ["Deployment"] + } + }, + "/v1beta1/dataApps/{dataAppId}/deployments/{deploymentId}": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/deployments/{deploymentId}'" + } + ], + "summary": "Get a deployment by ID.", + "operationId": "Deployment_GetDeployment", + "responses": { + "200": { + "description": "OK.", + "schema": { + "$ref": "#/definitions/v1beta1Deployment" + } + }, + "400": { + "description": "Bad request.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentId", + "description": "The ID of the deployment, which is returned when you [Create a deployment](#tag/Deployment/operation/Deployment_CreateDeployment).", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": ["Deployment"] + } + }, + "/v1beta1/dataApps/{dataAppId}/apiSpec": { + "get": { + "x-code-samples": [ + { + "lang": "Curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://dataservice.tidbapi.com/v1beta1/dataApps/{dataAppId}/apiSpec'" + } + ], + "summary": "Get the OpenAPI Specification of a Data App.", + "description": "TiDB Cloud Data Service supports generating the OpenAPI Specification 3.0 for each Data App, which enables you to interact with your endpoints in a standardized format. You can use this specification to generate standardized OpenAPI documentation, client SDKs, and server stubs.", + "operationId": "APISpecification_GetApiSpec", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/v1beta1ApiSpec" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "dataAppId", + "description": "The ID of the Data App. You can get the ID from the response of [List all Data Apps in a project](#tag/Data-App/operation/DataApp_ListDataApps).", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "format", + "description": "The format of the generated OpenAPI Specification.", + "in": "query", + "required": false, + "type": "string", + "enum": ["JSON", "YAML"], + "default": "JSON" + } + ], + "tags": ["OpenAPI Specification"] + } + } + }, + "definitions": { + "ApiKeyApiKeyExpireSetting": { + "type": "object", + "properties": { + "expireOption": { + "$ref": "#/definitions/ApiKeyExpireOption", + "default": "EXPIRE_OPTION_NEVER_EXPIRE" + }, + "apiKeyTtl": { + "type": "integer", + "format": "int64", + "description": "The expiration time for the key, in minutes.\nThe filed is only available when `expireOption` is set to `EXPIRE_OPTION_SET_TTL`.", + "minimum": 1, + "maximum": 525600 + } + }, + "description": "The expiration settings for the API key." + }, + "ApiKeyExpireOption": { + "type": "string", + "enum": ["EXPIRE_OPTION_NEVER_EXPIRE", "EXPIRE_OPTION_SET_TTL"], + "default": "EXPIRE_OPTION_NEVER_EXPIRE", + "description": "The method used to determine the API key's expiration:\n- `EXPIRE_OPTION_NEVER_EXPIRE`: this key will never expire\n - `EXPIRE_OPTION_SET_TTL`: this key will expire after the time specified by `apikeyTtl`" + }, + "ApiKeyExpireState": { + "type": "string", + "enum": [ + "EXPIRE_STATE_NEVER_EXPIRE", + "EXPIRE_STATE_EXPIRED", + "EXPIRE_STATE_NOT_EXPIRE" + ], + "default": "EXPIRE_STATE_NEVER_EXPIRE", + "description": "The expiration state of the API key:\n- `EXPIRE_STATE_NEVER_EXPIRE`: this API key never expires\n - `EXPIRE_STATE_EXPIRED`: this API key has expired\n - `EXPIRE_STATE_NOT_EXPIRE`: this API key is currently active" + }, + "ApiKeyRole": { + "type": "string", + "enum": ["READ_AND_WRITE", "READ_ONLY"], + "default": "READ_ONLY", + "description": "Controls whether the API key can read or write data to the clusters linked to the Data App.\n- `READ_AND_WRITE`: allows the API key to read and write data. You can use this API key to execute all SQL statements, such as DML and DDL statements.\n - `READ_ONLY`: only allows the API key to read data, such as `SELECT`, `SHOW`, `USE`, `DESC`, and `EXPLAIN` statements." + }, + "DeploymentOriginInfo": { + "type": "object", + "properties": { + "commit": { + "type": "string", + "description": "The commit ID associated with the deployment.", + "readOnly": true + }, + "diffUrl": { + "type": "string", + "description": "The URL to view the diff of the changes in the commit.", + "readOnly": true + } + }, + "description": "If the `origin` is `\"GitHub\"`, this filed displays the corresponding commit information." + }, + "GetApiSpecRequestFormat": { + "type": "string", + "enum": ["FORMAT_UNSPECIFIED", "JSON", "YAML"], + "default": "FORMAT_UNSPECIFIED", + "description": "- FORMAT_UNSPECIFIED: Unspecified. Do not use\n - JSON: Json format\n - YAML: Yaml format", + "title": "Api specification content format" + }, + "TestEndpointResponseColumn": { + "type": "object", + "properties": { + "col": { + "type": "string", + "description": "The column name of the requested data table." + }, + "dataType": { + "type": "string", + "description": "The column type of the requested data table." + }, + "nullable": { + "type": "boolean", + "description": "Whether the column of the requested data table supports null values." + } + } + }, + "TestEndpointResponseData": { + "type": "object", + "properties": { + "columns": { + "type": "array", + "items": { + "$ref": "#/definitions/TestEndpointResponseColumn" + }, + "description": "Returns the columns and columns' details of the requested data table of the endpoint." + }, + "rows": { + "type": "array", + "items": { + "$ref": "#/definitions/TestEndpointResponseRow" + }, + "description": "Return the columns and data results of the requested data table of the endpoint." + }, + "result": { + "$ref": "#/definitions/TestEndpointResponseResult" + } + }, + "title": "Endpoint request data" + }, + "TestEndpointResponseResult": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "description": "HTTPS status code of the request." + }, + "message": { + "type": "string", + "description": "HTTPS result message of the request. If the status code returned by the request is 200, OK is returned here. If there is an error in the request, the specific reason for the error is returned." + }, + "startMs": { + "type": "string", + "format": "int64", + "description": "The request's start timestamp. For example: 1704871891280" + }, + "endMs": { + "type": "string", + "format": "int64", + "description": "The request's end timestamp. For example: 1704871891474" + }, + "latency": { + "type": "string", + "description": "The request latency. For example: 194ms" + }, + "rowCount": { + "type": "integer", + "format": "int32", + "description": "The number of rows that the request should return. Sometimes the maximum number of returned rows set by the user is exceeded. But in the end, only the number of rows returned is the minimum of these two values." + }, + "rowAffect": { + "type": "integer", + "format": "int32", + "description": "When executing non-query SQL statements, the number of rows affected." + }, + "limit": { + "type": "integer", + "format": "int32", + "description": "The maximum number of returned rows set by the request." + } + }, + "description": "Return basic information about request execution. For example: whether the execution is successful, execution time, number of items returned, etc." + }, + "TestEndpointResponseRow": { + "type": "object", + "properties": { + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The columns and data results of the requested data table of the endpoint." + } + } + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1beta1ApiKeyRes": { + "type": "object", + "properties": { + "apiKeyId": { + "type": "string", + "format": "uint64", + "description": "The ID of the API key." + }, + "name": { + "type": "string", + "description": "The unique identifier for the API key, which is generated by the API and follows the format `dataApps/{dataAppId}/apiKeys/{apiKey}`." + }, + "publicKey": { + "type": "string", + "description": "The public key for the API key." + }, + "privateKey": { + "type": "string", + "description": "The private key for the API key. This is only fully displayed when the key is initially created. For security reasons, subsequent requests will obscure most of the key, revealing only the last four characters." + }, + "description": { + "type": "string", + "description": "The description of the API key." + }, + "role": { + "$ref": "#/definitions/ApiKeyRole", + "description": "The role of the API key." + }, + "rateLimitRpm": { + "type": "integer", + "format": "int32", + "description": "The maximum number of API requests allowed per minute using this key." + }, + "expireState": { + "$ref": "#/definitions/ApiKeyExpireState", + "description": "Expire state of the API Key" + }, + "expireTime": { + "type": "string", + "description": "The time at which the API key will expire. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + }, + "apiKeyExpireSetting": { + "$ref": "#/definitions/ApiKeyApiKeyExpireSetting", + "description": "The expiration settings for the API key." + } + }, + "description": "An API key of a Data App" + }, + "v1beta1ApiKey": { + "type": "object", + "properties": { + "description": { + "type": "string", + "description": "The description of the API key." + }, + "role": { + "$ref": "#/definitions/ApiKeyRole", + "description": "Role of the API Key" + }, + "rateLimitRpm": { + "type": "integer", + "format": "int32", + "default": 100, + "minimum": 1, + "maximum": 1000, + "description": "The maximum number of API requests allowed per minute using this key. For Chat2Query Data Apps, you cannot modify this field." + }, + "apiKeyExpireSetting": { + "$ref": "#/definitions/ApiKeyApiKeyExpireSetting", + "description": "The API Key expire setting" + } + }, + "description": "An API key of a Data App. ", + "required": ["description", "role", "rateLimitRpm"] + }, + "v1beta1ApiSpec": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the OpenAPI Specification, which is generated by the API and follows the format `dataApps/{dataAppId}/apiSpec`." + }, + "content": { + "type": "string", + "description": "The content of the OpenAPI Specification for the Data App." + } + }, + "title": "ApiSpec resource" + }, + "v1beta1DataApp": { + "type": "object", + "properties": { + "dataAppId": { + "type": "string", + "description": "The ID of the Data App.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "The unique identifier for the Data App, which is generated by the API and follows the format `dataApps/{dataAppId}`", + "readOnly": true + }, + "projectId": { + "type": "string", + "description": "The ID of the project that the Data App belongs to. You can get the project ID from the response of [List all accessible projects](https://docs.pingcap.com/tidbcloud/api/v1beta#tag/Project/operation/ListProjects).", + "required": ["projectId"] + }, + "clusterIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The IDs of the clusters that the Data App's data source is linked to." + }, + "appType": { + "$ref": "#/definitions/v1beta1DataAppType", + "description": "The type of the Data App.\n - `DATAAPP`: standard Data APP\n - `CHAT2QUERY`: Chat2Query Data App" + }, + "version": { + "type": "string", + "description": "The user-defined version number of the Data App, in the format of `x.x.x`.", + "pattern": "^[1-9]\\.[0-9]\\.[0-9]$", + "example": "1.0.0", + "default": "1.0.0", + "required": ["version"] + }, + "displayName": { + "type": "string", + "description": "The user-defined name of the Data App.", + "minLength": 1, + "maxLength": 32, + "required": ["displayName"] + }, + "description": { + "type": "string", + "description": "The user-defined description of the Data App.", + "minLength": 0, + "maxLength": 1000, + "required": ["description"] + }, + "createdAt": { + "type": "string", + "title": "The timestamp when the Data App was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + }, + "updatedAt": { + "type": "string", + "title": "The timestamp when the Data App was last updated. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + } + } + }, + "v1beta1DataAppType": { + "type": "string", + "enum": ["DATAAPP", "CHAT2QUERY"], + "description": "The type of the Data App.\n - `DATAAPP`: standard Data APP\n - `CHAT2QUERY`: Chat2Query Data App" + }, + "v1beta1SystemEndpointConfigRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the system endpoint configurations in a Data App, which is generated by the API and follows the format `dataApps/{data_app}/systemEndpointConfig`." + }, + "items": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1SystemEndpointConfigItem" + }, + "description": "The configuration items of system endpoints in a Data App.", + "required": ["items"] + } + }, + "title": "Response for UpdateSystemEndpointConfig", + "required": ["items"] + }, + "v1beta1SystemEndpointConfigItem": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "The type of the system endpoint.", + "example": "system-data", + "required": ["type"] + }, + "key": { + "type": "string", + "description": "The key of the system endpoint, combining the HTTP method and endpoint path. For example: `\"POST:/system/query\"`.", + "example": "POST:/system/query", + "required": ["key"] + }, + "enabled": { + "type": "boolean", + "description": "Controls whether to enable the system endpoint in a Data App.", + "required": ["enabled"] + } + }, + "required": ["type", "key", "enabled"] + }, + "v1beta1Chat2QuerySettingsRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the Chat2Query Data App settings, which is generated by the API and follows the format `dataApps/{data_app}/chat2querySettings`." + }, + "llmApiKey": { + "type": "string", + "description": "The access key required to use your large language model (LLM) service.", + "required": ["llmApiKey"] + }, + "languageCode": { + "type": "string", + "description": "The language to use for this Chat2Query Data App.", + "required": ["languageCode"] + }, + "llmModel": { + "type": "string", + "description": "The LLM model to use for this Chat2Query Data App.", + "required": ["llmModel"] + } + }, + "required": ["llmApiKey", "languageCode", "llmModel"] + }, + "v1beta1DataAppRes": { + "type": "object", + "properties": { + "dataAppId": { + "type": "string", + "description": "The ID of the Data App.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "The unique identifier for the Data App, which is generated by the API and follows the format `dataApps/{data_app_id}`." + }, + "version": { + "type": "string", + "description": "The user-defined version number of the Data App.", + "default": "1.0.0" + }, + "projectId": { + "type": "string", + "description": "The ID of the project that the Data App belongs to." + }, + "clusterIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The IDs of the clusters that the Data App's data source is linked to." + }, + "appType": { + "$ref": "#/definitions/v1beta1DataAppType", + "description": "The type of the Data App.\n - `DATAAPP`: standard Data APP\n - `CHAT2QUERY`: Chat2Query Data App" + }, + "displayName": { + "type": "string", + "description": "The user-defined name of the Data App." + }, + "description": { + "type": "string", + "description": "The user-defined description of the Data App." + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the Data App was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + }, + "updatedAt": { + "type": "string", + "description": "The timestamp when the Data App was last updated. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + } + } + }, + "v1beta1DataSource": { + "type": "object", + "properties": { + "clusterId": { + "type": "string", + "description": "The IDs of the clusters that the Data App's data source is linked to." + }, + "name": { + "type": "string", + "description": "The unique identifier for the data source, which is generated by the API and follows the format `dataApps/{dataAppId}/dataSources/{clusterId}`." + }, + "clusterDisplay": { + "type": "string", + "description": "The name of the cluster." + }, + "clusterType": { + "type": "string", + "description": "The cluster type:\n- `\"Serverless\"`: a [TiDB Cloud Serverless](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" + }, + "clusterProvider": { + "type": "string", + "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", + "example": "AWS" + }, + "clusterRegion": { + "type": "string", + "description": "The region code of the cluster.", + "example": "us-east-1" + }, + "clusterRegionDisplay": { + "type": "string", + "description": "The name of the cluster region as shown in the TiDB Cloud console.", + "example": "N. Virginia (us-east-1)" + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the Data App was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + } + } + }, + "v1beta1Deployment": { + "type": "object", + "properties": { + "deploymentId": { + "type": "string", + "description": "The ID of the deployment.", + "readOnly": true + }, + "name": { + "type": "string", + "description": "The unique identifier for the deployment, which is generated by the API and follows the format `dataApps/{dataAppId}/deployments/{deploymentId}`." + }, + "description": { + "type": "string", + "description": "The description of the deployment." + }, + "origin": { + "type": "string", + "description": "The source of the deployment:\n- `\"UI\"`: the deployment is submitted through this API or [TiDB Cloud console](https://tidbcloud.com)\n- `\"GitHub\"`: the deployment is [submitted through GitHub](https://docs.pingcap.com/tidbcloud/data-service-manage-github-connection)", + "readOnly": true + }, + "originInfo": { + "$ref": "#/definitions/DeploymentOriginInfo", + "description": "If the `origin` is `\"GitHub\"`, this filed displays the corresponding commit information." + }, + "createdBy": { + "type": "string", + "description": "The creator of the deployment.", + "readOnly": true + }, + "status": { + "type": "string", + "description": "The status of the deployment: `\"success\"` or `\"failed\"`.", + "readOnly": true + }, + "statusErrorMessage": { + "type": "string", + "description": "If the deployment failed, this filed displays the error message.", + "readOnly": true + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the deployment was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + }, + "deployedAt": { + "type": "string", + "description": "The timestamp when the deployment was deployed. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + }, + "finishedAt": { + "type": "string", + "description": "The timestamp when the deployment was finished. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`.", + "readOnly": true + } + } + }, + "v1beta1EndpointRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The unique identifier for the endpoint, which is generated by the API and follows the format `dataApps/{dataAppId}/endpoints/{endpointId}`." + }, + "status": { + "type": "string", + "description": "The deployment status of the endpoint:\n- `\"deployed\"`: the endpoint has been successfully deployed\n- `\"draft\"`: the endpoint is currently a draft and has not been deployed yet" + }, + "displayName": { + "type": "string", + "description": "The name of the endpoint. By default, it is the same as the `path` value. You can update the name using [Update an endpoint for a Data App](#tag/Endpoint/operation/Endpoint_UpdateEndpoint)." + }, + "description": { + "type": "string", + "description": "The user-defined description of the endpoint." + }, + "path": { + "type": "string", + "description": "The user-defined HTTP path of the endpoint in the Data App. A path must start with a slash (`/`). For example: `/v1/hello`." + }, + "method": { + "type": "string", + "description": "The user-defined HTTP method of the endpoint. The supported HTTP methods are: `GET`, `POST`, `PUT`, and `DELETE`." + }, + "clusterId": { + "type": "string", + "description": "The ID of the TiDB cluster that is linked to the endpoint." + }, + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointParamsRes" + }, + "description": "The parameters used in the endpoint." + }, + "settings": { + "$ref": "#/definitions/v1beta1EndpointSettingsRes", + "description": "The settings used in the endpoint." + }, + "tag": { + "type": "string", + "description": "The tag used for identifying a group of endpoints.", + "default": "Default" + }, + "batchOperation": { + "type": "boolean", + "description": "Controls whether to enable the endpoint to operate in batch mode. When it is set to `true`, you can operate on multiple rows in a single request." + }, + "sqlTemplate": { + "type": "string", + "description": "Specifies the SQL statements to query data through the endpoint." + }, + "type": { + "type": "string", + "description": "The type of the endpoint, which cannot be set by the user.", + "default": "sql_endpoint" + }, + "returnType": { + "type": "string", + "description": "The response format of the endpoint. Currently, only JSON is supported, represented by the value \"json\". There is no need for user configuration." + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the endpoint was created. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + }, + "updatedAt": { + "type": "string", + "description": "The timestamp when the endpoint was last updated. The time format follows the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard. For example: `\"2023-06-03T06:52:08Z\"`." + } + } + }, + "v1beta1Endpoint": { + "type": "object", + "properties": { + "displayName": { + "type": "string", + "description": "The name of the endpoint. By default, it is the same as the `path` value.", + "minLength": 1, + "maxLength": 32, + "pattern": "^[a-zA-Z0-9_\\-\\/\\[\\]]+$" + }, + "description": { + "type": "string", + "description": "The user-defined description of the endpoint.", + "minLength": 0, + "maxLength": 2000 + }, + "path": { + "type": "string", + "description": "The user-defined HTTP path of the endpoint in the Data App. A path must start with a slash (`/`). For example: `\"/v1/hello\"`.", + "pattern": "^\\/([a-zA-Z0-9_]+\\/)*[a-zA-Z0-9_]+$", + "minLength": 2, + "maxLength": 64 + }, + "method": { + "type": "string", + "description": "The user-defined HTTP method of the endpoint. The supported HTTP methods are: `GET`, `POST`, `PUT`, and `DELETE`." + }, + "clusterId": { + "type": "string", + "description": "The ID of the TiDB cluster that is linked to the endpoint." + }, + "params": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointParams" + }, + "description": "The parameters used in the endpoint." + }, + "settings": { + "$ref": "#/definitions/v1beta1EndpointSettings", + "description": "The settings used in the endpoint." + }, + "tag": { + "type": "string", + "description": "The tag used for identifying a group of endpoints.", + "default": "Default" + }, + "batchOperation": { + "type": "boolean", + "description": "Controls whether to enable the endpoint to operate in batch mode. When it is set to `true`, you can operate on multiple rows in a single request." + }, + "sqlTemplate": { + "type": "string", + "description": "Specifies the SQL statements to query data through the endpoint." + } + }, + "required": [ + "displayName", + "path", + "method", + "clusterId", + "settings", + "tag", + "sqlTemplate" + ] + }, + "v1beta1EndpointArgs": { + "type": "object", + "properties": { + "items": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The key-value pairs used as parameters for endpoint testing, in the format of `key:value`. All values are of the string type. For example: `\"limit\":\"2\"`" + } + }, + "required": ["items"] + }, + "v1beta1EndpointParamsRes": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The user-defined name of the parameter." + }, + "type": { + "$ref": "#/definitions/v1beta1EndpointParamsType", + "description": "The user-defined data type of the parameter. \n - `string`\n - `number`\n - `integer`\n - `bool`\n - `array`" + }, + "itemType": { + "type": "#/definitions/v1beta1EndpointParamsItemType", + "description": "The item type of an array type parameter. \n - `string`\n - `number`\n - `integer`" + }, + "required": { + "type": "boolean", + "description": "Specifies whether the parameter is required in the request." + }, + "defaultValue": { + "type": "string", + "description": "The default value of the parameter. Make sure that the value matches the type of parameter you specified. Otherwise, the endpoint returns an error." + }, + "description": { + "type": "string", + "description": "The description of the parameter." + }, + "enum": { + "type": "string", + "description": "Specifies the value options of the parameter. To specify multiple values, you can separate them with a comma (`,`). For example: `\"1,2\"`." + } + } + }, + "v1beta1EndpointParamsType": { + "type": "string", + "enum": ["string", "number", "integer", "bool", "array"], + "description": "The user-defined data type of the parameter. \n - `string`\n - `number`\n - `integer`\n - `bool`\n - `array`" + }, + "v1beta1EndpointParamsItemType": { + "type": "string", + "enum": ["string", "number", "integer"], + "description": "The item type of an array type parameter. \n - `string`\n - `number`\n - `integer`" + }, + "v1beta1EndpointParams": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "The user-defined name of the parameter." + }, + "type": { + "$ref": "#/definitions/v1beta1EndpointParamsType", + "description": "The user-defined data type of the parameter. \n - `string`\n - `number`\n - `integer`\n - `bool`\n - `array`" + }, + "itemType": { + "type": "#/definitions/v1beta1EndpointParamsItemType", + "description": "The item type of an array type parameter. \n - `string`\n - `number`\n - `integer`" + }, + "required": { + "type": "boolean", + "description": "Specifies whether the parameter is required in the request." + }, + "defaultValue": { + "type": "string", + "description": "The default value of the parameter. Make sure that the value matches the type of parameter you specified. Otherwise, the endpoint returns an error." + }, + "description": { + "type": "string", + "description": "The description of the parameter." + }, + "enum": { + "type": "string", + "description": "Specifies the value options of the parameter. To specify multiple values, you can separate them with a comma (`,`). For example: `\"1,2\"`." + } + }, + "required": ["name", "type"] + }, + "v1beta1EndpointSettingsRes": { + "type": "object", + "properties": { + "timeout": { + "type": "integer", + "format": "int32", + "description": "The user-defined timeout for the endpoint in milliseconds.", + "minimum": 1, + "maximum": 60000 + }, + "rowLimit": { + "type": "integer", + "format": "int32", + "description": "The maximum number of rows that the endpoint can operate or return.", + "minimum": 1, + "maximum": 2000 + }, + "paginationEnabled": { + "type": "boolean", + "description": "Controls whether to enable the pagination for the results returned by the `GET` request. When pagination is enabled, you can paginate the results by specifying `page` and `page_size` as query parameters when calling the endpoint." + }, + "cacheEnabled": { + "type": "boolean", + "description": "Controls whether to cache the response returned by your `GET` requests within a specified time-to-live (TTL) period." + }, + "cacheTtl": { + "type": "integer", + "format": "int32", + "description": "The time-to-live (TTL) period in seconds for cached response when `cacheEnabled` is set to `true`.", + "minimum": 30, + "maximum": 600 + } + }, + "description": "The settings used in the endpoint." + }, + "v1beta1EndpointSettings": { + "type": "object", + "properties": { + "timeout": { + "type": "integer", + "format": "int32", + "description": "The user-defined timeout for the endpoint in milliseconds.", + "minimum": 1, + "maximum": 60000 + }, + "rowLimit": { + "type": "integer", + "format": "int32", + "description": "The maximum number of rows that the endpoint can operate or return.", + "minimum": 1, + "maximum": 2000 + }, + "paginationEnabled": { + "type": "boolean", + "description": "Controls whether to enable the pagination for the results returned by the `GET` request. When pagination is enabled, you can paginate the results by specifying `page` and `page_size` as query parameters when calling the endpoint." + }, + "cacheEnabled": { + "type": "boolean", + "description": "Controls whether to cache the response returned by your `GET` requests within a specified time-to-live (TTL) period." + }, + "cacheTtl": { + "type": "integer", + "format": "int32", + "description": "The time-to-live (TTL) period in seconds for cached response when `cacheEnabled` is set to `true`.", + "minimum": 30, + "maximum": 600 + } + }, + "required": [ + "timeout", + "rowLimit", + "paginationEnabled", + "cacheEnabled", + "cacheTtl" + ], + "description": "The settings used in the endpoint." + }, + "v1beta1ListApiKeysResponse": { + "type": "object", + "properties": { + "apiKeys": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1ApiKeyRes" + }, + "description": "The items of API keys in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListApiKeys" + }, + "v1beta1ListDataAppsResponse": { + "type": "object", + "properties": { + "dataApps": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1DataAppRes" + }, + "description": "The items of Data Apps in the project." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListDataApps" + }, + "v1beta1ListDataSourcesResponse": { + "type": "object", + "properties": { + "dataSources": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1DataSource" + }, + "description": "The items of data sources in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListDataSources" + }, + "v1beta1ListDeploymentsResponse": { + "type": "object", + "properties": { + "deployments": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1Deployment" + }, + "description": "The items of deployments in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListDeployments" + }, + "v1beta1ListEndpointsResponse": { + "type": "object", + "properties": { + "endpoints": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1EndpointRes" + }, + "description": "The items of endpoints in the Data App." + }, + "nextPageToken": { + "type": "string", + "description": "The token to retrieve the next page of results." + } + }, + "title": "Response for ListEndpoint" + }, + "v1beta1TestEndpointResponse": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Endpoint's type." + }, + "data": { + "$ref": "#/definitions/TestEndpointResponseData", + "description": "The response of testing the endpoint." + } + }, + "title": "Response for TestEndpoint" + } + } +} diff --git a/static/openapi/tidbcloud-oas-v1beta1-msp.json b/static/openapi/tidbcloud-oas-v1beta1-msp.json new file mode 100644 index 000000000..2d65a677b --- /dev/null +++ b/static/openapi/tidbcloud-oas-v1beta1-msp.json @@ -0,0 +1,685 @@ +{ + "swagger": "2.0", + "info": { + "description": "This is a billing system server for managed service provider (MSP).\n\n**Note:** The MSP API is deprecated as of October 15, 2024, and will be removed in the future. If you are currently using the MSP API, migrate to the Partner Management API in [TiDB Cloud Partner](https://partner-console.tidbcloud.com/signin).", + "title": "MSP (Managed Service Provider) OPENAPI", + "contact": {}, + "version": "v1beta1" + }, + "host": "msp.tidbapi.com", + "basePath": "/v1beta1/msp", + "paths": { + "/bills/{billedMonth}": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/bills/{YYYY-MM}'" + } + ], + "description": "This endpoint retrieves the bill for the given month of a specific MSP. You can query a bill up to 6 months prior to the current month. The bill is returned in JSON format.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return MSP monthly bills", + "parameters": [ + { + "type": "string", + "description": "The month of this bill happens for the specified organization. The format is YYYY-MM, for example, '2023-08'.", + "name": "billedMonth", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/forms.MspBills" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + }, + "/credits": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/credits'" + } + ], + "description": "This endpoint retrieves the credits applied to a specific MSP.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return credits applied to a specific MSP", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.MspCredit" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + }, + "/customerSignupUrl": { + "post": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request POST \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/customerSignupUrl'" + } + ], + "description": "This endpoint creates a new signup URL for an MSP customer.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Account"], + "summary": "Create a new signup URL for an MSP customer", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/api.OpenApiMspCustomerSignupUrl" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.OpenApiError" + } + } + } + } + }, + "/discounts/": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/discounts'" + } + ], + "description": "This endpoint retrieves the discount applied to a specific MSP.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return discounts applied to a specific MSP", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.MspDiscount" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + }, + "/mspCustomers": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/mspCustomers'" + } + ], + "description": "This endpoint returns a list of MSP customers.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Account"], + "summary": "Get a list of MSP customers", + "parameters": [ + { + "type": "string", + "description": "The page token of the next page.", + "name": "pageToken", + "in": "query" + }, + { + "type": "integer", + "description": "The page size of the next page. If `pageSize` is set to 0, it returns all MSP customers in one page.", + "name": "pageSize", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/api.OpenApiListMspCustomerRsp" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.OpenApiError" + } + } + } + } + }, + "/mspCustomers/{customerOrgId}": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/mspCustomers/{customerOrgID}'" + } + ], + "description": "This endpoint retrieves a single MSP customer by their customer org ID.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Account"], + "summary": "Retrieve a single MSP customer", + "parameters": [ + { + "type": "string", + "description": "The MSP customer org ID.", + "name": "customerOrgId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/api.OpenApiMspCustomer" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/api.OpenApiError" + } + } + } + } + }, + "/mspCustomerBills/{billedMonth}/mspCustomers/{mspCustomerId}": { + "get": { + "x-code-samples": [ + { + "lang": "curl", + "source": "curl --digest \\\n --user 'YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY' \\\n --request GET \\\n --url 'https://msp.tidbapi.com/v1beta1/msp/mspCustomerBills/{YYYY-MM}/mspCustomers/{mspCustomerId}'" + } + ], + "description": "This endpoint retrieves the bill for the given month of a specific end customer of MSP. You can query a bill up to 6 months prior to the current month. The bill is returned in JSON format.", + "consumes": ["application/json"], + "produces": ["application/json"], + "tags": ["Billing"], + "summary": "Return monthly bills for a specific end customer of MSP", + "parameters": [ + { + "type": "string", + "description": "The month of this bill happens for the specified organization. The format is YYYY-MM, for example, '2023-08'.", + "name": "billedMonth", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "ID of the end customer of MSP.", + "name": "mspCustomerId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/forms.BillsExplorer" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/billing_errors.BaseError" + } + } + } + } + } + }, + "definitions": { + "api.OpenApiCreateMspCustomerSignupUrlReq": { + "type": "object", + "properties": { + "orgId": { + "description": "The ID of the MSP.", + "type": "string", + "example": "123456" + } + } + }, + "api.OpenApiError": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "error": {}, + "msgPrefix": { + "type": "string" + }, + "status": { + "type": "integer" + } + } + }, + "api.OpenApiListMspCustomerRsp": { + "type": "object", + "properties": { + "mspCustomers": { + "description": "The list of matching MSP Customers.", + "type": "array", + "items": { + "$ref": "#/definitions/api.OpenApiMspCustomer" + } + }, + "nextPageToken": { + "description": "`next_page_token` can be sent in a subsequent call to fetch more results", + "type": "string", + "example": "498c7f44-656f-4944-b455-0695faa5d4f9" + } + } + }, + "api.OpenApiMspCustomer": { + "type": "object", + "properties": { + "effectedTime": { + "description": "The effected time of the MSP customer.", + "type": "string", + "example": "2023-12-06 15:18:13" + }, + "email": { + "description": "The email of the MSP customer.", + "type": "string", + "example": "123@my.com" + }, + "expiredTime": { + "description": "The expired time of the MSP customer.", + "type": "string", + "example": "2023-12-06 15:18:13" + }, + "id": { + "description": "The ID of the MSP customer.", + "type": "string", + "example": "123456" + }, + "orgId": { + "description": "The ID of the MSP customer.", + "type": "string", + "example": "123456" + }, + "orgName": { + "description": "The org name of the MSP customer.", + "type": "string", + "example": "New Org" + }, + "state": { + "description": "The state of the MSP customer.", + "type": "string", + "example": "active" + } + } + }, + "api.OpenApiMspCustomerSignupUrl": { + "type": "object", + "properties": { + "customerSignupUrl": { + "description": "The signup URL of the MSP customer.", + "type": "string", + "example": "https://test.com/signup?msp=test\u0026third_party_account_provider=test\u0026third_party_account_token=test" + }, + "expiredAt": { + "description": "The expired time of the MSP customer signup url.", + "type": "string", + "example": "2024-12-06 15:18:13" + } + } + }, + "billing_errors.BaseError": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "error": {}, + "msgPrefix": { + "type": "string" + }, + "status": { + "type": "integer" + } + } + }, + "forms.BillsExplorer": { + "type": "object", + "properties": { + "overview": { + "description": "The overall information for a bill in the specified organization.", + "allOf": [ + { + "$ref": "#/definitions/forms.BillsOverview" + } + ] + }, + "summaryByProject": { + "description": "A breakdown of the bill by project.", + "allOf": [ + { + "$ref": "#/definitions/forms.SummaryByProject" + } + ] + }, + "summaryByService": { + "description": "A breakdown of the bill by service.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsServiceCosts" + } + } + } + }, + "forms.BillsOtherName": { + "type": "object", + "properties": { + "chargeName": { + "type": "string", + "example": "Support Plan" + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "discounts": { + "description": "Total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "runningTotal": { + "description": "The sum of services that the specified organization consumed in the period during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "totalCost": { + "description": "The total amount that the specified organization should pay toward this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "number", + "example": 0 + } + } + }, + "forms.BillsOverview": { + "type": "object", + "properties": { + "billedMonth": { + "description": "The month in which this bill is generated for the specified organization.", + "type": "string", + "example": "2023-09" + }, + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "discounts": { + "description": "Total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "runningTotal": { + "description": "The sum of services that the specified organization consumed in the period during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "totalCost": { + "description": "The total amount that the specified organization should pay toward this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "number", + "example": 0 + } + } + }, + "forms.BillsProjects": { + "type": "object", + "properties": { + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "discounts": { + "description": "Total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "projectName": { + "description": "The name of a project in the specified organization.", + "type": "string", + "example": "prod-project" + }, + "runningTotal": { + "description": "The sum of services that the specified organization consumed in the period during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "totalCost": { + "description": "The total amount that the specified organization should pay toward this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "number", + "example": 0 + } + } + }, + "forms.BillsServiceCosts": { + "type": "object", + "properties": { + "credits": { + "description": "The total credits held by the organization in this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "discounts": { + "description": "Total amount of discounts applied to this bill. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "runningTotal": { + "description": "The sum of services that the specified organization consumed in the period during this bill period. The value of this field is expressed in cents (100ths of one US Dollar).", + "type": "number", + "example": 0 + }, + "serviceCosts": { + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsServiceCosts" + } + }, + "serviceName": { + "description": "The name of services provided by TiDB Cloud.", + "type": "string", + "example": "TiDB Dedicated" + }, + "totalCost": { + "description": "The total amount that the specified organization should pay toward this bill. The value of this field is expressed in cents (100ths of one US Dollar).\n`total_cost` = `running_total` - `discounts` - `credits`.", + "type": "number", + "example": 0 + } + } + }, + "forms.MspBills": { + "type": "object", + "properties": { + "overview": { + "description": "The overall information for a bill in the specified organization.", + "allOf": [ + { + "$ref": "#/definitions/forms.BillsOverview" + } + ] + }, + "summaryByCustomer": { + "description": "Month of bills happens to a specific MSP.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.SummaryByCustomer" + } + }, + "summaryByService": { + "description": "A breakdown of the bill by service.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsServiceCosts" + } + } + } + }, + "forms.MspCredit": { + "type": "object", + "properties": { + "credit": { + "description": "The total amount of credit.", + "type": "number", + "example": 1000 + }, + "creditCode": { + "description": "The code of a credit.", + "type": "string", + "example": "498c7f44-656f-4944-b455-0695faa5d4f9" + }, + "expiryDate": { + "description": "Expired date of a credit.", + "type": "string", + "example": "2023-12-01T00:00:00Z" + }, + "remainingCredit": { + "description": "The remaining amount of a credit.", + "type": "number", + "example": 1000 + }, + "services": { + "description": "The service to which a credit is applicable.", + "type": "string", + "example": "General Product" + }, + "startDate": { + "description": "Effective start date of a credit.", + "type": "string", + "example": "2023-11-01T00:00:00Z" + }, + "status": { + "description": "The status of a credit.", + "type": "string", + "example": "active" + } + } + }, + "forms.MspDiscount": { + "type": "object", + "properties": { + "description": { + "description": "The description of a discount.", + "type": "string" + }, + "discountCode": { + "description": "The code of a discount.", + "type": "string", + "example": "498c7f44-656f-4944-b455-0695faa5d4f9" + }, + "expiryDate": { + "description": "Expired date of a credit.", + "type": "string", + "example": "2023-12-01T00:00:00Z" + }, + "percentageDiscount": { + "description": "The percentage is deducted from the original price. For example, a 20% discount on a $100 item would result in a discounted price of $80.", + "type": "string", + "example": "20%" + }, + "services": { + "description": "The service to which a discount is applicable.", + "type": "string", + "example": "Node Compute, Changefeed," + }, + "startDate": { + "description": "Effective start date of a credit.", + "type": "string", + "example": "2023-11-01T00:00:00Z" + }, + "status": { + "description": "The status of a discount.", + "type": "string", + "example": "valid" + } + } + }, + "forms.SummaryByCustomer": { + "type": "object", + "properties": { + "customerID": { + "description": "The Organization ID of MSP", + "type": "integer" + }, + "mspCustomerBills": { + "description": "The bill generated for a specific MSP customer in the specified month.", + "allOf": [ + { + "$ref": "#/definitions/forms.BillsExplorer" + } + ] + } + } + }, + "forms.SummaryByProject": { + "type": "object", + "properties": { + "otherCharges": { + "description": "These charges occur not only within a project but also across the entire organization.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsOtherName" + } + }, + "projects": { + "description": "The projects in the specified organization.", + "type": "array", + "items": { + "$ref": "#/definitions/forms.BillsProjects" + } + } + } + } + } +} diff --git a/static/openapi/tidbcloud-oas.json b/static/openapi/tidbcloud-oas.json new file mode 100644 index 000000000..3a995f09a --- /dev/null +++ b/static/openapi/tidbcloud-oas.json @@ -0,0 +1,18669 @@ +{ + "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\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 **Organization Settings** 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 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 have 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 `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. Click **Organization** in the lower-left corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab and then click **Create API Key**.\n4. Enter a description for your API key. The role of the API key is always `Owner` currently.\n5. Click **Next**. Copy and save the public key and the private key.\n6. 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.\n7. Click **Done**.\n\n### View details of an API key\n\nTo view details of an API key, perform the following steps:\n\n1. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. You can view the details of the API keys in the menu.\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. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Edit** in the API key row that you want to change.\n4. You can update the API key description.\n5. Click **Done**.\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. Click **Organization** in the upper-right corner of the TiDB Cloud console.\n2. Click **Organization Settings**. The organization settings page is displayed.\n3. Click the **API Keys** tab.\n4. Click **Delete** in the API key row that you want to delete.\n5. Click **I understand the consequences, delete this API Key.**\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## 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 Serverless clusters, 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." + }, + { + "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 Serverless clusters, 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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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)." + } + }, + "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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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 Serverless cluster, 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 Serverless cluster, 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 Serverless](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 Serverless cluster, 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 Serverless cluster, 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 Serverless", + "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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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 Serverless cluster, 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 Serverless cluster, 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)." + }, + "accesspoint_id": { + "type": "string", + "format": "uint64", + "x-nullable": true, + "example": "1", + "description": "The ID of the accesspoint." + } + } + }, + "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}/accesspoints": { + "get": { + "summary": "List all accesspoints for a cluster.", + "operationId": "ListAccesspoints", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the accesspoint." + }, + "project_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects)." + }, + "cluster_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the cluster." + }, + "display_name": { + "type": "string", + "example": "Accesspoint", + "description": "The display name of the accesspoint. 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]$" + }, + "tidb_node_quantity": { + "type": "integer", + "format": "int32", + "example": 2, + "description": "The number of tidb nodes in the accesspoint." + }, + "public_endpoint": { + "description": "The public endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + }, + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + }, + "vpc_peering_endpoint": { + "description": "The VPC peering endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + } + } + }, + "private_endpoint": { + "description": "The private endpoint.", + "type": "object", + "properties": { + "private_link_service": { + "description": "The private endpoint service.", + "type": "object", + "properties": { + "service_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"] + } + } + }, + "host": { + "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": "Accesspoint", + "title": "Accesspoint", + "required": [ + "id", + "project_id", + "cluster_id", + "display_name" + ] + }, + "description": "The accesspoints for the cluster." + }, + "total": { + "type": "integer", + "format": "int64", + "example": 1, + "description": "The total number of accesspoints." + } + }, + "description": "ListAccesspointsResp is the response for listing accesspoints for a cluster.", + "title": "ListAccesspointsResp", + "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 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}/accesspoints" + } + ] + }, + "post": { + "summary": "Create an Accesspoint.", + "description": "CreateAccesspoint", + "operationId": "CreateAccesspoint", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the accesspoint." + } + } + } + }, + "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": { + "display_name": { + "type": "string", + "example": "Accesspoint", + "description": "The display name of the accesspoint. 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]$" + }, + "public_endpoint": { + "description": "The public endpoint.", + "type": "object", + "properties": { + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + } + }, + "description": "CreateAccesspointReq is the request for creating an accesspoint for a cluster.", + "title": "CreateAccesspointReq", + "required": ["display_name"] + } + } + ], + "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}/accesspoints \\\n --header 'content-type: application/json' \\\n --data '{\"display_name\":\"Accesspoint\",\"public_endpoint\":{\"ip_allowlist\":[{\"cidr\":\"0.0.0.0/0\"}]}}'" + } + ] + } + }, + "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/accesspoints/{accesspoint_id}": { + "get": { + "summary": "Get an accesspoint by ID.", + "operationId": "GetAccesspoint", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the accesspoint." + }, + "project_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects)." + }, + "cluster_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the cluster." + }, + "display_name": { + "type": "string", + "example": "Accesspoint", + "description": "The display name of the accesspoint. 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]$" + }, + "tidb_node_quantity": { + "type": "integer", + "format": "int32", + "example": 2, + "description": "The number of tidb nodes in the accesspoint." + }, + "public_endpoint": { + "description": "The public endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + }, + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + }, + "vpc_peering_endpoint": { + "description": "The VPC peering endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + } + } + }, + "private_endpoint": { + "description": "The private endpoint.", + "type": "object", + "properties": { + "private_link_service": { + "description": "The private endpoint service.", + "type": "object", + "properties": { + "service_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"] + } + } + }, + "host": { + "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": "Accesspoint", + "title": "Accesspoint", + "required": ["id", "project_id", "cluster_id", "display_name"] + } + }, + "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": "accesspoint_id", + "description": "The ID of the accesspoint.", + "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}/accesspoints/{accesspoint_id}" + } + ] + }, + "delete": { + "summary": "Delete an accessendpoint for a cluster.", + "description": "DeleteAccesspoint", + "operationId": "DeleteAccesspoint", + "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": "accesspoint_id", + "description": "The ID of the accesspoint to be deleted.", + "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}/accesspoints/{accesspoint_id}" + } + ] + }, + "patch": { + "summary": "Update an accesspoint.", + "description": "UpdateAccesspoint", + "operationId": "UpdateAccesspoint", + "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.", + "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": "accesspoint_id", + "description": "The ID of the accesspoint to be updated.", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "display_name": { + "type": "string", + "x-nullable": true, + "example": "Accesspoint", + "description": "The display name of the accesspoint. 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]$" + }, + "public_endpoint": { + "description": "The public endpoint.", + "type": "object", + "properties": { + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + } + }, + "description": "UpdateAccesspointReq is the request for updating an accesspoint for a cluster.", + "title": "UpdateAccesspointReq" + } + } + ], + "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}/accesspoints/{accesspoint_id} \\\n --header 'content-type: application/json' \\\n --data '{\"display_name\":\"Accesspoint\",\"public_endpoint\":{\"ip_allowlist\":[{\"cidr\":\"0.0.0.0/0\"}]}}'" + } + ] + } + }, + "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/accesspoints/{accesspoint_id}/privateLinkEndpoints": { + "get": { + "summary": "List all private link endpoints for an accesspoint.", + "operationId": "ListPrivateLinkEndpoints", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": { + "items": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the private link endpoint." + }, + "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": "ACTIVE", + "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\"." + } + }, + "description": "PrivateLinkEndpoint", + "title": "PrivateLinkEndpoint", + "required": ["id", "endpoint_name", "status"] + }, + "description": "The private link endpoints for an accesspoint." + }, + "total": { + "type": "integer", + "format": "int64", + "example": 1, + "description": "The total number of private link endpoints." + } + }, + "description": "ListPrivateLinkEndpointsResp is the response for listing private link endpoints for an accesspoint.", + "title": "ListPrivateLinkEndpointsResp", + "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 the project.", + "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": "accesspoint_id", + "description": "The ID of the accesspoint.", + "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}/accesspoints/{accesspoint_id}/privateLinkEndpoints" + } + ] + }, + "post": { + "summary": "Create a private link endpoint for an accesspoint.", + "description": "CreatePrivateLinkEndpoint", + "operationId": "CreatePrivateLinkEndpoint", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the private link endpoint." + } + }, + "description": "CreatePrivateLinkEndpointResp is the response for creating a private link endpoint for a cluster.", + "title": "CreatePrivateLinkEndpointResp", + "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.", + "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": "accesspoint_id", + "description": "The ID of the accesspoint.", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "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." + } + }, + "description": "CreatePrivateLinkEndpointReq is the request for creating a private link endpoint for a cluster.", + "title": "CreatePrivateLinkEndpointReq", + "required": ["endpoint_name"] + } + } + ], + "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}/accesspoints/{accesspoint_id}/privateLinkEndpoints \\\n --header 'content-type: application/json' \\\n --data '{\"endpoint_name\":\"vpce-01234567890123456\"}'" + } + ] + } + }, + "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/accesspoints/{accesspoint_id}/privateLinkEndpoints/{private_link_endpoint_id}": { + "get": { + "summary": "Get a private link endpoint of an accesspoint by ID.", + "operationId": "GetPrivateLinkEndpoint", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the private link endpoint." + }, + "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": "ACTIVE", + "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\"." + } + }, + "description": "PrivateLinkEndpoint", + "title": "PrivateLinkEndpoint", + "required": ["id", "endpoint_name", "status"] + } + }, + "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.", + "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": "accesspoint_id", + "description": "The ID of the accesspoint.", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "private_link_endpoint_id", + "description": "The ID of the private link endpoint.", + "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}/accesspoints/{accesspoint_id}/privateLinkEndpoints/{private_link_endpoint_id}" + } + ] + }, + "delete": { + "summary": "Delete a private link endpoint for an accesspoint.", + "description": "DeletePrivateLinkEndpoint", + "operationId": "DeletePrivateLinkEndpoint", + "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.", + "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": "accesspoint_id", + "description": "The ID of the accesspoint.", + "in": "path", + "required": true, + "type": "string", + "format": "uint64" + }, + { + "name": "private_link_endpoint_id", + "description": "The ID of the private link endpoint to be deleted.", + "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}/accesspoints/{accesspoint_id}/privateLinkEndpoints/{private_link_endpoint_id}" + } + ] + } + }, + "/api/v1beta/projects/{project_id}/clusters/{cluster_id}/backups": { + "get": { + "summary": "List all backups for a cluster.", + "description": "For TiDB Cloud Serverless clusters, 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 Serverless clusters, 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 Serverless clusters, 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 Serverless clusters, 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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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" + ] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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\"},\"azure_token_access\":{\"sas_token\":\"YOUR_SAS_TOKEN\"},\"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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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\"},\"azure_token_access\":{\"sas_token\":\"YOUR_SAS_TOKEN\"},\"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 Serverless clusters.", + "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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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 Serverless clusters, 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 Serverless clusters, 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 Serverless clusters, 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 Serverless clusters, 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 Serverless clusters, 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 Serverless cluster.\n\nFor TiDB Cloud Serverless clusters, 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 Serverless cluster, 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 Serverless cluster, 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 Serverless clusters, 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": { + "AccesspointPublicEndpoint": { + "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", + "maximum": 65535, + "minimum": 1024 + }, + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + }, + "AccesspointVpcPeeringEndpoint": { + "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", + "maximum": 65535, + "minimum": 1024 + } + } + }, + "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", "AZBLOB"] + }, + "ImportStatusImportTaskPhase": { + "type": "string", + "enum": [ + "PREPARING", + "IMPORTING", + "COMPLETED", + "FAILED", + "CANCELING", + "CANCELED" + ] + }, + "PrivateEndpointPrivateLinkService": { + "type": "object", + "properties": { + "service_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"] + } + } + }, + "PrivateEndpointPrivateLinkServiceStatus": { + "type": "string", + "enum": ["CREATING", "ACTIVE", "DELETING"] + }, + "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": {} + } + } + } + }, + "openapiAccesspoint": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the accesspoint." + }, + "project_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects)." + }, + "cluster_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the cluster." + }, + "display_name": { + "type": "string", + "example": "Accesspoint", + "description": "The display name of the accesspoint. 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]$" + }, + "tidb_node_quantity": { + "type": "integer", + "format": "int32", + "example": 2, + "description": "The number of tidb nodes in the accesspoint." + }, + "public_endpoint": { + "description": "The public endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + }, + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + }, + "vpc_peering_endpoint": { + "description": "The VPC peering endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + } + } + }, + "private_endpoint": { + "description": "The private endpoint.", + "type": "object", + "properties": { + "private_link_service": { + "description": "The private endpoint service.", + "type": "object", + "properties": { + "service_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"] + } + } + }, + "host": { + "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": "Accesspoint", + "title": "Accesspoint", + "required": ["id", "project_id", "cluster_id", "display_name"] + }, + "openapiAccesspointPrivateEndpoint": { + "type": "object", + "properties": { + "private_link_service": { + "description": "The private endpoint service.", + "type": "object", + "properties": { + "service_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"] + } + } + }, + "host": { + "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\"`." + } + } + }, + "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"] + }, + "openapiAzureTokenAccess": { + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "description": "AzureTokenAccess represents the settings to access the Azure blob source by using sas token.", + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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 Serverless cluster, 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 Serverless cluster, 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 Serverless cluster, 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 Serverless cluster, 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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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 Serverless cluster, 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 Serverless cluster, 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 Serverless cluster, 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 Serverless cluster, 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"] + }, + "openapiCreateAccesspointResp": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the accesspoint." + } + } + }, + "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"] + }, + "openapiCreatePrivateLinkEndpointResp": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the private link endpoint." + } + }, + "description": "CreatePrivateLinkEndpointResp is the response for creating a private link endpoint for a cluster.", + "title": "CreatePrivateLinkEndpointResp", + "required": ["id"] + }, + "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"] + }, + "openapiIPAllowlist": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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"] + }, + "openapiListAccesspointsResp": { + "type": "object", + "properties": { + "items": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the accesspoint." + }, + "project_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the project. You can get the project ID from the response of [List all accessible projects](#tag/Project/operation/ListProjects)." + }, + "cluster_id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the cluster." + }, + "display_name": { + "type": "string", + "example": "Accesspoint", + "description": "The display name of the accesspoint. 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]$" + }, + "tidb_node_quantity": { + "type": "integer", + "format": "int32", + "example": 2, + "description": "The number of tidb nodes in the accesspoint." + }, + "public_endpoint": { + "description": "The public endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + }, + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + }, + "vpc_peering_endpoint": { + "description": "The VPC peering endpoint.", + "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", + "maximum": 65535, + "minimum": 1024 + } + } + }, + "private_endpoint": { + "description": "The private endpoint.", + "type": "object", + "properties": { + "private_link_service": { + "description": "The private endpoint service.", + "type": "object", + "properties": { + "service_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"] + } + } + }, + "host": { + "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": "Accesspoint", + "title": "Accesspoint", + "required": ["id", "project_id", "cluster_id", "display_name"] + }, + "description": "The accesspoints for the cluster." + }, + "total": { + "type": "integer", + "format": "int64", + "example": 1, + "description": "The total number of accesspoints." + } + }, + "description": "ListAccesspointsResp is the response for listing accesspoints for a cluster.", + "title": "ListAccesspointsResp", + "required": ["items", "total"] + }, + "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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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 Serverless cluster, 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 Serverless cluster, 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\n- `\"LOCAL_FILE\"`: import data from a local file (only available for [TiDB Cloud Serverless](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", "AZBLOB"] + }, + "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"] + }, + "azure_token_access": { + "description": "The settings to access the Azblob data with an sas token. This field is only needed if you want to access the Azblob data with an sas token.", + "type": "object", + "properties": { + "sas_token": { + "type": "string", + "example": "YOUR_SAS_TOKEN", + "description": "The sas token to access the data. This information will be redacted when it is retrieved to obtain the import task information." + } + }, + "title": "AzureTokenAccess", + "required": ["sas_token"] + }, + "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"] + }, + "openapiListPrivateLinkEndpointsResp": { + "type": "object", + "properties": { + "items": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the private link endpoint." + }, + "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": "ACTIVE", + "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\"." + } + }, + "description": "PrivateLinkEndpoint", + "title": "PrivateLinkEndpoint", + "required": ["id", "endpoint_name", "status"] + }, + "description": "The private link endpoints for an accesspoint." + }, + "total": { + "type": "integer", + "format": "int64", + "example": 1, + "description": "The total number of private link endpoints." + } + }, + "description": "ListPrivateLinkEndpointsResp is the response for listing private link endpoints for an accesspoint.", + "title": "ListPrivateLinkEndpointsResp", + "required": ["items", "total"] + }, + "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)." + } + }, + "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)." + } + }, + "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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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 Serverless](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\n\n**Warning:** `\"DEVELOPER\"` will soon be changed to `\"SERVERLESS\"` to represent TiDB Cloud Serverless clusters.", + "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"] + }, + "openapiPrivateLinkEndpoint": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uint64", + "example": "1", + "description": "The ID of the private link endpoint." + }, + "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": "ACTIVE", + "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\"." + } + }, + "description": "PrivateLinkEndpoint", + "title": "PrivateLinkEndpoint", + "required": ["id", "endpoint_name", "status"] + }, + "openapiPrivateLinkEndpointStatus": { + "type": "string", + "enum": ["PENDING", "ACTIVE", "DELETING", "FAILED"] + }, + "openapiPublicEndpointSpec": { + "type": "object", + "properties": { + "ip_allowlist": { + "type": "array", + "format": "array", + "items": { + "type": "object", + "properties": { + "cidr": { + "type": "string", + "example": "0.0.0.0/0", + "description": "CIDR." + } + } + }, + "description": "The IP allowlist for the public endpoint." + } + } + }, + "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 Serverless cluster, 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)." + }, + "accesspoint_id": { + "type": "string", + "format": "uint64", + "x-nullable": true, + "example": "1", + "description": "The ID of the accesspoint." + } + } + }, + "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)." + }, + "accesspoint_id": { + "type": "string", + "format": "uint64", + "x-nullable": true, + "example": "1", + "description": "The ID of the accesspoint." + } + } + }, + "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)." + }, + "accesspoint_id": { + "type": "string", + "format": "uint64", + "x-nullable": true, + "example": "1", + "description": "The ID of the accesspoint." + } + } + }, + "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 Serverless cluster, 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"] + } + ] +}