""" Code is generated by ucloud-model, DO NOT EDIT IT. """

import pytest
import logging

from ucloud.core import exc
from ucloud.testing import env, funcs, op, utest

logger = logging.getLogger(__name__)


scenario = utest.Scenario(489)


@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason())
def test_set_489(client: utest.Client, variables: dict):
    scenario.initial(variables)

    scenario.variables["Region"] = "cn-bj2"
    scenario.variables["Zone"] = "cn-bj2-02"
    scenario.variables["DBTypeId"] = "mysql-5.6"
    scenario.variables["InstanceMode"] = "HA"
    scenario.variables["InstanceType"] = "SATA_SSD"
    scenario.variables["Port"] = 3306
    scenario.variables["MemoryLimit"] = 1000
    scenario.variables["DiskSpace"] = 20
    scenario.variables["DBName"] = "auto_hassd_"
    scenario.variables["BackupName"] = "handbf_test_02"
    scenario.variables["UseSSD"] = True

    scenario.run(client)


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DescribeUDBType",
)
def describe_udb_type_00(client: utest.Client, variables: dict):
    d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")}

    try:
        resp = client.udb().describe_udb_type(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DescribeUDBParamGroup",
)
def describe_udb_param_group_01(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Offset": 0,
        "Limit": 100,
    }

    try:
        resp = client.udb().describe_udb_param_group(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["DataSet_paramGroup"] = utest.value_at_path(resp, "DataSet")
    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DescribeUDBInstancePrice",
)
def describe_udb_instance_price_02(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "MemoryLimit": variables.get("MemoryLimit"),
        "DiskSpace": variables.get("DiskSpace"),
        "DBTypeId": variables.get("DBTypeId"),
        "Count": 1,
    }

    try:
        resp = client.udb().describe_udb_instance_price(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CheckUDBInstanceAllowance",
)
def check_udb_instance_allowance_03(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UseSSD": variables.get("UseSSD"),
        "Region": variables.get("Region"),
        "MemoryLimit": variables.get("MemoryLimit"),
        "DiskSpace": variables.get("DiskSpace"),
        "Count": 1,
        "ClassType": "SQL",
    }

    try:
        resp = client.invoke("CheckUDBInstanceAllowance", d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=1,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CreateUDBInstance",
)
def create_udb_instance_04(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Quantity": 0,
        "Port": variables.get("Port"),
        "ParamGroupId": funcs.search_value(
            variables.get("DataSet_paramGroup"),
            "DBTypeId",
            variables.get("DBTypeId"),
            "GroupId",
        ),
        "Name": funcs.concat(
            variables.get("DBName"), variables.get("DBTypeId")
        ),
        "MemoryLimit": variables.get("MemoryLimit"),
        "InstanceType": variables.get("InstanceType"),
        "InstanceMode": variables.get("InstanceMode"),
        "DiskSpace": variables.get("DiskSpace"),
        "DBTypeId": variables.get("DBTypeId"),
        "ChargeType": "Month",
        "AdminPassword": "guanliyuanmima",
    }

    try:
        resp = client.udb().create_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["DBId"] = utest.value_at_path(resp, "DBId")
    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=2,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        (
            "str_eq",
            "DataSet.0.Name",
            funcs.concat(variables.get("DBName"), variables.get("DBTypeId")),
        ),
        ("str_eq", "DataSet.0.DBTypeId", variables.get("DBTypeId")),
    ],
    action="DescribeUDBInstance",
)
def describe_udb_instance_05(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Offset": 0,
        "Limit": 100,
        "DBId": variables.get("DBId"),
        "ClassType": "sql",
    }

    try:
        resp = client.udb().describe_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=50,
    retry_interval=10,
    startup_delay=30,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "State", "Running"),
    ],
    action="DescribeUDBInstanceState",
)
def describe_udb_instance_state_06(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().describe_udb_instance_state(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=2,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="UpdateUDBInstanceBackupStrategy",
)
def update_udb_instance_backup_strategy_07(
    client: utest.Client, variables: dict
):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
        "BackupTime": 13,
        "BackupDate": 1111110,
    }

    try:
        resp = client.udb().update_udb_instance_backup_strategy(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=1,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="EditUDBBackupBlacklist",
)
def edit_udb_backup_blacklist_08(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
        "Blacklist": "test.%",
    }

    try:
        resp = client.udb().edit_udb_backup_blacklist(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=20,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Blacklist", "test.%"),
    ],
    action="DescribeUDBBackupBlacklist",
)
def describe_udb_backup_blacklist_09(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().describe_udb_backup_blacklist(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=2,
    retry_interval=1,
    startup_delay=15,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="BackupUDBInstance",
)
def backup_udb_instance_10(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UseBlacklist": True,
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
        "BackupName": variables.get("BackupName"),
    }

    try:
        resp = client.udb().backup_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=50,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "DataSet.0.State", "Success"),
    ],
    action="DescribeUDBBackup",
)
def describe_udb_backup_11(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Offset": 0,
        "Limit": 100,
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().describe_udb_backup(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["BackupId"] = utest.value_at_path(resp, "DataSet.0.BackupId")
    return resp


@scenario.step(
    max_retries=20,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "State", "Success"),
        ("ne", "BackupSize", 0),
        ("ne", "BackupEndTime", 0),
    ],
    action="DescribeUDBInstanceBackupState",
)
def describe_udb_instance_backup_state_12(
    client: utest.Client, variables: dict
):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "BackupId": variables.get("BackupId"),
    }

    try:
        resp = client.udb().describe_udb_instance_backup_state(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=1,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CheckUDBInstanceAllowance",
)
def check_udb_instance_allowance_13(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UseSSD": variables.get("UseSSD"),
        "Region": variables.get("Region"),
        "MemoryLimit": variables.get("MemoryLimit"),
        "DiskSpace": variables.get("DiskSpace"),
        "Count": 1,
        "ClassType": "SQL",
    }

    try:
        resp = client.invoke("CheckUDBInstanceAllowance", d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=1,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("contains", "BackupPath", "http://"),
    ],
    action="DescribeUDBInstanceBackupURL",
)
def describe_udb_instance_backup_url_14(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
        "BackupId": variables.get("BackupId"),
    }

    try:
        resp = client.udb().describe_udb_instance_backup_url(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CheckUDBInstanceAllowance",
)
def check_udb_instance_allowance_15(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UseSSD": variables.get("UseSSD"),
        "Region": variables.get("Region"),
        "MemoryLimit": variables.get("MemoryLimit"),
        "DiskSpace": variables.get("DiskSpace"),
        "Count": 1,
        "ClassType": "SQL",
    }

    try:
        resp = client.invoke("CheckUDBInstanceAllowance", d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=1,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CreateUDBInstance",
)
def create_udb_instance_16(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Quantity": 0,
        "Port": 3306,
        "ParamGroupId": funcs.search_value(
            variables.get("DataSet_paramGroup"),
            "DBTypeId",
            "mysql-5.6",
            "GroupId",
        ),
        "Name": "frombf-hassd-56",
        "MemoryLimit": variables.get("MemoryLimit"),
        "InstanceType": variables.get("InstanceType"),
        "InstanceMode": variables.get("InstanceMode"),
        "DiskSpace": variables.get("DiskSpace"),
        "DBTypeId": "mysql-5.6",
        "ChargeType": "Month",
        "BackupId": variables.get("BackupId"),
        "AdminPassword": "guanliyuanmima",
    }

    try:
        resp = client.udb().create_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["DBId_frombf_56"] = utest.value_at_path(resp, "DBId")
    return resp


