{
  "swagger": "2.0",
  "info": {
    "title": "Control Plane Internal API",
    "description": "Control Plane Internal API.",
    "version": "v1"
  },
  "tags": [
    {
      "name": "MigrationClusterService"
    }
  ],
  "basePath": "/inner/mgmt/v1",
  "schemes": [
    "https"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/migrationClusters": {
      "post": {
        "operationId": "MigrationClusterService_CreateMigrationCluster",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1MigrationCluster"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1CreateMigrationClusterRequest"
            }
          }
        ],
        "tags": [
          "MigrationClusterService"
        ]
      }
    },
    "/migrationClusters/{id}": {
      "get": {
        "operationId": "MigrationClusterService_GetMigrationCluster",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1MigrationCluster"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/googlerpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "description": "ID of the migration cluster to retrieve",
            "in": "path",
            "required": true,
            "type": "string",
            "format": "uint64"
          }
        ],
        "tags": [
          "MigrationClusterService"
        ]
      }
    }
  },
  "definitions": {
    "MigrationClusterPdNodeSetting": {
      "type": "object",
      "properties": {
        "nodeSpecKey": {
          "type": "string"
        }
      }
    },
    "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    }"
    },
    "v1ConfigSyncStrategy": {
      "type": "object",
      "properties": {
        "allowFallbackToBackup": {
          "type": "boolean",
          "description": "If true, fallback to backup when live config fetch fails."
        },
        "skipSystemVariables": {
          "type": "boolean",
          "description": "If true, skip synchronizing system variables."
        },
        "skipPdConfig": {
          "type": "boolean",
          "description": "If true, skip synchronizing regular PD config."
        },
        "skipPdServerConfig": {
          "type": "boolean",
          "description": "If true, skip synchronizing PD server config."
        },
        "skipPlacementRules": {
          "type": "boolean",
          "description": "If true, skip synchronizing placement rules."
        },
        "skipStoreLimits": {
          "type": "boolean",
          "description": "If true, skip synchronizing store limits."
        }
      }
    },
    "v1CreateMigrationClusterRequest": {
      "type": "object",
      "properties": {
        "migrationCluster": {
          "title": "Details of the migration cluster to create",
          "allOf": [
            {
              "$ref": "#/definitions/v1MigrationCluster"
            }
          ]
        },
        "validateOnly": {
          "type": "boolean",
          "title": "If true, only validates the request and returns INVALID_ARGUMENT on failure,\nwithout creating or starting the operation"
        },
        "configSyncStrategy": {
          "description": "Strategy that controls how cluster configs are synchronized during migration cluster creation.",
          "allOf": [
            {
              "$ref": "#/definitions/v1ConfigSyncStrategy"
            }
          ]
        }
      },
      "required": [
        "migrationCluster"
      ]
    },
    "v1MigrationCluster": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the migration cluster",
          "readOnly": true
        },
        "sourceClusterId": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the source cluster"
        },
        "backupId": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the backup of the source cluster"
        },
        "targetProjectId": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the target project where the migration cluster will be created\nIf not provided, the migration cluster will be created in the same project as the source cluster"
        },
        "clusterDisplayName": {
          "type": "string",
          "title": "Display Name of the migration cluster to be created"
        },
        "tidbNodeSetting": {
          "title": "Configuration of the TiDB component in the migration cluster",
          "allOf": [
            {
              "$ref": "#/definitions/v1MigrationClusterTidbNodeSetting"
            }
          ]
        },
        "tikvNodeSetting": {
          "title": "Configuration of the TiKV component in the migration cluster",
          "allOf": [
            {
              "$ref": "#/definitions/v1MigrationClusterStorageNodeSetting"
            }
          ]
        },
        "tiflashNodeSetting": {
          "title": "Configuration of the TiFlash component in the migration cluster",
          "allOf": [
            {
              "$ref": "#/definitions/v1MigrationClusterStorageNodeSetting"
            }
          ]
        },
        "pdNodeSetting": {
          "title": "Configuration of the PD component in the migration cluster",
          "allOf": [
            {
              "$ref": "#/definitions/MigrationClusterPdNodeSetting"
            }
          ]
        },
        "brVersion": {
          "type": "string"
        },
        "targetClusterVersion": {
          "type": "string",
          "title": "Target version of the migration cluster to be upgraded to"
        },
        "state": {
          "title": "Current state of the migration cluster provision operation",
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/definitions/v1MigrationClusterState"
            }
          ]
        },
        "targetClusterId": {
          "type": "string",
          "format": "uint64",
          "title": "ID of the target cluster created for migration",
          "readOnly": true
        },
        "brImageTag": {
          "type": "string"
        },
        "brCustomOptions": {
          "type": "string",
          "title": "Custom options for the BR command"
        },
        "tidbImageTag": {
          "type": "string",
          "title": "Image tag for the TiDB component in the migration cluster during upgrade"
        },
        "tikvImageTag": {
          "type": "string",
          "title": "Image tag for the TiKV component in the migration cluster during upgrade"
        },
        "pdImageTag": {
          "type": "string",
          "title": "Image tag for the PD component in the migration cluster during upgrade"
        },
        "tiflashImageTag": {
          "type": "string",
          "title": "Image tag for the TiFlash component in the migration cluster during upgrade"
        },
        "createClusterTidbImageTag": {
          "type": "string",
          "title": "Image tag for the TiDB component in the migration cluster during creation"
        },
        "createClusterTikvImageTag": {
          "type": "string",
          "title": "Image tag for the TiKV component in the migration cluster during creation"
        },
        "createClusterPdImageTag": {
          "type": "string",
          "title": "Image tag for the PD component in the migration cluster during creation"
        },
        "createClusterTiflashImageTag": {
          "type": "string",
          "title": "Image tag for the TiFlash component in the migration cluster during creation"
        },
        "targetRegionId": {
          "description": "Optional. Defaults to source cluster region.\nCross-region clone is only allowed within the same cloud provider.",
          "allOf": [
            {
              "$ref": "#/definitions/v1RegionName"
            }
          ]
        },
        "restoreMode": {
          "description": "Optional. Defaults to SNAPSHOT if unspecified.\nUsers should explicitly choose another restore mode when needed.",
          "allOf": [
            {
              "$ref": "#/definitions/v1MigrationClusterRestoreMode"
            }
          ]
        },
        "backupRegionId": {
          "description": "Optional. Defaults to target_region_id if unspecified.\nThe backup region is not required to be the same as target_region_id.",
          "allOf": [
            {
              "$ref": "#/definitions/v1RegionName"
            }
          ]
        }
      },
      "required": [
        "sourceClusterId",
        "clusterDisplayName"
      ]
    },
    "v1MigrationClusterRestoreMode": {
      "type": "string",
      "enum": [
        "SNAPSHOT",
        "PITR"
      ]
    },
    "v1MigrationClusterState": {
      "type": "string",
      "enum": [
        "PENDING",
        "RUNNING",
        "SUCCEEDED",
        "FAILED"
      ],
      "title": "- PENDING: Operation is queued and waiting to start\n - RUNNING: Operation is currently executing\n - SUCCEEDED: Operation completed successfully\n - FAILED: Operation failed"
    },
    "v1MigrationClusterStorageNodeSetting": {
      "type": "object",
      "properties": {
        "nodeSpecKey": {
          "type": "string"
        },
        "nodeCount": {
          "type": "integer",
          "format": "int32",
          "x-nullable": true
        }
      }
    },
    "v1MigrationClusterTidbNodeGroup": {
      "type": "object",
      "properties": {
        "displayName": {
          "type": "string"
        },
        "isDefaultGroup": {
          "type": "boolean"
        },
        "nodeCount": {
          "type": "integer",
          "format": "int32",
          "x-nullable": true
        }
      },
      "required": [
        "displayName",
        "isDefaultGroup"
      ]
    },
    "v1MigrationClusterTidbNodeSetting": {
      "type": "object",
      "properties": {
        "nodeSpecKey": {
          "type": "string"
        },
        "tidbNodeGroups": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/v1MigrationClusterTidbNodeGroup"
          }
        }
      }
    },
    "v1RegionName": {
      "type": "string",
      "enum": [
        "AWS_US_EAST_2",
        "AWS_US_EAST_1",
        "AWS_US_WEST_1",
        "AWS_US_WEST_2",
        "AWS_AF_SOUTH_1",
        "AWS_AP_EAST_1",
        "AWS_AP_SOUTH_2",
        "AWS_AP_SOUTHEAST_3",
        "AWS_AP_SOUTHEAST_4",
        "AWS_AP_SOUTH_1",
        "AWS_AP_NORTHEAST_3",
        "AWS_AP_NORTHEAST_2",
        "AWS_AP_SOUTHEAST_1",
        "AWS_AP_SOUTHEAST_2",
        "AWS_AP_NORTHEAST_1",
        "AWS_CA_CENTRAL_1",
        "AWS_CA_WEST_1",
        "AWS_EU_CENTRAL_1",
        "AWS_EU_WEST_1",
        "AWS_EU_WEST_2",
        "AWS_EU_SOUTH_1",
        "AWS_EU_WEST_3",
        "AWS_EU_SOUTH_2",
        "AWS_EU_NORTH_1",
        "AWS_EU_CENTRAL_2",
        "AWS_IL_CENTRAL_1",
        "AWS_ME_SOUTH_1",
        "AWS_ME_CENTRAL_1",
        "AWS_SA_EAST_1",
        "AWS_AP_SOUTHEAST_5",
        "AWS_AP_SOUTHEAST_6",
        "AWS_AP_SOUTHEAST_7",
        "AWS_MX_CENTRAL_1",
        "GCP_ASIA_EAST1",
        "GCP_ASIA_EAST2",
        "GCP_ASIA_NORTHEAST1",
        "GCP_ASIA_NORTHEAST2",
        "GCP_ASIA_NORTHEAST3",
        "GCP_ASIA_SOUTH1",
        "GCP_ASIA_SOUTH2",
        "GCP_ASIA_SOUTHEAST1",
        "GCP_ASIA_SOUTHEAST2",
        "GCP_AUSTRALIA_SOUTHEAST1",
        "GCP_AUSTRALIA_SOUTHEAST2",
        "GCP_EUROPE_CENTRAL2",
        "GCP_EUROPE_NORTH1",
        "GCP_EUROPE_SOUTHWEST1",
        "GCP_EUROPE_WEST1",
        "GCP_EUROPE_WEST10",
        "GCP_EUROPE_WEST12",
        "GCP_EUROPE_WEST2",
        "GCP_EUROPE_WEST3",
        "GCP_EUROPE_WEST4",
        "GCP_EUROPE_WEST6",
        "GCP_EUROPE_WEST8",
        "GCP_EUROPE_WEST9",
        "GCP_ME_CENTRAL1",
        "GCP_ME_CENTRAL2",
        "GCP_ME_WEST1",
        "GCP_NORTHAMERICA_NORTHEAST1",
        "GCP_NORTHAMERICA_NORTHEAST2",
        "GCP_SOUTHAMERICA_EAST1",
        "GCP_SOUTHAMERICA_WEST1",
        "GCP_US_CENTRAL1",
        "GCP_US_EAST1",
        "GCP_US_EAST4",
        "GCP_US_EAST5",
        "GCP_US_SOUTH1",
        "GCP_US_WEST1",
        "GCP_US_WEST2",
        "GCP_US_WEST3",
        "GCP_US_WEST4",
        "AZURE_EASTUS",
        "AZURE_SOUTHCENTRALUS",
        "AZURE_WESTUS2",
        "AZURE_WESTUS3",
        "AZURE_AUSTRALIAEAST",
        "AZURE_SOUTHEASTASIA",
        "AZURE_NORTHEUROPE",
        "AZURE_SWEDENCENTRAL",
        "AZURE_UKSOUTH",
        "AZURE_WESTEUROPE",
        "AZURE_CENTRALUS",
        "AZURE_SOUTHAFRICANORTH",
        "AZURE_CENTRALINDIA",
        "AZURE_EASTASIA",
        "AZURE_JAPANEAST",
        "AZURE_KOREACENTRAL",
        "AZURE_CANADACENTRAL",
        "AZURE_FRANCECENTRAL",
        "AZURE_GERMANYWESTCENTRAL",
        "AZURE_ITALYNORTH",
        "AZURE_NORWAYEAST",
        "AZURE_POLANDCENTRAL",
        "AZURE_SPAINCENTRAL",
        "AZURE_SWITZERLANDNORTH",
        "AZURE_MEXICOCENTRAL",
        "AZURE_UAENORTH",
        "AZURE_BRAZILSOUTH",
        "AZURE_ISRAELCENTRAL",
        "AZURE_QATARCENTRAL",
        "AZURE_CENTRALUSSTAGE",
        "AZURE_EASTUSSTAGE",
        "AZURE_EASTUS2STAGE",
        "AZURE_NORTHCENTRALUSSTAGE",
        "AZURE_SOUTHCENTRALUSSTAGE",
        "AZURE_WESTUSSTAGE",
        "AZURE_WESTUS2STAGE",
        "AZURE_ASIA",
        "AZURE_ASIAPACIFIC",
        "AZURE_AUSTRALIA",
        "AZURE_BRAZIL",
        "AZURE_CANADA",
        "AZURE_EUROPE",
        "AZURE_FRANCE",
        "AZURE_GERMANY",
        "AZURE_GLOBAL",
        "AZURE_INDIA",
        "AZURE_ISRAEL",
        "AZURE_ITALY",
        "AZURE_JAPAN",
        "AZURE_KOREA",
        "AZURE_NEWZEALAND",
        "AZURE_NORWAY",
        "AZURE_POLAND",
        "AZURE_QATAR",
        "AZURE_SINGAPORE",
        "AZURE_SOUTHAFRICA",
        "AZURE_SWEDEN",
        "AZURE_SWITZERLAND",
        "AZURE_UAE",
        "AZURE_UK",
        "AZURE_UNITEDSTATES",
        "AZURE_UNITEDSTATESEUAP",
        "AZURE_EASTASIASTAGE",
        "AZURE_SOUTHEASTASIASTAGE",
        "AZURE_BRAZILUS",
        "AZURE_EASTUS2",
        "AZURE_EASTUSSTG",
        "AZURE_NORTHCENTRALUS",
        "AZURE_WESTUS",
        "AZURE_JAPANWEST",
        "AZURE_JIOINDIAWEST",
        "AZURE_CENTRALUSEUAP",
        "AZURE_EASTUS2EUAP",
        "AZURE_WESTCENTRALUS",
        "AZURE_SOUTHAFRICAWEST",
        "AZURE_AUSTRALIACENTRAL",
        "AZURE_AUSTRALIACENTRAL2",
        "AZURE_AUSTRALIASOUTHEAST",
        "AZURE_JIOINDIACENTRAL",
        "AZURE_KOREASOUTH",
        "AZURE_SOUTHINDIA",
        "AZURE_WESTINDIA",
        "AZURE_CANADAEAST",
        "AZURE_FRANCESOUTH",
        "AZURE_GERMANYNORTH",
        "AZURE_NORWAYWEST",
        "AZURE_SWITZERLANDWEST",
        "AZURE_UKWEST",
        "AZURE_UAECENTRAL",
        "AZURE_BRAZILSOUTHEAST",
        "ALICLOUD_AP_SOUTHEAST_1",
        "ALICLOUD_AP_NORTHEAST_1",
        "ALICLOUD_AP_NORTHEAST_2",
        "ALICLOUD_AP_SOUTHEAST_3",
        "ALICLOUD_AP_SOUTHEAST_5",
        "ALICLOUD_AP_SOUTHEAST_6",
        "ALICLOUD_AP_SOUTHEAST_7",
        "ALICLOUD_NA_SOUTH_1",
        "ALICLOUD_US_WEST_1",
        "ALICLOUD_US_EAST_1",
        "ALICLOUD_EU_CENTRAL_1",
        "ALICLOUD_EU_WEST_1",
        "ALICLOUD_ME_EAST_1",
        "ALICLOUD_ME_CENTRAL_1",
        "ALICLOUD_CN_HONGKONG"
      ],
      "description": "- AWS_US_EAST_2: AWS.\n - GCP_ASIA_EAST1: GCP.\n - AZURE_EASTUS: Azure\n - ALICLOUD_AP_SOUTHEAST_1: AliCloud",
      "title": "Refer to:\n  - AWS: https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints.\n  - GCP: https://console.cloud.google.com/compute/zones\n  - Azure: https://gist.github.com/ausfestivus/04e55c7d80229069bf3bc75870630ec8"
    }
  }
}
