From da9cb903fcf8373b007b2ed3f725aa2572b08cae Mon Sep 17 00:00:00 2001 From: UCloud Date: Thu, 21 May 2020 21:46:08 +0800 Subject: [PATCH] auto release for 0.9.0 (#16) FEATURES: - Add `ucloudstack` product ENHANCEMENTS: - Add `deprecated` decorator --- docs/services.rst | 20 +- tests/test_acceptance/conftest.py | 18 +- tests/test_acceptance/test_scenario_5183.py | 843 ++++++ tests/test_unit/test_core/test_deco.py | 13 + ucloud/client.py | 7 + ucloud/core/utils/compat.py | 2 +- ucloud/core/utils/deco.py | 8 +- ucloud/helpers/utils.py | 6 +- ucloud/services/ucloudstack/__init__.py | 1 + ucloud/services/ucloudstack/client.py | 2467 ++++++++++++++++ .../services/ucloudstack/schemas/__init__.py | 1 + ucloud/services/ucloudstack/schemas/apis.py | 2631 +++++++++++++++++ ucloud/services/ucloudstack/schemas/models.py | 468 +++ ucloud/version.py | 2 +- 14 files changed, 6470 insertions(+), 17 deletions(-) create mode 100644 tests/test_acceptance/test_scenario_5183.py create mode 100644 tests/test_unit/test_core/test_deco.py create mode 100644 ucloud/services/ucloudstack/__init__.py create mode 100644 ucloud/services/ucloudstack/client.py create mode 100644 ucloud/services/ucloudstack/schemas/__init__.py create mode 100644 ucloud/services/ucloudstack/schemas/apis.py create mode 100644 ucloud/services/ucloudstack/schemas/models.py diff --git a/docs/services.rst b/docs/services.rst index 9da0fce..f083e74 100644 --- a/docs/services.rst +++ b/docs/services.rst @@ -79,6 +79,12 @@ USMS .. autoclass:: ucloud.services.usms.client.USMSClient :members: +VPC +--- + +.. autoclass:: ucloud.services.vpc.client.VPCClient + :members: + IPSecVPN @@ -88,6 +94,13 @@ IPSecVPN :members: +UCloudStack +----------- + +.. autoclass:: ucloud.services.ucloudstack.client.UCloudStackClient + :members: + + UFS --- @@ -101,10 +114,3 @@ UHub .. autoclass:: ucloud.services.uhub.client.UHubClient :members: - -VPC ---- - -.. autoclass:: ucloud.services.vpc.client.VPCClient - :members: - diff --git a/tests/test_acceptance/conftest.py b/tests/test_acceptance/conftest.py index ea2af57..662029b 100644 --- a/tests/test_acceptance/conftest.py +++ b/tests/test_acceptance/conftest.py @@ -7,8 +7,22 @@ from ucloud.client import Client -@pytest.fixture(scope="session", autouse=True, name="client") -def client_factory(): +@pytest.fixture(scope="session", autouse=True) +def ustack_client(): + return Client( + { + "base_url": "http://192.168.179.2/api", + "region": "cn", + "public_key": os.getenv("UCLOUDSTACK_PUBLIC_KEY"), + "private_key": os.getenv("UCLOUDSTACK_PRIVATE_KEY"), + "max_retries": 10, + "timeout": 60, + } + ) + + +@pytest.fixture(scope="session", autouse=True) +def client(): return Client( { "region": "cn-bj2", diff --git a/tests/test_acceptance/test_scenario_5183.py b/tests/test_acceptance/test_scenario_5183.py new file mode 100644 index 0000000..10f4aed --- /dev/null +++ b/tests/test_acceptance/test_scenario_5183.py @@ -0,0 +1,843 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +import pytest +from ucloud.core import exc +from ucloud.testing import funcs, op, env, utest +from ucloud.testing.driver import spec + +scenario = spec.scenario(5183, "UCloudStack_02", owners=["lisa.wang@ucloud.cn"]) + + +@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason()) +def test_scenario_5183(ustack_client, variables): + scenario.store.update(variables) + scenario.store["Region"] = "cn" + scenario.store["Zone"] = "zone-01" + scenario.store["BeginTime"] = funcs.get_timestamp(10) - 3600 + scenario.store["EndTime"] = funcs.get_timestamp(10) + describe_vpc_00(ustack_client) + describe_security_group_01(ustack_client) + describe_storage_type_02(ustack_client) + describe_vm_type_03(ustack_client) + describe_image_04(ustack_client) + describe_image_05(ustack_client) + create_vm_instance_06(ustack_client) + describe_vm_instance_07(ustack_client) + allocate_eip_08(ustack_client) + create_lb_09(ustack_client) + describe_lb_10(ustack_client) + create_vs_11(ustack_client) + update_vs_12(ustack_client) + create_rs_13(ustack_client) + update_rs_14(ustack_client) + describe_rs_15(ustack_client) + disable_rs_16(ustack_client) + describe_rs_17(ustack_client) + enable_rs_18(ustack_client) + describe_rs_19(ustack_client) + create_vs_policy_20(ustack_client) + describe_vs_policy_21(ustack_client) + update_vs_policy_22(ustack_client) + delete_vs_policy_23(ustack_client) + delete_rs_24(ustack_client) + poweroff_vm_instance_25(ustack_client) + delete_vm_instance_26(ustack_client) + delete_lb_27(ustack_client) + + +@scenario.api( + title="查询VPC信息", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeVPCResponse"), + ], + action="DescribeVPC", +) +def describe_vpc_00(step, client): + variables = step.store + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} + try: + resp = client.ucloudstack().describe_vpc(d) + except exc.RetCodeException as e: + resp = e.json() + variables["VPCID"] = utest.value_at_path(resp, "Infos.0.VPCID") + variables["SubnetID"] = utest.value_at_path( + resp, "Infos.0.SubnetInfos.0.SubnetID" + ) + return resp + + +@scenario.api( + title="查询安全组信息", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeSecurityGroupResponse"), + ], + action="DescribeSecurityGroup", +) +def describe_security_group_01(step, client): + variables = step.store + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} + try: + resp = client.ucloudstack().describe_security_group(d) + except exc.RetCodeException as e: + resp = e.json() + variables["SGID"] = utest.value_at_path(resp, "Infos.0.SGID") + return resp + + +@scenario.api( + title="查询存储类型", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeStorageTypeResponse"), + ], + action="DescribeStorageType", +) +def describe_storage_type_02(step, client): + variables = step.store + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} + try: + resp = client.ucloudstack().describe_storage_type(d) + except exc.RetCodeException as e: + resp = e.json() + variables["StorageType"] = utest.value_at_path(resp, "Infos.0.StorageType") + return resp + + +@scenario.api( + title="查询主机机型", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeVMTypeResponse"), + ], + action="DescribeVMType", +) +def describe_vm_type_03(step, client): + variables = step.store + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} + try: + resp = client.ucloudstack().describe_vm_type(d) + except exc.RetCodeException as e: + resp = e.json() + variables["VMType"] = "ComputeSetBBBB" + return resp + + +@scenario.api( + title="获取镜像信息,包括默认镜像和自制镜像。", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeImageResponse"), + ], + action="DescribeImage", +) +def describe_image_04(step, client): + variables = step.store + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} + try: + resp = client.ucloudstack().describe_image(d) + except exc.RetCodeException as e: + resp = e.json() + variables["Infos"] = utest.value_at_path(resp, "Infos") + return resp + + +@scenario.api( + title="获取镜像信息,包括默认镜像和自制镜像。", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeImageResponse"), + ], + action="DescribeImage", +) +def describe_image_05(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "ImageIDs": [ + funcs.search_value( + variables.get("Infos"), "OSName", "CentOS 6.5 x86_64", "ImageID" + ) + ], + } + try: + resp = client.ucloudstack().describe_image(d) + except exc.RetCodeException as e: + resp = e.json() + variables["ImageID"] = utest.value_at_path(resp, "Infos.0.ImageID") + return resp + + +@scenario.api( + title="创建虚拟机", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "CreateVMInstanceResponse"), + ], + action="CreateVMInstance", +) +def create_vm_instance_06(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "WANSGID": variables.get("SGID"), + "VPCID": variables.get("VPCID"), + "VMType": variables.get("VMType"), + "SubnetID": variables.get("SubnetID"), + "Region": variables.get("Region"), + "Quantity": 1, + "Password": "Zhongshang_2018", + "Name": "host_test", + "Memory": 2048, + "ImageID": variables.get("ImageID"), + "DataDiskSpace": 10, + "DataDiskSetType": "StorageSetBBBB", + "ChargeType": "Month", + "CPU": 1, + "BootDiskSetType": "StorageSetBBBB", + } + try: + resp = client.ucloudstack().create_vm_instance(d) + except exc.RetCodeException as e: + resp = e.json() + variables["VMID"] = utest.value_at_path(resp, "VMID") + return resp + + +@scenario.api( + title="查询虚拟机", + max_retries=3, + retry_interval=1, + startup_delay=90, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeVMInstanceResponse"), + ("str_eq", "Infos.0.State", "Running"), + ], + action="DescribeVMInstance", +) +def describe_vm_instance_07(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VMIDs": [variables.get("VMID")], + "Region": variables.get("Region"), + } + try: + resp = client.ucloudstack().describe_vm_instance(d) + except exc.RetCodeException as e: + resp = e.json() + variables["InterfaceID"] = utest.value_at_path( + resp, "Infos.0.IPInfos.0.InterfaceID" + ) + variables["DiskID"] = utest.value_at_path( + resp, "Infos.0.DiskInfos.0.DiskID" + ) + return resp + + +@scenario.api( + title="申请外网IP", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "AllocateEIPResponse"), + ], + action="AllocateEIP", +) +def allocate_eip_08(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "OperatorName": "Bgp", + "Name": "test_eip", + "ChargeType": "Month", + "Bandwidth": 2, + } + try: + resp = client.ucloudstack().allocate_eip(d) + except exc.RetCodeException as e: + resp = e.json() + variables["EIPID"] = utest.value_at_path(resp, "EIPID") + return resp + + +@scenario.api( + title="创建负载均衡", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "CreateLBResponse"), + ], + action="CreateLB", +) +def create_lb_09(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VPCID": variables.get("VPCID"), + "VMType": variables.get("VMType"), + "SubnetID": variables.get("SubnetID"), + "SGID": variables.get("SGID"), + "Region": variables.get("Region"), + "Name": "lb_test1", + "LBType": "WAN", + "EIPID": variables.get("EIPID"), + "ChargeType": "Month", + } + try: + resp = client.ucloudstack().create_lb(d) + except exc.RetCodeException as e: + resp = e.json() + variables["LBID"] = utest.value_at_path(resp, "LBID") + return resp + + +@scenario.api( + title="获取负载均衡信息", + max_retries=3, + retry_interval=1, + startup_delay=60, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeLBResponse"), + ("str_eq", "Infos.0.LBStatus", "Running"), + ], + action="DescribeLB", +) +def describe_lb_10(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "LBIDs": [variables.get("LBID")], + } + try: + resp = client.ucloudstack().describe_lb(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="创建负载均衡VServer", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "CreateVSResponse"), + ], + action="CreateVS", +) +def create_vs_11(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Scheduler": "wrr", + "Region": variables.get("Region"), + "Protocol": "HTTP", + "Port": 123, + "LBID": variables.get("LBID"), + "HealthcheckType": "Port", + } + try: + resp = client.ucloudstack().create_vs(d) + except exc.RetCodeException as e: + resp = e.json() + variables["VSID"] = utest.value_at_path(resp, "VSID") + return resp + + +@scenario.api( + title="修改负载均衡VServer", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "UpdateVSResponse"), + ], + action="UpdateVS", +) +def update_vs_12(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Scheduler": "ip_hash", + "Region": variables.get("Region"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().update_vs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="添加服务节点", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "CreateRSResponse"), + ], + action="CreateRS", +) +def create_rs_13(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Weight": 1, + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "Port": 112, + "LBID": variables.get("LBID"), + "BindResourceID": variables.get("VMID"), + } + try: + resp = client.ucloudstack().create_rs(d) + except exc.RetCodeException as e: + resp = e.json() + variables["RSID"] = utest.value_at_path(resp, "RSID") + return resp + + +@scenario.api( + title="修改服务节点", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "UpdateRSResponse"), + ], + action="UpdateRS", +) +def update_rs_14(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Weight": 55, + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSID": variables.get("RSID"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().update_rs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="获取服务节点信息", + max_retries=3, + retry_interval=1, + startup_delay=30, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeRSResponse"), + ], + action="DescribeRS", +) +def describe_rs_15(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().describe_rs(d) + except exc.RetCodeException as e: + resp = e.json() + variables["RSID_1"] = utest.value_at_path(resp, "Infos.0.RSID") + return resp + + +@scenario.api( + title="禁用服务节点", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DisableRSResponse"), + ], + action="DisableRS", +) +def disable_rs_16(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSID": variables.get("RSID"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().disable_rs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="获取服务节点信息", + max_retries=3, + retry_interval=1, + startup_delay=30, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeRSResponse"), + ("str_eq", "Infos.0.RSMode", "Disable"), + ], + action="DescribeRS", +) +def describe_rs_17(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSIDs": [variables.get("RSID")], + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().describe_rs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="启用服务节点", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "EnableRSResponse"), + ], + action="EnableRS", +) +def enable_rs_18(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSID": variables.get("RSID"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().enable_rs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="获取服务节点信息", + max_retries=3, + retry_interval=1, + startup_delay=30, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeRSResponse"), + ("str_eq", "Infos.0.RSMode", "Enable"), + ], + action="DescribeRS", +) +def describe_rs_19(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSIDs": [variables.get("RSID")], + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().describe_rs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="创建内容转发规则", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "CreateVSPolicyResponse"), + ], + action="CreateVSPolicy", +) +def create_vs_policy_20(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSIDs": [variables.get("RSID")], + "Path": "/test12321", + "LBID": variables.get("LBID"), + "Domain": "test.com11", + } + try: + resp = client.ucloudstack().create_vs_policy(d) + except exc.RetCodeException as e: + resp = e.json() + variables["PolicyID"] = utest.value_at_path(resp, "PolicyID") + return resp + + +@scenario.api( + title="获取内容转发规则信息", + max_retries=3, + retry_interval=1, + startup_delay=20, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeVSPolicyResponse"), + ], + action="DescribeVSPolicy", +) +def describe_vs_policy_21(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "PolicyIDs": [variables.get("PolicyID")], + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().describe_vs_policy(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="更新内容转发规则", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "UpdateVSPolicyResponse"), + ], + action="UpdateVSPolicy", +) +def update_vs_policy_22(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "PolicyID": variables.get("PolicyID"), + "Path": "/testnew", + "LBID": variables.get("LBID"), + "Domain": "test.comnew", + } + try: + resp = client.ucloudstack().update_vs_policy(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="删除内容转发规则", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteVSPolicyResponse"), + ], + action="DeleteVSPolicy", +) +def delete_vs_policy_23(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "PolicyID": variables.get("PolicyID"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().delete_vs_policy(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="移除服务节点", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteRSResponse"), + ], + action="DeleteRS", +) +def delete_rs_24(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "RSID": variables.get("RSID"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().delete_rs(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="断电虚拟机", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "PoweroffVMInstanceResponse"), + ], + action="PoweroffVMInstance", +) +def poweroff_vm_instance_25(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VMID": variables.get("VMID"), + "Region": variables.get("Region"), + } + try: + resp = client.ucloudstack().poweroff_vm_instance(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="删除虚拟机", + max_retries=3, + retry_interval=1, + startup_delay=60, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteVMInstanceResponse"), + ], + action="DeleteVMInstance", +) +def delete_vm_instance_26(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VMID": variables.get("VMID"), + "Region": variables.get("Region"), + } + try: + resp = client.ucloudstack().delete_vm_instance(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.api( + title="删除负载均衡", + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteLBResponse"), + ], + action="DeleteLB", +) +def delete_lb_27(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "LBID": variables.get("LBID"), + } + try: + resp = client.ucloudstack().delete_lb(d) + except exc.RetCodeException as e: + resp = e.json() + return resp diff --git a/tests/test_unit/test_core/test_deco.py b/tests/test_unit/test_core/test_deco.py new file mode 100644 index 0000000..2ecc937 --- /dev/null +++ b/tests/test_unit/test_core/test_deco.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from ucloud.core.utils.deco import deprecated + + +@deprecated(instead_of="bar") +def foo(): + pass + + +def test_deprecated_deco(caplog): + foo() + assert "deprecated" in caplog.text diff --git a/ucloud/client.py b/ucloud/client.py index d5fcd86..a9e9187 100644 --- a/ucloud/client.py +++ b/ucloud/client.py @@ -107,6 +107,13 @@ def ipsecvpn(self): self._config, self.transport, self.middleware, self.logger ) + def ucloudstack(self): + from ucloud.services.ucloudstack.client import UCloudStackClient + + return UCloudStackClient( + self._config, self.transport, self.middleware, self.logger + ) + def ufs(self): from ucloud.services.ufs.client import UFSClient diff --git a/ucloud/core/utils/compat.py b/ucloud/core/utils/compat.py index 443799e..6906da3 100644 --- a/ucloud/core/utils/compat.py +++ b/ucloud/core/utils/compat.py @@ -10,6 +10,6 @@ else: import types - str = unicode # noqa: F821 + str = unicode # noqa: F821 # noqa: F821 string_types = types.StringTypes from collections import Callable diff --git a/ucloud/core/utils/deco.py b/ucloud/core/utils/deco.py index 6503db6..23bded4 100644 --- a/ucloud/core/utils/deco.py +++ b/ucloud/core/utils/deco.py @@ -18,12 +18,14 @@ def deprecated(instead_of="", message=""): def deco(fn): @functools.wraps(fn) def wrapper(*args, **kwargs): - msg = ["this function/method {} is deprecated"] + msg = [ + "this function/method `{}` is deprecated".format(fn.__name__) + ] instead_of and msg.append( - "please use {} instead".format(fn.__name__, instead_of) + "please use `{}` instead".format(instead_of) ) message and msg.append(message) - logger.warning(",".join(msg)) + logger.warning(", ".join(msg)) return fn(*args, **kwargs) return wrapper diff --git a/ucloud/helpers/utils.py b/ucloud/helpers/utils.py index 337e5e6..f8aeb68 100644 --- a/ucloud/helpers/utils.py +++ b/ucloud/helpers/utils.py @@ -62,10 +62,10 @@ def gen_string(letters, length): return "".join([random.choice(letters) for i in range(length)]) -def first(l): - if len(l) == 0: +def first(arr): + if len(arr) == 0: return None - return l[0] + return arr[0] def b64encode(s): diff --git a/ucloud/services/ucloudstack/__init__.py b/ucloud/services/ucloudstack/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/ucloud/services/ucloudstack/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/ucloud/services/ucloudstack/client.py b/ucloud/services/ucloudstack/client.py new file mode 100644 index 0000000..8ac117b --- /dev/null +++ b/ucloud/services/ucloudstack/client.py @@ -0,0 +1,2467 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +from ucloud.core.client import Client +from ucloud.services.ucloudstack.schemas import apis + + +class UCloudStackClient(Client): + def __init__(self, config, transport=None, middleware=None, logger=None): + super(UCloudStackClient, self).__init__( + config, transport, middleware, logger + ) + + def allocate_eip(self, req=None, **kwargs): + """ AllocateEIP - 申请外网IP + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **Bandwidth** (int) - (Required) 带宽,默认值1,默认范围1~100 + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **Name** (str) - (Required) 名称 + - **OperatorName** (str) - (Required) 线路。目前支持Bgp + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **EIPID** (str) - 申请的EIP的ID + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.AllocateEIPRequestSchema().dumps(d) + resp = self.invoke("AllocateEIP", d, **kwargs) + return apis.AllocateEIPResponseSchema().loads(resp) + + def attach_disk(self, req=None, **kwargs): + """ AttachDisk - 绑定硬盘 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **DiskID** (str) - (Required) 硬盘ID + - **ResourceID** (str) - (Required) 绑定的资源ID + - **ResourceType** (str) - (Required) 绑定的资源类型,枚举值:VM,标识虚拟机 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.AttachDiskRequestSchema().dumps(d) + resp = self.invoke("AttachDisk", d, **kwargs) + return apis.AttachDiskResponseSchema().loads(resp) + + def bind_alarm_template(self, req=None, **kwargs): + """ BindAlarmTemplate - 绑定告警模板 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **AlarmTemplateID** (str) - (Required) 告警模板ID + - **ResourceIDs** (list) - (Required) 【数组】告警模板ID。调用方式举例:ResourceIDs.0=“one-id”、ResourceIDs.1=“two-id”。 + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机, LB:负载均衡, NATGW:nat网关;EIP:弹性IP + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.BindAlarmTemplateRequestSchema().dumps(d) + resp = self.invoke("BindAlarmTemplate", d, **kwargs) + return apis.BindAlarmTemplateResponseSchema().loads(resp) + + def bind_eip(self, req=None, **kwargs): + """ BindEIP - 绑定UCoudStack外网IP + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国;中国 + - **EIPID** (str) - (Required) 外网IP的ID + - **ResourceID** (str) - (Required) 资源ID + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机, LB:负载均衡, NATGW:nat网关 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.BindEIPRequestSchema().dumps(d) + resp = self.invoke("BindEIP", d, **kwargs) + return apis.BindEIPResponseSchema().loads(resp) + + def bind_physical_ip(self, req=None, **kwargs): + """ BindPhysicalIP - 绑定物理 IP ,被绑定的资源必须处于运行中或有效状态。 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **PhysicalIPID** (str) - (Required) 物理IP的ID + - **ResourceID** (str) - (Required) 资源ID + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机 + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.BindPhysicalIPRequestSchema().dumps(d) + resp = self.invoke("BindPhysicalIP", d, **kwargs) + return apis.BindPhysicalIPResponseSchema().loads(resp) + + def bind_security_group(self, req=None, **kwargs): + """ BindSecurityGroup - 绑定安全组 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **ResourceID** (str) - (Required) 绑定的资源ID。调用方式举例:ResourceID=“one-id”。 + - **SGID** (str) - (Required) 安全组ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **NICID** (str) - 网卡ID + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.BindSecurityGroupRequestSchema().dumps(d) + resp = self.invoke("BindSecurityGroup", d, **kwargs) + return apis.BindSecurityGroupResponseSchema().loads(resp) + + def clone_disk(self, req=None, **kwargs): + """ CloneDisk - 克隆硬盘 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **Name** (str) - (Required) 名称 + - **SrcID** (str) - (Required) 源硬盘ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **DiskID** (str) - 克隆出的硬盘ID + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CloneDiskRequestSchema().dumps(d) + resp = self.invoke("CloneDisk", d, **kwargs) + return apis.CloneDiskResponseSchema().loads(resp) + + def create_custom_image(self, req=None, **kwargs): + """ CreateCustomImage - 创建自制镜像 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ImageName** (str) - (Required) 镜像名称 + - **VMID** (str) - (Required) 虚拟机ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **ImageDescription** (str) - 镜像描述。 + + **Response** + + - **ImageID** (str) - 创建的自制镜像ID + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateCustomImageRequestSchema().dumps(d) + resp = self.invoke("CreateCustomImage", d, **kwargs) + return apis.CreateCustomImageResponseSchema().loads(resp) + + def create_disk(self, req=None, **kwargs): + """ CreateDisk - 创建硬盘 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **DiskSpace** (int) - (Required) 磁盘大小 + - **Name** (str) - (Required) 磁盘名称 + - **SetType** (str) - (Required) 磁盘类型。例如:Normal,SSD + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **DiskID** (str) - 创建的磁盘ID + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateDiskRequestSchema().dumps(d) + resp = self.invoke("CreateDisk", d, **kwargs) + return apis.CreateDiskResponseSchema().loads(resp) + + def create_lb(self, req=None, **kwargs): + """ CreateLB - 创建负载均衡 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **LBType** (str) - (Required) 枚举值。LAN:内网,WAN:外网 + - **Name** (str) - (Required) 名称。 + - **SubnetID** (str) - (Required) LB 实例所在的子网 ID 。 + - **VMType** (str) - (Required) 运行负载均衡实例的主机机型。枚举值:如 Normal ,表示普通机型; SSD,表示 SSD 机型。(机型由平台管理员修改和指定,可参考获取主机机型接口) + - **VPCID** (str) - (Required) LB实例所在的 VPC ID 。 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **EIPID** (str) - 外网IP的ID,创建外网LB时为必需 + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + - **Remark** (str) - 描述。 + - **SGID** (str) - 安全组ID,创建外网LB时为必需 + + **Response** + + - **LBID** (str) - 返回创建的负载均衡ID + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateLBRequestSchema().dumps(d) + resp = self.invoke("CreateLB", d, **kwargs) + return apis.CreateLBResponseSchema().loads(resp) + + def create_natgw(self, req=None, **kwargs): + """ CreateNATGW - 创建NAT网关 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **EIPID** (str) - (Required) 外网IP的ID + - **Name** (str) - (Required) 名称。 + - **SGID** (str) - (Required) 安全组ID + - **SubnetID** (str) - (Required) NAT网关实例所在的子网 ID + - **VMType** (str) - (Required) 运行NAT网关实例的主机机型。枚举值:如 Normal ,表示普通机型; SSD,表示 SSD 机型。(机型由平台管理员修改和指定,可参考获取主机机型接口) + - **VPCID** (str) - (Required) NAT网关实例所在的 VPC ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + - **Remark** (str) - 描述 + + **Response** + + - **Message** (str) - 返回信息描述。 + - **NATGWID** (str) - 返回创建的NAT网关ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateNATGWRequestSchema().dumps(d) + resp = self.invoke("CreateNATGW", d, **kwargs) + return apis.CreateNATGWResponseSchema().loads(resp) + + def create_natgw_rule(self, req=None, **kwargs): + """ CreateNATGWRule - 添加NAT网关白名单 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **BindResourceID** (str) - (Required) 绑定的虚拟机资源ID + - **NATGWID** (str) - (Required) NAT网关ID + - **NATGWType** (str) - (Required) NAT的类型。枚举值:SNAT,DNAT + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + - **RuleID** (str) - 白名单ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateNATGWRuleRequestSchema().dumps(d) + resp = self.invoke("CreateNATGWRule", d, **kwargs) + return apis.CreateNATGWRuleResponseSchema().loads(resp) + + def create_physical_ip(self, req=None, **kwargs): + """ CreatePhysicalIP - 创建物理 IP ,需确保平台已配置物理 IP 线路相关信息及物理网络联通性。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **Name** (str) - (Required) 物理IP名称,限制字符长度30 + - **OperatorName** (str) - (Required) 物理IP线路 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Remark** (str) - 描述 + + **Response** + + - **Message** (str) - 返回信息描述 + - **PhysicalIPID** (str) - 返回创建的物理IP的ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreatePhysicalIPRequestSchema().dumps(d) + resp = self.invoke("CreatePhysicalIP", d, **kwargs) + return apis.CreatePhysicalIPResponseSchema().loads(resp) + + def create_rs(self, req=None, **kwargs): + """ CreateRS - 为负载均衡的 VServer 添加后端服务节点。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **BindResourceID** (str) - (Required) 服务节点的资源 ID ,仅支持添加与 LB 相同 VPC 的虚拟机资源 + - **LBID** (str) - (Required) 负载均衡ID + - **Port** (int) - (Required) 服务节点暴露的服务端口号 + - **VSID** (str) - (Required) VServer的ID + - **Weight** (int) - (Required) 服务节点的权重 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + - **RSID** (str) - 返回创建的RSID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateRSRequestSchema().dumps(d) + resp = self.invoke("CreateRS", d, **kwargs) + return apis.CreateRSResponseSchema().loads(resp) + + def create_security_group(self, req=None, **kwargs): + """ CreateSecurityGroup - 创建安全组 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Name** (str) - (Required) 名称; + - **Rule** (list) - (Required) 【数组】安全组规则。输入有效的规则,调用方式举例:Rule.0=“TCP|23|0.0.0.0/0|ACCEPT|HIGH|1”、Rule.1=“TCP|55|0.0.0.0/0|ACCEPT|HIGH|1” + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Remark** (str) - 描述; + + **Response** + + - **Message** (str) - 返回信息描述; + - **SGID** (str) - 创建的安全组ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateSecurityGroupRequestSchema().dumps(d) + resp = self.invoke("CreateSecurityGroup", d, **kwargs) + return apis.CreateSecurityGroupResponseSchema().loads(resp) + + def create_security_group_rule(self, req=None, **kwargs): + """ CreateSecurityGroupRule - 创建安全组规则 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Rules** (list) - (Required) 【数组】安全组规则。输入有效的规则,调用方式举例:Rule.0=“TCP|23|0.0.0.0/0|ACCEPT|HIGH|1”、Rule.1=“TCP|55|0.0.0.0/0|ACCEPT|HIGH|1” + - **SGID** (str) - (Required) 安全组ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述; + - **SGRuleID** (str) - 创建的安全组规则ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateSecurityGroupRuleRequestSchema().dumps(d) + resp = self.invoke("CreateSecurityGroupRule", d, **kwargs) + return apis.CreateSecurityGroupRuleResponseSchema().loads(resp) + + def create_snapshot(self, req=None, **kwargs): + """ CreateSnapshot - 创建硬盘快照 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **DiskID** (str) - (Required) 硬盘ID,输入“有效”状态的ID + - **Name** (str) - (Required) 快照名称,限制字符长度30 + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + - **Remark** (str) - 描述,限制字符长度100 + + **Response** + + - **Message** (str) - 返回信息描述 + - **SnapshotID** (str) - 创建的快照ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateSnapshotRequestSchema().dumps(d) + resp = self.invoke("CreateSnapshot", d, **kwargs) + return apis.CreateSnapshotResponseSchema().loads(resp) + + def create_subnet(self, req=None, **kwargs): + """ CreateSubnet - 创建子网 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Name** (str) - (Required) 名称; + - **Network** (str) - (Required) 网段。列如:10.0.0.0/16; + - **VPCID** (str) - (Required) 所属VPCID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Remark** (str) - 描述; + + **Response** + + - **Message** (str) - 返回信息描述; + - **SubnetID** (str) - 创建Subnet的ID; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateSubnetRequestSchema().dumps(d) + resp = self.invoke("CreateSubnet", d, **kwargs) + return apis.CreateSubnetResponseSchema().loads(resp) + + def create_user(self, req=None, **kwargs): + """ CreateUser - 管理员添加账号 + + **Request** + + - **PassWord** (str) - (Required) 账号密码。 + - **UserEmail** (str) - (Required) 账号邮箱。 + + **Response** + + - **Message** (str) - 返回信息描述。 + - **UserID** (int) - 账户ID + + """ + d = {} + req and d.update(req) + d = apis.CreateUserRequestSchema().dumps(d) + resp = self.invoke("CreateUser", d, **kwargs) + return apis.CreateUserResponseSchema().loads(resp) + + def create_vm_instance(self, req=None, **kwargs): + """ CreateVMInstance - 创建虚拟机 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **BootDiskSetType** (str) - (Required) 系统盘类型。枚举值:Normal,表示普通;SSD,表示SSD; + - **CPU** (int) - (Required) CPU个数,如1,2,4,8,16,32,64等。 + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **DataDiskSetType** (str) - (Required) 数据盘类型。枚举值:Normal,表示普通;SSD,表示SSD; + - **ImageID** (str) - (Required) 镜像 ID。基础镜像 ID 或者自制镜像 ID。如:cn-image-centos-74。 + - **Memory** (int) - (Required) 内存容量,如1024,2048,4096,8192,16384,32768,65535等。 + - **Name** (str) - (Required) 虚拟机名称。可输入如:myVM。名称只能包含中英文、数字以及- _ .且1-30个字符。 + - **Password** (str) - (Required) 密码。可输入如:ucloud.cn。密码长度限6-30个字符;需要同时包含两项或以上(大写字母/小写字母/数字/特殊符号);windows不能包含用户名(administrator)中超过2个连续字符的部分。 + - **SubnetID** (str) - (Required) 子网 ID。 + - **VMType** (str) - (Required) 机型。枚举值:Normal,表示普通;SSD,表示SSD; + - **VPCID** (str) - (Required) VPC ID。 + - **WANSGID** (str) - (Required) 外网安全组 ID。输入“有效”状态的安全组的ID。 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **DataDiskSpace** (int) - 数据盘大小,单位 GB。默认值为0。范围:【0,8000】,步长10。 + - **GPU** (int) - GPU 卡核心的占用个数。枚举值:【1,2,4】。GPU与CPU、内存大小关系:CPU个数>=4*GPU个数,同时内存与CPU规格匹配. + - **InternalIP** (str) - 指定内网IP。输入有效的指定内网 IP。默认为系统自动分配内网 IP。 + - **LANSGID** (str) - 内网安全组 ID。输入“有效”状态的安全组的ID。 + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **Message** (str) - 返回信息描述。 + - **VMID** (str) - 返回创建虚拟机的 ID 数组。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateVMInstanceRequestSchema().dumps(d) + resp = self.invoke("CreateVMInstance", d, **kwargs) + return apis.CreateVMInstanceResponseSchema().loads(resp) + + def create_vpc(self, req=None, **kwargs): + """ CreateVPC - 创建VPC + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Name** (str) - (Required) 名称; + - **Network** (str) - (Required) 网段。例如:10.0.0.0/16; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Remark** (str) - 描述; + + **Response** + + - **Message** (str) - 返回信息描述; + - **VPCID** (str) - 创建的VPCID; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateVPCRequestSchema().dumps(d) + resp = self.invoke("CreateVPC", d, **kwargs) + return apis.CreateVPCResponseSchema().loads(resp) + + def create_vs(self, req=None, **kwargs): + """ CreateVS - 创建负载均衡VServer + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **HealthcheckType** (str) - (Required) 健康检查类型,枚举值,Port:端口,Path:域名。TCP和UDP协议只支持Port类型。 + - **LBID** (str) - (Required) 负载均衡ID + - **Port** (int) - (Required) VServer 的监听端口。端口范围为 1~65535 ,其中 323、9102、9103、9104、9105、60909、60910 被系统占用。 + - **Protocol** (str) - (Required) VServer 的监听协议。枚举值:支持 TCP、UDP、HTTP 三种协议转发。 + - **Scheduler** (str) - (Required) 负载均衡的调度算法。枚举值:wrr:加权轮训;lc:最小连接数;hash:原地址。 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Domain** (str) - HTTP 健康检查时校验请求的 HOST 字段中的域名。当健康检查类型为端口检查时,该值为空。 + - **KeepaliveTimeout** (int) - 负载均衡的连接空闲超时时间,单位为秒,默认值为 60s 。 + - **Path** (str) - HTTP 健康检查的路径,健康检查类型为 HTTP 检查时为必填项。当健康检查类型为端口检查时,该值为空。 + - **PersistenceKey** (str) - 会话保持KEY,会话保持类型为Manual时为必填项,仅当 VServer 协议为 HTTP 时有效。 + - **PersistenceType** (str) - 会话保持类型。枚举值:None:关闭;Auto:自动生成;Manual:手动生成 。当协议为 TCP 时,该值不生效,会话保持和选择的调度算法相关;当协议为 UDP 时 Auto 表示开启会话保持 。 + + **Response** + + - **Message** (str) - 返回信息描述。 + - **VSID** (str) - 返回创建的VSID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateVSRequestSchema().dumps(d) + resp = self.invoke("CreateVS", d, **kwargs) + return apis.CreateVSResponseSchema().loads(resp) + + def create_vs_policy(self, req=None, **kwargs): + """ CreateVSPolicy - 创建七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **RSIDs** (list) - (Required) 【数组】内容转发规则应用的服务节点的 ID,来源于 VServer 中添加的服务节点。调用方式举例:RSIDs.0=“one-id”、RSIDs.1=“two-id”。 + - **VSID** (str) - (Required) VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Domain** (str) - 内容转发规则关联的请求域名,值可为空,即代表仅匹配路径。域名和路径至少需要指定一项,且域名和路径的组合在一个 VServer 中必须唯一。 + - **Path** (str) - 内容转发规则关联的请求访问路径,如 "/" 。域名和路径至少需要指定一项,且域名和路径的组合在一个 VServer 中必须唯一。 + + **Response** + + - **Message** (str) - 返回信息描述。 + - **PolicyID** (str) - 返回创建的内容转发规则ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateVSPolicyRequestSchema().dumps(d) + resp = self.invoke("CreateVSPolicy", d, **kwargs) + return apis.CreateVSPolicyResponseSchema().loads(resp) + + def delete_custom_image(self, req=None, **kwargs): + """ DeleteCustomImage - 删除自制镜像 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ImageID** (str) - (Required) 自制镜像ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteCustomImageRequestSchema().dumps(d) + resp = self.invoke("DeleteCustomImage", d, **kwargs) + return apis.DeleteCustomImageResponseSchema().loads(resp) + + def delete_disk(self, req=None, **kwargs): + """ DeleteDisk - 删除硬盘 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **DiskID** (str) - (Required) 被删除的硬盘ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteDiskRequestSchema().dumps(d) + resp = self.invoke("DeleteDisk", d, **kwargs) + return apis.DeleteDiskResponseSchema().loads(resp) + + def delete_lb(self, req=None, **kwargs): + """ DeleteLB - 删除负载均衡 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteLBRequestSchema().dumps(d) + resp = self.invoke("DeleteLB", d, **kwargs) + return apis.DeleteLBResponseSchema().loads(resp) + + def delete_natgw(self, req=None, **kwargs): + """ DeleteNATGW - 删除NAT网关 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **NATGWID** (str) - (Required) NAT网关ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteNATGWRequestSchema().dumps(d) + resp = self.invoke("DeleteNATGW", d, **kwargs) + return apis.DeleteNATGWResponseSchema().loads(resp) + + def delete_natgw_rule(self, req=None, **kwargs): + """ DeleteNATGWRule - 删除NAT网关白名单 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **NATGWID** (str) - (Required) nat网关ID + - **RuleID** (str) - (Required) 白名单ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteNATGWRuleRequestSchema().dumps(d) + resp = self.invoke("DeleteNATGWRule", d, **kwargs) + return apis.DeleteNATGWRuleResponseSchema().loads(resp) + + def delete_physical_ip(self, req=None, **kwargs): + """ DeletePhysicalIP - 删除物理IP + + **Request** + + - **Region** (str) - (Config) 地域。 + - **PhysicalIPID** (str) - (Required) 物理IP的ID + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回状态描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeletePhysicalIPRequestSchema().dumps(d) + resp = self.invoke("DeletePhysicalIP", d, **kwargs) + return apis.DeletePhysicalIPResponseSchema().loads(resp) + + def delete_rs(self, req=None, **kwargs): + """ DeleteRS - 移除负载均衡的单个服务节点 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **RSID** (str) - (Required) RServer的ID + - **VSID** (str) - (Required) VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteRSRequestSchema().dumps(d) + resp = self.invoke("DeleteRS", d, **kwargs) + return apis.DeleteRSResponseSchema().loads(resp) + + def delete_security_group(self, req=None, **kwargs): + """ DeleteSecurityGroup - 删除安全组 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **SGID** (str) - (Required) 安全组ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteSecurityGroupRequestSchema().dumps(d) + resp = self.invoke("DeleteSecurityGroup", d, **kwargs) + return apis.DeleteSecurityGroupResponseSchema().loads(resp) + + def delete_security_group_rule(self, req=None, **kwargs): + """ DeleteSecurityGroupRule - 删除安全组规则 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **SGID** (str) - (Required) 安全组ID + - **SGRuleID** (str) - (Required) 安全组规则ID + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回信息描述; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteSecurityGroupRuleRequestSchema().dumps(d) + resp = self.invoke("DeleteSecurityGroupRule", d, **kwargs) + return apis.DeleteSecurityGroupRuleResponseSchema().loads(resp) + + def delete_snapshot(self, req=None, **kwargs): + """ DeleteSnapshot - 删除快照,仅支持状态为正常的快照进行删除操作。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **SnapshotID** (str) - (Required) 快照ID + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteSnapshotRequestSchema().dumps(d) + resp = self.invoke("DeleteSnapshot", d, **kwargs) + return apis.DeleteSnapshotResponseSchema().loads(resp) + + def delete_subnet(self, req=None, **kwargs): + """ DeleteSubnet - 删除子网 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **SubnetID** (str) - (Required) SubnetID + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回信息描述; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteSubnetRequestSchema().dumps(d) + resp = self.invoke("DeleteSubnet", d, **kwargs) + return apis.DeleteSubnetResponseSchema().loads(resp) + + def delete_vm_instance(self, req=None, **kwargs): + """ DeleteVMInstance - 删除虚拟机 + + **Request** + + - **Region** (str) - (Config) 地域。 枚举值:cn,表示中国; + - **VMID** (str) - (Required) 虚拟机 ID。输入有效的虚拟机 ID。 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteVMInstanceRequestSchema().dumps(d) + resp = self.invoke("DeleteVMInstance", d, **kwargs) + return apis.DeleteVMInstanceResponseSchema().loads(resp) + + def delete_vpc(self, req=None, **kwargs): + """ DeleteVPC - 删除VPC + + **Request** + + - **Region** (str) - (Config) 地域。 + - **VPCID** (str) - (Required) ID + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回信息描述; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteVPCRequestSchema().dumps(d) + resp = self.invoke("DeleteVPC", d, **kwargs) + return apis.DeleteVPCResponseSchema().loads(resp) + + def delete_vs(self, req=None, **kwargs): + """ DeleteVS - 删除VServer + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) VServer 监听器所属的负载均衡 ID + - **VSID** (str) - (Required) 负载均衡VServer监听器ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteVSRequestSchema().dumps(d) + resp = self.invoke("DeleteVS", d, **kwargs) + return apis.DeleteVSResponseSchema().loads(resp) + + def delete_vs_policy(self, req=None, **kwargs): + """ DeleteVSPolicy - 删除七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **PolicyID** (str) - (Required) 内容转发规则ID + - **VSID** (str) - (Required) VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Action** (str) - 操作名称 + - **Message** (str) - 返回信息描述。 + - **RetCode** (int) - 返回码 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteVSPolicyRequestSchema().dumps(d) + resp = self.invoke("DeleteVSPolicy", d, **kwargs) + return apis.DeleteVSPolicyResponseSchema().loads(resp) + + def describe_disk(self, req=None, **kwargs): + """ DescribeDisk - 获取硬盘信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **DiskIDs** (list) - 【数组】磁盘的 ID。输入有效的 ID。调用方式举例:DiskIDs.0=“one-id”、DiskIDs.1=“two-id”。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + + **Response** + + - **Infos** (list) - 见 **DiskInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回磁盘总个数。 + + **Response Model** + + **DiskInfo** + + - **AttachResourceID** (str) - 绑定资源ID + - **ChargeType** (str) - 硬盘计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **CreateTime** (int) - 创建时间。时间戳 + - **DiskID** (str) - 硬盘ID + - **DiskStatus** (str) - 硬盘状态。Creating:创建中,BeingCloned:正在被克隆中,Unbound:已解绑,Unbounding:解绑中,Bounding:绑定中,Bound:已绑定,Upgrading:升级中,Deleting:删除中,Deleted:已删除,Releasing:销毁中,Released:已销毁 + - **ExpireTime** (int) - 过期时间。时间戳 + - **Name** (str) - 名称 + - **Region** (str) - 地域 + - **Remark** (str) - 备注 + - **SetType** (str) - 磁盘类型。例如:Normal,SSD + - **Size** (int) - 大小。单位GB + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeDiskRequestSchema().dumps(d) + resp = self.invoke("DescribeDisk", d, **kwargs) + return apis.DescribeDiskResponseSchema().loads(resp) + + def describe_eip(self, req=None, **kwargs): + """ DescribeEIP - 获取外网IP的信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **EIPIDs** (list) - 【数组】外网的 ID。输入有效的 ID。调用方式举例:EIPIDs.0=“one-id”、EIPIDs.1=“two-id” + - **Limit** (str) - 返回数据长度,默认为20,最大100。 + - **Offset** (str) - 列表起始位置偏移量,默认为0。 + + **Response** + + - **Infos** (list) - 见 **EIPInfo** 模型定义 + - **Message** (str) - 返回信息描述 + - **Totalcount** (int) - 返回现有外网IP总数 + + **Response Model** + + **EIPInfo** + + - **Bandwidth** (int) - 带宽大小 + - **BindResourceID** (str) - 绑定资源ID + - **BindResourceType** (str) - 绑定资源类型 + - **ChargeType** (str) - 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **CreateTime** (int) - 创建时间。时间戳 + - **EIPID** (str) - ID + - **ExpireTime** (int) - 过期时间。时间戳 + - **IP** (str) - 外网IP + - **Name** (str) - 名称 + - **OperatorName** (str) - 线路 + - **Region** (str) - 地域 + - **Remark** (str) - 备注 + - **Status** (str) - 状态。Allocating:申请中,Free:未绑定,Bounding:绑定中,Bound:已绑定,Unbounding:解绑中,Deleted:已删除,Releasing:销毁中,Released:已销毁,BandwidthChanging:带宽修改中 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeEIPRequestSchema().dumps(d) + resp = self.invoke("DescribeEIP", d, **kwargs) + return apis.DescribeEIPResponseSchema().loads(resp) + + def describe_image(self, req=None, **kwargs): + """ DescribeImage - 获取镜像信息,包括默认镜像和自制镜像。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **ImageIDs** (list) - 【数组】镜像的 ID。输入有效的 ID。调用方式举例:ImageIDs.0=“one-id”、ImageIDs.1=“two-id”。 + - **ImageType** (str) - 镜像类型。枚举值:Base(基础镜像,平台默认提供的镜像),Custom(自制镜像,通过虚拟机导出的镜像) 。若该值为空,默认查询所有镜像。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + + **Response** + + - **Infos** (list) - 见 **ImageInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回镜像的总个数。 + + **Response Model** + + **ImageInfo** + + - **CreateTime** (int) - 创建时间。时间戳。 + - **ImageID** (str) - 镜像ID + - **ImageStatus** (str) - 镜像状态。枚举类型:Making(创建中),Available(可用),Unavailable(不可用),Terminating(销毁中),Used(被使用中),Deleting(删除中),Deleted(已删除) + - **ImageType** (str) - 镜像类型。枚举类型:Base(基础镜像),Custom(自制镜像)。 + - **Name** (str) - 镜像名称 + - **OSDistribution** (str) - 镜像系统发行版本。例如:Centos, Ubuntu, Windows等 + - **OSName** (str) - 系统名称。例如:CentOS 7.4 x86_64 + - **OSType** (str) - 系统类型。例如:Linux, Windows,Kylin + - **Region** (str) - 地域 + - **SetArch** (str) - 架构名称。例如:x86_64 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeImageRequestSchema().dumps(d) + resp = self.invoke("DescribeImage", d, **kwargs) + return apis.DescribeImageResponseSchema().loads(resp) + + def describe_lb(self, req=None, **kwargs): + """ DescribeLB - 获取负载均衡信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **LBIDs** (list) - 【数组】负载均衡的 ID。调用方式举例:LBIDs.0=“one-id”、LBIDs.1=“two-id”。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **SubnetID** (str) - 子网ID + - **VPCID** (str) - VPCID + + **Response** + + - **Infos** (list) - 见 **LBInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回负载均衡总个数。 + + **Response Model** + + **LBInfo** + + - **AlarmTemplateID** (str) - 告警模板ID + - **ChargeType** (str) - 虚拟机计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **CreateTime** (int) - 创建时间,时间戳 + - **ExpireTime** (int) - 过期时间,时间戳 + - **LBID** (str) - 负载均衡ID + - **LBStatus** (str) - 状态。Creating:创建中,Running:运行中,Deleting:删除中,Deleted:已删除 + - **LBType** (str) - 负载均衡类型,枚举值,WAN:外网负载均衡,LAN:内网负载均衡。 + - **Name** (str) - 名称 + - **PrivateIP** (str) - 负载均衡的内网 IP 地址,当LB为外网类型时,该值为空。 + - **PublicIP** (str) - 负载均衡的外网 IP 地址,当LB为内网类型时,该值为空。 + - **Region** (str) - 地域 + - **Remark** (str) - 描述 + - **SGID** (str) - 安全组 ID ,当LB为内网类型时,该值为空。 + - **SubnetID** (str) - 子网ID + - **VPCID** (str) - VPCID + - **VSCount** (int) - VServer的数量 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeLBRequestSchema().dumps(d) + resp = self.invoke("DescribeLB", d, **kwargs) + return apis.DescribeLBResponseSchema().loads(resp) + + def describe_metric(self, req=None, **kwargs): + """ DescribeMetric - 获取资源监控信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **BeginTime** (str) - (Required) 开始时间。使用unix时间戳 + - **EndTime** (str) - (Required) 结束时间。使用Unix时间戳 + - **MetricName** (list) - (Required) 监控指标。1. 获取虚拟机监控信息调用举例,MetricName.0="CPUUtilization"、MetricName.0="MemUsage"。虚拟机监控指标枚举值:BlockProcessCount,表示阻塞进程数;CPUUtilization,表示CPU使用率;DiskReadOps,表示磁盘读次数;DiskWriteOps,表示磁盘写次数;IORead,表示磁盘读吞吐;IOWrite,表示磁盘写吞吐;LoadAvg,表示平均负载1分钟;MemUsage,表示内存使用率;NetPacketIn,表示网卡入包量;NetPacketOut,表示网卡出包量;NICIn,表示网卡入带宽;NICOut,表示网卡出带宽;SpaceUsage,表示空间使用率;TCPConnectCount,表示TCP连接数;2. EIP监控指标:NetPacketIn:入包量;NetPacketOut:出包量;NICIn:入带宽;NICOut:出带宽;NICOutUsage:出带宽使用率; + - **ResourceID** (str) - (Required) 资源ID + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机;EIP:弹性IP + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,中国; + + **Response** + + - **Infos** (list) - 见 **MetricInfo** 模型定义 + - **Message** (str) - 返回信息描述 + - **TotalCount** (int) - 返回监控信息条数 + + **Response Model** + + **MetricSet** + + - **Timestamp** (int) - 监控时间 + - **Value** (float) - 监控值 + + **MetricInfo** + + - **Infos** (list) - 见 **MetricSet** 模型定义 + - **MetricName** (str) - 监控指标。虚拟机的监控指标枚举值为:BlockProcessCount,表示阻塞进程数;CPUUtilization,表示CPU使用率;DiskReadOps,表示磁盘读次数;DiskWriteOps,表示磁盘写次数;IORead,表示磁盘读吞吐;IOWrite,表示磁盘写吞吐;LoadAvg,表示平均负载1分钟;MemUsage,表示内存使用率;NetPacketIn,表示网卡入包量;NetPacketOut,表示网卡出包量;NICIn,表示网卡入带宽;NICOut,表示网卡出带宽;SpaceUsage,表示空间使用率;TCPConnectCount,表示TCP连接数; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeMetricRequestSchema().dumps(d) + resp = self.invoke("DescribeMetric", d, **kwargs) + return apis.DescribeMetricResponseSchema().loads(resp) + + def describe_natgw(self, req=None, **kwargs): + """ DescribeNATGW - 获取NAT网关信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **NATGWIDs** (list) - 【数组】NAT网关的 ID。调用方式举例:NATGWIDs.0=“one-id”、NATGWIDs.1=“two-id”。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + + **Response** + + - **Infos** (list) - 见 **NATGWInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回NAT网关总个数 + + **Response Model** + + **NATGWInfo** + + - **AlarmTemplateID** (str) - 告警模板ID + - **ChargeType** (str) - 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **CreateTime** (int) - 创建时间,时间戳 + - **EIP** (str) - 虚拟IP + - **ExpireTime** (int) - 过期时间,时间戳 + - **NATGWID** (str) - NAT网关ID + - **NATGWStatus** (str) - 状态。Creating:创建中, Running:运行中, Deleting:删除中, Deleted:已删除 + - **Name** (str) - 名称 + - **Region** (str) - 地域 + - **Remark** (str) - 备注 + - **SGID** (str) - NAT网关绑定的安全组ID + - **SubnetID** (str) - NAT网关实例所在的子网 ID + - **VPCID** (str) - NAT网关实例所在的 VPC ID + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeNATGWRequestSchema().dumps(d) + resp = self.invoke("DescribeNATGW", d, **kwargs) + return apis.DescribeNATGWResponseSchema().loads(resp) + + def describe_natgw_rule(self, req=None, **kwargs): + """ DescribeNATGWRule - 获取NAT网关白名单信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **NATGWID** (str) - (Required) NAT网关ID + - **NATGWType** (str) - (Required) NAT类型。枚举值:SNAT,DNAT + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **BindResourceIDs** (list) - 【数组】NAT网关白名单资源ID。调用方式举例:NATGWRules.0=“one-id”、NATGWRules.1=“two-id”。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **RuleIDs** (list) - 【数组】NAT网关白名单ID。调用方式举例:NATGWRules.0=“one-id”、NATGWRules.1=“two-id”。 + + **Response** + + - **Infos** (list) - 见 **NATGWRuleInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回NAT网关白名单资源总个数。 + + **Response Model** + + **NATGWRuleInfo** + + - **BindResourceID** (str) - 绑定的资源ID + - **BindResourceType** (str) - 绑定资源的类型 + - **CreateTime** (int) - 创建时间,时间戳。 + - **IP** (str) - 白名单资源的内网IP地址 + - **NATGWID** (str) - NAT网关ID + - **NATGWType** (str) - nat网关类型 + - **Name** (str) - 添加的白名单资源名称 + - **RuleID** (str) - 白名单ID + - **RuleStatus** (str) - 状态。Bounding:绑定中,Bound:已绑定,Unbounding:解绑中,Unbound:已解绑 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeNATGWRuleRequestSchema().dumps(d) + resp = self.invoke("DescribeNATGWRule", d, **kwargs) + return apis.DescribeNATGWRuleResponseSchema().loads(resp) + + def describe_physical_ip(self, req=None, **kwargs): + """ DescribePhysicalIP - 获取物理IP信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Limit** (str) - 返回数据长度,默认为20,最大100。 + - **Offset** (str) - 列表起始位置偏移量,默认为0。 + - **PhysicalIPIDs** (list) - 【数组】物理IP的 ID。输入有效的 ID。调用方式举例:PhysicalIPIDs.0=“one-id”、PhysicalIPIDs.1=“two-id” + + **Response** + + - **Infos** (list) - 见 **PhysicalIPInfo** 模型定义 + - **Message** (str) - 返回信息描述 + - **TotalCount** (int) - 返回现有物理IP总数 + + **Response Model** + + **PhysicalIPInfo** + + - **BindResourceID** (str) - 绑定资源ID + - **BindResourceType** (str) - 绑定资源类型 + - **CreateTime** (int) - 创建时间。时间戳 + - **IP** (str) - 物理IP + - **Name** (str) - 名称 + - **OperatorName** (str) - 线路 + - **PhysicalIPID** (str) - 物理IP的ID + - **Region** (str) - 地域 + - **Remark** (str) - 备注 + - **Status** (str) - 状态。Allocating:申请中,Free:未绑定,Bounding:绑定中,Bound:已绑定,Unbounding:解绑中,Deleted:已删除,Releasing:销毁中,Released:已销毁 + - **UpdateTime** (int) - 过期时间。时间戳 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribePhysicalIPRequestSchema().dumps(d) + resp = self.invoke("DescribePhysicalIP", d, **kwargs) + return apis.DescribePhysicalIPResponseSchema().loads(resp) + + def describe_rs(self, req=None, **kwargs): + """ DescribeRS - 获取负载均衡服务的服务节点信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **RSIDs** (list) - 【数组】RServer的 ID。调用方式举例:RSIDs.0=“one-id”、RSIDs.1=“two-id”。 + - **VSID** (str) - VServer的ID + + **Response** + + - **Infos** (list) - 见 **RSInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回该负载均衡下VServer的总个数。 + + **Response Model** + + **RSInfo** + + - **BindResourceID** (str) - 绑定的资源ID + - **CreateTime** (int) - 创建时间,时间戳 + - **IP** (str) - 服务节点的内网 IP 地址 + - **LBID** (str) - 服务节点所属的负载均衡 ID + - **Name** (str) - 服务节点的资源名称 + - **Port** (int) - 服务节点暴露的服务端口号 + - **RSID** (str) - 服务节点的 ID + - **RSMode** (str) - 节点模式。枚举值,Enabling:开启中,Enable:已启用,Disabling:禁用中,Disable:已禁用 + - **RSStatus** (str) - RSStatus 的描述修改为:状态,枚举值,Creating:创建中,Inactive:无效,Active:有效,Updating:更新中,Deleting:删除中,Deleted:已删除。其中有效代表节点服务健康,无效代表节点服务异常。 + - **UpdateTime** (int) - 更新时间,时间戳 + - **VSID** (str) - 服务节点所属的 VServer ID + - **Weight** (int) - 服务节点的权重 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeRSRequestSchema().dumps(d) + resp = self.invoke("DescribeRS", d, **kwargs) + return apis.DescribeRSResponseSchema().loads(resp) + + def describe_recycled_resource(self, req=None, **kwargs): + """ DescribeRecycledResource - 查询回收站资源 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **ResourceIDs** (list) - 【数组】资源ID,输入“有效”的ID。调用方式举例:ResourceIDs.0=“one-id”、ResourceIDs.1=“two-id”。 + + **Response** + + - **Infos** (list) - 见 **RecycledResourceInfo** 模型定义 + - **TotalCount** (int) - 返回回收站资源的总个数 + + **Response Model** + + **RecycledResourceInfo** + + - **CreateTime** (int) - 创建时间 + - **DeleteTime** (int) - 删除时间 + - **Description** (str) - 描述 + - **ExpireTime** (int) - 过期时间 + - **IsAutoTerminated** (bool) - 是否自动销户 + - **Name** (str) - 名称 + - **Region** (str) - 地域 + - **ResourceID** (str) - 资源ID + - **ResourceType** (str) - 资源类型:VM:虚拟机,Disk:硬盘,EIP:外网IP,PIP:物理IP,MySQL:数据库,Redis:缓存 + - **Status** (str) - 资源状态 + - **WillTerminateTime** (int) - 销毁时间 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeRecycledResourceRequestSchema().dumps(d) + resp = self.invoke("DescribeRecycledResource", d, **kwargs) + return apis.DescribeRecycledResourceResponseSchema().loads(resp) + + def describe_security_group(self, req=None, **kwargs): + """ DescribeSecurityGroup - 查询安全组信息 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **Zone** (str) - (Required) 可用区。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **SGIDs** (list) - 【数组】安全组的 ID。输入有效的 ID。调用方式举例:SGIDs.0=“one-id”、SGIDs.1=“two-id” + + **Response** + + - **Infos** (list) - 见 **SGInfo** 模型定义 + - **Message** (str) - 返回信息描述; + - **TotalCount** (int) - 安全组的总数 + + **Response Model** + + **SGRuleInfo** + + - **DstPort** (str) - 端口号 + - **IsIn** (str) - 方向。1:入,0:出 + - **Priority** (str) - 优先级。HIGH:高,MEDIUM:中,LOW:低 + - **ProtocolType** (str) - 协议 + - **RuleAction** (str) - 动作。ACCEPT:接受,DROP:拒绝 + - **RuleID** (str) - 规则ID + - **SrcIP** (str) - IP或者掩码/段形式。10.0.0.2,10.0.10.10/16 + + **SGInfo** + + - **CreateTime** (int) - 创建时间,时间戳 + - **Name** (str) - 名称 + - **Region** (str) - 地域 + - **Remark** (str) - 描述 + - **ResourceCount** (int) - 资源绑定数量 + - **Rule** (list) - 见 **SGRuleInfo** 模型定义 + - **RuleCount** (int) - 规则数量 + - **SGID** (str) - 安全组ID + - **Status** (str) - 状态。Creating:创建中,Updating:更新中,Available:有效,Deleted:已删除,Terminating:销毁中,Terminated:已销毁 + - **UpdateTime** (int) - 更新时间,时间戳 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeSecurityGroupRequestSchema().dumps(d) + resp = self.invoke("DescribeSecurityGroup", d, **kwargs) + return apis.DescribeSecurityGroupResponseSchema().loads(resp) + + def describe_storage_type(self, req=None, **kwargs): + """ DescribeStorageType - 查询存储类型 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Infos** (list) - 见 **StorageTypeInfo** 模型定义 + - **Message** (str) - 返回信息描述; + - **TotalCount** (int) - 存储类型的总数 + + **Response Model** + + **StorageTypeInfo** + + - **Region** (str) - 地域 + - **SetArch** (str) - 架构 + - **StorageType** (str) - 存储类型 + - **StorageTypeAlias** (str) - 存储类型别名 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeStorageTypeRequestSchema().dumps(d) + resp = self.invoke("DescribeStorageType", d, **kwargs) + return apis.DescribeStorageTypeResponseSchema().loads(resp) + + def describe_subnet(self, req=None, **kwargs): + """ DescribeSubnet - 查询子网信息 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **Zone** (str) - (Required) 可用区。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **SubnetIDs** (list) - 【数组】子网 ID。调用方式举例:SubnetIDs.0=“one-id”、SubnetIDs.1=“two-id” + - **VPCID** (str) - VPCID + + **Response** + + - **Infos** (list) - 见 **SubnetInfo** 模型定义 + - **Message** (str) - 返回信息描述; + - **TotalCount** (int) - 子网的总数 + + **Response Model** + + **SubnetInfo** + + - **CreateTime** (int) - 创建时间,时间戳 + - **Name** (str) - 名称 + - **Network** (str) - 网段 + - **Region** (str) - 地域 + - **Remark** (str) - 描述 + - **State** (str) - 状态;Allocating:申请中,Available:有效,Deleting:删除中,Deleted:已删除 + - **SubnetID** (str) - ID + - **UpdateTime** (int) - 更新时间,时间戳 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeSubnetRequestSchema().dumps(d) + resp = self.invoke("DescribeSubnet", d, **kwargs) + return apis.DescribeSubnetResponseSchema().loads(resp) + + def describe_user(self, req=None, **kwargs): + """ DescribeUser - 查询租户信息 + + **Request** + + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **UserIDs** (list) - 【数组】租户的 ID。输入有效的 ID。调用方式举例:UserIDs.0=123”、UserIDs.1=456 + + **Response** + + - **Infos** (list) - 见 **UserInfo** 模型定义 + - **Message** (str) - 返回信息描述 + - **TotalCount** (int) - 返回现有租户总数 + + **Response Model** + + **UserInfo** + + - **Amount** (float) - 账户余额 + - **CreateTime** (int) - 账户创建时间。时间戳 + - **Email** (str) - 租户名称 + - **PrivateKey** (str) - 私钥 + - **PublicKey** (str) - 公钥 + - **Status** (str) - 用户状态。USER_STATUS_AVAILABLE:正常,USER_STATUS_FREEZE:冻结 + - **UpdateTime** (int) - 更新时间。时间戳 + - **UserID** (int) - 租户ID. + + """ + d = {} + req and d.update(req) + d = apis.DescribeUserRequestSchema().dumps(d) + resp = self.invoke("DescribeUser", d, **kwargs) + return apis.DescribeUserResponseSchema().loads(resp) + + def describe_vm_instance(self, req=None, **kwargs): + """ DescribeVMInstance - 查询虚拟机 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (str) - 列表起始位置偏移量,默认为0。 + - **SubnetID** (str) - 子网 ID。输入“有效”状态的子网 ID。 + - **VMIDs** (list) - 【数组】虚拟机的 ID。输入有效的 ID。调用方式举例:PrivateIp.0=“one-id”、PrivateIp.1=“two-id”。 + - **VPCID** (str) - VPC ID。输入“有效”状态的VPC ID。 + + **Response** + + - **Infos** (list) - 见 **VMInstanceInfo** 模型定义 + - **Message** (str) - 返回信息描述 + - **TotalCount** (int) - 返回虚拟机总个数 + + **Response Model** + + **VMIPInfo** + + - **IP** (str) - IP 值 + - **InterfaceID** (str) - 网卡 ID + - **IsElastic** (str) - 是否是弹性网卡。枚举值:Y,表示是;N,表示否; + - **MAC** (str) - MAC 地址值 + - **SGID** (str) - 安全组 ID + - **SGName** (str) - 安全组名称 + - **SubnetID** (str) - 子网 ID + - **SubnetName** (str) - 子网名称 + - **Type** (str) - IP 类型。枚举值:Private,表示内网;Public,表示外网;Physical,表示物理网; + - **VPCID** (str) - VPC ID + - **VPCName** (str) - VPC 名称 + + **VMDiskInfo** + + - **DiskID** (str) - 磁盘 ID + - **Drive** (str) - 磁盘盘符 + - **IsElastic** (str) - 是否是弹性磁盘。枚举值为:Y,表示是;N,表示否; + - **Name** (str) - 磁盘名称 + - **Size** (int) - 磁盘大小,单位 GB + - **Type** (str) - 磁盘类型。枚举值:Boot,表示系统盘;Data,表示数据盘; + + **VMInstanceInfo** + + - **CPU** (int) - CPU 个数 + - **ChargeType** (str) - 虚拟机计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **CreateTime** (int) - 虚拟机创建时间 + - **DiskInfos** (list) - 见 **VMDiskInfo** 模型定义 + - **ExpireTime** (int) - 虚拟机过期时间 + - **IPInfos** (list) - 见 **VMIPInfo** 模型定义 + - **ImageID** (str) - 镜像 ID + - **Memory** (int) - 内存大小,单位 M + - **Name** (str) - 虚拟机名称 + - **OSName** (str) - 操作系统名称 + - **OSType** (str) - 操作系统类型 + - **Region** (str) - Region + - **RegionAlias** (str) - Region 别名 + - **Remark** (str) - 备注 + - **State** (str) - 虚拟机状态。枚举值:Initializing,表示初始化;Starting,表示启动中;Restarting,表示重启中;Running,表示运行;Stopping,表示关机中;Stopped,表示关机;Deleted,表示已删除;Resizing,表示修改配置中;Terminating,表示销毁中;Terminated,表示已销毁;Migrating,表示迁移中;WaitReinstall,表示重装中;Reinstalling,表示重装中;Poweroffing,表示断电中;ChangeSGing,表示修改防火墙中; + - **SubnetID** (str) - 子网 ID + - **SubnetName** (str) - 子网 名称 + - **VMID** (str) - 虚拟机 ID + - **VMType** (str) - 虚拟机类型 + - **VMTypeAlias** (str) - 虚拟机类型别名 + - **VPCID** (str) - VPC ID + - **VPCName** (str) - VPC 名称 + - **Zone** (str) - Zone + - **ZoneAlias** (str) - Zone 别名 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeVMInstanceRequestSchema().dumps(d) + resp = self.invoke("DescribeVMInstance", d, **kwargs) + return apis.DescribeVMInstanceResponseSchema().loads(resp) + + def describe_vm_type(self, req=None, **kwargs): + """ DescribeVMType - 查询主机机型 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Infos** (list) - 见 **VMTypeInfo** 模型定义 + - **Message** (str) - 返回信息描述; + - **TotalCount** (int) - 主机机型的总数 + + **Response Model** + + **VMTypeInfo** + + - **Region** (str) - 地域 + - **SetArch** (str) - 架构 + - **VMType** (str) - 机型 + - **VMTypeAlias** (str) - 机型别名 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeVMTypeRequestSchema().dumps(d) + resp = self.invoke("DescribeVMType", d, **kwargs) + return apis.DescribeVMTypeResponseSchema().loads(resp) + + def describe_vpc(self, req=None, **kwargs): + """ DescribeVPC - 查询VPC信息 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **Zone** (str) - (Required) 可用区。 + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **VPCIDs** (list) - 【数组】VPC的 ID。调用方式举例:VPCIDs.0=“one-id”、VPCIDs.1=“two-id” + + **Response** + + - **Infos** (list) - 见 **VPCInfo** 模型定义 + - **Message** (str) - 返回信息描述; + - **TotalCount** (int) - VPC的总数 + + **Response Model** + + **SubnetInfo** + + - **CreateTime** (int) - 创建时间,时间戳 + - **Name** (str) - 名称 + - **Network** (str) - 网段 + - **Region** (str) - 地域 + - **Remark** (str) - 描述 + - **State** (str) - 状态;Allocating:申请中,Available:有效,Deleting:删除中,Deleted:已删除 + - **SubnetID** (str) - ID + - **UpdateTime** (int) - 更新时间,时间戳 + - **Zone** (str) - 可用区 + + **VPCInfo** + + - **CreateTime** (int) - 创建时间,时间戳 + - **Name** (str) - 名称 + - **Network** (str) - 网段,比如10.0.0.0/16 + - **Region** (str) - 地域。 + - **Remark** (str) - 描述 + - **State** (str) - 状态;Allocating:申请中,Available:有效,Terminating:销毁中,Terminated:已销毁 + - **SubnetCount** (int) - 该VPC下拥有的子网数目 + - **SubnetInfos** (list) - 见 **SubnetInfo** 模型定义 + - **UpdateTime** (int) - 修改时间,时间戳 + - **VPCID** (str) - VPC的ID + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeVPCRequestSchema().dumps(d) + resp = self.invoke("DescribeVPC", d, **kwargs) + return apis.DescribeVPCResponseSchema().loads(resp) + + def describe_vs(self, req=None, **kwargs): + """ DescribeVS - 获取负载均衡 VServer 信息 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **VSIDs** (list) - 【数组】VServer的 ID。调用方式举例:VSIDs.0=“one-id”、VSIDs.1=“two-id”。 + + **Response** + + - **Infos** (list) - 见 **VSInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回当前负载均衡 VServer 总个数。 + + **Response Model** + + **RSInfo** + + - **BindResourceID** (str) - 绑定的资源ID + - **CreateTime** (int) - 创建时间,时间戳 + - **IP** (str) - 服务节点的内网 IP 地址 + - **LBID** (str) - 服务节点所属的负载均衡 ID + - **Name** (str) - 服务节点的资源名称 + - **Port** (int) - 服务节点暴露的服务端口号 + - **RSID** (str) - 服务节点的 ID + - **RSMode** (str) - 节点模式。枚举值,Enabling:开启中,Enable:已启用,Disabling:禁用中,Disable:已禁用 + - **RSStatus** (str) - RSStatus 的描述修改为:状态,枚举值,Creating:创建中,Inactive:无效,Active:有效,Updating:更新中,Deleting:删除中,Deleted:已删除。其中有效代表节点服务健康,无效代表节点服务异常。 + - **UpdateTime** (int) - 更新时间,时间戳 + - **VSID** (str) - 服务节点所属的 VServer ID + - **Weight** (int) - 服务节点的权重 + + **VSPolicyInfo** + + - **CreateTime** (int) - 创建时间,时间戳 + - **Domain** (str) - 内容转发规则关联的请求域名,值可为空,即代表仅匹配路径。 + - **LBID** (str) - 负载均衡ID + - **Path** (str) - 内容转发规则关联的请求访问路径,如 "/" 。 + - **PolicyID** (str) - 内容转发规则ID + - **PolicyStatus** (str) - 状态,枚举值,Available:有效,Deleted:已删除 + - **RSInfos** (list) - 见 **RSInfo** 模型定义 + - **UpdateTime** (int) - 更新时间,时间戳 + - **VSID** (str) - VServerID + + **VSInfo** + + - **AlarmTemplateID** (str) - 告警模板ID + - **CreateTime** (int) - 创建时间,时间戳 + - **Domain** (str) - HTTP 健康检查时校验请求的 HOST 字段中的域名。当健康检查类型为端口检查时,该值为空。 + - **HealthcheckType** (str) - 负载均衡的健康检查类型。枚举值:Port:端口检查;Path: HTTP检查 。 + - **KeepaliveTimeout** (int) - 负载均衡的连接空闲超时时间,单位为秒,默认值为 60s 。当 VServer 协议为 UDP 时,该值为空。 + - **LBID** (str) - VServer 所属的负载均衡 ID + - **Path** (str) - HTTP 健康检查的路径。当健康检查类型为端口检查时,该值为空。 + - **PersistenceKey** (str) - 会话保持KEY,仅当 VServer 协议为 HTTP 且会话保持为手动时有效。 + - **PersistenceType** (str) - 会话保持类型。枚举值:None:关闭;Auto:自动生成;Manual:手动生成 。当协议为 TCP 时,该值为空;当协议为 UDP 时 Auto 表示开启会话保持 。 + - **Port** (int) - 端口 + - **Protocol** (str) - 协议 + - **RSHealthStatus** (str) - 健康检查状态,枚举值,Empty:全部异常,Parts:部分异常,All:正常 + - **RSInfos** (list) - 见 **RSInfo** 模型定义 + - **UpdateTime** (int) - 更新时间,时间戳 + - **VSID** (str) - VServer的ID + - **VSPolicyInfos** (list) - 见 **VSPolicyInfo** 模型定义 + - **VSStatus** (str) - VServer 的资源状态。枚举值,Available:可用,Updating:更新中,Deleted:已删除 。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeVSRequestSchema().dumps(d) + resp = self.invoke("DescribeVS", d, **kwargs) + return apis.DescribeVSResponseSchema().loads(resp) + + def describe_vs_policy(self, req=None, **kwargs): + """ DescribeVSPolicy - 获取七层负载均衡内容转发规则信息,仅当 VServer 的监听协议为 HTTP 时有效。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Limit** (int) - 返回数据长度,默认为20,最大100。 + - **Offset** (int) - 列表起始位置偏移量,默认为0。 + - **PolicyIDs** (list) - 【数组】七层负载均衡内容转发规则的 ID。调用方式举例:PolicyIDs.0=“one-id”、PolicyIDs.1=“two-id” + - **VSID** (str) - VServerID + + **Response** + + - **Infos** (list) - 见 **VSPolicyInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + - **TotalCount** (int) - 返回内容转发规则的总个数。 + + **Response Model** + + **RSInfo** + + - **BindResourceID** (str) - 绑定的资源ID + - **CreateTime** (int) - 创建时间,时间戳 + - **IP** (str) - 服务节点的内网 IP 地址 + - **LBID** (str) - 服务节点所属的负载均衡 ID + - **Name** (str) - 服务节点的资源名称 + - **Port** (int) - 服务节点暴露的服务端口号 + - **RSID** (str) - 服务节点的 ID + - **RSMode** (str) - 节点模式。枚举值,Enabling:开启中,Enable:已启用,Disabling:禁用中,Disable:已禁用 + - **RSStatus** (str) - RSStatus 的描述修改为:状态,枚举值,Creating:创建中,Inactive:无效,Active:有效,Updating:更新中,Deleting:删除中,Deleted:已删除。其中有效代表节点服务健康,无效代表节点服务异常。 + - **UpdateTime** (int) - 更新时间,时间戳 + - **VSID** (str) - 服务节点所属的 VServer ID + - **Weight** (int) - 服务节点的权重 + + **VSPolicyInfo** + + - **CreateTime** (int) - 创建时间,时间戳 + - **Domain** (str) - 内容转发规则关联的请求域名,值可为空,即代表仅匹配路径。 + - **LBID** (str) - 负载均衡ID + - **Path** (str) - 内容转发规则关联的请求访问路径,如 "/" 。 + - **PolicyID** (str) - 内容转发规则ID + - **PolicyStatus** (str) - 状态,枚举值,Available:有效,Deleted:已删除 + - **RSInfos** (list) - 见 **RSInfo** 模型定义 + - **UpdateTime** (int) - 更新时间,时间戳 + - **VSID** (str) - VServerID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeVSPolicyRequestSchema().dumps(d) + resp = self.invoke("DescribeVSPolicy", d, **kwargs) + return apis.DescribeVSPolicyResponseSchema().loads(resp) + + def detach_disk(self, req=None, **kwargs): + """ DetachDisk - 解绑UClouStack硬盘 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **DiskID** (str) - (Required) 硬盘ID + - **ResourceID** (str) - (Required) 绑定的资源ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DetachDiskRequestSchema().dumps(d) + resp = self.invoke("DetachDisk", d, **kwargs) + return apis.DetachDiskResponseSchema().loads(resp) + + def disable_rs(self, req=None, **kwargs): + """ DisableRS - 禁用负载均衡的单个服务节点 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **RSID** (str) - (Required) RServer的ID + - **VSID** (str) - (Required) VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DisableRSRequestSchema().dumps(d) + resp = self.invoke("DisableRS", d, **kwargs) + return apis.DisableRSResponseSchema().loads(resp) + + def enable_rs(self, req=None, **kwargs): + """ EnableRS - 启用负载均衡的单个服务节点 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **RSID** (str) - (Required) RServer的ID + - **VSID** (str) - (Required) VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.EnableRSRequestSchema().dumps(d) + resp = self.invoke("EnableRS", d, **kwargs) + return apis.EnableRSResponseSchema().loads(resp) + + def get_disk_price(self, req=None, **kwargs): + """ GetDiskPrice - 获取硬盘价格 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **DiskSpace** (int) - (Required) 磁盘大小 + - **SetType** (str) - (Required) 磁盘类型 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **Infos** (list) - 见 **PriceInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + + **Response Model** + + **PriceInfo** + + - **ChargeType** (str) - 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **Price** (float) - 价格 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.GetDiskPriceRequestSchema().dumps(d) + resp = self.invoke("GetDiskPrice", d, **kwargs) + return apis.GetDiskPriceResponseSchema().loads(resp) + + def get_eip_price(self, req=None, **kwargs): + """ GetEIPPrice - 获取外网IP价格 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **Bandwidth** (int) - (Required) 带宽,默认值1,默认范围1~100 + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **OpertatorName** (str) - (Required) 线路。目前支持Bgp + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **Infos** (list) - 见 **PriceInfo** 模型定义 + - **Message** (str) - 返回信息描述 + + **Response Model** + + **PriceInfo** + + - **ChargeType** (str) - 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **Price** (float) - 价格 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.GetEIPPriceRequestSchema().dumps(d) + resp = self.invoke("GetEIPPrice", d, **kwargs) + return apis.GetEIPPriceResponseSchema().loads(resp) + + def get_vm_instance_price(self, req=None, **kwargs): + """ GetVMInstancePrice - 获取虚拟机价格 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **BootDiskSetType** (str) - (Required) 系统盘类型。枚举值:Normal,表示普通;SSD,表示SSD; + - **CPU** (int) - (Required) CPU 个数,目前只能输入数据库配置指定规格参数,如:1核2048M、2核4096M、4核8192M、8核16384M、16核32768M。 + - **ChargeType** (str) - (Required) 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **DataDiskSetType** (str) - (Required) 数据盘类型。枚举值:Normal,表示普通;SSD,表示SSD; + - **DataDiskSpace** (int) - (Required) 数据盘大小,单位 GB。默认值为0。范围:【0,8000】,步长10。 + - **ImageID** (str) - (Required) 镜像 ID。基础镜像 ID 或者自制镜像 ID。如:cn-image-centos-74。 + - **Memory** (int) - (Required) 内存大小,单位 M。目前只能输入数据库配置指定规格参数,如:1核2048M、2核4096M、4核8192M、8核16384M、16核32768M。 + - **OSType** (str) - (Required) 系统类型。 + - **VMType** (str) - (Required) 机型。枚举值:Normal,表示普通;SSD,表示SSD; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **GPU** (int) - GPU 卡核心的占用个数。枚举值:【1,2,4】。GPU与CPU、内存大小关系:CPU个数>=4*GPU个数,同时内存与CPU规格匹配. + - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 + + **Response** + + - **Infos** (list) - 见 **PriceInfo** 模型定义 + - **Message** (str) - 返回信息描述。 + + **Response Model** + + **PriceInfo** + + - **ChargeType** (str) - 计费模式。枚举值:Dynamic,表示小时;Month,表示月;Year,表示年; + - **Price** (float) - 价格 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.GetVMInstancePriceRequestSchema().dumps(d) + resp = self.invoke("GetVMInstancePrice", d, **kwargs) + return apis.GetVMInstancePriceResponseSchema().loads(resp) + + def modify_eip_bandwidth(self, req=None, **kwargs): + """ ModifyEIPBandwidth - 调整外网IP带宽 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **Bandwidth** (int) - (Required) 调整后的带宽 + - **EIPID** (str) - (Required) 外网IP的ID + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回信息描述; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.ModifyEIPBandwidthRequestSchema().dumps(d) + resp = self.invoke("ModifyEIPBandwidth", d, **kwargs) + return apis.ModifyEIPBandwidthResponseSchema().loads(resp) + + def modify_name_and_remark(self, req=None, **kwargs): + """ ModifyNameAndRemark - 修改资源名称和备注 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Name** (str) - (Required) 名称; + - **ResourceID** (str) - (Required) 资源ID; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Remark** (str) - 描述; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.ModifyNameAndRemarkRequestSchema().dumps(d) + resp = self.invoke("ModifyNameAndRemark", d, **kwargs) + return apis.ModifyNameAndRemarkResponseSchema().loads(resp) + + def poweroff_vm_instance(self, req=None, **kwargs): + """ PoweroffVMInstance - 断电虚拟机,可能导致丢失数据甚至损坏操作系统,仅适用于虚拟机死机及级端测试场景。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **VMID** (str) - (Required) 虚拟机ID + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.PoweroffVMInstanceRequestSchema().dumps(d) + resp = self.invoke("PoweroffVMInstance", d, **kwargs) + return apis.PoweroffVMInstanceResponseSchema().loads(resp) + + def recharge(self, req=None, **kwargs): + """ Recharge - 管理员给租户充值 + + **Request** + + - **Amount** (int) - (Required) 充值金额。最少100,最大500000 + - **FromType** (str) - (Required) 充值来源。INPOUR_FROM_ALIPAY:支付宝,INPOUR_FROM_OFFLINE:银行转账,INPOUR_FROM_SINPAY:新浪支付,INPOUR_FROM_WECHAT_PAY:微信转账。 + - **SerialNo** (str) - (Required) 充值单号。充值方式为“账户余额”时为必要参数。 + - **UserID** (int) - (Required) 租户的账户ID。 + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {} + req and d.update(req) + d = apis.RechargeRequestSchema().dumps(d) + resp = self.invoke("Recharge", d, **kwargs) + return apis.RechargeResponseSchema().loads(resp) + + def reinstall_vm_instance(self, req=None, **kwargs): + """ ReinstallVMInstance - 重装系统,关机的虚拟机才可以重装系统 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **ImageID** (str) - (Required) 镜像ID + - **VMID** (str) - (Required) 虚拟机ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.ReinstallVMInstanceRequestSchema().dumps(d) + resp = self.invoke("ReinstallVMInstance", d, **kwargs) + return apis.ReinstallVMInstanceResponseSchema().loads(resp) + + def release_eip(self, req=None, **kwargs): + """ ReleaseEIP - 删除外网IP + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国;中国 + - **EIPID** (str) - (Required) 外网IP的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国 + + **Response** + + - **Message** (str) - 返回状态描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.ReleaseEIPRequestSchema().dumps(d) + resp = self.invoke("ReleaseEIP", d, **kwargs) + return apis.ReleaseEIPResponseSchema().loads(resp) + + def renew_resource(self, req=None, **kwargs): + """ RenewResource - 续费回收站资源 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **ResourceID** (str) - (Required) 待续续的资源ID + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + - **Quantity** (int) - 购买时长,默认为 1。按小时(Dynamic)付费的资源无需此参数,按月付费的资源传 0 时,代表购买至月末。 + + **Response** + + - **Message** (str) - 返回描述信息 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.RenewResourceRequestSchema().dumps(d) + resp = self.invoke("RenewResource", d, **kwargs) + return apis.RenewResourceResponseSchema().loads(resp) + + def reset_vm_instance_password(self, req=None, **kwargs): + """ ResetVMInstancePassword - 重置虚拟机密码,主机必须开机才可以重置密码 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Password** (str) - (Required) 密码 + - **VMID** (str) - (Required) 虚拟机ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.ResetVMInstancePasswordRequestSchema().dumps(d) + resp = self.invoke("ResetVMInstancePassword", d, **kwargs) + return apis.ResetVMInstancePasswordResponseSchema().loads(resp) + + def resize_vm_config(self, req=None, **kwargs): + """ ResizeVMConfig - 修改虚拟机配置 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **CPU** (int) - (Required) CPU 个数,如 1、2、4、8、16、32、64。 + - **Memory** (int) - (Required) 内存容量,如 2048、4096、8192、16384、32768、65536、131072。 + - **VMID** (str) - (Required) 虚拟机ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.ResizeVMConfigRequestSchema().dumps(d) + resp = self.invoke("ResizeVMConfig", d, **kwargs) + return apis.ResizeVMConfigResponseSchema().loads(resp) + + def restart_vm_instance(self, req=None, **kwargs): + """ RestartVMInstance - 重启虚拟机 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **VMID** (str) - (Required) 虚拟机ID; + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.RestartVMInstanceRequestSchema().dumps(d) + resp = self.invoke("RestartVMInstance", d, **kwargs) + return apis.RestartVMInstanceResponseSchema().loads(resp) + + def rollback_resource(self, req=None, **kwargs): + """ RollbackResource - 恢复回收站资源 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **ResourceID** (str) - (Required) 待恢复的资源ID + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + + **Response** + + - **Message** (str) - 返回描述信息 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.RollbackResourceRequestSchema().dumps(d) + resp = self.invoke("RollbackResource", d, **kwargs) + return apis.RollbackResourceResponseSchema().loads(resp) + + def rollback_snapshot(self, req=None, **kwargs): + """ RollbackSnapshot - 将某个快照内的数据回滚到原云硬盘,仅支持正常状态的快照进行回滚操作,回滚时硬盘必须处于未绑定或其挂载的主机为关机状态。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:如 cn,表示中国。 + - **DiskID** (str) - (Required) 对应的云硬盘 ID; + - **SnapshotID** (str) - (Required) 快照ID + - **Zone** (str) - (Required) 可用区。枚举值:如 zone-01,表示可用区1。 + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.RollbackSnapshotRequestSchema().dumps(d) + resp = self.invoke("RollbackSnapshot", d, **kwargs) + return apis.RollbackSnapshotResponseSchema().loads(resp) + + def start_vm_instance(self, req=None, **kwargs): + """ StartVMInstance - 开启虚拟机 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **VMID** (str) - (Required) 虚拟机 ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.StartVMInstanceRequestSchema().dumps(d) + resp = self.invoke("StartVMInstance", d, **kwargs) + return apis.StartVMInstanceResponseSchema().loads(resp) + + def stop_vm_instance(self, req=None, **kwargs): + """ StopVMInstance - 关闭虚拟机 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **VMID** (str) - (Required) 虚拟机 ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + - **VMID** (str) - 虚拟机 ID + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.StopVMInstanceRequestSchema().dumps(d) + resp = self.invoke("StopVMInstance", d, **kwargs) + return apis.StopVMInstanceResponseSchema().loads(resp) + + def terminate_resource(self, req=None, **kwargs): + """ TerminateResource - 销毁资源 + + **Request** + + - **Region** (str) - (Config) 地域。 + - **ResourceID** (str) - (Required) 资源id + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回描述信息 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.TerminateResourceRequestSchema().dumps(d) + resp = self.invoke("TerminateResource", d, **kwargs) + return apis.TerminateResourceResponseSchema().loads(resp) + + def un_bind_eip(self, req=None, **kwargs): + """ UnBindEIP - 解绑外网IP + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国;中国 + - **EIPID** (str) - (Required) 外网IP的ID + - **ResourceID** (str) - (Required) 资源ID + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机, LB:负载均衡, NATGW:nat网关 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UnBindEIPRequestSchema().dumps(d) + resp = self.invoke("UnBindEIP", d, **kwargs) + return apis.UnBindEIPResponseSchema().loads(resp) + + def un_bind_security_group(self, req=None, **kwargs): + """ UnBindSecurityGroup - 解绑安全组 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **ResourceID** (str) - (Required) 解绑的资源ID。调用方式举例:ResourceID=“one-id”。 + - **SGID** (str) - (Required) 安全组ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UnBindSecurityGroupRequestSchema().dumps(d) + resp = self.invoke("UnBindSecurityGroup", d, **kwargs) + return apis.UnBindSecurityGroupResponseSchema().loads(resp) + + def unbind_alarm_template(self, req=None, **kwargs): + """ UnbindAlarmTemplate - 解绑告警模板 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **AlarmTemplateID** (str) - (Required) 告警模板ID + - **ResourceIDs** (list) - (Required) 【数组】资源的 ID。调用方式举例:ResourceIDs.0=“one-id”、ResourceIDs.1=“two-id”。 + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机, LB:负载均衡, NATGW:nat网关;EIP:弹性网卡 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UnbindAlarmTemplateRequestSchema().dumps(d) + resp = self.invoke("UnbindAlarmTemplate", d, **kwargs) + return apis.UnbindAlarmTemplateResponseSchema().loads(resp) + + def unbind_physical_ip(self, req=None, **kwargs): + """ UnbindPhysicalIP - 解绑物理IP + + **Request** + + - **Region** (str) - (Config) 地域。 + - **PhysicalIPID** (str) - (Required) 物理IP的ID + - **ResourceID** (str) - (Required) 资源ID + - **ResourceType** (str) - (Required) 资源类型。VM:虚拟机 + - **Zone** (str) - (Required) 可用区。 + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UnbindPhysicalIPRequestSchema().dumps(d) + resp = self.invoke("UnbindPhysicalIP", d, **kwargs) + return apis.UnbindPhysicalIPResponseSchema().loads(resp) + + def update_alarm_template_rule(self, req=None, **kwargs): + """ UpdateAlarmTemplateRule - 更新告警模板规则 + + **Request** + + - **Region** (str) - (Config) 地域 + - **AlarmStrategy** (str) - (Required) 瘦脸策略 + - **AlarmTemplateID** (str) - (Required) 告警模板ID + - **AlarmTemplateRuleID** (str) - (Required) 告警规则ID + - **Compare** (str) - (Required) 对比方式 + - **ContactGroupID** (str) - (Required) 通知组ID + - **MetricName** (str) - (Required) 监控指标名称 + - **ResourceType** (str) - (Required) 资源类型 + - **Threshold** (str) - (Required) 告警阈值 + - **TriggerCount** (str) - (Required) 连续触发次数 + - **Zone** (str) - (Required) 可用区 + + **Response** + + - **Message** (str) - 返回描述信息 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UpdateAlarmTemplateRuleRequestSchema().dumps(d) + resp = self.invoke("UpdateAlarmTemplateRule", d, **kwargs) + return apis.UpdateAlarmTemplateRuleResponseSchema().loads(resp) + + def update_rs(self, req=None, **kwargs): + """ UpdateRS - 修改负载均衡的服务节点 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) VServer 监听器所属的负载均衡 ID + - **RSID** (str) - (Required) RServer的ID + - **VSID** (str) - (Required) RServer所属的VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Port** (int) - 端口号 + - **Weight** (int) - 权重 + + **Response** + + - **Action** (str) - 操作名称 + - **Message** (str) - 返回信息描述。 + - **RetCode** (int) - 返回码 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UpdateRSRequestSchema().dumps(d) + resp = self.invoke("UpdateRS", d, **kwargs) + return apis.UpdateRSResponseSchema().loads(resp) + + def update_security_group_rule(self, req=None, **kwargs): + """ UpdateSecurityGroupRule - 修改安全组规则 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值: cn,表示中国; + - **Rules** (list) - (Required) 【数组】规则。输入有效的 规则。调用方式举例:Rules.0=“TCP|23|0.0.0.0/0|ACCEPT|HIGH|1”、Rules.1=“TCP|55|0.0.0.0/0|ACCEPT|HIGH|1” + - **SGID** (str) - (Required) 安全组ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述; + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UpdateSecurityGroupRuleRequestSchema().dumps(d) + resp = self.invoke("UpdateSecurityGroupRule", d, **kwargs) + return apis.UpdateSecurityGroupRuleResponseSchema().loads(resp) + + def update_vs(self, req=None, **kwargs): + """ UpdateVS - 修改负载均衡VServer + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) VServer 监听器所属的负载均衡 ID + - **VSID** (str) - (Required) 需要更新的VSID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **CACertificateID** (str) - CA证书ID,用于验证客户端证书的签名,仅当VServer监听协议为 HTTPS 且 SSLMode 为双向认证时有效。 + - **Domain** (str) - HTTP 健康检查时校验请求的 HOST 字段中的域名。当健康检查类型为端口检查时,该值为空。 + - **HealthcheckType** (str) - 负载均衡的健康检查类型。枚举值:Port:端口检查;Path: HTTP检查 。仅当 VServer 协议类型为 HTTP 时,才可进行 HTTP 检查。 + - **KeepaliveTimeout** (int) - 负载均衡的连接空闲超时时间,单位为秒,默认值为 60s 。当 VServer 协议为 UDP 时,该值为空。 + - **Path** (str) - HTTP 健康检查的路径,健康检查类型为 HTTP 检查时为必填项。当健康检查类型为端口检查时,该值为空。 + - **PersistenceKey** (str) - 会话保持KEY,会话保持类型为Manual时为必填项,仅当 VServer 协议为 HTTP 时有效。 + - **PersistenceType** (str) - 会话保持类型。枚举值:None:关闭;Auto:自动生成;Manual:手动生成 。当协议为 TCP 时,该值不生效,会话保持和选择的调度算法相关;当协议为 UDP 时 Auto 表示开启会话保持 。 + - **Port** (int) - VServer 监听端口 + - **SSLMode** (str) - HTTPS SSL 认证解析模式。玫举值:UNIDIRECTIONAL:单向认证,MUTUAL:双向认证 。仅当VServer监听协议为 HTTPS 时有效。 + - **Scheduler** (str) - 负载均衡的调度算法。枚举值:wrr:加权轮训;least_conn:最小连接数;hash:原地址,四层lb使用。ip_hash:七层lb使用 + - **ServerCertificateID** (str) - 服务器证书ID,用于证明服务器的身份,仅当 VServer监听协议为 HTTPS 时有效。 + + **Response** + + - **Action** (str) - 操作名称 + - **Message** (str) - 返回信息描述。 + - **RetCode** (int) - 返回码 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UpdateVSRequestSchema().dumps(d) + resp = self.invoke("UpdateVS", d, **kwargs) + return apis.UpdateVSResponseSchema().loads(resp) + + def update_vs_policy(self, req=None, **kwargs): + """ UpdateVSPolicy - 更新七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **LBID** (str) - (Required) 负载均衡ID + - **PolicyID** (str) - (Required) 内容转发规则ID + - **VSID** (str) - (Required) VServer的ID + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Domain** (str) - 内容转发规则关联的请求域名,值可为空,即代表仅匹配路径。 + - **Path** (str) - 内容转发规则关联的请求访问路径,如 "/" 。 + - **RSIDs** (list) - 【数组】RServer的 ID。调用方式举例:RSIDs.0=“one-id”、RSIDs.1=“two-id”。 + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UpdateVSPolicyRequestSchema().dumps(d) + resp = self.invoke("UpdateVSPolicy", d, **kwargs) + return apis.UpdateVSPolicyResponseSchema().loads(resp) + + def upgrade_disk(self, req=None, **kwargs): + """ UpgradeDisk - 升级硬盘 + + **Request** + + - **Region** (str) - (Config) 地域。枚举值:cn,表示中国; + - **DiskID** (str) - (Required) 硬盘ID + - **DiskSpace** (int) - (Required) 硬盘升级后的容量, 不能小于原硬盘容量,单位为 GB 。 + - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + + **Response** + + - **Message** (str) - 返回信息描述。 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.UpgradeDiskRequestSchema().dumps(d) + resp = self.invoke("UpgradeDisk", d, **kwargs) + return apis.UpgradeDiskResponseSchema().loads(resp) diff --git a/ucloud/services/ucloudstack/schemas/__init__.py b/ucloud/services/ucloudstack/schemas/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/ucloud/services/ucloudstack/schemas/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/ucloud/services/ucloudstack/schemas/apis.py b/ucloud/services/ucloudstack/schemas/apis.py new file mode 100644 index 0000000..490291c --- /dev/null +++ b/ucloud/services/ucloudstack/schemas/apis.py @@ -0,0 +1,2631 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +from ucloud.core.typesystem import schema, fields +from ucloud.services.ucloudstack.schemas import models + +""" UCloudStack API Schema +""" +""" +API: AllocateEIP + +申请外网IP +""" + + +class AllocateEIPRequestSchema(schema.RequestSchema): + """ AllocateEIP - 申请外网IP + """ + + fields = { + "Bandwidth": fields.Int(required=True, dump_to="Bandwidth"), + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "Name": fields.Str(required=True, dump_to="Name"), + "OperatorName": fields.Str(required=True, dump_to="OperatorName"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class AllocateEIPResponseSchema(schema.ResponseSchema): + """ AllocateEIP - 申请外网IP + """ + + fields = { + "EIPID": fields.Str(required=True, load_from="EIPID"), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: AttachDisk + +绑定硬盘 +""" + + +class AttachDiskRequestSchema(schema.RequestSchema): + """ AttachDisk - 绑定硬盘 + """ + + fields = { + "DiskID": fields.Str(required=True, dump_to="DiskID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class AttachDiskResponseSchema(schema.ResponseSchema): + """ AttachDisk - 绑定硬盘 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: BindAlarmTemplate + +绑定告警模板 +""" + + +class BindAlarmTemplateRequestSchema(schema.RequestSchema): + """ BindAlarmTemplate - 绑定告警模板 + """ + + fields = { + "AlarmTemplateID": fields.Str(required=True, dump_to="AlarmTemplateID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceIDs": fields.List(fields.Str()), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class BindAlarmTemplateResponseSchema(schema.ResponseSchema): + """ BindAlarmTemplate - 绑定告警模板 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: BindEIP + +绑定UCoudStack外网IP +""" + + +class BindEIPRequestSchema(schema.RequestSchema): + """ BindEIP - 绑定UCoudStack外网IP + """ + + fields = { + "EIPID": fields.Str(required=True, dump_to="EIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class BindEIPResponseSchema(schema.ResponseSchema): + """ BindEIP - 绑定UCoudStack外网IP + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: BindPhysicalIP + +绑定物理 IP ,被绑定的资源必须处于运行中或有效状态。 +""" + + +class BindPhysicalIPRequestSchema(schema.RequestSchema): + """ BindPhysicalIP - 绑定物理 IP ,被绑定的资源必须处于运行中或有效状态。 + """ + + fields = { + "PhysicalIPID": fields.Str(required=True, dump_to="PhysicalIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class BindPhysicalIPResponseSchema(schema.ResponseSchema): + """ BindPhysicalIP - 绑定物理 IP ,被绑定的资源必须处于运行中或有效状态。 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: BindSecurityGroup + +绑定安全组 +""" + + +class BindSecurityGroupRequestSchema(schema.RequestSchema): + """ BindSecurityGroup - 绑定安全组 + """ + + fields = { + "NICID": fields.Str(required=False, dump_to="NICID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "SGID": fields.Str(required=True, dump_to="SGID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class BindSecurityGroupResponseSchema(schema.ResponseSchema): + """ BindSecurityGroup - 绑定安全组 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: CloneDisk + +克隆硬盘 +""" + + +class CloneDiskRequestSchema(schema.RequestSchema): + """ CloneDisk - 克隆硬盘 + """ + + fields = { + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "Name": fields.Str(required=True, dump_to="Name"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "SrcID": fields.Str(required=True, dump_to="SrcID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CloneDiskResponseSchema(schema.ResponseSchema): + """ CloneDisk - 克隆硬盘 + """ + + fields = { + "DiskID": fields.Str(required=True, load_from="DiskID"), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: CreateCustomImage + +创建自制镜像 +""" + + +class CreateCustomImageRequestSchema(schema.RequestSchema): + """ CreateCustomImage - 创建自制镜像 + """ + + fields = { + "ImageDescription": fields.Str( + required=False, dump_to="ImageDescription" + ), + "ImageName": fields.Str(required=True, dump_to="ImageName"), + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateCustomImageResponseSchema(schema.ResponseSchema): + """ CreateCustomImage - 创建自制镜像 + """ + + fields = { + "ImageID": fields.Str(required=True, load_from="ImageID"), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: CreateDisk + +创建硬盘 +""" + + +class CreateDiskRequestSchema(schema.RequestSchema): + """ CreateDisk - 创建硬盘 + """ + + fields = { + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "DiskSpace": fields.Int(required=True, dump_to="DiskSpace"), + "Name": fields.Str(required=True, dump_to="Name"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "SetType": fields.Str(required=True, dump_to="SetType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateDiskResponseSchema(schema.ResponseSchema): + """ CreateDisk - 创建硬盘 + """ + + fields = { + "DiskID": fields.Str(required=True, load_from="DiskID"), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: CreateLB + +创建负载均衡 +""" + + +class CreateLBRequestSchema(schema.RequestSchema): + """ CreateLB - 创建负载均衡 + """ + + fields = { + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "EIPID": fields.Str(required=False, dump_to="EIPID"), + "LBType": fields.Str(required=True, dump_to="LBType"), + "Name": fields.Str(required=True, dump_to="Name"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "SGID": fields.Str(required=False, dump_to="SGID"), + "SubnetID": fields.Str(required=True, dump_to="SubnetID"), + "VMType": fields.Str(required=True, dump_to="VMType"), + "VPCID": fields.Str(required=True, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateLBResponseSchema(schema.ResponseSchema): + """ CreateLB - 创建负载均衡 + """ + + fields = { + "LBID": fields.Str(required=False, load_from="LBID"), + "Message": fields.Str(required=False, load_from="Message"), + } + + +""" +API: CreateNATGW + +创建NAT网关 +""" + + +class CreateNATGWRequestSchema(schema.RequestSchema): + """ CreateNATGW - 创建NAT网关 + """ + + fields = { + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "EIPID": fields.Str(required=True, dump_to="EIPID"), + "Name": fields.Str(required=True, dump_to="Name"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "SGID": fields.Str(required=True, dump_to="SGID"), + "SubnetID": fields.Str(required=True, dump_to="SubnetID"), + "VMType": fields.Str(required=True, dump_to="VMType"), + "VPCID": fields.Str(required=True, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateNATGWResponseSchema(schema.ResponseSchema): + """ CreateNATGW - 创建NAT网关 + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "NATGWID": fields.Str(required=False, load_from="NATGWID"), + } + + +""" +API: CreateNATGWRule + +添加NAT网关白名单 +""" + + +class CreateNATGWRuleRequestSchema(schema.RequestSchema): + """ CreateNATGWRule - 添加NAT网关白名单 + """ + + fields = { + "BindResourceID": fields.Str(required=True, dump_to="BindResourceID"), + "NATGWID": fields.Str(required=True, dump_to="NATGWID"), + "NATGWType": fields.Str(required=True, dump_to="NATGWType"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateNATGWRuleResponseSchema(schema.ResponseSchema): + """ CreateNATGWRule - 添加NAT网关白名单 + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "RuleID": fields.Str(required=False, load_from="RuleID"), + } + + +""" +API: CreatePhysicalIP + +创建物理 IP ,需确保平台已配置物理 IP 线路相关信息及物理网络联通性。 +""" + + +class CreatePhysicalIPRequestSchema(schema.RequestSchema): + """ CreatePhysicalIP - 创建物理 IP ,需确保平台已配置物理 IP 线路相关信息及物理网络联通性。 + """ + + fields = { + "Name": fields.Str(required=True, dump_to="Name"), + "OperatorName": fields.Str(required=True, dump_to="OperatorName"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreatePhysicalIPResponseSchema(schema.ResponseSchema): + """ CreatePhysicalIP - 创建物理 IP ,需确保平台已配置物理 IP 线路相关信息及物理网络联通性。 + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "PhysicalIPID": fields.Str(required=True, load_from="PhysicalIPID"), + } + + +""" +API: CreateRS + +为负载均衡的 VServer 添加后端服务节点。 +""" + + +class CreateRSRequestSchema(schema.RequestSchema): + """ CreateRS - 为负载均衡的 VServer 添加后端服务节点。 + """ + + fields = { + "BindResourceID": fields.Str(required=True, dump_to="BindResourceID"), + "LBID": fields.Str(required=True, dump_to="LBID"), + "Port": fields.Int(required=True, dump_to="Port"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Weight": fields.Int(required=True, dump_to="Weight"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateRSResponseSchema(schema.ResponseSchema): + """ CreateRS - 为负载均衡的 VServer 添加后端服务节点。 + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "RSID": fields.Str(required=False, load_from="RSID"), + } + + +""" +API: CreateSecurityGroup + +创建安全组 +""" + + +class CreateSecurityGroupRequestSchema(schema.RequestSchema): + """ CreateSecurityGroup - 创建安全组 + """ + + fields = { + "Name": fields.Str(required=True, dump_to="Name"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "Rule": fields.List(fields.Str()), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateSecurityGroupResponseSchema(schema.ResponseSchema): + """ CreateSecurityGroup - 创建安全组 + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "SGID": fields.Str(required=False, load_from="SGID"), + } + + +""" +API: CreateSecurityGroupRule + +创建安全组规则 +""" + + +class CreateSecurityGroupRuleRequestSchema(schema.RequestSchema): + """ CreateSecurityGroupRule - 创建安全组规则 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "Rules": fields.List(fields.Str()), + "SGID": fields.Str(required=True, dump_to="SGID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateSecurityGroupRuleResponseSchema(schema.ResponseSchema): + """ CreateSecurityGroupRule - 创建安全组规则 + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "SGRuleID": fields.Str(required=False, load_from="SGRuleID"), + } + + +""" +API: CreateSnapshot + +创建硬盘快照 +""" + + +class CreateSnapshotRequestSchema(schema.RequestSchema): + """ CreateSnapshot - 创建硬盘快照 + """ + + fields = { + "DiskID": fields.Str(required=True, dump_to="DiskID"), + "Name": fields.Str(required=True, dump_to="Name"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateSnapshotResponseSchema(schema.ResponseSchema): + """ CreateSnapshot - 创建硬盘快照 + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "SnapshotID": fields.Str(required=True, load_from="SnapshotID"), + } + + +""" +API: CreateSubnet + +创建子网 +""" + + +class CreateSubnetRequestSchema(schema.RequestSchema): + """ CreateSubnet - 创建子网 + """ + + fields = { + "Name": fields.Str(required=True, dump_to="Name"), + "Network": fields.Str(required=True, dump_to="Network"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "VPCID": fields.Str(required=True, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateSubnetResponseSchema(schema.ResponseSchema): + """ CreateSubnet - 创建子网 + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "SubnetID": fields.Str(required=False, load_from="SubnetID"), + } + + +""" +API: CreateUser + +管理员添加账号 +""" + + +class CreateUserRequestSchema(schema.RequestSchema): + """ CreateUser - 管理员添加账号 + """ + + fields = { + "PassWord": fields.Str(required=True, dump_to="PassWord"), + "UserEmail": fields.Str(required=True, dump_to="UserEmail"), + } + + +class CreateUserResponseSchema(schema.ResponseSchema): + """ CreateUser - 管理员添加账号 + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "UserID": fields.Int(required=False, load_from="UserID"), + } + + +""" +API: CreateVMInstance + +创建虚拟机 +""" + + +class CreateVMInstanceRequestSchema(schema.RequestSchema): + """ CreateVMInstance - 创建虚拟机 + """ + + fields = { + "BootDiskSetType": fields.Str(required=True, dump_to="BootDiskSetType"), + "CPU": fields.Int(required=True, dump_to="CPU"), + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "DataDiskSetType": fields.Str(required=True, dump_to="DataDiskSetType"), + "DataDiskSpace": fields.Int(required=False, dump_to="DataDiskSpace"), + "GPU": fields.Int(required=False, dump_to="GPU"), + "ImageID": fields.Str(required=True, dump_to="ImageID"), + "InternalIP": fields.Str(required=False, dump_to="InternalIP"), + "LANSGID": fields.Str(required=False, dump_to="LANSGID"), + "Memory": fields.Int(required=True, dump_to="Memory"), + "Name": fields.Str(required=True, dump_to="Name"), + "Password": fields.Str(required=True, dump_to="Password"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "SubnetID": fields.Str(required=True, dump_to="SubnetID"), + "VMType": fields.Str(required=True, dump_to="VMType"), + "VPCID": fields.Str(required=True, dump_to="VPCID"), + "WANSGID": fields.Str(required=True, dump_to="WANSGID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateVMInstanceResponseSchema(schema.ResponseSchema): + """ CreateVMInstance - 创建虚拟机 + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "VMID": fields.Str(required=False, load_from="VMID"), + } + + +""" +API: CreateVPC + +创建VPC +""" + + +class CreateVPCRequestSchema(schema.RequestSchema): + """ CreateVPC - 创建VPC + """ + + fields = { + "Name": fields.Str(required=True, dump_to="Name"), + "Network": fields.Str(required=True, dump_to="Network"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateVPCResponseSchema(schema.ResponseSchema): + """ CreateVPC - 创建VPC + """ + + fields = { + "Message": fields.Str(required=True, load_from="Message"), + "VPCID": fields.Str(required=False, load_from="VPCID"), + } + + +""" +API: CreateVS + +创建负载均衡VServer +""" + + +class CreateVSRequestSchema(schema.RequestSchema): + """ CreateVS - 创建负载均衡VServer + """ + + fields = { + "Domain": fields.Str(required=False, dump_to="Domain"), + "HealthcheckType": fields.Str(required=True, dump_to="HealthcheckType"), + "KeepaliveTimeout": fields.Int( + required=False, dump_to="KeepaliveTimeout" + ), + "LBID": fields.Str(required=True, dump_to="LBID"), + "Path": fields.Str(required=False, dump_to="Path"), + "PersistenceKey": fields.Str(required=False, dump_to="PersistenceKey"), + "PersistenceType": fields.Str( + required=False, dump_to="PersistenceType" + ), + "Port": fields.Int(required=True, dump_to="Port"), + "Protocol": fields.Str(required=True, dump_to="Protocol"), + "Region": fields.Str(required=True, dump_to="Region"), + "Scheduler": fields.Str(required=True, dump_to="Scheduler"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateVSResponseSchema(schema.ResponseSchema): + """ CreateVS - 创建负载均衡VServer + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "VSID": fields.Str(required=False, load_from="VSID"), + } + + +""" +API: CreateVSPolicy + +创建七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 +""" + + +class CreateVSPolicyRequestSchema(schema.RequestSchema): + """ CreateVSPolicy - 创建七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "Domain": fields.Str(required=False, dump_to="Domain"), + "LBID": fields.Str(required=True, dump_to="LBID"), + "Path": fields.Str(required=False, dump_to="Path"), + "RSIDs": fields.List(fields.Str()), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class CreateVSPolicyResponseSchema(schema.ResponseSchema): + """ CreateVSPolicy - 创建七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "PolicyID": fields.Str(required=False, load_from="PolicyID"), + } + + +""" +API: DeleteCustomImage + +删除自制镜像 +""" + + +class DeleteCustomImageRequestSchema(schema.RequestSchema): + """ DeleteCustomImage - 删除自制镜像 + """ + + fields = { + "ImageID": fields.Str(required=True, dump_to="ImageID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteCustomImageResponseSchema(schema.ResponseSchema): + """ DeleteCustomImage - 删除自制镜像 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteDisk + +删除硬盘 +""" + + +class DeleteDiskRequestSchema(schema.RequestSchema): + """ DeleteDisk - 删除硬盘 + """ + + fields = { + "DiskID": fields.Str(required=True, dump_to="DiskID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteDiskResponseSchema(schema.ResponseSchema): + """ DeleteDisk - 删除硬盘 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteLB + +删除负载均衡 +""" + + +class DeleteLBRequestSchema(schema.RequestSchema): + """ DeleteLB - 删除负载均衡 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteLBResponseSchema(schema.ResponseSchema): + """ DeleteLB - 删除负载均衡 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteNATGW + +删除NAT网关 +""" + + +class DeleteNATGWRequestSchema(schema.RequestSchema): + """ DeleteNATGW - 删除NAT网关 + """ + + fields = { + "NATGWID": fields.Str(required=True, dump_to="NATGWID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteNATGWResponseSchema(schema.ResponseSchema): + """ DeleteNATGW - 删除NAT网关 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteNATGWRule + +删除NAT网关白名单 +""" + + +class DeleteNATGWRuleRequestSchema(schema.RequestSchema): + """ DeleteNATGWRule - 删除NAT网关白名单 + """ + + fields = { + "NATGWID": fields.Str(required=True, dump_to="NATGWID"), + "Region": fields.Str(required=True, dump_to="Region"), + "RuleID": fields.Str(required=True, dump_to="RuleID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteNATGWRuleResponseSchema(schema.ResponseSchema): + """ DeleteNATGWRule - 删除NAT网关白名单 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeletePhysicalIP + +删除物理IP +""" + + +class DeletePhysicalIPRequestSchema(schema.RequestSchema): + """ DeletePhysicalIP - 删除物理IP + """ + + fields = { + "PhysicalIPID": fields.Str(required=True, dump_to="PhysicalIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeletePhysicalIPResponseSchema(schema.ResponseSchema): + """ DeletePhysicalIP - 删除物理IP + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteRS + +移除负载均衡的单个服务节点 +""" + + +class DeleteRSRequestSchema(schema.RequestSchema): + """ DeleteRS - 移除负载均衡的单个服务节点 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "RSID": fields.Str(required=True, dump_to="RSID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteRSResponseSchema(schema.ResponseSchema): + """ DeleteRS - 移除负载均衡的单个服务节点 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteSecurityGroup + +删除安全组 +""" + + +class DeleteSecurityGroupRequestSchema(schema.RequestSchema): + """ DeleteSecurityGroup - 删除安全组 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "SGID": fields.Str(required=True, dump_to="SGID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteSecurityGroupResponseSchema(schema.ResponseSchema): + """ DeleteSecurityGroup - 删除安全组 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteSecurityGroupRule + +删除安全组规则 +""" + + +class DeleteSecurityGroupRuleRequestSchema(schema.RequestSchema): + """ DeleteSecurityGroupRule - 删除安全组规则 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "SGID": fields.Str(required=True, dump_to="SGID"), + "SGRuleID": fields.Str(required=True, dump_to="SGRuleID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteSecurityGroupRuleResponseSchema(schema.ResponseSchema): + """ DeleteSecurityGroupRule - 删除安全组规则 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteSnapshot + +删除快照,仅支持状态为正常的快照进行删除操作。 +""" + + +class DeleteSnapshotRequestSchema(schema.RequestSchema): + """ DeleteSnapshot - 删除快照,仅支持状态为正常的快照进行删除操作。 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "SnapshotID": fields.Str(required=True, dump_to="SnapshotID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteSnapshotResponseSchema(schema.ResponseSchema): + """ DeleteSnapshot - 删除快照,仅支持状态为正常的快照进行删除操作。 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteSubnet + +删除子网 +""" + + +class DeleteSubnetRequestSchema(schema.RequestSchema): + """ DeleteSubnet - 删除子网 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "SubnetID": fields.Str(required=True, dump_to="SubnetID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteSubnetResponseSchema(schema.ResponseSchema): + """ DeleteSubnet - 删除子网 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteVMInstance + +删除虚拟机 +""" + + +class DeleteVMInstanceRequestSchema(schema.RequestSchema): + """ DeleteVMInstance - 删除虚拟机 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteVMInstanceResponseSchema(schema.ResponseSchema): + """ DeleteVMInstance - 删除虚拟机 + """ + + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: DeleteVPC + +删除VPC +""" + + +class DeleteVPCRequestSchema(schema.RequestSchema): + """ DeleteVPC - 删除VPC + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "VPCID": fields.Str(required=True, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteVPCResponseSchema(schema.ResponseSchema): + """ DeleteVPC - 删除VPC + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteVS + +删除VServer +""" + + +class DeleteVSRequestSchema(schema.RequestSchema): + """ DeleteVS - 删除VServer + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteVSResponseSchema(schema.ResponseSchema): + """ DeleteVS - 删除VServer + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DeleteVSPolicy + +删除七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 +""" + + +class DeleteVSPolicyRequestSchema(schema.RequestSchema): + """ DeleteVSPolicy - 删除七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "PolicyID": fields.Str(required=True, dump_to="PolicyID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteVSPolicyResponseSchema(schema.ResponseSchema): + """ DeleteVSPolicy - 删除七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "Action": fields.Str(required=True, load_from="Action"), + "Message": fields.Str(required=False, load_from="Message"), + "RetCode": fields.Int(required=True, load_from="RetCode"), + } + + +""" +API: DescribeDisk + +获取硬盘信息 +""" + + +class DescribeDiskRequestSchema(schema.RequestSchema): + """ DescribeDisk - 获取硬盘信息 + """ + + fields = { + "DiskIDs": fields.List(fields.Str()), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeDiskResponseSchema(schema.ResponseSchema): + """ DescribeDisk - 获取硬盘信息 + """ + + fields = { + "Infos": fields.List( + models.DiskInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeEIP + +获取外网IP的信息 +""" + + +class DescribeEIPRequestSchema(schema.RequestSchema): + """ DescribeEIP - 获取外网IP的信息 + """ + + fields = { + "EIPIDs": fields.List(fields.Str()), + "Limit": fields.Str(required=False, dump_to="Limit"), + "Offset": fields.Str(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeEIPResponseSchema(schema.ResponseSchema): + """ DescribeEIP - 获取外网IP的信息 + """ + + fields = { + "Infos": fields.List( + models.EIPInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "Totalcount": fields.Int(required=False, load_from="Totalcount"), + } + + +""" +API: DescribeImage + +获取镜像信息,包括默认镜像和自制镜像。 +""" + + +class DescribeImageRequestSchema(schema.RequestSchema): + """ DescribeImage - 获取镜像信息,包括默认镜像和自制镜像。 + """ + + fields = { + "ImageIDs": fields.List(fields.Str()), + "ImageType": fields.Str(required=False, dump_to="ImageType"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeImageResponseSchema(schema.ResponseSchema): + """ DescribeImage - 获取镜像信息,包括默认镜像和自制镜像。 + """ + + fields = { + "Infos": fields.List( + models.ImageInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeLB + +获取负载均衡信息 +""" + + +class DescribeLBRequestSchema(schema.RequestSchema): + """ DescribeLB - 获取负载均衡信息 + """ + + fields = { + "LBIDs": fields.List(fields.Str()), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "SubnetID": fields.Str(required=False, dump_to="SubnetID"), + "VPCID": fields.Str(required=False, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeLBResponseSchema(schema.ResponseSchema): + """ DescribeLB - 获取负载均衡信息 + """ + + fields = { + "Infos": fields.List( + models.LBInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeMetric + +获取资源监控信息 +""" + + +class DescribeMetricRequestSchema(schema.RequestSchema): + """ DescribeMetric - 获取资源监控信息 + """ + + fields = { + "BeginTime": fields.Str(required=True, dump_to="BeginTime"), + "EndTime": fields.Str(required=True, dump_to="EndTime"), + "MetricName": fields.List(fields.Str()), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeMetricResponseSchema(schema.ResponseSchema): + """ DescribeMetric - 获取资源监控信息 + """ + + fields = { + "Infos": fields.List( + models.MetricInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=False, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeNATGW + +获取NAT网关信息 +""" + + +class DescribeNATGWRequestSchema(schema.RequestSchema): + """ DescribeNATGW - 获取NAT网关信息 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "NATGWIDs": fields.List(fields.Str()), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeNATGWResponseSchema(schema.ResponseSchema): + """ DescribeNATGW - 获取NAT网关信息 + """ + + fields = { + "Infos": fields.List( + models.NATGWInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeNATGWRule + +获取NAT网关白名单信息 +""" + + +class DescribeNATGWRuleRequestSchema(schema.RequestSchema): + """ DescribeNATGWRule - 获取NAT网关白名单信息 + """ + + fields = { + "BindResourceIDs": fields.List(fields.Str()), + "Limit": fields.Int(required=False, dump_to="Limit"), + "NATGWID": fields.Str(required=True, dump_to="NATGWID"), + "NATGWType": fields.Str(required=True, dump_to="NATGWType"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "RuleIDs": fields.List(fields.Str()), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeNATGWRuleResponseSchema(schema.ResponseSchema): + """ DescribeNATGWRule - 获取NAT网关白名单信息 + """ + + fields = { + "Infos": fields.List( + models.NATGWRuleInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribePhysicalIP + +获取物理IP信息 +""" + + +class DescribePhysicalIPRequestSchema(schema.RequestSchema): + """ DescribePhysicalIP - 获取物理IP信息 + """ + + fields = { + "Limit": fields.Str(required=False, dump_to="Limit"), + "Offset": fields.Str(required=False, dump_to="Offset"), + "PhysicalIPIDs": fields.List(fields.Str()), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribePhysicalIPResponseSchema(schema.ResponseSchema): + """ DescribePhysicalIP - 获取物理IP信息 + """ + + fields = { + "Infos": fields.List( + models.PhysicalIPInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeRS + +获取负载均衡服务的服务节点信息 +""" + + +class DescribeRSRequestSchema(schema.RequestSchema): + """ DescribeRS - 获取负载均衡服务的服务节点信息 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "RSIDs": fields.List(fields.Str()), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=False, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeRSResponseSchema(schema.ResponseSchema): + """ DescribeRS - 获取负载均衡服务的服务节点信息 + """ + + fields = { + "Infos": fields.List( + models.RSInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeRecycledResource + +查询回收站资源 +""" + + +class DescribeRecycledResourceRequestSchema(schema.RequestSchema): + """ DescribeRecycledResource - 查询回收站资源 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceIDs": fields.List(fields.Str()), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeRecycledResourceResponseSchema(schema.ResponseSchema): + """ DescribeRecycledResource - 查询回收站资源 + """ + + fields = { + "Infos": fields.List( + models.RecycledResourceInfoSchema(), + required=True, + load_from="Infos", + ), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeSecurityGroup + +查询安全组信息 +""" + + +class DescribeSecurityGroupRequestSchema(schema.RequestSchema): + """ DescribeSecurityGroup - 查询安全组信息 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "SGIDs": fields.List(fields.Str()), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeSecurityGroupResponseSchema(schema.ResponseSchema): + """ DescribeSecurityGroup - 查询安全组信息 + """ + + fields = { + "Infos": fields.List( + models.SGInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeStorageType + +查询存储类型 +""" + + +class DescribeStorageTypeRequestSchema(schema.RequestSchema): + """ DescribeStorageType - 查询存储类型 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeStorageTypeResponseSchema(schema.ResponseSchema): + """ DescribeStorageType - 查询存储类型 + """ + + fields = { + "Infos": fields.List( + models.StorageTypeInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeSubnet + +查询子网信息 +""" + + +class DescribeSubnetRequestSchema(schema.RequestSchema): + """ DescribeSubnet - 查询子网信息 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "SubnetIDs": fields.List(fields.Str()), + "VPCID": fields.Str(required=False, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeSubnetResponseSchema(schema.ResponseSchema): + """ DescribeSubnet - 查询子网信息 + """ + + fields = { + "Infos": fields.List( + models.SubnetInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeUser + +查询租户信息 +""" + + +class DescribeUserRequestSchema(schema.RequestSchema): + """ DescribeUser - 查询租户信息 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "UserIDs": fields.List(fields.Int()), + } + + +class DescribeUserResponseSchema(schema.ResponseSchema): + """ DescribeUser - 查询租户信息 + """ + + fields = { + "Infos": fields.List( + models.UserInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeVMInstance + +查询虚拟机 +""" + + +class DescribeVMInstanceRequestSchema(schema.RequestSchema): + """ DescribeVMInstance - 查询虚拟机 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Str(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "SubnetID": fields.Str(required=False, dump_to="SubnetID"), + "VMIDs": fields.List(fields.Str()), + "VPCID": fields.Str(required=False, dump_to="VPCID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeVMInstanceResponseSchema(schema.ResponseSchema): + """ DescribeVMInstance - 查询虚拟机 + """ + + fields = { + "Infos": fields.List( + models.VMInstanceInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=False, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeVMType + +查询主机机型 +""" + + +class DescribeVMTypeRequestSchema(schema.RequestSchema): + """ DescribeVMType - 查询主机机型 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeVMTypeResponseSchema(schema.ResponseSchema): + """ DescribeVMType - 查询主机机型 + """ + + fields = { + "Infos": fields.List( + models.VMTypeInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeVPC + +查询VPC信息 +""" + + +class DescribeVPCRequestSchema(schema.RequestSchema): + """ DescribeVPC - 查询VPC信息 + """ + + fields = { + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "VPCIDs": fields.List(fields.Str()), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeVPCResponseSchema(schema.ResponseSchema): + """ DescribeVPC - 查询VPC信息 + """ + + fields = { + "Infos": fields.List( + models.VPCInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeVS + +获取负载均衡 VServer 信息 +""" + + +class DescribeVSRequestSchema(schema.RequestSchema): + """ DescribeVS - 获取负载均衡 VServer 信息 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSIDs": fields.List(fields.Str()), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeVSResponseSchema(schema.ResponseSchema): + """ DescribeVS - 获取负载均衡 VServer 信息 + """ + + fields = { + "Infos": fields.List( + models.VSInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DescribeVSPolicy + +获取七层负载均衡内容转发规则信息,仅当 VServer 的监听协议为 HTTP 时有效。 +""" + + +class DescribeVSPolicyRequestSchema(schema.RequestSchema): + """ DescribeVSPolicy - 获取七层负载均衡内容转发规则信息,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "PolicyIDs": fields.List(fields.Str()), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=False, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeVSPolicyResponseSchema(schema.ResponseSchema): + """ DescribeVSPolicy - 获取七层负载均衡内容转发规则信息,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "Infos": fields.List( + models.VSPolicyInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + +""" +API: DetachDisk + +解绑UClouStack硬盘 +""" + + +class DetachDiskRequestSchema(schema.RequestSchema): + """ DetachDisk - 解绑UClouStack硬盘 + """ + + fields = { + "DiskID": fields.Str(required=True, dump_to="DiskID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DetachDiskResponseSchema(schema.ResponseSchema): + """ DetachDisk - 解绑UClouStack硬盘 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: DisableRS + +禁用负载均衡的单个服务节点 +""" + + +class DisableRSRequestSchema(schema.RequestSchema): + """ DisableRS - 禁用负载均衡的单个服务节点 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "RSID": fields.Str(required=True, dump_to="RSID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DisableRSResponseSchema(schema.ResponseSchema): + """ DisableRS - 禁用负载均衡的单个服务节点 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: EnableRS + +启用负载均衡的单个服务节点 +""" + + +class EnableRSRequestSchema(schema.RequestSchema): + """ EnableRS - 启用负载均衡的单个服务节点 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "RSID": fields.Str(required=True, dump_to="RSID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class EnableRSResponseSchema(schema.ResponseSchema): + """ EnableRS - 启用负载均衡的单个服务节点 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: GetDiskPrice + +获取硬盘价格 +""" + + +class GetDiskPriceRequestSchema(schema.RequestSchema): + """ GetDiskPrice - 获取硬盘价格 + """ + + fields = { + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "DiskSpace": fields.Int(required=True, dump_to="DiskSpace"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "SetType": fields.Str(required=True, dump_to="SetType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class GetDiskPriceResponseSchema(schema.ResponseSchema): + """ GetDiskPrice - 获取硬盘价格 + """ + + fields = { + "Infos": fields.List( + models.PriceInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: GetEIPPrice + +获取外网IP价格 +""" + + +class GetEIPPriceRequestSchema(schema.RequestSchema): + """ GetEIPPrice - 获取外网IP价格 + """ + + fields = { + "Bandwidth": fields.Int(required=True, dump_to="Bandwidth"), + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "OpertatorName": fields.Str(required=True, dump_to="OpertatorName"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class GetEIPPriceResponseSchema(schema.ResponseSchema): + """ GetEIPPrice - 获取外网IP价格 + """ + + fields = { + "Infos": fields.List( + models.PriceInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + } + + +""" +API: GetVMInstancePrice + +获取虚拟机价格 +""" + + +class GetVMInstancePriceRequestSchema(schema.RequestSchema): + """ GetVMInstancePrice - 获取虚拟机价格 + """ + + fields = { + "BootDiskSetType": fields.Str(required=True, dump_to="BootDiskSetType"), + "CPU": fields.Int(required=True, dump_to="CPU"), + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "DataDiskSetType": fields.Str(required=True, dump_to="DataDiskSetType"), + "DataDiskSpace": fields.Int(required=True, dump_to="DataDiskSpace"), + "GPU": fields.Int(required=False, dump_to="GPU"), + "ImageID": fields.Str(required=True, dump_to="ImageID"), + "Memory": fields.Int(required=True, dump_to="Memory"), + "OSType": fields.Str(required=True, dump_to="OSType"), + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "VMType": fields.Str(required=True, dump_to="VMType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class GetVMInstancePriceResponseSchema(schema.ResponseSchema): + """ GetVMInstancePrice - 获取虚拟机价格 + """ + + fields = { + "Infos": fields.List( + models.PriceInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=False, load_from="Message"), + } + + +""" +API: ModifyEIPBandwidth + +调整外网IP带宽 +""" + + +class ModifyEIPBandwidthRequestSchema(schema.RequestSchema): + """ ModifyEIPBandwidth - 调整外网IP带宽 + """ + + fields = { + "Bandwidth": fields.Int(required=True, dump_to="Bandwidth"), + "EIPID": fields.Str(required=True, dump_to="EIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ModifyEIPBandwidthResponseSchema(schema.ResponseSchema): + """ ModifyEIPBandwidth - 调整外网IP带宽 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: ModifyNameAndRemark + +修改资源名称和备注 +""" + + +class ModifyNameAndRemarkRequestSchema(schema.RequestSchema): + """ ModifyNameAndRemark - 修改资源名称和备注 + """ + + fields = { + "Name": fields.Str(required=True, dump_to="Name"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ModifyNameAndRemarkResponseSchema(schema.ResponseSchema): + """ ModifyNameAndRemark - 修改资源名称和备注 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: PoweroffVMInstance + +断电虚拟机,可能导致丢失数据甚至损坏操作系统,仅适用于虚拟机死机及级端测试场景。 +""" + + +class PoweroffVMInstanceRequestSchema(schema.RequestSchema): + """ PoweroffVMInstance - 断电虚拟机,可能导致丢失数据甚至损坏操作系统,仅适用于虚拟机死机及级端测试场景。 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class PoweroffVMInstanceResponseSchema(schema.ResponseSchema): + """ PoweroffVMInstance - 断电虚拟机,可能导致丢失数据甚至损坏操作系统,仅适用于虚拟机死机及级端测试场景。 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: Recharge + +管理员给租户充值 +""" + + +class RechargeRequestSchema(schema.RequestSchema): + """ Recharge - 管理员给租户充值 + """ + + fields = { + "Amount": fields.Int(required=True, dump_to="Amount"), + "FromType": fields.Str(required=True, dump_to="FromType"), + "SerialNo": fields.Str(required=True, dump_to="SerialNo"), + "UserID": fields.Int(required=True, dump_to="UserID"), + } + + +class RechargeResponseSchema(schema.ResponseSchema): + """ Recharge - 管理员给租户充值 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: ReinstallVMInstance + +重装系统,关机的虚拟机才可以重装系统 +""" + + +class ReinstallVMInstanceRequestSchema(schema.RequestSchema): + """ ReinstallVMInstance - 重装系统,关机的虚拟机才可以重装系统 + """ + + fields = { + "ImageID": fields.Str(required=True, dump_to="ImageID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ReinstallVMInstanceResponseSchema(schema.ResponseSchema): + """ ReinstallVMInstance - 重装系统,关机的虚拟机才可以重装系统 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: ReleaseEIP + +删除外网IP +""" + + +class ReleaseEIPRequestSchema(schema.RequestSchema): + """ ReleaseEIP - 删除外网IP + """ + + fields = { + "EIPID": fields.Str(required=True, dump_to="EIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ReleaseEIPResponseSchema(schema.ResponseSchema): + """ ReleaseEIP - 删除外网IP + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: RenewResource + +续费回收站资源 +""" + + +class RenewResourceRequestSchema(schema.RequestSchema): + """ RenewResource - 续费回收站资源 + """ + + fields = { + "Quantity": fields.Int(required=False, dump_to="Quantity"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class RenewResourceResponseSchema(schema.ResponseSchema): + """ RenewResource - 续费回收站资源 + """ + + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: ResetVMInstancePassword + +重置虚拟机密码,主机必须开机才可以重置密码 +""" + + +class ResetVMInstancePasswordRequestSchema(schema.RequestSchema): + """ ResetVMInstancePassword - 重置虚拟机密码,主机必须开机才可以重置密码 + """ + + fields = { + "Password": fields.Str(required=True, dump_to="Password"), + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ResetVMInstancePasswordResponseSchema(schema.ResponseSchema): + """ ResetVMInstancePassword - 重置虚拟机密码,主机必须开机才可以重置密码 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: ResizeVMConfig + +修改虚拟机配置 +""" + + +class ResizeVMConfigRequestSchema(schema.RequestSchema): + """ ResizeVMConfig - 修改虚拟机配置 + """ + + fields = { + "CPU": fields.Int(required=True, dump_to="CPU"), + "Memory": fields.Int(required=True, dump_to="Memory"), + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class ResizeVMConfigResponseSchema(schema.ResponseSchema): + """ ResizeVMConfig - 修改虚拟机配置 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: RestartVMInstance + +重启虚拟机 +""" + + +class RestartVMInstanceRequestSchema(schema.RequestSchema): + """ RestartVMInstance - 重启虚拟机 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class RestartVMInstanceResponseSchema(schema.ResponseSchema): + """ RestartVMInstance - 重启虚拟机 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: RollbackResource + +恢复回收站资源 +""" + + +class RollbackResourceRequestSchema(schema.RequestSchema): + """ RollbackResource - 恢复回收站资源 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class RollbackResourceResponseSchema(schema.ResponseSchema): + """ RollbackResource - 恢复回收站资源 + """ + + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: RollbackSnapshot + +将某个快照内的数据回滚到原云硬盘,仅支持正常状态的快照进行回滚操作,回滚时硬盘必须处于未绑定或其挂载的主机为关机状态。 +""" + + +class RollbackSnapshotRequestSchema(schema.RequestSchema): + """ RollbackSnapshot - 将某个快照内的数据回滚到原云硬盘,仅支持正常状态的快照进行回滚操作,回滚时硬盘必须处于未绑定或其挂载的主机为关机状态。 + """ + + fields = { + "DiskID": fields.Str(required=True, dump_to="DiskID"), + "Region": fields.Str(required=True, dump_to="Region"), + "SnapshotID": fields.Str(required=True, dump_to="SnapshotID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class RollbackSnapshotResponseSchema(schema.ResponseSchema): + """ RollbackSnapshot - 将某个快照内的数据回滚到原云硬盘,仅支持正常状态的快照进行回滚操作,回滚时硬盘必须处于未绑定或其挂载的主机为关机状态。 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: StartVMInstance + +开启虚拟机 +""" + + +class StartVMInstanceRequestSchema(schema.RequestSchema): + """ StartVMInstance - 开启虚拟机 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class StartVMInstanceResponseSchema(schema.ResponseSchema): + """ StartVMInstance - 开启虚拟机 + """ + + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: StopVMInstance + +关闭虚拟机 +""" + + +class StopVMInstanceRequestSchema(schema.RequestSchema): + """ StopVMInstance - 关闭虚拟机 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "VMID": fields.Str(required=True, dump_to="VMID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class StopVMInstanceResponseSchema(schema.ResponseSchema): + """ StopVMInstance - 关闭虚拟机 + """ + + fields = { + "Message": fields.Str(required=False, load_from="Message"), + "VMID": fields.Str(required=False, load_from="VMID"), + } + + +""" +API: TerminateResource + +销毁资源 +""" + + +class TerminateResourceRequestSchema(schema.RequestSchema): + """ TerminateResource - 销毁资源 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class TerminateResourceResponseSchema(schema.ResponseSchema): + """ TerminateResource - 销毁资源 + """ + + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: UnBindEIP + +解绑外网IP +""" + + +class UnBindEIPRequestSchema(schema.RequestSchema): + """ UnBindEIP - 解绑外网IP + """ + + fields = { + "EIPID": fields.Str(required=True, dump_to="EIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UnBindEIPResponseSchema(schema.ResponseSchema): + """ UnBindEIP - 解绑外网IP + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: UnBindSecurityGroup + +解绑安全组 +""" + + +class UnBindSecurityGroupRequestSchema(schema.RequestSchema): + """ UnBindSecurityGroup - 解绑安全组 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "SGID": fields.Str(required=True, dump_to="SGID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UnBindSecurityGroupResponseSchema(schema.ResponseSchema): + """ UnBindSecurityGroup - 解绑安全组 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: UnbindAlarmTemplate + +解绑告警模板 +""" + + +class UnbindAlarmTemplateRequestSchema(schema.RequestSchema): + """ UnbindAlarmTemplate - 解绑告警模板 + """ + + fields = { + "AlarmTemplateID": fields.Str(required=True, dump_to="AlarmTemplateID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceIDs": fields.List(fields.Str()), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UnbindAlarmTemplateResponseSchema(schema.ResponseSchema): + """ UnbindAlarmTemplate - 解绑告警模板 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: UnbindPhysicalIP + +解绑物理IP +""" + + +class UnbindPhysicalIPRequestSchema(schema.RequestSchema): + """ UnbindPhysicalIP - 解绑物理IP + """ + + fields = { + "PhysicalIPID": fields.Str(required=True, dump_to="PhysicalIPID"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=True, dump_to="ResourceID"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UnbindPhysicalIPResponseSchema(schema.ResponseSchema): + """ UnbindPhysicalIP - 解绑物理IP + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: UpdateAlarmTemplateRule + +更新告警模板规则 +""" + + +class UpdateAlarmTemplateRuleRequestSchema(schema.RequestSchema): + """ UpdateAlarmTemplateRule - 更新告警模板规则 + """ + + fields = { + "AlarmStrategy": fields.Str(required=True, dump_to="AlarmStrategy"), + "AlarmTemplateID": fields.Str(required=True, dump_to="AlarmTemplateID"), + "AlarmTemplateRuleID": fields.Str( + required=True, dump_to="AlarmTemplateRuleID" + ), + "Compare": fields.Str(required=True, dump_to="Compare"), + "ContactGroupID": fields.Str(required=True, dump_to="ContactGroupID"), + "MetricName": fields.Str(required=True, dump_to="MetricName"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceType": fields.Str(required=True, dump_to="ResourceType"), + "Threshold": fields.Str(required=True, dump_to="Threshold"), + "TriggerCount": fields.Str(required=True, dump_to="TriggerCount"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateAlarmTemplateRuleResponseSchema(schema.ResponseSchema): + """ UpdateAlarmTemplateRule - 更新告警模板规则 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: UpdateRS + +修改负载均衡的服务节点 +""" + + +class UpdateRSRequestSchema(schema.RequestSchema): + """ UpdateRS - 修改负载均衡的服务节点 + """ + + fields = { + "LBID": fields.Str(required=True, dump_to="LBID"), + "Port": fields.Int(required=False, dump_to="Port"), + "RSID": fields.Str(required=True, dump_to="RSID"), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Weight": fields.Int(required=False, dump_to="Weight"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateRSResponseSchema(schema.ResponseSchema): + """ UpdateRS - 修改负载均衡的服务节点 + """ + + fields = { + "Action": fields.Str(required=True, load_from="Action"), + "Message": fields.Str(required=False, load_from="Message"), + "RetCode": fields.Int(required=True, load_from="RetCode"), + } + + +""" +API: UpdateSecurityGroupRule + +修改安全组规则 +""" + + +class UpdateSecurityGroupRuleRequestSchema(schema.RequestSchema): + """ UpdateSecurityGroupRule - 修改安全组规则 + """ + + fields = { + "Region": fields.Str(required=True, dump_to="Region"), + "Rules": fields.List(fields.Str()), + "SGID": fields.Str(required=True, dump_to="SGID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateSecurityGroupRuleResponseSchema(schema.ResponseSchema): + """ UpdateSecurityGroupRule - 修改安全组规则 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + +""" +API: UpdateVS + +修改负载均衡VServer +""" + + +class UpdateVSRequestSchema(schema.RequestSchema): + """ UpdateVS - 修改负载均衡VServer + """ + + fields = { + "CACertificateID": fields.Str( + required=False, dump_to="CACertificateID" + ), + "Domain": fields.Str(required=False, dump_to="Domain"), + "HealthcheckType": fields.Str( + required=False, dump_to="HealthcheckType" + ), + "KeepaliveTimeout": fields.Int( + required=False, dump_to="KeepaliveTimeout" + ), + "LBID": fields.Str(required=True, dump_to="LBID"), + "Path": fields.Str(required=False, dump_to="Path"), + "PersistenceKey": fields.Str(required=False, dump_to="PersistenceKey"), + "PersistenceType": fields.Str( + required=False, dump_to="PersistenceType" + ), + "Port": fields.Int(required=False, dump_to="Port"), + "Region": fields.Str(required=True, dump_to="Region"), + "SSLMode": fields.Str(required=False, dump_to="SSLMode"), + "Scheduler": fields.Str(required=False, dump_to="Scheduler"), + "ServerCertificateID": fields.Str( + required=False, dump_to="ServerCertificateID" + ), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateVSResponseSchema(schema.ResponseSchema): + """ UpdateVS - 修改负载均衡VServer + """ + + fields = { + "Action": fields.Str(required=True, load_from="Action"), + "Message": fields.Str(required=False, load_from="Message"), + "RetCode": fields.Int(required=True, load_from="RetCode"), + } + + +""" +API: UpdateVSPolicy + +更新七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 +""" + + +class UpdateVSPolicyRequestSchema(schema.RequestSchema): + """ UpdateVSPolicy - 更新七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = { + "Domain": fields.Str(required=False, dump_to="Domain"), + "LBID": fields.Str(required=True, dump_to="LBID"), + "Path": fields.Str(required=False, dump_to="Path"), + "PolicyID": fields.Str(required=True, dump_to="PolicyID"), + "RSIDs": fields.List(fields.Str()), + "Region": fields.Str(required=True, dump_to="Region"), + "VSID": fields.Str(required=True, dump_to="VSID"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpdateVSPolicyResponseSchema(schema.ResponseSchema): + """ UpdateVSPolicy - 更新七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 + """ + + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: UpgradeDisk + +升级硬盘 +""" + + +class UpgradeDiskRequestSchema(schema.RequestSchema): + """ UpgradeDisk - 升级硬盘 + """ + + fields = { + "DiskID": fields.Str(required=True, dump_to="DiskID"), + "DiskSpace": fields.Int(required=True, dump_to="DiskSpace"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class UpgradeDiskResponseSchema(schema.ResponseSchema): + """ UpgradeDisk - 升级硬盘 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} diff --git a/ucloud/services/ucloudstack/schemas/models.py b/ucloud/services/ucloudstack/schemas/models.py new file mode 100644 index 0000000..0bf3674 --- /dev/null +++ b/ucloud/services/ucloudstack/schemas/models.py @@ -0,0 +1,468 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +from ucloud.core.typesystem import schema, fields + + +class DiskInfoSchema(schema.ResponseSchema): + """ DiskInfo - 磁盘信息 + """ + + fields = { + "AttachResourceID": fields.Str( + required=False, load_from="AttachResourceID" + ), + "ChargeType": fields.Str(required=False, load_from="ChargeType"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "DiskID": fields.Str(required=False, load_from="DiskID"), + "DiskStatus": fields.Str(required=False, load_from="DiskStatus"), + "ExpireTime": fields.Int(required=False, load_from="ExpireTime"), + "Name": fields.Str(required=False, load_from="Name"), + "Region": fields.Str(required=False, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "SetType": fields.Str(required=False, load_from="SetType"), + "Size": fields.Int(required=False, load_from="Size"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + +class EIPInfoSchema(schema.ResponseSchema): + """ EIPInfo - 外网IP信息 + """ + + fields = { + "Bandwidth": fields.Int(required=False, load_from="Bandwidth"), + "BindResourceID": fields.Str( + required=False, load_from="BindResourceID" + ), + "BindResourceType": fields.Str( + required=False, load_from="BindResourceType" + ), + "ChargeType": fields.Str(required=False, load_from="ChargeType"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "EIPID": fields.Str(required=False, load_from="EIPID"), + "ExpireTime": fields.Int(required=False, load_from="ExpireTime"), + "IP": fields.Str(required=False, load_from="IP"), + "Name": fields.Str(required=False, load_from="Name"), + "OperatorName": fields.Str(required=False, load_from="OperatorName"), + "Region": fields.Str(required=False, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "Status": fields.Str(required=False, load_from="Status"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + +class ImageInfoSchema(schema.ResponseSchema): + """ ImageInfo - 镜像信息 + """ + + fields = { + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "ImageID": fields.Str(required=True, load_from="ImageID"), + "ImageStatus": fields.Str(required=True, load_from="ImageStatus"), + "ImageType": fields.Str(required=True, load_from="ImageType"), + "Name": fields.Str(required=True, load_from="Name"), + "OSDistribution": fields.Str(required=True, load_from="OSDistribution"), + "OSName": fields.Str(required=True, load_from="OSName"), + "OSType": fields.Str(required=True, load_from="OSType"), + "Region": fields.Str(required=True, load_from="Region"), + "SetArch": fields.Str(required=True, load_from="SetArch"), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class LBInfoSchema(schema.ResponseSchema): + """ LBInfo - 负载均衡信息 + """ + + fields = { + "AlarmTemplateID": fields.Str( + required=True, load_from="AlarmTemplateID" + ), + "ChargeType": fields.Str(required=True, load_from="ChargeType"), + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "ExpireTime": fields.Int(required=True, load_from="ExpireTime"), + "LBID": fields.Str(required=True, load_from="LBID"), + "LBStatus": fields.Str(required=True, load_from="LBStatus"), + "LBType": fields.Str(required=True, load_from="LBType"), + "Name": fields.Str(required=True, load_from="Name"), + "PrivateIP": fields.Str(required=False, load_from="PrivateIP"), + "PublicIP": fields.Str(required=False, load_from="PublicIP"), + "Region": fields.Str(required=True, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "SGID": fields.Str(required=False, load_from="SGID"), + "SubnetID": fields.Str(required=True, load_from="SubnetID"), + "VPCID": fields.Str(required=True, load_from="VPCID"), + "VSCount": fields.Int(required=True, load_from="VSCount"), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class MetricSetSchema(schema.ResponseSchema): + """ MetricSet - 监控值 + """ + + fields = { + "Timestamp": fields.Int(required=False, load_from="Timestamp"), + "Value": fields.Float(required=False, load_from="Value"), + } + + +class MetricInfoSchema(schema.ResponseSchema): + """ MetricInfo - 监控信息 + """ + + fields = { + "Infos": fields.List(MetricSetSchema()), + "MetricName": fields.Str(required=False, load_from="MetricName"), + } + + +class NATGWInfoSchema(schema.ResponseSchema): + """ NATGWInfo - NAT网关信息 + """ + + fields = { + "AlarmTemplateID": fields.Str( + required=True, load_from="AlarmTemplateID" + ), + "ChargeType": fields.Str(required=True, load_from="ChargeType"), + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "EIP": fields.Str(required=True, load_from="EIP"), + "ExpireTime": fields.Int(required=True, load_from="ExpireTime"), + "NATGWID": fields.Str(required=True, load_from="NATGWID"), + "NATGWStatus": fields.Str(required=True, load_from="NATGWStatus"), + "Name": fields.Str(required=True, load_from="Name"), + "Region": fields.Str(required=True, load_from="Region"), + "Remark": fields.Str(required=True, load_from="Remark"), + "SGID": fields.Str(required=True, load_from="SGID"), + "SubnetID": fields.Str(required=True, load_from="SubnetID"), + "VPCID": fields.Str(required=True, load_from="VPCID"), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class NATGWRuleInfoSchema(schema.ResponseSchema): + """ NATGWRuleInfo - NAT网关关联的白名单资源信息 + """ + + fields = { + "BindResourceID": fields.Str(required=True, load_from="BindResourceID"), + "BindResourceType": fields.Str( + required=True, load_from="BindResourceType" + ), + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "IP": fields.Str(required=True, load_from="IP"), + "NATGWID": fields.Str(required=True, load_from="NATGWID"), + "NATGWType": fields.Str(required=True, load_from="NATGWType"), + "Name": fields.Str(required=True, load_from="Name"), + "RuleID": fields.Str(required=True, load_from="RuleID"), + "RuleStatus": fields.Str(required=True, load_from="RuleStatus"), + } + + +class PhysicalIPInfoSchema(schema.ResponseSchema): + """ PhysicalIPInfo - 物理IP信息 + """ + + fields = { + "BindResourceID": fields.Str(required=True, load_from="BindResourceID"), + "BindResourceType": fields.Str( + required=True, load_from="BindResourceType" + ), + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "IP": fields.Str(required=True, load_from="IP"), + "Name": fields.Str(required=True, load_from="Name"), + "OperatorName": fields.Str(required=True, load_from="OperatorName"), + "PhysicalIPID": fields.Str(required=True, load_from="PhysicalIPID"), + "Region": fields.Str(required=True, load_from="Region"), + "Remark": fields.Str(required=True, load_from="Remark"), + "Status": fields.Str(required=True, load_from="Status"), + "UpdateTime": fields.Int(required=True, load_from="UpdateTime"), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class RSInfoSchema(schema.ResponseSchema): + """ RSInfo - 转发规则关联的服务节点信息 + """ + + fields = { + "BindResourceID": fields.Str(required=True, load_from="BindResourceID"), + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "IP": fields.Str(required=True, load_from="IP"), + "LBID": fields.Str(required=True, load_from="LBID"), + "Name": fields.Str(required=True, load_from="Name"), + "Port": fields.Int(required=True, load_from="Port"), + "RSID": fields.Str(required=True, load_from="RSID"), + "RSMode": fields.Str(required=True, load_from="RSMode"), + "RSStatus": fields.Str(required=True, load_from="RSStatus"), + "UpdateTime": fields.Int(required=True, load_from="UpdateTime"), + "VSID": fields.Str(required=True, load_from="VSID"), + "Weight": fields.Int(required=True, load_from="Weight"), + } + + +class RecycledResourceInfoSchema(schema.ResponseSchema): + """ RecycledResourceInfo - 回收站资源信息 + """ + + fields = { + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "DeleteTime": fields.Int(required=True, load_from="DeleteTime"), + "Description": fields.Str(required=True, load_from="Description"), + "ExpireTime": fields.Int(required=True, load_from="ExpireTime"), + "IsAutoTerminated": fields.Bool( + required=True, load_from="IsAutoTerminated" + ), + "Name": fields.Str(required=True, load_from="Name"), + "Region": fields.Str(required=True, load_from="Region"), + "ResourceID": fields.Str(required=True, load_from="ResourceID"), + "ResourceType": fields.Str(required=True, load_from="ResourceType"), + "Status": fields.Str(required=False, load_from="Status"), + "WillTerminateTime": fields.Int( + required=True, load_from="WillTerminateTime" + ), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class SGRuleInfoSchema(schema.ResponseSchema): + """ SGRuleInfo - 安全组规则信息 + """ + + fields = { + "DstPort": fields.Str(required=False, load_from="DstPort"), + "IsIn": fields.Str(required=False, load_from="IsIn"), + "Priority": fields.Str(required=False, load_from="Priority"), + "ProtocolType": fields.Str(required=False, load_from="ProtocolType"), + "RuleAction": fields.Str(required=False, load_from="RuleAction"), + "RuleID": fields.Str(required=False, load_from="RuleID"), + "SrcIP": fields.Str(required=False, load_from="SrcIP"), + } + + +class SGInfoSchema(schema.ResponseSchema): + """ SGInfo - 安全组信息 + """ + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Name": fields.Str(required=False, load_from="Name"), + "Region": fields.Str(required=False, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "ResourceCount": fields.Int(required=False, load_from="ResourceCount"), + "Rule": fields.List(SGRuleInfoSchema()), + "RuleCount": fields.Int(required=False, load_from="RuleCount"), + "SGID": fields.Str(required=False, load_from="SGID"), + "Status": fields.Str(required=False, load_from="Status"), + "UpdateTime": fields.Int(required=False, load_from="UpdateTime"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + +class StorageTypeInfoSchema(schema.ResponseSchema): + """ StorageTypeInfo - 存储类型信息 + """ + + fields = { + "Region": fields.Str(required=True, load_from="Region"), + "SetArch": fields.Str(required=True, load_from="SetArch"), + "StorageType": fields.Str(required=True, load_from="StorageType"), + "StorageTypeAlias": fields.Str( + required=True, load_from="StorageTypeAlias" + ), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class SubnetInfoSchema(schema.ResponseSchema): + """ SubnetInfo - 子网信息 + """ + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Name": fields.Str(required=False, load_from="Name"), + "Network": fields.Str(required=False, load_from="Network"), + "Region": fields.Str(required=False, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "State": fields.Str(required=False, load_from="State"), + "SubnetID": fields.Str(required=False, load_from="SubnetID"), + "UpdateTime": fields.Int(required=False, load_from="UpdateTime"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + +class UserInfoSchema(schema.ResponseSchema): + """ UserInfo - 租户信息 + """ + + fields = { + "Amount": fields.Float(required=False, load_from="Amount"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Email": fields.Str(required=False, load_from="Email"), + "PrivateKey": fields.Str(required=False, load_from="PrivateKey"), + "PublicKey": fields.Str(required=False, load_from="PublicKey"), + "Status": fields.Str(required=False, load_from="Status"), + "UpdateTime": fields.Int(required=False, load_from="UpdateTime"), + "UserID": fields.Int(required=False, load_from="UserID"), + } + + +class VMIPInfoSchema(schema.ResponseSchema): + """ VMIPInfo - UCloudStack虚拟机IP信息 + """ + + fields = { + "IP": fields.Str(required=False, load_from="IP"), + "InterfaceID": fields.Str(required=False, load_from="InterfaceID"), + "IsElastic": fields.Str(required=False, load_from="IsElastic"), + "MAC": fields.Str(required=False, load_from="MAC"), + "SGID": fields.Str(required=False, load_from="SGID"), + "SGName": fields.Str(required=False, load_from="SGName"), + "SubnetID": fields.Str(required=False, load_from="SubnetID"), + "SubnetName": fields.Str(required=False, load_from="SubnetName"), + "Type": fields.Str(required=False, load_from="Type"), + "VPCID": fields.Str(required=False, load_from="VPCID"), + "VPCName": fields.Str(required=False, load_from="VPCName"), + } + + +class VMDiskInfoSchema(schema.ResponseSchema): + """ VMDiskInfo - UCloudStack虚拟机磁盘信息 + """ + + fields = { + "DiskID": fields.Str(required=False, load_from="DiskID"), + "Drive": fields.Str(required=False, load_from="Drive"), + "IsElastic": fields.Str(required=False, load_from="IsElastic"), + "Name": fields.Str(required=False, load_from="Name"), + "Size": fields.Int(required=False, load_from="Size"), + "Type": fields.Str(required=False, load_from="Type"), + } + + +class VMInstanceInfoSchema(schema.ResponseSchema): + """ VMInstanceInfo - UCloudStack虚拟机信息 + """ + + fields = { + "CPU": fields.Int(required=False, load_from="CPU"), + "ChargeType": fields.Str(required=False, load_from="ChargeType"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "DiskInfos": fields.List(VMDiskInfoSchema()), + "ExpireTime": fields.Int(required=False, load_from="ExpireTime"), + "IPInfos": fields.List(VMIPInfoSchema()), + "ImageID": fields.Str(required=False, load_from="ImageID"), + "Memory": fields.Int(required=False, load_from="Memory"), + "Name": fields.Str(required=False, load_from="Name"), + "OSName": fields.Str(required=False, load_from="OSName"), + "OSType": fields.Str(required=False, load_from="OSType"), + "Region": fields.Str(required=False, load_from="Region"), + "RegionAlias": fields.Str(required=False, load_from="RegionAlias"), + "Remark": fields.Str(required=False, load_from="Remark"), + "State": fields.Str(required=False, load_from="State"), + "SubnetID": fields.Str(required=False, load_from="SubnetID"), + "SubnetName": fields.Str(required=False, load_from="SubnetName"), + "VMID": fields.Str(required=False, load_from="VMID"), + "VMType": fields.Str(required=False, load_from="VMType"), + "VMTypeAlias": fields.Str(required=False, load_from="VMTypeAlias"), + "VPCID": fields.Str(required=False, load_from="VPCID"), + "VPCName": fields.Str(required=False, load_from="VPCName"), + "Zone": fields.Str(required=False, load_from="Zone"), + "ZoneAlias": fields.Str(required=False, load_from="ZoneAlias"), + } + + +class VMTypeInfoSchema(schema.ResponseSchema): + """ VMTypeInfo - 主机机型信息 + """ + + fields = { + "Region": fields.Str(required=True, load_from="Region"), + "SetArch": fields.Str(required=True, load_from="SetArch"), + "VMType": fields.Str(required=True, load_from="VMType"), + "VMTypeAlias": fields.Str(required=True, load_from="VMTypeAlias"), + "Zone": fields.Str(required=True, load_from="Zone"), + } + + +class VPCInfoSchema(schema.ResponseSchema): + """ VPCInfo - VPC信息 + """ + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Name": fields.Str(required=False, load_from="Name"), + "Network": fields.Str(required=False, load_from="Network"), + "Region": fields.Str(required=False, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "State": fields.Str(required=False, load_from="State"), + "SubnetCount": fields.Int(required=False, load_from="SubnetCount"), + "SubnetInfos": fields.List(SubnetInfoSchema()), + "UpdateTime": fields.Int(required=False, load_from="UpdateTime"), + "VPCID": fields.Str(required=False, load_from="VPCID"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + +class VSPolicyInfoSchema(schema.ResponseSchema): + """ VSPolicyInfo - 内容转发规则信息 + """ + + fields = { + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "Domain": fields.Str(required=True, load_from="Domain"), + "LBID": fields.Str(required=True, load_from="LBID"), + "Path": fields.Str(required=True, load_from="Path"), + "PolicyID": fields.Str(required=True, load_from="PolicyID"), + "PolicyStatus": fields.Str(required=True, load_from="PolicyStatus"), + "RSInfos": fields.List(RSInfoSchema()), + "UpdateTime": fields.Int(required=True, load_from="UpdateTime"), + "VSID": fields.Str(required=True, load_from="VSID"), + } + + +class VSInfoSchema(schema.ResponseSchema): + """ VSInfo - RServer信息 + """ + + fields = { + "AlarmTemplateID": fields.Str( + required=True, load_from="AlarmTemplateID" + ), + "CreateTime": fields.Int(required=True, load_from="CreateTime"), + "Domain": fields.Str(required=False, load_from="Domain"), + "HealthcheckType": fields.Str( + required=True, load_from="HealthcheckType" + ), + "KeepaliveTimeout": fields.Int( + required=True, load_from="KeepaliveTimeout" + ), + "LBID": fields.Str(required=True, load_from="LBID"), + "Path": fields.Str(required=False, load_from="Path"), + "PersistenceKey": fields.Str( + required=False, load_from="PersistenceKey" + ), + "PersistenceType": fields.Str( + required=True, load_from="PersistenceType" + ), + "Port": fields.Int(required=True, load_from="Port"), + "Protocol": fields.Str(required=True, load_from="Protocol"), + "RSHealthStatus": fields.Str(required=True, load_from="RSHealthStatus"), + "RSInfos": fields.List(RSInfoSchema()), + "UpdateTime": fields.Int(required=True, load_from="UpdateTime"), + "VSID": fields.Str(required=True, load_from="VSID"), + "VSPolicyInfos": fields.List(VSPolicyInfoSchema()), + "VSStatus": fields.Str(required=True, load_from="VSStatus"), + } + + +class PriceInfoSchema(schema.ResponseSchema): + """ PriceInfo - 价格信息 + """ + + fields = { + "ChargeType": fields.Str(required=True, load_from="ChargeType"), + "Price": fields.Float(required=True, load_from="Price"), + } diff --git a/ucloud/version.py b/ucloud/version.py index 8c1bf01..8166ff6 100644 --- a/ucloud/version.py +++ b/ucloud/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -version = "0.8.2" +version = "0.9.0"