scenario:
  id: 65abf943-53e4-476a-820f-9d1f7601678a
  context:
    auth:
      type: digest
    base_path: /v1beta2
    host: null
  description: ng_byoc_cluster_imports_azure
  name: ng_byoc_cluster_imports_azure
steps:
- operation_id: TidbService_CreateTidb
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs",
      "headers": {},
      "query_params": {},
      "body": {
        "displayName": "sce-ng-byoc-cluster-imports-azure",
        "regionId": "{regionId}",
        "minRcu": "5000",
        "maxRcu": "6000",
        "servicePlan": "BYOC",
        "cloudProvider": "{cloud_provider}",
        "resourcePoolId": "{resource_pool_id}"
      },
      "body_params": {
        "regionId": "region_id",
        "cloud_provider": "cloud_provider",
        "resource_pool_id": "resource_pool_id"
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "cluster_1",
          "eval": "body.tidbId"
        }
      ]
    }
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 0
- operation_id: PrivateEndpointConnectionService_GetPrivateLinkService
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/privateLinkService",
      "headers": {},
      "query_params": {},
      "body": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == 'ACTIVE'"
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "private_link_service_1",
          "eval": "body.serviceName"
        }
      ]
    }
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 0.5
- operation_id: TidbService_GetTidb
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}",
      "headers": {},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == 'ACTIVE'"
    }
  save: null
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 1
- operation_id: TidbService_ResetRootPassword
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}:resetRootPassword",
      "headers": {},
      "query_params": {},
      "body": {
        "rootPassword": "pi31415926"
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: null
  description: ''
  max_retries: 5
  delay_after: 60
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 1.5
- operation_id: PublicConnectionSettingService_UpdatePublicConnectionSetting
  request_type: http
  request: |-
    {
      "method": "PATCH",
      "path": "/tidbs/{tidbId}/publicConnectionSetting",
      "headers": {},
      "query_params": {},
      "body": {
        "enabled": true,
        "ipAccessList": [
          {
            "cidrNotation": "0.0.0.0/0",
            "description": "Allow all IPs"
          }
        ]
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: null
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 2
- operation_id: ClusterService_GetCluster
  generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
  order: 3
  case_type: supplimental_positive
  request_type: http
  request: |-
    {
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "method": "GET",
      "path": "/tidbs/{tidbId}",
      "path_params": {
        "tidbId": "cluster_1"
      },
      "query_params": {},
      "headers": {},
      "body": {}
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == \"ABC\""
    }
  description: Poll the cluster state until it becomes ACTIVE.
  max_retries: 30
  delay_after: 10
  step_type: defined
  name: force_wait_dns
  save: null
  continue_on_unexpected: true
  stage: prepare
  meta: '{}'
- operation_id: TidbService_GetTidb
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}",
      "headers": {},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == \"ACTIVE\" && size(body.endpoints.filter(e, e.connectionType == 'PUBLIC')) > 0 && body.endpoints.filter(e, e.connectionType == 'PUBLIC')[0].host != \"\""
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "public_endpoint",
          "eval": "body.endpoints.filter(e, e.connectionType == 'PUBLIC')[0].host"
        },
        {
          "key": "port",
          "eval": "body.endpoints.filter(e, e.connectionType == 'PUBLIC')[0].port"
        }
      ]
    }
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 4
- operation_id: CheckImportDatabaseConnectivity
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports:checkDatabaseConnectivity",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "body": {
        "username": "root",
        "password": "pi31415926"
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.success == true"
    }
  save: null
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 4.5
- operation_id: CheckImportSource
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports:checkSource",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "body": {
        "source": {
          "type": "ENUM_AZURE_BLOB",
          "azureBlob": {
            "uri": "https://fangcloudtest.blob.core.windows.net/testimportdata/testdata/",
            "authType": "ENUM_SAS_TOKEN",
            "sasToken": "{azure_account_sas_token}"
          }
        }
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "body_params": {
        "azure_account_sas_token": "azure_account_sas_token"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.success == true"
    }
  save: null
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 5
- operation_id: CreateImportIntoTask
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "body": {
        "username": "root",
        "password": "pi31415926",
        "creationDetails": {
          "source": {
            "type": "ENUM_AZURE_BLOB",
            "azureBlob": {
              "uri": "https://fangcloudtest.blob.core.windows.net/testimportdata/testdata/",
              "authType": "ENUM_SAS_TOKEN",
              "sasToken": "{azure_account_sas_token}"
            }
          },
          "targetTableInfos": [
            {
              "database": "test",
              "table": "students",
              "filesWildcard": "azure://testimportdata/testdata/test.students.sql?account-name=fangcloudtest"
            }
          ]
        }
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "body_params": {
        "azure_account_sas_token": "azure_account_sas_token"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "import_1",
          "eval": "body.importId"
        }
      ]
    }
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 6
- operation_id: ListImportIntoTasks
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports?pageSize=20&pageToken=0",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.totalSize > 0"
    }
  save: null
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 7
- operation_id: CancelImportIntoTask
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports/{importId}:cancel",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1",
        "importId": "import_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: null
  description: Cancel Import task under prepare stage
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 8
- operation_id: GetImportIntoTask
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports/{importId}",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1",
        "importId": "import_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == 'ENUM_CANCELED'"
    }
  save: null
  description: ''
  max_retries: 60
  delay_after: 5
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 9
- operation_id: CreateImportIntoTask
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "body": {
        "username": "root",
        "password": "pi31415926",
        "creationDetails": {
          "source": {
            "type": "ENUM_AZURE_BLOB",
            "azureBlob": {
              "uri": "https://fangcloudtest.blob.core.windows.net/testimportdata/testdata/",
              "authType": "ENUM_SAS_TOKEN",
              "sasToken": "{azure_account_sas_token}"
            }
          },
          "targetTableInfos": [
            {
              "database": "test",
              "table": "students",
              "filesWildcard": "azure://testimportdata/testdata/test.students.sql?account-name=fangcloudtest"
            }
          ]
        }
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "body_params": {
        "azure_account_sas_token": "azure_account_sas_token"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "import_3",
          "eval": "body.importId"
        }
      ]
    }
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 10
- operation_id: ListImportIntoTasks
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports?pageSize=20&pageToken=0",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.totalSize > 0"
    }
  save: null
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 11
- operation_id: GetImportIntoTask
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports/{importId}",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1",
        "importId": "import_3"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == 'ENUM_IMPORTING'"
    }
  save: null
  description: ''
  max_retries: 60
  delay_after: 5
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 12
- operation_id: CancelImportIntoTask
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports/{importId}:cancel",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1",
        "importId": "import_3"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: null
  description: Cancel Import task under Importing stage
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 13
- operation_id: GetImportIntoTask
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports/{importId}",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1",
        "importId": "import_3"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == 'ENUM_CANCELED'"
    }
  save: null
  description: ''
  max_retries: 60
  delay_after: 5
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 14
- operation_id: CheckImportSource
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports:checkSource",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "body": {
        "source": {
          "type": "ENUM_AZURE_BLOB",
          "azureBlob": {
            "uri": "https://fangcloudtest.blob.core.windows.net/testimportdata/testdata/",
            "authType": "ENUM_SAS_TOKEN",
            "sasToken": "{azure_account_sas_token}"
          }
        }
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "body_params": {
        "azure_account_sas_token": "azure_account_sas_token"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.success == true"
    }
  save: null
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 15
- operation_id: Mysqlsh_clear_import_data
  order: 16.1
  case_type: typical_positive
  request_type: cmd_mysqlsh
  request: |-
    {
      "name": "mysqlsh",
      "args": [
        "--sql",
        "mysql://root:pi31415926@{public_endpoint}:{port}/mysql",
        "--result-format=json",
        "-e",
        "delete from test.students",
        "--quiet-start=2"
      ],
      "args_params": {
        "public_endpoint": "public_endpoint",
        "port": "port"
      }
    }
  expect: |-
    {
      "exit_code": 0
    }
  description: Clear imported data of canceled task.
  max_retries: 0
  delay_after: 0
  step_type: defined
  name: check_password
  continue_on_unexpected: false
  save: null
  stage: execute
  meta: '{}'
