{
  "swagger": "2.0",
  "info": {
    "title": "Import APIs for TiDB Cloud Serverless",
    "version": "alpha"
  },
  "tags": [
    {
      "name": "ImportService"
    }
  ],
  "schemes": ["https"],
  "consumes": ["application/json"],
  "produces": ["application/json"],
  "paths": {
    "/api/v1/serverless/imports:listSupportedDataTypes": {
      "get": {
        "summary": "List the data types supported by the import.",
        "operationId": "ImportService_ListSupportedDataTypes",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ImportsSupportedDataTypesResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports": {
      "get": {
        "summary": "Provides a list of import jobs.",
        "operationId": "ImportService_ListImports",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/console.ListImportsResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The ID of the cluster to import into.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "page_token",
            "description": "Optional. The page token, default is empty.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "page_size",
            "description": "Optional. The page size, default is 10.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "order_by",
            "description": "Optional. List imports order by, separated by comma, default is ascending. Example: \"foo, bar desc\". Supported field: create_time",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": ["ImportService"]
      },
      "post": {
        "summary": "Create an import job.",
        "operationId": "ImportService_CreateImport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Import"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "The ID of the cluster to import into.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/console.ImportService.CreateImportBody"
            }
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports/{id}": {
      "get": {
        "summary": "Get an import detailed information.",
        "operationId": "ImportService_GetImport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Import"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The ID of the cluster to import into.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "id",
            "description": "Required. The ID of the import.",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports/{id}:cancel": {
      "post": {
        "summary": "Cancel an import job.",
        "operationId": "ImportService_CancelImport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/Import"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID of import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The ID of the cluster to import into.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "id",
            "description": "Required. The ID of the import.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/console.ImportService.CancelImportBody"
            }
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:getDataIngestionProfile": {
      "get": {
        "summary": "Get the data ingestion profile of a cluster.",
        "operationId": "ImportService_GetDataIngestionProfile",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/DataIngestionProfile"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID of cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID of cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The ID of the cluster to import into.",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:getTableColumns": {
      "get": {
        "summary": "Get the columns of a table.",
        "operationId": "ImportService_GetTableColumns",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ImportsGetTableColumnsResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "database",
            "description": "Required. The database name.",
            "in": "query",
            "required": true,
            "type": "string"
          },
          {
            "name": "table",
            "description": "Required. The table name.",
            "in": "query",
            "required": true,
            "type": "string"
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:listTargetTables": {
      "get": {
        "summary": "List the target tables.",
        "operationId": "ImportService_ListTargetTables",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ListTargetTablesResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:precheck": {
      "post": {
        "summary": "Precheck and return the scan result.",
        "operationId": "ImportService_Precheck",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/PrecheckResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organization ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ImportService.PrecheckBody"
            }
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:previewLocal": {
      "post": {
        "summary": "Preview the local import result.",
        "operationId": "ImportService_PreviewLocal",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ImportsPreviewLocalResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ImportService.PreviewLocalBody"
            }
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:upload": {
      "post": {
        "summary": "Generate Upload url for importing data.",
        "operationId": "ImportService_Upload",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/UploadResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID of cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID of cluster.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The ID of the cluster to import into.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ImportService.UploadBody"
            }
          }
        ],
        "tags": ["ImportService"]
      }
    },
    "/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/imports:validate": {
      "post": {
        "summary": "Validate the import.",
        "operationId": "ImportService_ValidateImport",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ValidateImportResp"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "org_id",
            "description": "Required. The organize ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "project_id",
            "description": "Required. The project ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "cluster_id",
            "description": "Required. The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/ImportService.ValidateImportBody"
            }
          }
        ],
        "tags": ["ImportService"]
      }
    }
  },
  "definitions": {
    "Any": {
      "type": "object",
      "additionalProperties": {},
      "properties": {
        "@type": {
          "type": "string"
        }
      }
    },
    "AzureBlobSource": {
      "type": "object",
      "properties": {
        "auth_type": {
          "description": "The Azure Blob URI of the import source.",
          "$ref": "#/definitions/ImportAzureBlobAuthType.Enum"
        },
        "sas_token": {
          "description": "The sas token. This field is input-only.",
          "type": "string"
        },
        "uri": {
          "description": "The Azure Blob URI of the import source. For example: azure://<account>.blob.core.windows.net/<container>/<path>.",
          "type": "string"
        },
        "target_table_infos": {
          "description": "The target table information of the import.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ImportTargetTableInfo"
          }
        }
      },
      "required": ["auth_type", "uri"]
    },
    "BaseResp": {
      "type": "object",
      "properties": {
        "tags": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "title": "such as: request_id, trace_id"
        },
        "err_code": {
          "type": "string",
          "format": "int64"
        },
        "err_msg": {
          "type": "string"
        }
      }
    },
    "CSVFormat": {
      "type": "object",
      "properties": {
        "separator": {
          "description": "Separator of each value in CSV files. Default is ','.",
          "type": "string"
        },
        "delimiter": {
          "description": "Delimiter of string type variables in CSV files. Default is '\"'.",
          "type": "string"
        },
        "header": {
          "description": "Import CSV files of the tables with header. Default is true.",
          "type": "boolean"
        },
        "not_null": {
          "description": "Whether the columns in CSV files can be null. Default is false.",
          "type": "boolean"
        },
        "null": {
          "description": "Representation of null values in CSV files. Default is \"\\N\".",
          "type": "string"
        },
        "backslash_escape": {
          "description": "Whether to escape backslashes in CSV files. Default is true.",
          "type": "boolean"
        },
        "trim_last_separator": {
          "description": "Whether to trim the last separator in CSV files. Default is false.",
          "type": "boolean"
        }
      }
    },
    "ColumnInfo": {
      "type": "object",
      "properties": {
        "column_name": {
          "description": "The name of the column.",
          "type": "string"
        },
        "column_type": {
          "description": "The type of the column.",
          "type": "string"
        }
      }
    },
    "CreationDetails": {
      "type": "object",
      "properties": {
        "import_options": {
          "description": "Optional. The options of the import.",
          "$ref": "#/definitions/ImportOptions",
          "readOnly": true
        },
        "source": {
          "description": "Optional. The source of the import.",
          "$ref": "#/definitions/ImportSource",
          "readOnly": true
        }
      }
    },
    "DataIngestionProfile": {
      "type": "object",
      "properties": {
        "type": {
          "description": "The data ingestion profile type.",
          "$ref": "#/definitions/ImportDataIngestionProfileType.Enum"
        },
        "s3_profile": {
          "description": "The S3 profile.",
          "$ref": "#/definitions/S3Profile"
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "Database": {
      "type": "object",
      "properties": {
        "database": {
          "description": "The database name.",
          "type": "string"
        },
        "tables": {
          "description": "The list of tables.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "FullTable": {
      "type": "object",
      "properties": {
        "database_name": {
          "description": "The database name.",
          "type": "string"
        },
        "table_name": {
          "description": "The table name.",
          "type": "string"
        },
        "row_headers": {
          "description": "The headers of the table.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "row_values": {
          "description": "The columns of the table.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Row"
          }
        },
        "row_data_types": {
          "description": "The data types of the columns.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "column_is_pk": {
          "description": "A boolean flag indicating whether each column is part of the primary key.\nTrue if the column is a primary key; false otherwise.",
          "type": "array",
          "items": {
            "type": "boolean"
          }
        },
        "column_auto_gen": {
          "type": "array",
          "items": {
            "type": "boolean"
          },
          "title": "column_auto_gen represents column is auto_increment or auto_random"
        }
      }
    },
    "GCSSource": {
      "type": "object",
      "properties": {
        "uri": {
          "description": "The GCS URI of the import source.",
          "type": "string"
        },
        "auth_type": {
          "description": "The auth method of the import source.",
          "$ref": "#/definitions/ImportGcsAuthType.Enum"
        },
        "service_account_key": {
          "type": "string",
          "title": "The service account key"
        },
        "target_table_infos": {
          "description": "The target table information of the import.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ImportTargetTableInfo"
          }
        }
      },
      "required": ["uri", "auth_type"]
    },
    "Import": {
      "type": "object",
      "properties": {
        "id": {
          "description": "The ID of the import.",
          "type": "string",
          "readOnly": true
        },
        "display_name": {
          "description": "The display name of the import.",
          "type": "string",
          "readOnly": true
        },
        "cluster_id": {
          "description": "The ID of the cluster to import into.",
          "type": "string",
          "readOnly": true
        },
        "total_size": {
          "description": "The total size of the data imported.",
          "type": "string",
          "format": "uint64",
          "readOnly": true
        },
        "create_time": {
          "description": "The time the import was created.",
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "complete_time": {
          "description": "The time the import was completed.",
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "state": {
          "description": "The state of the import.",
          "$ref": "#/definitions/ImportState.Enum",
          "readOnly": true
        },
        "complete_percent": {
          "description": "The process in percent of the import job, but doesn't include the post-processing progress.",
          "type": "integer",
          "format": "int64",
          "readOnly": true
        },
        "message": {
          "description": "The output message of the import.",
          "type": "string",
          "readOnly": true
        },
        "created_by": {
          "description": "The user who created the import.",
          "type": "string",
          "readOnly": true
        },
        "creation_details": {
          "description": "The creation details of the import.",
          "$ref": "#/definitions/CreationDetails",
          "readOnly": true
        },
        "post_import_completed_percent": {
          "description": "The overall validation progress of the import task after the data has been imported into the target cluster.",
          "type": "integer",
          "format": "int64",
          "readOnly": true
        },
        "compatible_id": {
          "description": "The `uint64` identifier for the upload, provided to ensure compatibility\nwith the RPC call from the dataflow-svc v1beta OPENAPI.",
          "type": "string",
          "format": "uint64",
          "readOnly": true
        },
        "start_time": {
          "description": "The start time of the import.",
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "total_tables_count": {
          "description": "The total tables count of the import.",
          "type": "integer",
          "format": "int64"
        },
        "all_completed_tables": {
          "description": "The completed tables info of the import.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/console.ImportTableCompletionInfo"
          }
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "ImportAzureBlobAuthType.Enum": {
      "description": " - SAS_TOKEN: The access method is sas token.",
      "type": "string",
      "enum": ["SAS_TOKEN"]
    },
    "ImportDataIngestionProfileType.Enum": {
      "description": " - S3: S3 source.",
      "type": "string",
      "enum": ["S3"]
    },
    "ImportFileType.Enum": {
      "description": " - CSV: CSV type.\n - SQL: SQL type.\n - AURORA_SNAPSHOT: Aurora snapshot type.\n - PARQUET: Parquet type.",
      "type": "string",
      "enum": ["CSV", "SQL", "AURORA_SNAPSHOT", "PARQUET"]
    },
    "ImportGcsAuthType.Enum": {
      "description": " - SERVICE_ACCOUNT_KEY: The access method is service account key.",
      "type": "string",
      "enum": ["SERVICE_ACCOUNT_KEY"]
    },
    "ImportOSSAuthType.Enum": {
      "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"]
    },
    "ImportOptions": {
      "type": "object",
      "properties": {
        "file_type": {
          "description": "The import file type.",
          "$ref": "#/definitions/ImportFileType.Enum"
        },
        "csv_format": {
          "description": "Optional. The CSV format.",
          "$ref": "#/definitions/CSVFormat"
        },
        "need_drop_table": {
          "description": "Optional. Only used in tutorial.",
          "type": "boolean"
        },
        "display_name": {
          "description": "Optional. The display name of the import.",
          "type": "string"
        }
      },
      "required": ["file_type"]
    },
    "ImportPrecheckStatusType.Enum": {
      "description": " - COMPLETED: The precheck is completed.\n - TIMEOUT: The precheck is timeout and return partial result.\n - TRUNCATED: The precheck result is truncated.",
      "type": "string",
      "enum": ["COMPLETED", "TIMEOUT", "TRUNCATED"]
    },
    "ImportS3AuthType.Enum": {
      "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"]
    },
    "ImportS3CompatibleAuthType.Enum": {
      "description": " - ACCESS_KEY: The access method is access key.",
      "type": "string",
      "enum": ["ACCESS_KEY"]
    },
    "ImportService.PrecheckBody": {
      "type": "object",
      "properties": {
        "import_options": {
          "description": "Required. The options of the import.",
          "$ref": "#/definitions/ImportOptions"
        },
        "source": {
          "description": "Required. The source of the import.",
          "$ref": "#/definitions/ImportSource"
        }
      },
      "required": ["import_options", "source"]
    },
    "ImportService.PreviewLocalBody": {
      "type": "object",
      "properties": {
        "upload_id": {
          "description": "Required. The source of the import.",
          "type": "string"
        },
        "file_type": {
          "description": "Required. The target database of import.",
          "$ref": "#/definitions/ImportFileType.Enum"
        },
        "csv_format": {
          "description": "Optional. The format specifications for CSV files, if applicable.",
          "$ref": "#/definitions/CSVFormat"
        }
      },
      "required": ["upload_id", "file_type"]
    },
    "ImportService.UploadBody": {
      "type": "object",
      "properties": {
        "file_name": {
          "description": "Required. The name of the file to import.",
          "type": "string"
        }
      },
      "required": ["file_name"]
    },
    "ImportService.ValidateImportBody": {
      "type": "object",
      "properties": {
        "validation_type": {
          "description": "Required. The type of validation.",
          "$ref": "#/definitions/ImportValidationType.Enum"
        },
        "source": {
          "description": "Required. The source information of the import.",
          "$ref": "#/definitions/ImportSource"
        }
      },
      "required": ["validation_type", "source"]
    },
    "ImportSource": {
      "type": "object",
      "properties": {
        "type": {
          "description": "The import source type.",
          "$ref": "#/definitions/ImportSourceType.Enum"
        },
        "local": {
          "$ref": "#/definitions/LocalSource"
        },
        "s3": {
          "$ref": "#/definitions/S3Source"
        },
        "gcs": {
          "$ref": "#/definitions/GCSSource"
        },
        "azure_blob": {
          "$ref": "#/definitions/AzureBlobSource"
        },
        "s3_compatible": {
          "$ref": "#/definitions/S3CompatibleSource"
        },
        "oss": {
          "$ref": "#/definitions/OSSSource"
        }
      },
      "required": ["type"]
    },
    "ImportSourceType.Enum": {
      "type": "string",
      "enum": ["LOCAL", "S3", "GCS", "AZURE_BLOB", "S3_COMPATIBLE", "OSS"],
      "title": "- LOCAL: Local source.\n - S3: S3 source.\n - GCS: gcs source\n - AZURE_BLOB: azure blob source\n - S3_COMPATIBLE: S3 compatible source\n - OSS: OSS source"
    },
    "ImportState.Enum": {
      "description": " - PREPARING: The import is preparing.\n - IMPORTING: The import is importing.\n - COMPLETED: The import is completed.\n - FAILED: The import is failed.\n - CANCELING: The import is canceling.\n - CANCELED: The import is canceled.",
      "type": "string",
      "enum": ["PREPARING", "IMPORTING", "COMPLETED", "FAILED", "CANCELING", "CANCELED"]
    },
    "ImportTargetTableInfo": {
      "type": "object",
      "properties": {
        "target_table": {
          "description": "The target table info.",
          "$ref": "#/definitions/console.Table"
        },
        "custom_file": {
          "description": "If the custom_file is empty, will use the default rule to import data.",
          "type": "string"
        }
      }
    },
    "ImportValidationType.Enum": {
      "description": " - SOURCE_ACCESS_CHECK: The validation ensures that the source is accessible.\n - TABLE_EMPTY_CHECK: The validation ensures that the target table is empty.",
      "type": "string",
      "enum": ["SOURCE_ACCESS_CHECK", "TABLE_EMPTY_CHECK"]
    },
    "ImportsGetTableColumnsResp": {
      "type": "object",
      "properties": {
        "table": {
          "description": "The table information with columns.",
          "$ref": "#/definitions/FullTable"
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "ImportsPreviewLocalResp": {
      "type": "object",
      "properties": {
        "table": {
          "$ref": "#/definitions/FullTable",
          "title": "local file only contains one table"
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "ImportsSupportedDataTypesResp": {
      "type": "object",
      "properties": {
        "data_types": {
          "description": "The list of supported data types.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "ListTargetTablesResp": {
      "type": "object",
      "properties": {
        "databases": {
          "description": "The list of tables.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Database"
          }
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "LocalSource": {
      "type": "object",
      "properties": {
        "upload_id": {
          "description": "The upload id of import source file.",
          "type": "string"
        },
        "target_database": {
          "description": "The target database of import.",
          "type": "string"
        },
        "target_table": {
          "description": "The target table of import.",
          "type": "string"
        },
        "file_name": {
          "description": "The file name of import source file.",
          "type": "string",
          "readOnly": true
        },
        "columns": {
          "description": "INPUT_ONLY. The columns definition of the target table.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ColumnInfo"
          }
        },
        "pk_columns": {
          "description": "INPUT_ONLY. The primary key columns of the target table.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["upload_id", "target_database", "target_table", "columns", "pk_columns"]
    },
    "OSSSource": {
      "type": "object",
      "properties": {
        "uri": {
          "description": "The OSS URI of the import source.",
          "type": "string"
        },
        "auth_type": {
          "description": "The auth method of the import source.",
          "$ref": "#/definitions/ImportOSSAuthType.Enum"
        },
        "access_key": {
          "description": "The access key.",
          "$ref": "#/definitions/OSSSource.AccessKey"
        },
        "role_arn": {
          "type": "string"
        },
        "target_table_infos": {
          "description": "The target table information of the import.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ImportTargetTableInfo"
          }
        }
      },
      "required": ["uri", "auth_type"]
    },
    "OSSSource.AccessKey": {
      "type": "object",
      "properties": {
        "id": {
          "description": "The accessKey id.",
          "type": "string"
        },
        "secret": {
          "description": "The accessKey secret. This field is input-only.",
          "type": "string"
        }
      },
      "required": ["id", "secret"]
    },
    "PrecheckResp": {
      "type": "object",
      "properties": {
        "target_tables": {
          "description": "The list of tables which has matched data files.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/TableResult"
          }
        },
        "error_message": {
          "description": "The error message consists of the unmatched tables.",
          "type": "string"
        },
        "total_data_files_count": {
          "description": "The total data files count.",
          "type": "string",
          "format": "uint64"
        },
        "total_tables_count": {
          "description": "The total tables count.",
          "type": "string",
          "format": "uint64"
        },
        "status": {
          "description": "The status.",
          "$ref": "#/definitions/ImportPrecheckStatusType.Enum"
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "Row": {
      "type": "object",
      "properties": {
        "column_values": {
          "description": "The values of the row.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "S3CompatibleSource": {
      "type": "object",
      "properties": {
        "uri": {
          "description": "The S3 compatible URI of the import source.",
          "type": "string"
        },
        "auth_type": {
          "description": "The auth method of the import source.",
          "$ref": "#/definitions/ImportS3CompatibleAuthType.Enum"
        },
        "access_key": {
          "description": "The access key.",
          "$ref": "#/definitions/S3CompatibleSource.AccessKey"
        },
        "target_table_infos": {
          "description": "The target table information of the import.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ImportTargetTableInfo"
          }
        },
        "endpoint": {
          "description": "The custom S3 endpoint (HTTPS only).\nUsed for connecting to non-AWS S3-compatible storage, such as Cloudflare or other cloud providers.\nEnsure the endpoint is a valid HTTPS URL (e.g., \"https://custom-s3.example.com\").",
          "type": "string"
        }
      },
      "required": ["uri", "auth_type"]
    },
    "S3CompatibleSource.AccessKey": {
      "type": "object",
      "properties": {
        "id": {
          "description": "The access key id.",
          "type": "string"
        },
        "secret": {
          "description": "The secret access key. This field is input-only.",
          "type": "string"
        }
      },
      "required": ["id", "secret"]
    },
    "S3Profile": {
      "type": "object",
      "properties": {
        "aws_account_id": {
          "description": "The aws account id.",
          "type": "string"
        },
        "aws_external_id": {
          "description": "The aws external id.",
          "type": "string"
        }
      }
    },
    "S3Source": {
      "type": "object",
      "properties": {
        "uri": {
          "description": "The S3 URI of the import source.",
          "type": "string"
        },
        "auth_type": {
          "description": "The auth method of the import source.",
          "$ref": "#/definitions/ImportS3AuthType.Enum"
        },
        "role_arn": {
          "type": "string",
          "title": "The role arn"
        },
        "access_key": {
          "description": "The access key.",
          "$ref": "#/definitions/S3Source.AccessKey"
        },
        "target_table_infos": {
          "description": "The target table information of the import.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/ImportTargetTableInfo"
          }
        }
      },
      "required": ["uri", "auth_type"]
    },
    "S3Source.AccessKey": {
      "type": "object",
      "properties": {
        "id": {
          "description": "The access key id.",
          "type": "string"
        },
        "secret": {
          "description": "The secret access key. This field is input-only.",
          "type": "string"
        }
      },
      "required": ["id", "secret"]
    },
    "Status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Any"
          }
        }
      }
    },
    "TableResult": {
      "type": "object",
      "properties": {
        "target_table": {
          "description": "The target table.",
          "$ref": "#/definitions/console.Table"
        },
        "error_message": {
          "description": "The error message.",
          "type": "string"
        },
        "matched_data_files": {
          "description": "The matched data files.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "matched_schema_file": {
          "description": "The matched schema file.",
          "type": "string"
        },
        "use_schema_file": {
          "description": "whether the matched schema file is used in import.",
          "type": "boolean"
        }
      }
    },
    "UploadResponse": {
      "type": "object",
      "properties": {
        "upload_url": {
          "description": "The URL to upload the file to.",
          "type": "string",
          "readOnly": true
        },
        "upload_id": {
          "description": "The ID of the upload.",
          "type": "string",
          "readOnly": true
        },
        "compatible_id": {
          "description": "The `uint64` identifier for the upload, provided to ensure compatibility\nwith the RPC call from the dataflow-svc v1beta OPENAPI.",
          "type": "string",
          "format": "uint64",
          "readOnly": true
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "ValidateImportResp": {
      "type": "object",
      "properties": {
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "console.ImportService.CancelImportBody": {
      "type": "object"
    },
    "console.ImportService.CreateImportBody": {
      "type": "object",
      "properties": {
        "import_options": {
          "description": "Required. The options of the import.",
          "$ref": "#/definitions/ImportOptions"
        },
        "source": {
          "description": "Required. The source of the import.",
          "$ref": "#/definitions/ImportSource"
        },
        "creator": {
          "description": "Optional. The creator identity. Only use with the RPC call from the dataflow-svc v1beta OPENAPI.",
          "type": "string"
        }
      },
      "required": ["import_options", "source"]
    },
    "console.ImportTableCompletionInfo": {
      "type": "object",
      "properties": {
        "table_name": {
          "description": "The table name.",
          "type": "string"
        },
        "result": {
          "description": "The result of the table import.",
          "$ref": "#/definitions/console.ImportTableCompletionInfo.Result"
        },
        "message": {
          "description": "The message of the table import.",
          "type": "string"
        },
        "data_file_pattern": {
          "description": "The data file pattern.",
          "type": "string"
        }
      }
    },
    "console.ImportTableCompletionInfo.Result": {
      "type": "string",
      "enum": ["SUCCESS", "WARNING", "ERROR"]
    },
    "console.ListImportsResp": {
      "type": "object",
      "properties": {
        "imports": {
          "description": "The imports.",
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Import"
          },
          "readOnly": true
        },
        "total_size": {
          "description": "The total size of the imports.",
          "type": "integer",
          "format": "int64",
          "readOnly": true
        },
        "next_page_token": {
          "description": "The next page token.",
          "type": "string",
          "readOnly": true
        },
        "base_resp": {
          "$ref": "#/definitions/BaseResp"
        }
      }
    },
    "console.Table": {
      "type": "object",
      "properties": {
        "database": {
          "description": "The database name.",
          "type": "string"
        },
        "table": {
          "description": "The table name.",
          "type": "string"
        }
      }
    }
  },
  "securityDefinitions": {
    "bearer": {
      "type": "apiKey",
      "description": "Authentication token, prefixed by Bearer: 'Bearer token'",
      "name": "Authorization",
      "in": "header"
    }
  }
}
