scenario:
  id: f54e3cc5-d32c-4b0c-be1d-0dbeadea03b0
  context:
    auth:
      type: digest
    base_path: /v1beta1
    host: null
  description: all write APIs are forbidden(403)
  name: rbac_v1beta1_aws_write_403
steps:
  - operation_id: ClusterService_CreateCluster
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters",
        "headers": {},
        "query_params": {},
        "path_params": {},
        "body": {
          "displayName": "sce-rbac-v1beta1-aws-write-403",
          "regionId": "{regionId}",
          "labels": {
            "tidb.cloud/project": "{projectId}"
          },
          "tidbNodeSetting": {
            "nodeSpecKey": "2C8G",
            "tidbNodeGroups": [
              {
                "nodeCount": 1
              }
            ]
          },
          "tikvNodeSetting": {
            "nodeCount": 3,
            "nodeSpecKey": "2C8G",
            "storageSizeGi": 200,
            "storageType": "Standard"
          },
          "port": 4000,
          "rootPassword": "MyPassword123"
        },
        "body_params": {
          "regionId": "region_id",
          "projectId": "project_id"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    save: |-
      {
        "placeholder": [
          {
            "key": "cluster_1",
            "eval": "body.clusterId"
          },
          {
            "key": "project_1",
            "eval": "body.labels['tidb.cloud/project']"
          }
        ]
      }
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 0
  - operation_id: NetworkContainerService_ListNetworkContainers
    case_type: supplimental_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        },
        "method": "GET",
        "path": "/networkContainers?projectId={projectId}&cloudProvider=aws",
        "path_params": {
          "projectId": "project_id"
        },
        "query_params": {},
        "headers": {},
        "body": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: Get cluster networks container info.
    max_retries: 0
    delay_after: 0
    step_type: defined
    name: get_cluster_network_container_info
    save: |-
      {
        "placeholder": [
          {
            "key": "network_container_1",
            "eval": "body.networkContainers[0].networkContainerId"
          }
        ]
      }
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 0.4
  - operation_id: ClusterService_GetCluster
    case_type: supplimental_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        },
        "method": "GET",
        "path": "/clusters/{clusterId}",
        "path_params": {
          "clusterId": "cluster_1"
        },
        "query_params": {},
        "headers": {},
        "body": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": "body.state == \"ACTIVE\""
      }
    description: Poll the cluster state until it becomes ACTIVE.
    max_retries: 60
    delay_after: 30
    step_type: defined
    name: wait_for_cluster_active
    save: |-
      {
        "placeholder": [
          {
            "key": "nodegroup_1",
            "eval": "body.tidbNodeSetting.tidbNodeGroups[0].tidbNodeGroupId"
          }
        ]
      }
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 0.5
  - operation_id: DatabaseAuditLogService_CreateAuditLogConfig
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        },
        "method": "PATCH",
        "path": "/clusters/{clusterId}/auditLogConfig",
        "path_params": {
          "clusterId": "cluster_1"
        },
        "query_params": {},
        "headers": {},
        "body": {
          "awsRoleArn": "arn:aws:iam::024848481520:role/fordbauditlogrole",
          "azureSasToken": "",
          "bucketRegionId": "{regionId}",
          "bucketUri": "s3://testdbauditlog/dbauditlog-test/",
          "enabled": true
        },
        "body_params": {
          "regionId": "region_id"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: Create audit log config.
    max_retries: 0
    delay_after: 0
    step_type: generated
    name: Create audit log config
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
    generation_id: 09198df8-3eef-4d82-a5a4-31eb9b0db7de
    order: 0.6
  - operation_id: NetworkContainerService_CreateVpcPeering
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/vpcPeerings",
        "headers": {},
        "query_params": {},
        "body": {
          "tidbCloudRegionId": "aws-us-west-2",
          "customerRegionId": "aws-us-west-2",
          "customerAccountId": "024848481520",
          "customerVpcId": "vpc-0393f150b4eb1a955",
          "customerVpcCidr": "10.16.0.0/16",
          "labels":{
            "tidb.cloud/project":"{projectId}"
          }
        },
        "body_params": {
          "projectId": "project_id"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    save: |-
      {
        "placeholder": [
          {
            "key": "vpcpeering_1",
            "eval": "body.vpcPeeringId"
          },
          {
            "key": "tidbcloudregion_1",
            "eval": "body.tidbCloudRegionId"
          },
          {
            "key": "customerregion_1",
            "eval": "body.customerRegionId"
          },
          {
            "key": "customeraccount_1",
            "eval": "body.customerAccountId"
          },
          {
            "key": "customervpc_1",
            "eval": "body.customerVpcId"
          }
        ]
      }
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 0.7
  - operation_id: ClusterService_CreateCluster
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters",
        "headers": {},
        "query_params": {},
        "path_params": {},
        "body": {
          "displayName": "llm-e2e-cluster-test",
          "regionId": "{regionId}",
          "labels": {
            "tidb.cloud/project": "{project_1}"
          },
          "tidbNodeSetting": {
            "nodeSpecKey": "2C4G",
            "tidbNodeGroups": [
              {
                "nodeCount": 1
              }
            ]
          },
          "tikvNodeSetting": {
            "nodeCount": 3,
            "nodeSpecKey": "2C4G",
            "storageSizeGi": 60,
            "storageType": "Standard"
          },
          "port": 4000,
          "rootPassword": "TestPassword123"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "body_params": {
          "project_1": "project_1",
          "regionId": "region_id"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 1
  - operation_id: ClusterService_DeleteCluster
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/clusters/{clusterId}",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 2
  - operation_id: ClusterService_UpdateCluster
    request_type: http
    request: |-
      {
        "method": "PATCH",
        "path": "/clusters/{clusterId}",
        "headers": {},
        "query_params": {},
        "body": {
          "displayName": "updated-cluster-name"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 3
  - operation_id: ClusterService_PauseCluster
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters/{clusterId}:pauseCluster",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 4
  - operation_id: ClusterService_ResumeCluster
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters/{clusterId}:resumeCluster",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 5
  - operation_id: ClusterService_ResetRootPassword
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters/{clusterId}:resetRootPassword",
        "headers": {},
        "query_params": {},
        "body": {
          "rootPassword": "NewPassword123!"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 6
  - operation_id: ClusterService_UpdateLogRedactionPolicy
    request_type: http
    request: |-
      {
        "method": "PATCH",
        "path": "/clusters/{clusterId}/logRedactionPolicy",
        "headers": {},
        "query_params": {},
        "body": {
          "redactLog": false
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 7
  - operation_id: TidbNodeGroupService_CreateTidbNodeGroup
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters/{clusterId}/tidbNodeGroups",
        "headers": {},
        "query_params": {},
        "body": {
          "displayName": "test-tidb-node-group",
          "nodeCount": 1
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 8
  - operation_id: TidbNodeGroupService_DeleteTidbNodeGroup
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1",
          "tidbNodeGroupId": "nodegroup_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 9
  - operation_id: TidbNodeGroupService_UpdateTidbNodeGroup
    request_type: http
    request: |-
      {
        "method": "PATCH",
        "path": "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}",
        "headers": {},
        "query_params": {},
        "body": {
          "displayName": "updated-tidb-node-group",
          "nodeCount": 2
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1",
          "tidbNodeGroupId": "nodegroup_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 10
  - operation_id: TidbNodeGroupService_UpdatePublicEndpointSetting
    request_type: http
    request: |-
      {
        "method": "PATCH",
        "path": "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/publicEndpointSetting",
        "headers": {},
        "query_params": {},
        "body": {
          "enabled": true,
          "ipAccessList": [
            {
              "cidrNotation": "0.0.0.0/0",
              "description": "Allow all access"
            }
          ]
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1",
          "tidbNodeGroupId": "nodegroup_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 11
  - operation_id: NetworkContainerService_CreateNetworkContainer
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/networkContainers",
        "headers": {},
        "query_params": {},
        "body": {
          "regionId": "{regionId}",
          "labels": {
            "tidb.cloud/project": "{project_1}"
          }
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "body_params": {
          "project_1": "project_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 12
  - operation_id: NetworkContainerService_DeleteNetworkContainer
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/networkContainers/{networkContainerId}",
        "headers": {},
        "query_params": {},
        "path_params": {
          "networkContainerId": "network_container_1"
        },
        "body": {},
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 13
  - operation_id: NetworkContainerService_CreateVpcPeering
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/vpcPeerings",
        "headers": {},
        "query_params": {},
        "body": {
          "tidbCloudRegionId": "aws-us-west-2",
          "customerRegionId": "aws-us-west-2",
          "customerAccountId": "024848481520",
          "customerVpcId": "vpc-0393f150b4eb1a955",
          "customerVpcCidr": "10.0.0.0/16",
          "labels":{
            "tidb.cloud/project":"{projectId}"
          }
        },
        "body_params": {
          "projectId": "project_id"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 14
  - operation_id: NetworkContainerService_DeleteVpcPeering
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/vpcPeerings/{vpcPeeringId}",
        "headers": {},
        "query_params": {},
        "body": {},
        "path_params": {
          "vpcPeeringId": "vpcpeering_1"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 15
  - operation_id: DatabaseAuditLogService_CreateAuditLogConfig
    request_type: http
    request: |-
      {
        "method": "PATCH",
        "path": "/clusters/{clusterId}/auditLogConfig",
        "headers": {},
        "query_params": {},
        "body": {
          "enabled": true,
          "bucketUri": "s3://test-audit-bucket",
          "bucketRegionId": "aws-us-west-2"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 16
  - operation_id: DatabaseAuditLogService_UpdateAuditLogConfig
    request_type: http
    request: |-
      {
        "method": "PATCH",
        "path": "/clusters/{clusterId}/auditLogConfig",
        "headers": {},
        "query_params": {},
        "body": {
          "enabled": true,
          "bucketUri": "s3://test-audit-bucket",
          "bucketRegionId": "aws-us-west-2"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 17
  - operation_id: DatabaseAuditLogService_CreateAuditLogFilterRule
    request_type: http
    request: |-
      {
        "method": "POST",
        "path": "/clusters/{clusterId}/auditLogFilterRules",
        "headers": {},
        "query_params": {},
        "body": {
          "userExpr": "test_user",
          "dbExpr": "test_db",
          "tableExpr": "test_table",
          "accessTypeList": [
            "SELECT"
          ]
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 18
  - operation_id: DatabaseAuditLogService_DeleteAuditLogFilterRule
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/clusters/{clusterId}/auditLogFilterRules/123",
        "headers": {},
        "query_params": {},
        "body": {},
        "auth": {
          "auth_type": "digest",
          "auth_role": "target_apikey"
        },
        "path_params": {
          "clusterId": "cluster_1"
        }
      }
    expect: |-
      {
        "status_code": 403,
        "cel": ""
      }
    save: null
    description: ""
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 19
  - operation_id: ClusterService_DeleteCluster
    order: 20
    case_type: typical_positive
    request_type: http
    request: |-
      {
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        },
        "method": "DELETE",
        "path": "/clusters/{clusterId}",
        "path_params": {
          "clusterId": "cluster_1"
        },
        "query_params": {},
        "headers": {},
        "body": {}
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    description: Cleanup step for TiDB Cloud cluster with no parent dependency.
    max_retries: 0
    delay_after: 0
    step_type: generated
    name: Delete TiDB Cloud Cluster
    save: null
    continue_on_unexpected: false
    stage: execute
    meta: "{}"
  - operation_id: NetworkContainerService_DeleteVpcPeering
    request_type: http
    request: |-
      {
        "method": "DELETE",
        "path": "/vpcPeerings/{vpcPeeringId}",
        "headers": {},
        "query_params": {},
        "body": {},
        "path_params": {
          "vpcPeeringId": "vpcpeering_1"
        },
        "auth": {
          "auth_type": "digest",
          "auth_role": "resource_apikey"
        }
      }
    expect: |-
      {
        "status_code": 200,
        "cel": ""
      }
    save: null
    description: Cleanup step for TiDB Cloud vpcpeering with no parent dependency.
    max_retries: 0
    delay_after: 0
    name: ""
    continue_on_unexpected: false
    stage: ""
    meta: "{}"
    generation_id: ""
    order: 21