- operation_id: CreateImportIntoTask
  request_type: http
  request: |-
    {
      "method": "POST",
      "path": "/tidbs/{tidbId}/imports",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "path_params": {
        "tidbId": "cluster_1"
      },
      "body": {
        "username": "root",
        "password": "pi31415926",
        "creationDetails": {
          "source": {
            "type": "ENUM_AZURE_BLOB",
            "azureBlob": {
              "uri": "https://fangcloudtest.blob.core.windows.net/testimportdata/testdata/",
              "authType": "ENUM_SAS_TOKEN",
              "sasToken": "{azure_account_sas_token}"
            }
          },
          "targetTableInfos": [
            {
              "database": "test",
              "table": "students",
              "filesWildcard": "azure://testimportdata/testdata/test.students.sql?account-name=fangcloudtest"
            }
          ]
        }
      },
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "body_params": {
        "azure_account_sas_token": "azure_account_sas_token"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "import_2",
          "eval": "body.importId"
        }
      ]
    }
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 16.2
- operation_id: ListImportIntoTasks
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports?pageSize=20&pageToken=0",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.totalSize > 0"
    }
  save: null
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 17
- operation_id: GetImportIntoTask
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/tidbs/{tidbId}/imports/{importId}",
      "headers": {"Accept": "application/json+camel"},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1",
        "importId": "import_2"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.state == 'ENUM_COMPLETED'"
    }
  save: null
  description: ''
  max_retries: 60
  delay_after: 10
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 18
- operation_id: Mysqlsh_connection
  generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
  order: 19
  case_type: typical_positive
  request_type: cmd_mysqlsh
  request: |-
    {
      "name": "mysqlsh",
      "args": [
        "--sql",
        "mysql://root:pi31415926@{public_endpoint}:{port}/mysql",
        "--result-format=json",
        "-e",
        "select count(*) as count from test.students",
        "--quiet-start=2"
      ],
      "args_params": {
        "public_endpoint": "public_endpoint",
        "port": "port"
      }
    }
  expect: |-
    {
      "exit_code": 0,
      "cel": "output.count > 0"
    }
  description: Check the connection status of the cluster.
  max_retries: 0
  delay_after: 0
  step_type: defined
  name: check_password
  continue_on_unexpected: false
  save: null
  stage: execute
  meta: '{}'
- operation_id: TidbService_DeleteTidb
  request_type: http
  request: |-
    {
      "method": "DELETE",
      "path": "/tidbs/{tidbId}",
      "headers": {},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "tidbId": "cluster_1"
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": ""
    }
  save: null
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 20
