scenario:
  id: 5d6f93c1-8d4f-496e-8cd0-3a727b73e524
  context:
    auth:
      type: digest
    base_path: /v1beta2
    host: null
  description: ng_backups_operation
  name: ng_backups_operation
steps:
- operation_id: BackupService_ListBackups
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/backups",
      "headers": {},
      "query_params": {
        "states": [
          "SUCCEEDED"
        ],
        "triggerTypes": [
          "AUTO"
        ],
        "pageSize": 5
      },
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      }
    }
  expect: |-
    {
      "status_code": 200,
      "cel": "body.totalSize > 0"
    }
  save: |-
    {
      "placeholder": [
        {
          "key": "backup_1",
          "eval": "size(body.backups.filter(b, !body.backups.exists(other, other.tidbId == b.tidbId && (timestamp(other.createTime) > timestamp(b.createTime) || (timestamp(other.createTime) == timestamp(b.createTime) && int(other.id) > int(b.id)))))) > 0 ? body.backups.filter(b, !body.backups.exists(other, other.tidbId == b.tidbId && (timestamp(other.createTime) > timestamp(b.createTime) || (timestamp(other.createTime) == timestamp(b.createTime) && int(other.id) > int(b.id)))))[0].id : '0'"
        }
      ]
    }
  description: ''
  max_retries: 120
  delay_after: 30
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 0
- operation_id: BackupService_DeleteBackup
  request_type: http
  request: |-
    {
      "method": "DELETE",
      "path": "/backups/{id}",
      "headers": {},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      },
      "path_params": {
        "id": "backup_1"
      }
    }
  expect: |-
    {
      "status_code": 400,
      "cel": "body.message == 'This backup is protected under the Data Safety Policy and cannot be deleted until expiration. Contact support if you want to delete it before it expires.' || body.message.matches('(?i)backup not found')"
    }
  save: null
  description: ''
  max_retries: 0
  delay_after: 0
  name: ''
  continue_on_unexpected: false
  stage: ''
  meta: '{}'
  generation_id: ''
  order: 2
- operation_id: BackupService_ListDeletedTidbs
  request_type: http
  request: |-
    {
      "method": "GET",
      "path": "/backups:listDeletedTidbs",
      "headers": {},
      "query_params": {},
      "body": {},
      "auth": {
        "auth_type": "digest",
        "content": {
          "private_key": "placeholder",
          "public_key": "placeholder"
        }
      }
    }
  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: 3
