scenario:
  id: 376ad526-529d-4026-81d7-ecc60e8c89a1
  context:
    auth:
      type: bearer
    base_path: null
    host: us-west-2.env.shared.aws.tidbcloud.com
  description: next gen console changefeed operation
  name: ng_console_cluster_changefeed
steps:
  - operation_id: TidbService_CreateTidb
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/api/v2025/cloud/v1beta2/tidbs?orgId={orgId}",
        "headers": {},
        "query_params": {},
        "body": {
          "displayName": "ng-console-changefeed-operation",
          "regionId": "{regionId}",
          "maxRcu": "6000",
          "servicePlan": "Premium",
          "cloudProvider": "{cloud_provider}",
          "highAvailabilityType": "REGIONAL"
        },
        "body_params": {
          "regionId": "region_id",
          "cloud_provider": "cloud_provider"
        },
        "path_params": {
          "orgId": "org_id"
        },
        "auth": {
          "auth_type": "bearer_token"
        }
      }
    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: TidbService_GetTidb
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v2025/cloud/v1beta2/tidbs/{tidbId}?orgId={orgId}",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        }
      }
    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
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TidbService_ResetPassword
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v2025/cloud/v1beta2/tidbs/{tidbId}:resetRootPassword?orgId={orgId}",
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        },
        "query_params": {},
        "headers": {},
        "body": {
          "rootPassword": "31415926"
        },
        "body_params": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: Reset Cluster Pasword 
    max_retries: 3
    delay_after: 40
    step_type: defined
    name: reset_password
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 2
  - operation_id: TiCDCService_GetChangefeedList
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds?page=1&per_page=20",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.total == 0"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 3
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_TestConnection
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/test",
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        },
        "query_params": {},
        "headers": {},
        "body": {
          "changefeed_type": "MYSQL",
          "mysql_info": {
              "connection": {
                  "endpoint": "34.218.43.86:49609",
                  "username": "e2e_admin",
                  "password": "{mysql_source_password}"
              }
          },
          "network_info": {
              "network_type": "NetworkType_Public"
          }
        },
        "body_params": {
          "mysql_source_password": "mysql_source_password"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: validateSourceConnection
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 4
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_changefeedSpecifications
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeedSpecifications?changefeed_type=MYSQL",
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        },
        "query_params": {},
        "headers": {},
        "body": {},
        "body_params": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: changefeedSpecifications
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 5
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_CreateChangefeed
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds",
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        },
        "query_params": {},
        "headers": {},
        "body": {
          "changefeed_type": "MYSQL",
          "network_info": {
              "network_type": "NetworkType_Public"
          },
          "mysql_info": {
              "start_position": {
                  "mode": "FROM_NOW"
              },
              "connection": {
                  "endpoint": "34.218.43.86:49609",
                  "username": "e2e_admin",
                  "password": "{mysql_source_password}"
              },
              "table_config": {
                  "filter_rule": [
                      "*.*"
                  ],
                  "mode": "FORCE_SYNC",
                  "event_filter_rule": [],
                  "case_sensitive": false
              }
          },
          "changefeed_spec": "2rcu",
          "name": "e2e-cf-{tidbId}"
        },
        "body_params": {
          "tidbId": "cluster_1",
          "mysql_source_password": "mysql_source_password"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: create_changefeed
    save: |-
      {
        "placeholder": [
          {
            "key": "changefeed_id_1",
            "eval": "body.changefeed_id"
          }
        ]
      }
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 6
  - operation_id: TiCDCService_GetChangefeed
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}",
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.status == 'RUNNING'"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 7
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_PauseChangefeed
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}:pause",
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        },
        "query_params": {},
        "headers": {},
        "body": {},
        "body_params": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: pause_changefeed
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 8
  - operation_id: TiCDCService_GetChangefeed
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}",
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.status == 'PAUSED'"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 9
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_ResumeChangefeed
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}:resume",
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        },
        "query_params": {},
        "headers": {},
        "body": {},
        "body_params": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: resume_changefeed
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 10
  - operation_id: TiCDCService_GetChangefeed
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}",
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.status == 'RUNNING'"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 11
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_ScaleUpChangefeed
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}:scale",
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        },
        "query_params": {},
        "headers": {},
        "body": {
          "changefeed_spec": "4rcu"
        },
        "body_params": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: scale_up_changefeed
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 12
  - operation_id: TiCDCService_GetChangefeed
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}",
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.status == 'RUNNING' && body.changefeed_spec == '4rcu'"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 13
  - case_id: c37f522f5754a26096985d8962f63afe
    operation_id: TiCDCService_ScaleDownChangefeed
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "bearer_token"
        },
        "method": "POST",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}:scale",
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        },
        "query_params": {},
        "headers": {},
        "body": {
          "changefeed_spec": "2rcu"
        },
        "body_params": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: ""
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: scale_down_changefeed
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 14
  - operation_id: TiCDCService_GetChangefeed
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}",
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.status == 'RUNNING' && body.changefeed_spec == '2rcu'"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 15
  - operation_id: TiCDCService_DeleteChangefeed
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds/{changefeedId}",
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "changefeedId": "changefeed_id_1"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 16
  - operation_id: TiCDCService_GetChangefeedList
    request_type: http
    request: |-
      {
        "method": "GET",
        "path": "/api/v1beta2/tidbs/{tidbId}/changefeeds?page=1&per_page=20",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.total == 0"
      }
    save: null
    description: ""
    max_retries: 120
    delay_after: 30
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 17
  - operation_id: TidbService_DeleteTidb
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/api/v2025/cloud/v1beta2/tidbs/{tidbId}?orgId={orgId}",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "bearer_token"
        },
        "path_params": {
          "tidbId": "cluster_1",
          "orgId": "org_id"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    save: null
    description: ''
    max_retries: 3
    delay_after: 30
    name: ''
    continue_on_unexpected: false
    stage: ''
    meta: '{}'
    generation_id: ''
    order: 18
