{
  "swagger": "2.0",
  "info": {
    "title": "TiDB Cloud Serverless Private Link Connection Open API",
    "description": "TiDB Cloud Serverless Private Link Connection Open API",
    "version": "v1beta1"
  },
  "tags": [
    {
      "name": "PrivateLinkConnectionService"
    }
  ],
  "host": "serverless.tidbapi.com",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/v1beta1/clusters/{clusterId}/privateLinkConnections/{privateLinkConnectionId}": {
      "get": {
        "summary": "Get a private link connection.",
        "operationId": "PrivateLinkConnectionService_GetPrivateLinkConnection",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/PrivateLinkConnection"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateLinkConnectionId",
            "description": "The private link connection ID.",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      },
      "delete": {
        "summary": "Delete a private link connection.",
        "operationId": "PrivateLinkConnectionService_DeletePrivateLinkConnection",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/PrivateLinkConnection"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateLinkConnectionId",
            "description": "The private link connection ID.",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      }
    },
    "/v1beta1/clusters/{clusterId}/privateLinkConnections": {
      "get": {
        "summary": "List private link connections.",
        "operationId": "PrivateLinkConnectionService_ListPrivateLinkConnections",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/ListPrivateLinkConnectionsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "pageSize",
            "description": "The maximum number to return.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "pageToken",
            "description": "The page token for pagination.",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "state",
            "description": " - CREATING: The private link connection is being created.\n - ACTIVE: The private link connection is active.\n - FAILED: The private link connection is in failed state.\n - PENDING_ACCEPTANCE: The private link connection is pending acceptance. only for AWS endpoint service and Alicloud endpoint service.\n - DELETING: The private link connection is being deleted.",
            "in": "query",
            "required": false,
            "type": "string",
            "enum": [
              "CREATING",
              "ACTIVE",
              "FAILED",
              "PENDING_ACCEPTANCE",
              "DELETING"
            ]
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      },
      "post": {
        "summary": "Create a private link connection.",
        "operationId": "PrivateLinkConnectionService_CreatePrivateLinkConnection",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/PrivateLinkConnection"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PrivateLinkConnectionService.CreatePrivateLinkConnectionBody"
            }
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      }
    },
    "/v1beta1/clusters/{clusterId}/privateLinkConnections:getAvailabilityZones": {
      "get": {
        "summary": "Get account and availability zones information for private link connection.",
        "operationId": "PrivateLinkConnectionService_GetAvailabilityZones",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/GetAvailabilityZonesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      }
    },
    "/v1beta1/clusters/{clusterId}/privateLinkConnections/{privateLinkConnectionId}:attachDomains": {
      "post": {
        "summary": "Attach domains for private link connection.",
        "operationId": "PrivateLinkConnectionService_AttachDomains",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/AttachDomain"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateLinkConnectionId",
            "description": "The private link connection ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PrivateLinkConnectionService.AttachDomainsBody"
            }
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      }
    },
    "/v1beta1/clusters/{clusterId}/privateLinkConnections/{privateLinkConnectionId}:detachDomains": {
      "post": {
        "summary": "Detach domains for private link connection.",
        "operationId": "PrivateLinkConnectionService_DetachDomains",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/AttachDomain"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clusterId",
            "description": "The cluster ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "privateLinkConnectionId",
            "description": "The private link connection ID.",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/PrivateLinkConnectionService.DetachDomainsBody"
            }
          }
        ],
        "tags": [
          "PrivateLinkConnectionService"
        ]
      }
    }
  },
  "definitions": {
    "AlicloudEndpointService": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The endpoint service name."
        },
        "endpointId": {
          "type": "string",
          "description": "The endpoint ID.",
          "readOnly": true
        },
        "availabilityZoneIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The availability zones of the endpoint.",
          "readOnly": true
        }
      },
      "required": [
        "name"
      ]
    },
    "AmazonMSKProvisioned": {
      "type": "object",
      "properties": {
        "mskArn": {
          "type": "string",
          "description": "The arn of Amazon MSK Provisioned."
        },
        "mskVpcConnectionArn": {
          "type": "string",
          "description": "The arn of MSK VPC connection arn.",
          "readOnly": true
        },
        "availabilityZoneIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The availability zones of the connection.",
          "readOnly": true
        }
      },
      "required": [
        "mskArn"
      ]
    },
    "Any": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string"
        }
      },
      "additionalProperties": {}
    },
    "AttachDomain": {
      "type": "object",
      "properties": {
        "attachDomainId": {
          "type": "string",
          "description": "The attach domain ID.",
          "readOnly": true
        },
        "clusterId": {
          "type": "string",
          "description": "The cluster ID.",
          "readOnly": true
        },
        "privateLinkConnectionId": {
          "type": "string",
          "description": "The private link connection ID.",
          "readOnly": true
        },
        "type": {
          "description": "The domain type to attach.",
          "allOf": [
            {
              "$ref": "#/definitions/PrivateLinkConnectionDomainType.Enum"
            }
          ]
        },
        "uniqueName": {
          "type": "string",
          "description": "The unique name of the domain to attach, it can be empty only when type is TIDBCLOUD_MANAGED and validate_only is true."
        },
        "domains": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Domain"
          },
          "description": "The domains attached.",
          "readOnly": true
        },
        "createdBy": {
          "type": "string",
          "description": "The user who attach the domain.",
          "readOnly": true
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "title": "create time",
          "readOnly": true
        }
      },
      "required": [
        "type"
      ]
    },
    "AwsEndpointService": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The endpoint service name."
        },
        "region": {
          "type": "string",
          "title": "The region of endpoint service name, default to cluster's region"
        },
        "endpointId": {
          "type": "string",
          "description": "The endpoint ID.",
          "readOnly": true
        },
        "availabilityZoneIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The availability zones of the endpoint.",
          "readOnly": true
        }
      },
      "required": [
        "name"
      ]
    },
    "Domain": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The domain name.",
          "readOnly": true
        },
        "state": {
          "type": "string",
          "title": "The domain state",
          "readOnly": true
        },
        "message": {
          "type": "string",
          "description": "Fail message if the domain is in failed state.",
          "readOnly": true
        }
      }
    },
    "GetAvailabilityZonesResponse": {
      "type": "object",
      "properties": {
        "accountId": {
          "type": "string",
          "description": "The account ID."
        },
        "azIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Availability zone ids."
        }
      }
    },
    "ListPrivateLinkConnectionsResponse": {
      "type": "object",
      "properties": {
        "privateLinkConnections": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/PrivateLinkConnection"
          }
        },
        "nextPageToken": {
          "type": "string"
        },
        "totalSize": {
          "type": "integer",
          "format": "int64"
        }
      }
    },
    "PrivateLinkConnection": {
      "type": "object",
      "properties": {
        "privateLinkConnectionId": {
          "type": "string",
          "title": "The private link connection ID, format: plc-xxx",
          "readOnly": true
        },
        "clusterId": {
          "type": "string",
          "description": "The ID of the cluster."
        },
        "displayName": {
          "type": "string",
          "description": "Display name for the private link connection."
        },
        "state": {
          "description": "The state of the private link connection.",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/PrivateLinkConnectionState.Enum"
            }
          ]
        },
        "message": {
          "type": "string",
          "description": "The message describing fail reason.",
          "readOnly": true
        },
        "createdBy": {
          "type": "string",
          "description": "The user who created the private link connection.",
          "readOnly": true
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp when the private link connection was created.",
          "readOnly": true
        },
        "updateTime": {
          "type": "string",
          "format": "date-time",
          "x-nullable": true,
          "description": "Timestamp when the private link connection was updated.",
          "readOnly": true
        },
        "type": {
          "title": "The type of the private link connection",
          "allOf": [
            {
              "$ref": "#/definitions/PrivateLinkConnectionType.Enum"
            }
          ]
        },
        "attachedDomains": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/AttachDomain"
          },
          "title": "The attached domains for the private link connection, only display in Get API",
          "readOnly": true
        },
        "awsEndpointService": {
          "$ref": "#/definitions/AwsEndpointService"
        },
        "alicloudEndpointService": {
          "$ref": "#/definitions/AlicloudEndpointService"
        },
        "amazonMskProvisioned": {
          "$ref": "#/definitions/AmazonMSKProvisioned"
        }
      },
      "required": [
        "clusterId",
        "displayName",
        "type"
      ]
    },
    "PrivateLinkConnectionDomainType.Enum": {
      "type": "string",
      "enum": [
        "TIDBCLOUD_MANAGED",
        "CONFLUENT"
      ],
      "description": " - TIDBCLOUD_MANAGED: The domain pattern is <provider>.plc.tidbcloud.com.\n - CONFLUENT: The domain pattern is <provider>.confluent.cloud."
    },
    "PrivateLinkConnectionService.AttachDomainsBody": {
      "type": "object",
      "properties": {
        "attachDomain": {
          "description": "The domain to attach.",
          "allOf": [
            {
              "$ref": "#/definitions/AttachDomain"
            }
          ]
        },
        "validateOnly": {
          "type": "boolean",
          "description": "Only validate the request and return the domains without attaching them."
        }
      },
      "required": [
        "attachDomain"
      ]
    },
    "PrivateLinkConnectionService.CreatePrivateLinkConnectionBody": {
      "type": "object",
      "properties": {
        "privateLinkConnection": {
          "description": "The private link connection to create.",
          "allOf": [
            {
              "$ref": "#/definitions/PrivateLinkConnection"
            }
          ]
        }
      },
      "required": [
        "privateLinkConnection"
      ]
    },
    "PrivateLinkConnectionService.DetachDomainsBody": {
      "type": "object",
      "properties": {
        "attachDomainId": {
          "type": "string",
          "description": "The attached domain ID to detach."
        }
      },
      "required": [
        "attachDomainId"
      ]
    },
    "PrivateLinkConnectionState.Enum": {
      "type": "string",
      "enum": [
        "CREATING",
        "ACTIVE",
        "FAILED",
        "PENDING_ACCEPTANCE",
        "DELETING"
      ],
      "description": " - CREATING: The private link connection is being created.\n - ACTIVE: The private link connection is active.\n - FAILED: The private link connection is in failed state.\n - PENDING_ACCEPTANCE: The private link connection is pending acceptance. only for AWS endpoint service and Alicloud endpoint service.\n - DELETING: The private link connection is being deleted."
    },
    "PrivateLinkConnectionType.Enum": {
      "type": "string",
      "enum": [
        "AWS_ENDPOINT_SERVICE",
        "ALICLOUD_ENDPOINT_SERVICE",
        "AMAZON_MSK_PROVISIONED"
      ],
      "description": " - AWS_ENDPOINT_SERVICE: AWS endpoint service type.\n - ALICLOUD_ENDPOINT_SERVICE: Alicloud endpoint service type.\n - AMAZON_MSK_PROVISIONED: Amazon MSK Provisioned type."
    },
    "Status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/Any"
          }
        }
      }
    }
  }
}
