{
  "swagger": "2.0",
  "info": {
    "title": "TiDB Cloud Premium API",
    "description": "TiDB Cloud Premium API",
    "version": "v1beta2"
  },
  "tags": [
    {
      "name": "PrivateEndpointConnectionService"
    }
  ],
  "host": "cloud.tidbapi.com",
  "basePath": "/api/v2025/cloud/v1beta2",
  "schemes": ["https"],
  "consumes": ["application/json"],
  "produces": ["application/json"],
  "paths": {
    "/api/v2025/cloud/v1beta2/tidbs/{tidbId}/privateEndpointConnections": {
      "get": {
        "summary": "List private endpoint connections",
        "description": "Lists all private endpoint connections for a specific TiDB Cloud Premium instance.",
        "operationId": "PrivateEndpointConnectionService_ListPrivateEndpointConnections",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2ListPrivateEndpointConnectionsResponse"
            }
          },
          "400": {
            "description": "A request field is invalid.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "401": {
            "description": "The API key cannot be authenticated.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "403": {
            "description": "The API key does not have permission to access the resource.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "429": {
            "description": "You have exceeded the rate limit.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "500": {
            "description": "Internal server error.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "pageSize",
            "description": "The maximum number of private link connections to return. The service may return fewer than this value.\nIf unspecified, at most X private link connections will be returned.\nThe maximum value is X; values above X will be coerced to X.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageToken",
            "description": "A page token, received from a previous `ListPrivateLinkConnections` call.\nProvide this to retrieve the subsequent page.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "skip",
            "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "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": ["PrivateEndpointConnectionService"]
      },
      "post": {
        "summary": "Create a private endpoint connection",
        "description": "Creates a private endpoint connection for a specific TiDB Cloud Premium instance.",
        "operationId": "PrivateEndpointConnectionService_CreatePrivateEndpointConnection",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2PrivateEndpointConnection"
            }
          },
          "400": {
            "description": "A request field is invalid.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "401": {
            "description": "The API key cannot be authenticated.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "403": {
            "description": "The API key does not have permission to access the resource.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "429": {
            "description": "You have exceeded the rate limit.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "500": {
            "description": "Internal server error.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateEndpointConnection",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2PrivateEndpointConnection"
            }
          },
          {
            "name": "validateOnly",
            "description": "Default is false. If true, the request will not be applied and only validation will be performed.\nAt present, this field is only available for Azure provider.",
            "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": ["PrivateEndpointConnectionService"]
      }
    },
    "/api/v2025/cloud/v1beta2/tidbs/{tidbId}/privateEndpointConnections/{privateEndpointConnectionId}": {
      "get": {
        "summary": "Get a private endpoint connection",
        "description": "Retrieves details of a specific private endpoint connection.",
        "operationId": "PrivateEndpointConnectionService_GetPrivateEndpointConnection",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2PrivateEndpointConnection"
            }
          },
          "400": {
            "description": "A request field is invalid.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "401": {
            "description": "The API key cannot be authenticated.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "403": {
            "description": "The API key does not have permission to access the resource.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "429": {
            "description": "You have exceeded the rate limit.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "500": {
            "description": "Internal server error.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateEndpointConnectionId",
            "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": ["PrivateEndpointConnectionService"]
      },
      "delete": {
        "summary": "Delete a private endpoint connection",
        "description": "Deletes a private endpoint connection from a specific TiDB Cloud Premium instance.",
        "operationId": "PrivateEndpointConnectionService_DeletePrivateEndpointConnection",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2PrivateEndpointConnection"
            }
          },
          "400": {
            "description": "A request field is invalid.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "401": {
            "description": "The API key cannot be authenticated.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "403": {
            "description": "The API key does not have permission to access the resource.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "429": {
            "description": "You have exceeded the rate limit.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "500": {
            "description": "Internal server error.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateEndpointConnectionId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "validateOnly",
            "description": "Default is false. If true, the request will not be applied and only validation will be performed.\nAt present, this field is only available for Azure provider.",
            "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": ["PrivateEndpointConnectionService"]
      }
    },
    "/api/v2025/cloud/v1beta2/tidbs/{tidbId}/privateLinkService": {
      "get": {
        "summary": "Get private link service",
        "description": "Retrieves the private link service details for a specific TiDB Cloud Premium instance.",
        "operationId": "PrivateEndpointConnectionService_GetPrivateLinkService",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/nextgenv1beta2PrivateLinkService"
            }
          },
          "400": {
            "description": "A request field is invalid.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "401": {
            "description": "The API key cannot be authenticated.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "403": {
            "description": "The API key does not have permission to access the resource.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "429": {
            "description": "You have exceeded the rate limit.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "500": {
            "description": "Internal server error.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "tidbId",
            "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": ["PrivateEndpointConnectionService"]
      }
    }
  },
  "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"
        }
      }
    },
    "nextgenv1beta2ListPrivateEndpointConnectionsResponse": {
      "type": "object",
      "properties": {
        "nextPageToken": {
          "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages.",
          "type": "string"
        },
        "privateEndpointConnections": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/nextgenv1beta2PrivateEndpointConnection",
            "type": "object"
          }
        },
        "totalSize": {
          "description": "The total number of private link connections that match the query.",
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "nextgenv1beta2PrivateEndpointConnection": {
      "type": "object",
      "properties": {
        "cloudProvider": {
          "description": "The cloud provider for the region.",
          "allOf": [
            {
              "$ref": "#/definitions/v1beta1RegionCloudProvider"
            }
          ],
          "readOnly": true
        },
        "endpointId": {
          "description": "The endpoint ID of the private link connection.\nFor AWS, it's VPC endpoint ID.\nFor GCP, it's private service connect endpoint ID.\nFor Azure, it's private endpoint resource ID.\nFor AliCloud, it's endpoint ID.",
          "type": "string"
        },
        "endpointState": {
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2PrivateEndpointConnectionEndpointState"
            }
          ],
          "readOnly": true
        },
        "host": {
          "type": "string",
          "readOnly": true
        },
        "id": {
          "type": "string",
          "readOnly": true
        },
        "message": {
          "type": "string",
          "readOnly": true
        },
        "name": {
          "type": "string",
          "readOnly": true,
          "title": "Format: tidbs/{tidb_id}/privateEndpointConnections/{private_endpoint_connection_id}"
        },
        "port": {
          "type": "string",
          "readOnly": true
        },
        "privateDomainName": {
          "description": "Only for AliCloud.\nUse private endpoint's Domain name to generate new TiDB DNS name.",
          "type": "string"
        },
        "privateEndpointConnectionId": {
          "type": "string",
          "readOnly": true
        },
        "privateIpAddress": {
          "description": "Only for Azure.\nThe private IP address of the private endpoint in the user's vNet.",
          "type": "string"
        },
        "privateLinkService": {
          "description": "The private link service name.",
          "type": "string",
          "readOnly": true
        },
        "privateLinkServiceState": {
          "description": "The private link service state.",
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2PrivateLinkServiceState"
            }
          ],
          "readOnly": true
        },
        "regionDisplayName": {
          "type": "string",
          "readOnly": true
        },
        "regionId": {
          "description": "The region where the private endpoint connection is created.",
          "type": "string"
        },
        "tidbId": {
          "type": "string",
          "readOnly": true
        }
      },
      "required": ["regionId", "endpointId"]
    },
    "nextgenv1beta2PrivateEndpointConnectionEndpointState": {
      "description": " - PENDING: Customer has posted to TiDB cloud API,\nbut endpoint connection has not been accepted **asynchronously** by TiDB Cloud.\n - DISCOVERED: Customer has created the endpoint in their vpc, but has not posted to TiDB Cloud API.",
      "type": "string",
      "enum": ["PENDING", "ACTIVE", "DELETING", "FAILED", "DISCOVERED"]
    },
    "nextgenv1beta2PrivateLinkService": {
      "type": "object",
      "properties": {
        "availableZones": {
          "description": "Only available for AWS.\nSame as the `AvailabilityZones` field in response body of\n`github.com/aws/aws-sdk-go-v2/service/ec2.DescribeVpcEndpointServices` method.",
          "type": "array",
          "items": {
            "type": "string"
          },
          "readOnly": true
        },
        "cloudProvider": {
          "allOf": [
            {
              "$ref": "#/definitions/v1beta1RegionCloudProvider"
            }
          ],
          "readOnly": true
        },
        "name": {
          "type": "string",
          "title": "Format: tidbs/{tidb_id}/privateLinkService"
        },
        "regionDisplayName": {
          "type": "string",
          "readOnly": true
        },
        "regionId": {
          "type": "string",
          "readOnly": true,
          "title": "Format: {cloud_provider}-{region_code}"
        },
        "serviceDnsName": {
          "description": "For AWS, it's the fully qualified domain name (FQDN) shared for all private endpoints, despite which VPC the endpoint located in.\nFor GCP, it's the zone name (suffix of FQDN) shared for all private endpoints located in a single VPC network. The format of FQDN is `<endpoint_name>.<service_dns_name>`.\nFor Azure, it's the zone name shared across public internet. The format of FQDN is `<endpoint_name>-<random_hash>.<service_dns_name>`.\nFor AliCloud, it's the endpoint domain name shared for all private endpoints. The format of FQDN is `<endpoint_name>.<service_dns_name>`.",
          "type": "string",
          "readOnly": true
        },
        "serviceName": {
          "description": "For AWS, it's the service name of the Private Link Service.\nFor GCP, it's the resource name of the service attachment.\nFor Azure, it's service resource ID of the Private Link Service.\nFor AliCloud, it's the service name of the Private Link Service.",
          "type": "string",
          "readOnly": true
        },
        "servicePort": {
          "description": "The port of the private link service.",
          "type": "integer",
          "format": "int32",
          "readOnly": true
        },
        "state": {
          "allOf": [
            {
              "$ref": "#/definitions/nextgenv1beta2PrivateLinkServiceState"
            }
          ],
          "readOnly": true
        },
        "tidbId": {
          "type": "string",
          "readOnly": true
        }
      }
    },
    "nextgenv1beta2PrivateLinkServiceState": {
      "type": "string",
      "enum": ["CREATING", "ACTIVE", "DELETING"]
    },
    "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"
        }
      }
    },
    "v1beta1RegionCloudProvider": {
      "description": "Enum of cloud provider names.\n\n - aws: Amazon Web Services.\n - gcp: Google Cloud Platform.\n - azure: Microsoft Azure.\n - alicloud: Alibaba Cloud.",
      "type": "string",
      "enum": ["aws", "gcp", "azure", "alicloud"]
    }
  }
}
