{
  "swagger": "2.0",
  "info": {
    "title": "TiDB Cloud Premium API",
    "description": "TiDB Cloud Premium API",
    "version": "v1beta2"
  },
  "tags": [
    {
      "name": "ExportService"
    }
  ],
  "host": "cloud.tidbapi.com",
  "basePath": "/api/v2025/cloud/v1beta2",
  "schemes": ["https"],
  "consumes": ["application/json"],
  "produces": ["application/json"],
  "paths": {
    "/api/v2025/cloud/v1beta2/tidbs/{tidbId}/exports": {
      "get": {
        "summary": "List exports for a TiDB cluster",
        "operationId": "ExportService_ListExports",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2ListExportsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "description": "The ID of the TiDB cluster. Required.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "pageSize",
            "description": "The maximum number of exports to return. The service may return fewer than this value.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageToken",
            "description": "A page token, received from a previous `ListExports` call. Provide this to retrieve the subsequent page.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "skip",
            "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "orgId",
            "description": "Organization id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "projectId",
            "description": "Project id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": ["ExportService"]
      },
      "post": {
        "summary": "Create an export",
        "operationId": "ExportService_CreateExport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2Export"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "description": "The ID of the TiDB cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "export",
            "description": "The export to create.",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2Export"
            }
          },
          {
            "name": "validateOnly",
            "description": "If true, the request will be validated but not executed.",
            "in": "query",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "orgId",
            "description": "Organization id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "projectId",
            "description": "Project id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": ["ExportService"]
      }
    },
    "/api/v2025/cloud/v1beta2/tidbs/{tidbId}/exports/{exportId}": {
      "get": {
        "summary": "Get an export",
        "operationId": "ExportService_GetExport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2Export"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "description": "The ID of the TiDB cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "exportId",
            "description": "The ID of the export.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "orgId",
            "description": "Organization id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "projectId",
            "description": "Project id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": ["ExportService"]
      },
      "delete": {
        "summary": "Delete an export",
        "operationId": "ExportService_DeleteExport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2Export"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "description": "The ID of the TiDB cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "exportId",
            "description": "The ID of the export to delete.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "orgId",
            "description": "Organization id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "projectId",
            "description": "Project id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": ["ExportService"]
      }
    },
    "/api/v2025/cloud/v1beta2/tidbs/{tidbId}/exports/{exportId}:cancel": {
      "post": {
        "summary": "Cancel an export",
        "operationId": "ExportService_CancelExport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2Export"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "description": "The ID of the TiDB cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "exportId",
            "description": "The ID of the export to cancel.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2ExportServiceCancelExportBody"
            }
          },
          {
            "name": "orgId",
            "description": "Organization id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "projectId",
            "description": "Project id",
            "in": "query",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": ["ExportService"]
      }
    }
  },
  "definitions": {
    "googlerpcStatus": {
      "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors).",
      "type": "object",
      "properties": {
        "code": {
          "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code].",
          "type": "integer",
          "format": "int32"
        },
        "details": {
          "description": "A list of messages that carry the error details.  There is a common set of\nmessage types for APIs to use.",
          "type": "array",
          "items": {
            "$ref": "#/definitions/protobufAny",
            "type": "object"
          }
        },
        "message": {
          "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client.",
          "type": "string"
        }
      }
    },
    "nextgenv1beta2AzureBlobCloudStorage": {
      "type": "object",
      "properties": {
        "authType": {
          "description": "Required. The auth method of Azure Blob.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2AzureBlobCloudStorageAzureBlobAuthType"
            }
          ]
        },
        "sasToken": {
          "description": "Optional. The SAS token.",
          "type": "string"
        },
        "uri": {
          "description": "Required. The Azure Blob URI. For example: azure://<account>.blob.core.windows.net/<container>/<path>/.",
          "type": "string"
        }
      },
      "required": ["uri", "authType"]
    },
    "nextgenv1beta2AzureBlobCloudStorageAzureBlobAuthType": {
      "description": " - SAS_TOKEN: The access method is SAS token.",
      "type": "string",
      "enum": ["SAS_TOKEN"]
    },
    "nextgenv1beta2CloudStorage": {
      "description": "CloudStorage defines the destination configuration for exported data.",
      "type": "object",
      "properties": {
        "azureBlob": {
          "$ref": "#/definitions/nextgenv1beta2AzureBlobCloudStorage"
        },
        "gcs": {
          "$ref": "#/definitions/nextgenv1beta2GCSCloudStorage"
        },
        "oss": {
          "$ref": "#/definitions/nextgenv1beta2OSSCloudStorage"
        },
        "s3": {
          "$ref": "#/definitions/nextgenv1beta2S3CloudStorage"
        },
        "type": {
          "description": "Required. The type of cloud storage.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2CloudStorageTypeEnum"
            }
          ]
        }
      },
      "required": ["type"]
    },
    "nextgenv1beta2CloudStorageTypeEnum": {
      "description": " - S3: Amazon S3 cloud storage.\n - GCS: Google Cloud Storage.\n - AZURE_BLOB: Azure Blob Storage.\n - OSS: Alibaba Cloud OSS.",
      "type": "string",
      "enum": ["S3", "GCS", "AZURE_BLOB", "OSS"]
    },
    "nextgenv1beta2Export": {
      "type": "object",
      "properties": {
        "cloudStorage": {
          "description": "The destination configuration for where the exported data is stored.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2CloudStorage"
            }
          ]
        },
        "completeTime": {
          "description": "Timestamp when the export task was completed, in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.",
          "type": "string",
          "format": "date-time",
          "readOnly": true,
          "x-nullable": true
        },
        "createTime": {
          "description": "Timestamp when the export task was created, in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.",
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "createdBy": {
          "description": "The email address of the user who created the export task.",
          "type": "string",
          "readOnly": true
        },
        "displayName": {
          "description": "The display name of the export task. Default value is `SNAPSHOT_{snapshot_time}`.",
          "type": "string"
        },
        "exportId": {
          "description": "The unique ID of the export task.",
          "type": "string",
          "readOnly": true
        },
        "exportOptions": {
          "description": "The configuration options for the export task.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportOptions"
            }
          ]
        },
        "password": {
          "description": "Database password.",
          "type": "string"
        },
        "reason": {
          "description": "An error message if the export task failed. Otherwise, empty.",
          "type": "string",
          "readOnly": true
        },
        "snapshotTime": {
          "description": "The snapshot time of the export.",
          "type": "string",
          "format": "date-time",
          "readOnly": true,
          "x-nullable": true
        },
        "snapshotTso": {
          "description": "The snapshot TSO of the export.",
          "type": "string",
          "format": "uint64",
          "readOnly": true
        },
        "state": {
          "description": "The state of the export task.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportState"
            }
          ],
          "readOnly": true
        },
        "tidbId": {
          "description": "The ID of the cluster to which the export task belongs.",
          "type": "string",
          "readOnly": true
        },
        "updateTime": {
          "description": "Timestamp when the export task was last updated, in the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.",
          "type": "string",
          "format": "date-time",
          "readOnly": true,
          "x-nullable": true
        },
        "username": {
          "description": "Database username.",
          "type": "string"
        }
      },
      "required": ["exportOptions", "cloudStorage", "username"]
    },
    "nextgenv1beta2ExportOptions": {
      "type": "object",
      "properties": {
        "compression": {
          "description": "The compression algorithm of the export file.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportOptionsCompressionType"
            }
          ]
        },
        "csvFormat": {
          "description": "The format specification for the CSV file.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportOptionsCSVFormat"
            }
          ]
        },
        "fileType": {
          "description": "The export file type.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportOptionsFileType"
            }
          ]
        },
        "filter": {
          "description": "Defines which tables to include in the export.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportOptionsFilter"
            }
          ]
        }
      },
      "required": ["fileType", "compression", "filter"]
    },
    "nextgenv1beta2ExportOptionsCSVFormat": {
      "type": "object",
      "properties": {
        "delimiter": {
          "description": "The character used to enclose string values in the CSV file. Default value is `\"`.",
          "type": "string",
          "x-nullable": true
        },
        "nullValue": {
          "description": "The string representation of NULL values in the CSV file. Default is `\\N`.",
          "type": "string",
          "x-nullable": true
        },
        "separator": {
          "description": "The character used to separate values in the CSV file. Default value is `,`.",
          "type": "string"
        },
        "skipHeader": {
          "description": "Indicates whether to omit the header row in exported CSV files. Default value is `false`.",
          "type": "boolean"
        }
      }
    },
    "nextgenv1beta2ExportOptionsCompressionType": {
      "description": "- GZIP: The parquet compression type is GZIP.\n - SNAPPY: The parquet compression type is SNAPPY.\n - ZSTD: The parquet compression type is ZSTD.\n - NONE: No compression.",
      "type": "string",
      "enum": ["GZIP", "SNAPPY", "ZSTD", "NONE"],
      "title": "Compression type enum for export"
    },
    "nextgenv1beta2ExportOptionsFileType": {
      "description": "- SQL: SQL type.\n - CSV: CSV type.",
      "type": "string",
      "enum": ["SQL", "CSV"],
      "title": "File type enum for export"
    },
    "nextgenv1beta2ExportOptionsFilter": {
      "type": "object",
      "properties": {
        "sql": {
          "description": "Filters the exported data with the SQL statement.",
          "type": "string"
        },
        "table": {
          "description": "Filters the exported data with table filter patterns.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2ExportOptionsFilterTable"
            }
          ]
        }
      }
    },
    "nextgenv1beta2ExportOptionsFilterTable": {
      "type": "object",
      "properties": {
        "patterns": {
          "description": "A list of [table-filter](https://docs.pingcap.com/tidb/stable/table-filter/#syntax) patterns.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "where": {
          "description": "Filters the exported tables with the `WHERE` condition.",
          "type": "string"
        }
      },
      "required": ["patterns"]
    },
    "nextgenv1beta2ExportServiceCancelExportBody": {
      "type": "object"
    },
    "nextgenv1beta2ExportState": {
      "description": "- RUNNING: The export job is running.\n - SUCCEEDED: The export job succeeded.\n - FAILED: The export job failed.\n - CANCELED: The export job is canceled.\n - DELETED: The export job is deleted.",
      "type": "string",
      "enum": ["RUNNING", "SUCCEEDED", "FAILED", "CANCELED", "DELETED"],
      "title": "State enum for export operations"
    },
    "nextgenv1beta2GCSCloudStorage": {
      "type": "object",
      "properties": {
        "authType": {
          "description": "Required. The auth method of GCS.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2GCSCloudStorageGCSAuthType"
            }
          ]
        },
        "serviceAccountKey": {
          "description": "Required. The service account key.",
          "type": "string"
        },
        "uri": {
          "description": "Required. The GCS URI. For example: gs://<bucket>/<path>/.",
          "type": "string"
        }
      },
      "required": ["uri", "authType"]
    },
    "nextgenv1beta2GCSCloudStorageGCSAuthType": {
      "description": " - SERVICE_ACCOUNT_KEY: The access method is service account key.",
      "type": "string",
      "enum": ["SERVICE_ACCOUNT_KEY"]
    },
    "nextgenv1beta2ListExportsResponse": {
      "type": "object",
      "properties": {
        "exports": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/nextgenv1beta2Export",
            "type": "object"
          }
        },
        "nextPageToken": {
          "description": "A token, which can be sent as `page_token` to retrieve the next page.",
          "type": "string"
        },
        "totalSize": {
          "description": "The total number of exports that match the query.",
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "nextgenv1beta2OSSCloudStorage": {
      "type": "object",
      "properties": {
        "accessKey": {
          "description": "Optional. The access key.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2OSSCloudStorageAccessKey"
            }
          ]
        },
        "authType": {
          "description": "Required. The auth method of OSS.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2OSSCloudStorageOSSAuthType"
            }
          ]
        },
        "roleArn": {
          "description": "Optional. The role ARN.",
          "type": "string"
        },
        "uri": {
          "description": "Required. The OSS URI. For example: oss://<bucket>/<path>/.",
          "type": "string"
        }
      },
      "required": ["uri", "authType"]
    },
    "nextgenv1beta2OSSCloudStorageAccessKey": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Required. The access key id.",
          "type": "string"
        },
        "secret": {
          "description": "Required. The access key secret. This field is input-only.",
          "type": "string"
        }
      },
      "required": ["id", "secret"]
    },
    "nextgenv1beta2OSSCloudStorageOSSAuthType": {
      "description": " - ACCESS_KEY: The access method is access key.\n - ROLE_ARN: The access method is role ARN.",
      "type": "string",
      "enum": ["ACCESS_KEY", "ROLE_ARN"]
    },
    "nextgenv1beta2S3CloudStorage": {
      "type": "object",
      "properties": {
        "accessKey": {
          "description": "Optional. The access key of the S3.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2S3CloudStorageAccessKey"
            }
          ]
        },
        "authType": {
          "description": "Required. The auth method of S3.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2S3CloudStorageS3AuthType"
            }
          ]
        },
        "roleArn": {
          "description": "Optional. The role ARN of the S3.",
          "type": "string"
        },
        "uri": {
          "description": "Required. The URI of the S3 folder. For example: s3://<bucket>/<path>/.",
          "type": "string"
        }
      },
      "required": ["uri", "authType"]
    },
    "nextgenv1beta2S3CloudStorageAccessKey": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Required. The access key id of the S3.",
          "type": "string"
        },
        "secret": {
          "description": "Required. The secret access key of the S3.",
          "type": "string"
        }
      },
      "required": ["id", "secret"]
    },
    "nextgenv1beta2S3CloudStorageS3AuthType": {
      "description": " - ROLE_ARN: The access method is role ARN.\n - ACCESS_KEY: The access method is access key.",
      "type": "string",
      "enum": ["ROLE_ARN", "ACCESS_KEY"]
    },
    "protobufAny": {
      "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n    Foo foo = ...;\n    Any any;\n    any.PackFrom(foo);\n    ...\n    if (any.UnpackTo(&foo)) {\n      ...\n    }\n\nExample 2: Pack and unpack a message in Java.\n\n    Foo foo = ...;\n    Any any = Any.pack(foo);\n    ...\n    if (any.is(Foo.class)) {\n      foo = any.unpack(Foo.class);\n    }\n    // or ...\n    if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n      foo = any.unpack(Foo.getDefaultInstance());\n    }\n\n Example 3: Pack and unpack a message in Python.\n\n    foo = Foo(...)\n    any = Any()\n    any.Pack(foo)\n    ...\n    if any.Is(Foo.DESCRIPTOR):\n      any.Unpack(foo)\n      ...\n\n Example 4: Pack and unpack a message in Go\n\n     foo := &pb.Foo{...}\n     any, err := anypb.New(foo)\n     if err != nil {\n       ...\n     }\n     ...\n     foo := &pb.Foo{}\n     if err := any.UnmarshalTo(foo); err != nil {\n       ...\n     }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n    package google.profile;\n    message Person {\n      string first_name = 1;\n      string last_name = 2;\n    }\n\n    {\n      \"@type\": \"type.googleapis.com/google.profile.Person\",\n      \"firstName\": <string>,\n      \"lastName\": <string>\n    }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n    {\n      \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n      \"value\": \"1.212s\"\n    }",
      "type": "object",
      "additionalProperties": {},
      "properties": {
        "@type": {
          "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n  value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n  URL, or have them precompiled into a binary to avoid any\n  lookup. Therefore, binary compatibility needs to be preserved\n  on changes to types. (Use versioned type names to manage\n  breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics.",
          "type": "string"
        }
      }
    }
  }
}