@scenario.step(
    max_retries=100,
    retry_interval=3,
    startup_delay=0,
    fast_fail=True,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "State", "Running"),
    ],
    action="DescribeUDBInstanceState",
)
def describe_udb_instance_state_17(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId_frombf_56"),
    }

    try:
        resp = client.udb().describe_udb_instance_state(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=100,
    retry_interval=5,
    startup_delay=3,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "DescribeUDBInstanceResponse"),
        ("str_eq", "DataSet.0.State", "Running"),
    ],
    action="DescribeUDBInstance",
)
def describe_udb_instance_18(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Offset": 0,
        "Limit": 100,
        "DBId": variables.get("DBId_frombf_56"),
        "ClassType": "sql",
    }

    try:
        resp = client.udb().describe_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=2,
    retry_interval=1,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "StopUDBInstanceResponse"),
    ],
    action="StopUDBInstance",
)
def stop_udb_instance_19(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId_frombf_56"),
    }

    try:
        resp = client.udb().stop_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=20,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "DescribeUDBInstanceResponse"),
        ("str_eq", "DataSet.0.State", "Shutoff"),
    ],
    action="DescribeUDBInstance",
)
def describe_udb_instance_20(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId_frombf_56"),
    }

    try:
        resp = client.udb().describe_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=20,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("ne", "EarliestTime", 0),
    ],
    action="FetchUDBInstanceEarliestRecoverTime",
)
def fetch_udb_instance_earliest_recover_time_21(
    client: utest.Client, variables: dict
):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().fetch_udb_instance_earliest_recover_time(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["EarliestTime"] = utest.value_at_path(resp, "EarliestTime")
    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CheckUDBInstanceAllowance",
)
def check_udb_instance_allowance_22(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UseSSD": variables.get("UseSSD"),
        "Region": variables.get("Region"),
        "MemoryLimit": variables.get("MemoryLimit"),
        "DiskSpace": variables.get("DiskSpace"),
        "Count": 1,
        "ClassType": "sql",
    }

    try:
        resp = client.invoke("CheckUDBInstanceAllowance", d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=5,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="CreateUDBInstanceByRecovery",
)
def create_udb_instance_by_recovery_23(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "SrcDBId": variables.get("DBId"),
        "Region": variables.get("Region"),
        "RecoveryTime": variables.get("EarliestTime"),
        "Quantity": 0,
        "Name": "56-hd-frombf",
        "ChargeType": "Month",
    }

    try:
        resp = client.udb().create_udb_instance_by_recovery(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["HD_DBId"] = utest.value_at_path(resp, "DBId")
    return resp


@scenario.step(
    max_retries=100,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "State", "Running"),
    ],
    action="DescribeUDBInstanceState",
)
def describe_udb_instance_state_24(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("HD_DBId"),
    }

    try:
        resp = client.udb().describe_udb_instance_state(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=100,
    retry_interval=5,
    startup_delay=3,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "DescribeUDBInstanceResponse"),
        ("str_eq", "DataSet.0.State", "Running"),
    ],
    action="DescribeUDBInstance",
)
def describe_udb_instance_25(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "Offset": 0,
        "Limit": 100,
        "DBId": variables.get("HD_DBId"),
        "ClassType": "sql",
    }

    try:
        resp = client.udb().describe_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "StopUDBInstanceResponse"),
    ],
    action="StopUDBInstance",
)
def stop_udb_instance_26(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("HD_DBId"),
    }

    try:
        resp = client.udb().stop_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=20,
    retry_interval=3,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "DescribeUDBInstanceResponse"),
        ("str_eq", "DataSet.0.State", "Shutoff"),
    ],
    action="DescribeUDBInstance",
)
def describe_udb_instance_27(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("HD_DBId"),
    }

    try:
        resp = client.udb().describe_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=0,
    retry_interval=0,
    startup_delay=10,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DeleteUDBBackup",
)
def delete_udb_backup_28(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "BackupId": variables.get("BackupId"),
    }

    try:
        resp = client.udb().delete_udb_backup(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=0,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "StopUDBInstanceResponse"),
    ],
    action="StopUDBInstance",
)
def stop_udb_instance_29(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().stop_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=20,
    retry_interval=3,
    startup_delay=30,
    fast_fail=False,
    validators=lambda variables: [
        ("str_eq", "RetCode", 0),
        ("str_eq", "Action", "DescribeUDBInstanceResponse"),
        ("str_eq", "DataSet.0.State", "Shutoff"),
    ],
    action="DescribeUDBInstance",
)
def describe_udb_instance_30(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().describe_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=2,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DeleteUDBInstance",
)
def delete_udb_instance_31(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId_frombf_56"),
    }

    try:
        resp = client.udb().delete_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=2,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DeleteUDBInstance",
)
def delete_udb_instance_32(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("HD_DBId"),
    }

    try:
        resp = client.udb().delete_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp


@scenario.step(
    max_retries=3,
    retry_interval=1,
    startup_delay=2,
    fast_fail=False,
    validators=lambda variables: [("str_eq", "RetCode", 0)],
    action="DeleteUDBInstance",
)
def delete_udb_instance_33(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "DBId": variables.get("DBId"),
    }

    try:
        resp = client.udb().delete_udb_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp
