{
  "swagger": "2.0",
  "info": {
    "title": "Control Plane Internal API",
    "description": "Control Plane Internal API.",
    "version": "v1"
  },
  "tags": [
    {
      "name": "PrivateLinkServiceMigrationService"
    }
  ],
  "basePath": "/inner/mgmt/v1",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/privateLinkServiceMigrations": {
      "get": {
        "summary": "List private link service migration operations with filtering and pagination",
        "operationId": "PrivateLinkServiceMigrationService_ListPrivateLinkServiceMigrations",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_mgmt_servicev1ListPrivateLinkServiceMigrationsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "sourceClusterId",
            "description": "Filter by source cluster ID",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "targetClusterId",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "targetServicePlan",
            "description": "Service plan of the target cluster. Unique identifier for the private link service migration: target_service_plan + id.",
            "in": "query",
            "required": true,
            "type": "string",
            "enum": [
              "Starter",
              "Essential",
              "Premium",
              "BYOC",
              "Dedicated",
              "Premium_Reserved",
              "Essential_V2"
            ]
          },
          {
            "name": "organizationId",
            "description": "Filter by organization ID",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "projectId",
            "description": "Filter by project ID",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "states",
            "description": "Filter by operation state\n\n - PENDING: Operation is queued and waiting to start\n - RUNNING: Operation is currently executing\n - SUCCEEDED: Operation completed successfully\n - FAILED: Operation failed\n - CANCELLED: Operation was cancelled",
            "in": "query",
            "required": false,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "PENDING",
                "RUNNING",
                "SUCCEEDED",
                "FAILED",
                "CANCELLED"
              ]
            },
            "collectionFormat": "multi"
          },
          {
            "name": "createTimeFrom",
            "description": "Filter by creation time range",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "createTimeTo",
            "in": "query",
            "required": false,
            "type": "string",
            "format": "date-time"
          },
          {
            "name": "pageSize",
            "description": "The maximum number of private link service migration operations to return in each response.\nThe server may return fewer than this at its discretion.\nIf no value is specified, a default value of 100 will be used.",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int64"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int64"
          }
        ],
        "tags": [
          "PrivateLinkServiceMigrationService"
        ]
      },
      "post": {
        "summary": "Create a new private link service migration operation\nRequire the source cluster and target cluster are in the same project and same region.",
        "operationId": "PrivateLinkServiceMigrationService_CreatePrivateLinkServiceMigration",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigration"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "description": "*\nRequest to create a new private link service migration operation.",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/tidb_mgmt_servicev1CreatePrivateLinkServiceMigrationRequest"
            }
          }
        ],
        "tags": [
          "PrivateLinkServiceMigrationService"
        ]
      }
    },
    "/privateLinkServiceMigrations/{id}": {
      "get": {
        "summary": "Get a specific private link service migration operation by ID",
        "operationId": "PrivateLinkServiceMigrationService_GetPrivateLinkServiceMigration",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigration"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "description": "ID of the migration operation to retrieve",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "targetServicePlan",
            "description": "Service plan of the target cluster. Unique identifier for the private link service migration: target_service_plan + id.",
            "in": "query",
            "required": true,
            "type": "string",
            "enum": [
              "Starter",
              "Essential",
              "Premium",
              "BYOC",
              "Dedicated",
              "Premium_Reserved",
              "Essential_V2"
            ]
          }
        ],
        "tags": [
          "PrivateLinkServiceMigrationService"
        ]
      }
    },
    "/privateLinkServiceMigrations/{id}:cancel": {
      "post": {
        "summary": "Cancel a private link service migration operation\nThis cancel action just to stop the migration operation, but not to rollback the migration operation.",
        "operationId": "PrivateLinkServiceMigrationService_CancelPrivateLinkServiceMigration",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "type": "object",
              "properties": {}
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "description": "ID of the migration operation to cancel",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          },
          {
            "name": "targetServicePlan",
            "description": "Service plan of the target cluster. Unique identifier for the private link service migration: target_service_plan + id.",
            "in": "query",
            "required": true,
            "type": "string",
            "enum": [
              "Starter",
              "Essential",
              "Premium",
              "BYOC",
              "Dedicated",
              "Premium_Reserved",
              "Essential_V2"
            ]
          }
        ],
        "tags": [
          "PrivateLinkServiceMigrationService"
        ]
      }
    }
  },
  "definitions": {
    "commonv1beta1ServicePlan": {
      "type": "string",
      "enum": [
        "Starter",
        "Essential",
        "Premium",
        "BYOC",
        "Dedicated",
        "Premium_Reserved",
        "Essential_V2"
      ]
    },
    "googlerpcStatus": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32",
          "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]."
        },
        "message": {
          "type": "string",
          "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."
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/protobufAny"
          },
          "description": "A list of messages that carry the error details.  There is a common set of\nmessage types for APIs to use."
        }
      },
      "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)."
    },
    "protobufAny": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string",
          "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."
        }
      },
      "additionalProperties": {},
      "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(\u0026foo)) {\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 := \u0026pb.Foo{...}\n     any, err := anypb.New(foo)\n     if err != nil {\n       ...\n     }\n     ...\n     foo := \u0026pb.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\": \u003cstring\u003e,\n      \"lastName\": \u003cstring\u003e\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    }"
    },
    "tidb_mgmt_servicev1CreatePrivateLinkServiceMigrationRequest": {
      "type": "object",
      "properties": {
        "migration": {
          "title": "The migration operation to create",
          "allOf": [
            {
              "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigration"
            }
          ]
        },
        "validateOnly": {
          "type": "boolean",
          "title": "If true, only validates the request and returns INVALID_ARGUMENT on failure,\nwithout creating or starting the operation"
        }
      },
      "description": "*\nRequest to create a new private link service migration operation.",
      "required": [
        "migration"
      ]
    },
    "tidb_mgmt_servicev1ListPrivateLinkServiceMigrationsResponse": {
      "type": "object",
      "properties": {
        "migrations": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigration"
          },
          "title": "List of migration operations",
          "readOnly": true
        }
      },
      "description": "*\nResponse containing a list of private link service migration operations."
    },
    "tidb_mgmt_servicev1MigrationPlan": {
      "type": "object",
      "properties": {
        "disableRecreatePrivateLinkServiceForSourceTidbGroup": {
          "type": "boolean",
          "title": "If true, the private link service for the source TiDB group will not be recreated (default: false)"
        },
        "timeoutSeconds": {
          "type": "integer",
          "format": "int32",
          "x-nullable": true,
          "title": "Maximum time to wait for the migration to complete (in seconds)\nIf not set, uses the default timeout"
        }
      },
      "description": "*\nMigrationPlan defines the configuration for a private link service migration operation."
    },
    "tidb_mgmt_servicev1PrivateLinkServiceMigration": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uint64",
          "title": "Unique identifier for the migration operation",
          "readOnly": true
        },
        "sourceClusterId": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the source cluster"
        },
        "targetClusterId": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the target cluster"
        },
        "targetServicePlan": {
          "title": "Service plan of the target cluster",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/commonv1beta1ServicePlan"
            }
          ]
        },
        "migrationTidbGroups": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigrationMigrationTidbGroup"
          },
          "title": "List of TiDB groups to be migrated (must contain at least one group)"
        },
        "runMode": {
          "title": "Execution mode for the migration operation (default: PARALLEL)",
          "allOf": [
            {
              "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigrationRunMode"
            }
          ]
        },
        "state": {
          "title": "Overall state of the migration operation",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigrationState"
            }
          ]
        },
        "message": {
          "type": "string",
          "title": "Overall status message for the operation",
          "readOnly": true
        },
        "migrationPlan": {
          "title": "Migration plan configuration",
          "allOf": [
            {
              "$ref": "#/definitions/tidb_mgmt_servicev1MigrationPlan"
            }
          ]
        },
        "organizationId": {
          "type": "string",
          "format": "uint64",
          "title": "Metadata fields",
          "readOnly": true
        },
        "projectId": {
          "type": "string",
          "format": "uint64",
          "readOnly": true
        },
        "createTime": {
          "type": "string",
          "format": "date-time",
          "title": "Timestamps",
          "readOnly": true
        },
        "updateTime": {
          "type": "string",
          "format": "date-time",
          "readOnly": true
        },
        "deleteTime": {
          "type": "string",
          "format": "date-time",
          "x-nullable": true,
          "readOnly": true
        }
      },
      "description": "*\nPrivateLinkServiceMigration represents a private link service migration operation between TiDB clusters.\nThis operation manages the migration of TiDB groups from a source cluster to a target cluster.",
      "required": [
        "sourceClusterId",
        "targetClusterId",
        "migrationTidbGroups"
      ]
    },
    "tidb_mgmt_servicev1PrivateLinkServiceMigrationMigrationTidbGroup": {
      "type": "object",
      "properties": {
        "sourceTidbGroupId": {
          "type": "string",
          "title": "ID of the source TiDB group"
        },
        "targetTidbGroupId": {
          "type": "string",
          "title": "ID of the target TiDB group"
        },
        "state": {
          "title": "State of this specific migration pair",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/tidb_mgmt_servicev1PrivateLinkServiceMigrationState"
            }
          ]
        },
        "message": {
          "type": "string",
          "title": "Last status message for this pair",
          "readOnly": true
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "x-nullable": true,
          "title": "Timestamp when this group migration started",
          "readOnly": true
        },
        "completeTime": {
          "type": "string",
          "format": "date-time",
          "x-nullable": true,
          "title": "Timestamp when this group migration completed",
          "readOnly": true
        }
      },
      "description": "*\nMigrationTidbGroup represents a pair of TiDB groups to be migrated.",
      "required": [
        "sourceTidbGroupId",
        "targetTidbGroupId"
      ]
    },
    "tidb_mgmt_servicev1PrivateLinkServiceMigrationRunMode": {
      "type": "string",
      "enum": [
        "PARALLEL",
        "SEQUENTIAL"
      ],
      "description": "*\nRunMode defines how the migration operation should be executed.\n@deprecated This field is deprecated and will be removed in future versions.\n\n - PARALLEL: Execute all group migrations in parallel (default)\n - SEQUENTIAL: Execute group migrations one by one"
    },
    "tidb_mgmt_servicev1PrivateLinkServiceMigrationState": {
      "type": "string",
      "enum": [
        "PENDING",
        "RUNNING",
        "SUCCEEDED",
        "FAILED",
        "CANCELLED"
      ],
      "description": "*\nState represents the current state of a migration operation or group.\n\n - PENDING: Operation is queued and waiting to start\n - RUNNING: Operation is currently executing\n - SUCCEEDED: Operation completed successfully\n - FAILED: Operation failed\n - CANCELLED: Operation was cancelled"
    }
  }
}
