From 1e8f87b7099e614001156077ccc0f8ab2a7c03b5 Mon Sep 17 00:00:00 2001 From: UCloud Date: Fri, 5 Jun 2020 13:19:39 +0800 Subject: [PATCH] auto release for 0.9.1 (#17) --- tests/test_acceptance/conftest.py | 2 +- tests/test_acceptance/test_scenario_5292.py | 1018 +++++++++++++++++ ucloud/services/ucloudstack/client.py | 196 +++- ucloud/services/ucloudstack/schemas/apis.py | 159 ++- ucloud/services/ucloudstack/schemas/models.py | 88 +- ucloud/version.py | 2 +- 6 files changed, 1412 insertions(+), 53 deletions(-) create mode 100644 tests/test_acceptance/test_scenario_5292.py diff --git a/tests/test_acceptance/conftest.py b/tests/test_acceptance/conftest.py index 662029b..b77c39a 100644 --- a/tests/test_acceptance/conftest.py +++ b/tests/test_acceptance/conftest.py @@ -11,7 +11,7 @@ def ustack_client(): return Client( { - "base_url": "http://192.168.179.2/api", + "base_url": "http://console.pre.ucloudstack.com/api", "region": "cn", "public_key": os.getenv("UCLOUDSTACK_PUBLIC_KEY"), "private_key": os.getenv("UCLOUDSTACK_PRIVATE_KEY"), diff --git a/tests/test_acceptance/test_scenario_5292.py b/tests/test_acceptance/test_scenario_5292.py new file mode 100644 index 0000000..cc1ea83 --- /dev/null +++ b/tests/test_acceptance/test_scenario_5292.py @@ -0,0 +1,1018 @@ +# -*- 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(5292, "UCloudStack_05", owners=["lisa.wang@ucloud.cn"]) + + +@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason()) +def test_scenario_5292(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_vm_type_02(ustack_client) + describe_storage_type_03(ustack_client) + describe_image_04(ustack_client) + create_vm_instance_05(ustack_client) + create_vm_instance_06(ustack_client) + describe_vm_instance_07(ustack_client) + describe_vm_instance_08(ustack_client) + create_certificate_09(ustack_client) + create_certificate_10(ustack_client) + describe_certificate_11(ustack_client) + describe_certificate_12(ustack_client) + create_lb_13(ustack_client) + describe_lb_14(ustack_client) + create_vs_15(ustack_client) + create_rs_16(ustack_client) + describe_rs_17(ustack_client) + update_vs_18(ustack_client) + delete_rs_19(ustack_client) + delete_vs_20(ustack_client) + describe_op_logs_21(ustack_client) + delete_lb_22(ustack_client) + delete_certificate_23(ustack_client) + delete_certificate_24(ustack_client) + poweroff_vm_instance_25(ustack_client) + poweroff_vm_instance_26(ustack_client) + delete_vm_instance_27(ustack_client) + delete_vm_instance_28(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", "DescribeVMTypeResponse"), + ], + action="DescribeVMType", +) +def describe_vm_type_02(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"] = utest.value_at_path(resp, "Infos.0.VMType") + 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_03(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", "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["Image_id"] = utest.value_at_path(resp, "Infos.0.ImageID") + 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", "CreateVMInstanceResponse"), + ], + action="CreateVMInstance", +) +def create_vm_instance_05(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "WANSGID": variables.get("SGID"), + "VPCID": variables.get("VPCID"), + "VMType": "ComputeSetBBBB", + "SubnetID": variables.get("SubnetID"), + "Region": variables.get("Region"), + "Password": "Zhongshang_2018", + "Name": "host_test", + "Memory": 2048, + "ImageID": "cn-image-centos-65", + "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=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": "ComputeSetBBBB", + "SubnetID": variables.get("SubnetID"), + "Region": variables.get("Region"), + "Password": "Zhongshang_2018", + "Name": "host_test", + "Memory": 2048, + "ImageID": "cn-image-centos-65", + "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["EIPID"] = utest.value_at_path(resp, "EIPID") + variables["DiskID"] = utest.value_at_path(resp, "DiskID") + variables["VMID_1"] = 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() + 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", "DescribeVMInstanceResponse"), + ("str_eq", "Infos.0.State", "Running"), + ], + action="DescribeVMInstance", +) +def describe_vm_instance_08(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VMIDs": [variables.get("VMID_1")], + "Region": variables.get("Region"), + } + try: + resp = client.ucloudstack().describe_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", "CreateCertificateResponse"), + ], + action="CreateCertificate", +) +def create_certificate_09(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "PrivateKey": """-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEA8QbLsBnQmXRFLONEkHL1LfvYZZi04HH5Kv4fX9UFT8S6vzwv +jrBu+oToMujfH+5O8eV4LTyovTuMnRZfFYmIRF0Y2EHFK05t5bu7PVE9gCFJitHS +Pj2YBVOYA8IfH0C6C9uE9pT35A/U54Apw2p36N8W8f3vYbCZH+4SlosfM68bWGAl +E7feqU6UHlo6+4IJdmwxH02siTTPoucaBgT4kBXcT5ylgozZl4tncLNHdsIYtXrk +VoCOcCF44uVin1H+hL8xtFM8+ovL7Eixr/KS+wtALlCODKzzQ3rBXgNixGHJUJKR +xBOPQZKULwqJAlvXfP6+QElK8vu0qySJ3FOhcQIDAQABAoIBAAPvZnfzk/JNcauv +8jihh9s+V2QhQCLB+Z14FK8N3U5WGe5xXx1nSAiTDu912d69l1BfvLyQVvjv9fXC +nb7ORglHs9YkDMIOP8EWdZIkt2pWIMtBbbtSah78JGk7TCLIfcEfzmXwPLPehk1Z +TFVCcb69lbRRvwzLQ1TA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SA PRIVATE KEY-----""", + "Name": "server", + "CertificateType": "ServerCrt", + "Certificate": """-----BEGIN CERTIFICATE----- +MIIFzTCCBLWgAwIBAgIQQ8IswmAhEIKfNhrKqb0F3DANBgkqhkiG9w0BAQsFADCB +lzELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs +IEluYy4xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxHTAbBgNVBAsT +FERvbWFpbiBWYWxpZGF0ZWQgU1NMMSEwHwYDVQQDExhUcnVzdEFzaWEgRFYgU1NM +IENBIC0gRzUwHhcNMTYxMjA2MDAwMDAwWhcNMTcxMjA2MjM1OTU5WjAgMR4wHAYD +VQQDDBVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDxBsuwGdCZdEUs40SQcvUt+9hlmLTgcfkq/h9f1QVPxLq/PC+O +sG76hOgy6N8f7k7x5XgtPKi9O4ydFl8ViYhEXRjYQcUrTm3lu7s9UT2AIUmK0dI+ +PZgFU5gDwh8fQLoL24T2lPfkD9TngCnDanfo3xbx/e9hsJkf7hKWix8zrxtYYCUT +t96pTpQeWjr7ggl2bDEfTayJNM+i5xoGBPiQFdxPnKWCjNmXi2dws0d2whi1euRW +gI5wIXji5WKfUf6EvzG0Uzz6i8vsSLGv8pL7C0AuUI4MrPNDesFeA2LEYclQkpHE +E49BkpQvCokCW9d8/r5ASUry+7SrJIncU6FxAgMBAAGjggKJMIIChTAgBgNVHREE +GTAXghVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wCQYDVR0TBAIwADBhBgNVHSAEWjBY +MFYGBmeBDAECATBMMCMGCCsGAQUFBwIBFhdodHRwczovL2Quc3ltY2IuY29tL2Nw +czAlBggrBgEFBQcCAjAZDBdodHRwczovL2Quc3ltY2IuY29tL3JwYTAfBgNVHSME +GDAWgBRtWMd/GufhPy6mjJc1Qrv00z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5bWNiLmNvbS9wY2EzLWc1LmNybDAOBgNVHQ8B +Af8EBAMCAQYwLgYIKwYBBQUHAQEEIjAgMB4GCCsGAQUFBzABhhJodHRwOi8vcy5z +eW1jZC5jb20wYQYDVR0gBFowWDBWBgZngQwBAgEwTDAjBggrBgEFBQcCARYXaHR0 +cHM6Ly9kLnN5bWNiLmNvbS9jcHMwJQYIKwYBBQUHAgIwGRoXaHR0cHM6Ly9kLnN5 +bWNiLmNvbS9ycGEwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCkGA1Ud +EQQiMCCkHjAcMRowGAYDVQQDExFTeW1hbnRlY1BLSS0yLTYwMTAdBgNVHQ4EFgQU +bVjHfxrn4T8upoyXNUK79NM4rD8wHwYDVR0jBBgwFoAUf9Nlp8Ld7LvwMAnzQzn6 +Aq8zMTMwDQYJKoZIhvcNAQELBQADggEBABUphhBbeG7scE3EveIN0dOjXPgwgQi8 +I2ZAKYm6DawoGz1lEJVdvFmkyMbP973X80b7mKmn0nNbe1kjA4M0O0hHaMM1ZaEv +7e9vHEAoGyysMO6HzPWYMkyNxcCV7Nos2Uv4RvLDpQHh7P4Kt6fUU13ipcynrtQD +1lFUM0yoTzwwFsPu3Pk+94hL58ErqwqJQwxoHMgLIQeMVHeNKcWFy1bddSbIbCWU +Zs6cMxhrra062ZCpDCbxyEaFNGAtYQMqNz55Z/14XgSUONZ/cJTns6QKhpcgTOwB +fnNzRnk+aWreP7osKhXlz4zs+llP7goBDKFOMMtoEXx3YjJCKgpqmBU= +-----END CERTIFICATE-----""", + } + try: + resp = client.ucloudstack().create_certificate(d) + except exc.RetCodeException as e: + resp = e.json() + variables["CertificateID_server"] = utest.value_at_path( + resp, "CertificateID" + ) + 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", "CreateCertificateResponse"), + ], + action="CreateCertificate", +) +def create_certificate_10(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "Name": "ssl_client", + "CertificateType": "CACrt", + "Certificate": """-----BEGIN CERTIFICATE----- +MIIFzTCCBLWgAwIBAgIQQ8IswmAhEIKfNhrKqb0F3DANBgkqhkiG9w0BAQsFADCB +lzELMAkGA1UEBhMCQ04xJTAjBgNVBAoTHFRydXN0QXNpYSBUZWNobm9sb2dpZXMs +IEluYy4xHzAdBgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxHTAbBgNVBAsT +FERvbWFpbiBWYWxpZGF0ZWQgU1NMMSEwHwYDVQQDExhUcnVzdEFzaWEgRFYgU1NM +IENBIC0gRzUwHhcNMTYxMjA2MDAwMDAwWhcNMTcxMjA2MjM1OTU5WjAgMR4wHAYD +VQQDDBVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDxBsuwGdCZdEUs40SQcvUt+9hlmLTgcfkq/h9f1QVPxLq/PC+O +sG76hOgy6N8f7k7x5XgtPKi9O4ydFl8ViYhEXRjYQcUrTm3lu7s9UT2AIUmK0dI+ +PZgFU5gDwh8fQLoL24T2lPfkD9TngCnDanfo3xbx/e9hsJkf7hKWix8zrxtYYCUT +t96pTpQeWjr7ggl2bDEfTayJNM+i5xoGBPiQFdxPnKWCjNmXi2dws0d2whi1euRW +gI5wIXji5WKfUf6EvzG0Uzz6i8vsSLGv8pL7C0AuUI4MrPNDesFeA2LEYclQkpHE +E49BkpQvCokCW9d8/r5ASUry+7SrJIncU6FxAgMBAAGjggKJMIIChTAgBgNVHREE +GTAXghVtLmVjb2xvZ3ktZW1vYmlsZS5jb20wCQYDVR0TBAIwADBhBgNVHSAEWjBY +MFYGBmeBDAECATBMMCMGCCsGAQUFBwIBFhdodHRwczovL2Quc3ltY2IuY29tL2Nw +czAlBggrBgEFBQcCAjAZDBdodHRwczovL2Quc3ltY2IuY29tL3JwYTAfB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A1UdHwQo +MCYwJKAioCCGHmh0dHA6Ly9zLnN5bWNiLmNvbS9wY2EzLWc1LmNybDAOBgNVHQ8B +Af8EBAMCAQYwLgYIKwYBBQUHAQEEIjAgMB4GCCsGAQUFBzABhhJodHRwOi8vcy5z +eW1jZC5jb20wYQYDVR0gBFowWDBWBgZngQwBAgEwTDAjBggrBgEFBQcCARYXaHR0 +cHM6Ly9kLnN5bWNiLmNvbS9jcHMwJQYIKwYBBQUHAgIwGRoXaHR0cHM6Ly9kLnN5 +bWNiLmNvbS9ycGEwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMCkGA1Ud +EQQiMCCkHjAcMRowGAYDVQQDExFTeW1hbnRlY1BLSS0yLTYwMTAdBgNVHQ4EFgQU +bVjHfxrn4T8upoyXNUK79NM4rD8wHwYDVR0jBBgwFoAUf9Nlp8Ld7LvwMAnzQzn6 +Aq8zMTMwDQYJKoZIhvcNAQELBQADggEBABUphhBbeG7scE3EveIN0dOjXPgwgQi8 +I2ZAKYm6DawoGz1lEJVdvFmkyMbP973X80b7mKmn0nNbe1kjA4M0O0hHaMM1ZaEv +7e9vHEAoGyysMO6HzPWYMkyNxcCV7Nos2Uv4RvLDpQHh7P4Kt6fUU13ipcynrtQD +1lFUM0yoTzwwFsPu3Pk+94hL58ErqwqJQwxoHMgLIQeMVHeNKcWFy1bddSbIbCWU +Zs6cMxhrra062ZCpDCbxyEaFNGAtYQMqNz55Z/14XgSUONZ/cJTns6QKhpcgTOwB +fnNzRnk+aWreP7osKhXlz4zs+llP7goBDKFOMMtoEXx3YjJCKgpqmBU= +-----END CERTIFICATE-----""", + } + try: + resp = client.ucloudstack().create_certificate(d) + except exc.RetCodeException as e: + resp = e.json() + variables["CertificateID_client"] = utest.value_at_path( + resp, "CertificateID" + ) + return resp + + +@scenario.api( + title="查询证书", + max_retries=3, + retry_interval=1, + startup_delay=5, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeCertificateResponse"), + ], + action="DescribeCertificate", +) +def describe_certificate_11(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "CertificateType": "ServerCrt", + "CertificateIDs": [variables.get("CertificateID_server")], + } + try: + resp = client.ucloudstack().describe_certificate(d) + except exc.RetCodeException as e: + resp = e.json() + variables["ssl_ser"] = utest.value_at_path(resp, "Infos.0.CertificateID") + return resp + + +@scenario.api( + title="查询证书", + max_retries=3, + retry_interval=1, + startup_delay=5, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeCertificateResponse"), + ], + action="DescribeCertificate", +) +def describe_certificate_12(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "CertificateType": "CACrt", + "CertificateIDs": [variables.get("CertificateID_client")], + } + try: + resp = client.ucloudstack().describe_certificate(d) + except exc.RetCodeException as e: + resp = e.json() + variables["ssl_cl"] = utest.value_at_path(resp, "Infos.0.CertificateID") + 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_13(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VPCID": variables.get("VPCID"), + "VMType": "ComputeSetBBBB", + "SubnetID": variables.get("SubnetID"), + "Region": variables.get("Region"), + "Name": "lb_test1", + "LBType": "LAN", + "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=90, + 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_14(step, client): + variables = step.store + d = {"Zone": variables.get("Zone"), "Region": variables.get("Region")} + 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_15(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "ServerCertificateID": variables.get("ssl_ser"), + "Scheduler": "wrr", + "SSLMode": "duplex", + "Region": variables.get("Region"), + "Protocol": "HTTPS", + "Port": 443, + "LBID": variables.get("LBID"), + "HealthcheckType": "Port", + "CACertificateID": variables.get("ssl_cl"), + } + 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="添加服务节点", + 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_16(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Weight": 1, + "VSID": variables.get("VSID"), + "Region": variables.get("Region"), + "Port": 189, + "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=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeRSResponse"), + ], + action="DescribeRS", +) +def describe_rs_17(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() + 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", "UpdateVSResponse"), + ], + action="UpdateVS", +) +def update_vs_18(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=30, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteRSResponse"), + ], + action="DeleteRS", +) +def delete_rs_19(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="删除VServer", + max_retries=3, + retry_interval=1, + startup_delay=10, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteVSResponse"), + ], + action="DeleteVS", +) +def delete_vs_20(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().delete_vs(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", "DescribeOPLogsResponse"), + ], + action="DescribeOPLogs", +) +def describe_op_logs_21(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "ResourceType": "lb", + "ResourceID": variables.get("LBID"), + "Region": variables.get("Region"), + "Offset": 0, + "Limit": 100, + "IsSuccess": 1, + "EndTime": variables.get("EndTime"), + "BeginTime": variables.get("BeginTime"), + } + try: + resp = client.ucloudstack().describe_op_logs(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_22(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 + + +@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", "DeleteCertificateResponse"), + ], + action="DeleteCertificate", +) +def delete_certificate_23(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "CertificateID": variables.get("CertificateID_server"), + } + try: + resp = client.ucloudstack().delete_certificate(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", "DeleteCertificateResponse"), + ], + action="DeleteCertificate", +) +def delete_certificate_24(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "Region": variables.get("Region"), + "CertificateID": variables.get("CertificateID_client"), + } + try: + resp = client.ucloudstack().delete_certificate(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=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "PoweroffVMInstanceResponse"), + ], + action="PoweroffVMInstance", +) +def poweroff_vm_instance_26(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VMID": variables.get("VMID_1"), + "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=30, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteVMInstanceResponse"), + ], + action="DeleteVMInstance", +) +def delete_vm_instance_27(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=30, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteVMInstanceResponse"), + ], + action="DeleteVMInstance", +) +def delete_vm_instance_28(step, client): + variables = step.store + d = { + "Zone": variables.get("Zone"), + "VMID": variables.get("VMID_1"), + "Region": variables.get("Region"), + } + try: + resp = client.ucloudstack().delete_vm_instance(d) + except exc.RetCodeException as e: + resp = e.json() + return resp diff --git a/ucloud/services/ucloudstack/client.py b/ucloud/services/ucloudstack/client.py index 8ac117b..ac3591d 100644 --- a/ucloud/services/ucloudstack/client.py +++ b/ucloud/services/ucloudstack/client.py @@ -170,6 +170,31 @@ def clone_disk(self, req=None, **kwargs): resp = self.invoke("CloneDisk", d, **kwargs) return apis.CloneDiskResponseSchema().loads(resp) + def create_certificate(self, req=None, **kwargs): + """ CreateCertificate - 创建证书 + + **Request** + + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **Certificate** (str) - (Required) 证书内容 + - **CertificateType** (str) - (Required) 证书类型,枚举值["ServerCrt","CACrt"]。分别表示服务器证书和CA证书。只有在双向认证的时候才需要CA证书 + - **Name** (str) - (Required) 证书名称 + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **PrivateKey** (str) - 私钥内容,服务器证书必传,CA证书不用传递 + - **Remark** (str) - 证书描述 + + **Response** + + - **CertificateID** (str) - 证书ID + - **Message** (str) - 错误描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.CreateCertificateRequestSchema().dumps(d) + resp = self.invoke("CreateCertificate", d, **kwargs) + return apis.CreateCertificateResponseSchema().loads(resp) + def create_custom_image(self, req=None, **kwargs): """ CreateCustomImage - 创建自制镜像 @@ -479,16 +504,22 @@ def create_vm_instance(self, req=None, **kwargs): - **VPCID** (str) - (Required) VPC ID。 - **WANSGID** (str) - (Required) 外网安全组 ID。输入“有效”状态的安全组的ID。 - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **Bandwidth** (str) - 带宽 - **DataDiskSpace** (int) - 数据盘大小,单位 GB。默认值为0。范围:【0,8000】,步长10。 - **GPU** (int) - GPU 卡核心的占用个数。枚举值:【1,2,4】。GPU与CPU、内存大小关系:CPU个数>=4*GPU个数,同时内存与CPU规格匹配. + - **IPVersion** (str) - 外网IP版本,默认IPv4 - **InternalIP** (str) - 指定内网IP。输入有效的指定内网 IP。默认为系统自动分配内网 IP。 + - **InternetIP** (str) - 指定外网IP - **LANSGID** (str) - 内网安全组 ID。输入“有效”状态的安全组的ID。 + - **OperatorName** (str) - 线路 - **Quantity** (int) - 购买时长。默认值1。小时不生效,月范围【1,11】,年范围【1,5】。 **Response** + - **DiskID** (str) - 返回创建数据盘的 ID + - **EIPID** (str) - 返回创建外网IP的 ID - **Message** (str) - 返回信息描述。 - - **VMID** (str) - 返回创建虚拟机的 ID 数组。 + - **VMID** (str) - 返回创建虚拟机的 ID """ d = {"Region": self.config.region} @@ -529,14 +560,17 @@ def create_vs(self, req=None, **kwargs): - **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:原地址。 + - **Protocol** (str) - (Required) VServer 的监听协议。枚举值:支持 TCP、UDP、HTTP、HTTPS 四种协议转发。 + - **Scheduler** (str) - (Required) 负载均衡的调度算法。枚举值:wrr:加权轮训;least_conn:最小连接数;hash:原地址,四层lb使用。ip_hash:七层lb使用 - **Zone** (str) - (Required) 可用区。枚举值:zone-01,表示中国; + - **CACertificateID** (str) - CA证书ID,用于验证客户端证书的签名,仅当VServer监听协议为 HTTPS 且 SSLMode 为双向认证时有效。 - **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 表示开启会话保持 。 + - **SSLMode** (str) - SSL认证模式,HTTPS协议下必传,取值范围["simplex","duplex"]分别表示单向认证和双向认证。 + - **ServerCertificateID** (str) - 服务器证书ID,用于证明服务器的身份,仅当 VServer监听协议为 HTTPS时有效。 **Response** @@ -575,6 +609,26 @@ def create_vs_policy(self, req=None, **kwargs): resp = self.invoke("CreateVSPolicy", d, **kwargs) return apis.CreateVSPolicyResponseSchema().loads(resp) + def delete_certificate(self, req=None, **kwargs): + """ DeleteCertificate - 删除证书 + + **Request** + + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **CertificateID** (str) - (Required) 证书ID + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + + **Response** + + - **Message** (str) - 返回信息描述 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DeleteCertificateRequestSchema().dumps(d) + resp = self.invoke("DeleteCertificate", d, **kwargs) + return apis.DeleteCertificateResponseSchema().loads(resp) + def delete_custom_image(self, req=None, **kwargs): """ DeleteCustomImage - 删除自制镜像 @@ -873,9 +927,7 @@ def delete_vs_policy(self, req=None, **kwargs): **Response** - - **Action** (str) - 操作名称 - **Message** (str) - 返回信息描述。 - - **RetCode** (int) - 返回码 """ d = {"Region": self.config.region} @@ -884,6 +936,58 @@ def delete_vs_policy(self, req=None, **kwargs): resp = self.invoke("DeleteVSPolicy", d, **kwargs) return apis.DeleteVSPolicyResponseSchema().loads(resp) + def describe_certificate(self, req=None, **kwargs): + """ DescribeCertificate - 查询证书 + + **Request** + + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **CertificateIDs** (list) - 证书ID列表 + - **CertificateType** (str) - 证书类型,枚举值["ServerCrt","CACrt"]。分别表示服务器证书和CA证书。 + - **Limit** (int) - 返回数据长度,默认为20,最大100 + - **Offset** (int) - 列表起始位置偏移量,默认为0 + + **Response** + + - **Infos** (list) - 见 **CertificateInfo** 模型定义 + - **Message** (str) - 返回信息描述 + - **TotalCount** (int) - 证书总个数 + + **Response Model** + + **BindVSInfo** + + - **LBID** (str) - LB ID + - **LBName** (str) - LB名称 + - **Port** (int) - VS的端口 + - **Protocol** (str) - VS的协议 + - **VSID** (str) - VS ID + + **CertificateInfo** + + - **CertificateContent** (str) - 证书内容 + - **CertificateID** (str) - 证书ID + - **CertificateType** (str) - 证书类型,枚举值["ServerCrt","CACrt"] + - **CommonName** (str) - 主域名 + - **CreateTime** (int) - 创建时间(平台创建时间) + - **ExpireTime** (int) - 证书内容的过期时间 + - **Fingerprint** (str) - 证书指纹 + - **Name** (str) - 证书名 + - **Privatekey** (str) - 私钥内容 + - **Region** (str) - 地域 + - **Remark** (str) - 证书描述 + - **SubjectAlternativeNames** (list) - 备域名 + - **VSInfos** (list) - 见 **BindVSInfo** 模型定义 + - **Zone** (str) - 可用区 + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeCertificateRequestSchema().dumps(d) + resp = self.invoke("DescribeCertificate", d, **kwargs) + return apis.DescribeCertificateResponseSchema().loads(resp) + def describe_disk(self, req=None, **kwargs): """ DescribeDisk - 获取硬盘信息 @@ -982,8 +1086,10 @@ def describe_image(self, req=None, **kwargs): **Response** + - **Action** (str) - 操作名称 - **Infos** (list) - 见 **ImageInfo** 模型定义 - **Message** (str) - 返回信息描述。 + - **RetCode** (int) - 返回码 - **TotalCount** (int) - 返回镜像的总个数。 **Response Model** @@ -992,7 +1098,7 @@ def describe_image(self, req=None, **kwargs): - **CreateTime** (int) - 创建时间。时间戳。 - **ImageID** (str) - 镜像ID - - **ImageStatus** (str) - 镜像状态。枚举类型:Making(创建中),Available(可用),Unavailable(不可用),Terminating(销毁中),Used(被使用中),Deleting(删除中),Deleted(已删除) + - **ImageStatus** (str) - 镜像状态。枚举类型:Making(创建中),Available(可用),Unavailable(不可用),Terminating(销毁中),Used(被使用中),Deleting(删除中),Deleted(已删除), Uploading(导入中) - **ImageType** (str) - 镜像类型。枚举类型:Base(基础镜像),Custom(自制镜像)。 - **Name** (str) - 镜像名称 - **OSDistribution** (str) - 镜像系统发行版本。例如:Centos, Ubuntu, Windows等 @@ -1179,6 +1285,51 @@ def describe_natgw_rule(self, req=None, **kwargs): resp = self.invoke("DescribeNATGWRule", d, **kwargs) return apis.DescribeNATGWRuleResponseSchema().loads(resp) + def describe_op_logs(self, req=None, **kwargs): + """ DescribeOPLogs - 查询操作日志 + + **Request** + + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 `_ + - **BeginTime** (int) - (Required) 开始时间 + - **EndTime** (int) - (Required) 结束时间 + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 `_ + - **IsSuccess** (str) - 是否操作成功 + - **Limit** (int) - + - **Offset** (int) - + - **ResourceID** (str) - 资源ID + - **ResourceType** (str) - 资源类型 + + **Response** + + - **Infos** (list) - 见 **OPLogInfo** 模型定义 + - **Message** (str) - 错误信息 + - **TotalCount** (int) - 总数 + + **Response Model** + + **OPLogInfo** + + - **CreateTime** (int) - 创建时间 + - **IsSuccess** (str) - 是否操作成功, Yes, No + - **OPLogsID** (str) - 日志ID + - **OPName** (str) - API + - **OPTime** (int) - 操作时间 + - **OpMessage** (str) - 错误信息 + - **Region** (str) - + - **ResourceID** (str) - 资源ID + - **ResourceType** (int) - 资源类型 + - **RetCode** (int) - 状态码 + - **UserEmail** (str) - 账号邮箱 + - **Zone** (str) - + + """ + d = {"Region": self.config.region} + req and d.update(req) + d = apis.DescribeOPLogsRequestSchema().dumps(d) + resp = self.invoke("DescribeOPLogs", d, **kwargs) + return apis.DescribeOPLogsResponseSchema().loads(resp) + def describe_physical_ip(self, req=None, **kwargs): """ DescribePhysicalIP - 获取物理IP信息 @@ -1482,6 +1633,7 @@ def describe_vm_instance(self, req=None, **kwargs): **VMIPInfo** - **IP** (str) - IP 值 + - **IPVersion** (str) - IP版本,支持值:IPv4\\IPv6 - **InterfaceID** (str) - 网卡 ID - **IsElastic** (str) - 是否是弹性网卡。枚举值:Y,表示是;N,表示否; - **MAC** (str) - MAC 地址值 @@ -1518,7 +1670,7 @@ def describe_vm_instance(self, req=None, **kwargs): - **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,表示修改防火墙中; + - **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 @@ -1639,6 +1791,18 @@ def describe_vs(self, req=None, **kwargs): **Response Model** + **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 + **RSInfo** - **BindResourceID** (str) - 绑定的资源ID @@ -1654,18 +1818,6 @@ def describe_vs(self, req=None, **kwargs): - **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 @@ -2354,9 +2506,7 @@ def update_rs(self, req=None, **kwargs): **Response** - - **Action** (str) - 操作名称 - **Message** (str) - 返回信息描述。 - - **RetCode** (int) - 返回码 """ d = {"Region": self.config.region} @@ -2403,15 +2553,13 @@ def update_vs(self, req=None, **kwargs): - **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 时有效。 + - **SSLMode** (str) - SSL认证模式,HTTPS协议下必传,取值范围["simplex","duplex"]分别表示单向认证和双向认证。 - **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} diff --git a/ucloud/services/ucloudstack/schemas/apis.py b/ucloud/services/ucloudstack/schemas/apis.py index 490291c..1453d8c 100644 --- a/ucloud/services/ucloudstack/schemas/apis.py +++ b/ucloud/services/ucloudstack/schemas/apis.py @@ -204,6 +204,38 @@ class CloneDiskResponseSchema(schema.ResponseSchema): } +""" +API: CreateCertificate + +创建证书 +""" + + +class CreateCertificateRequestSchema(schema.RequestSchema): + """ CreateCertificate - 创建证书 + """ + + fields = { + "Certificate": fields.Str(required=True, dump_to="Certificate"), + "CertificateType": fields.Str(required=True, dump_to="CertificateType"), + "Name": fields.Str(required=True, dump_to="Name"), + "PrivateKey": fields.Str(required=False, dump_to="PrivateKey"), + "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 CreateCertificateResponseSchema(schema.ResponseSchema): + """ CreateCertificate - 创建证书 + """ + + fields = { + "CertificateID": fields.Str(required=True, load_from="CertificateID"), + "Message": fields.Str(required=True, load_from="Message"), + } + + """ API: CreateCustomImage @@ -592,17 +624,21 @@ class CreateVMInstanceRequestSchema(schema.RequestSchema): """ fields = { + "Bandwidth": fields.Str(required=False, dump_to="Bandwidth"), "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"), + "IPVersion": fields.Str(required=False, dump_to="IPVersion"), "ImageID": fields.Str(required=True, dump_to="ImageID"), "InternalIP": fields.Str(required=False, dump_to="InternalIP"), + "InternetIP": fields.Str(required=False, dump_to="InternetIP"), "LANSGID": fields.Str(required=False, dump_to="LANSGID"), "Memory": fields.Int(required=True, dump_to="Memory"), "Name": fields.Str(required=True, dump_to="Name"), + "OperatorName": fields.Str(required=False, dump_to="OperatorName"), "Password": fields.Str(required=True, dump_to="Password"), "Quantity": fields.Int(required=False, dump_to="Quantity"), "Region": fields.Str(required=True, dump_to="Region"), @@ -619,6 +655,8 @@ class CreateVMInstanceResponseSchema(schema.ResponseSchema): """ fields = { + "DiskID": fields.Str(required=False, load_from="DiskID"), + "EIPID": fields.Str(required=False, load_from="EIPID"), "Message": fields.Str(required=False, load_from="Message"), "VMID": fields.Str(required=False, load_from="VMID"), } @@ -666,6 +704,9 @@ class CreateVSRequestSchema(schema.RequestSchema): """ fields = { + "CACertificateID": fields.Str( + required=False, dump_to="CACertificateID" + ), "Domain": fields.Str(required=False, dump_to="Domain"), "HealthcheckType": fields.Str(required=True, dump_to="HealthcheckType"), "KeepaliveTimeout": fields.Int( @@ -680,7 +721,11 @@ class CreateVSRequestSchema(schema.RequestSchema): "Port": fields.Int(required=True, dump_to="Port"), "Protocol": fields.Str(required=True, dump_to="Protocol"), "Region": fields.Str(required=True, dump_to="Region"), + "SSLMode": fields.Str(required=False, dump_to="SSLMode"), "Scheduler": fields.Str(required=True, dump_to="Scheduler"), + "ServerCertificateID": fields.Str( + required=False, dump_to="ServerCertificateID" + ), "Zone": fields.Str(required=True, dump_to="Zone"), } @@ -727,6 +772,31 @@ class CreateVSPolicyResponseSchema(schema.ResponseSchema): } +""" +API: DeleteCertificate + +删除证书 +""" + + +class DeleteCertificateRequestSchema(schema.RequestSchema): + """ DeleteCertificate - 删除证书 + """ + + fields = { + "CertificateID": fields.Str(required=True, dump_to="CertificateID"), + "Region": fields.Str(required=True, dump_to="Region"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DeleteCertificateResponseSchema(schema.ResponseSchema): + """ DeleteCertificate - 删除证书 + """ + + fields = {"Message": fields.Str(required=True, load_from="Message")} + + """ API: DeleteCustomImage @@ -1106,10 +1176,42 @@ class DeleteVSPolicyResponseSchema(schema.ResponseSchema): """ DeleteVSPolicy - 删除七层负载均衡内容转发规则,仅当 VServer 的监听协议为 HTTP 时有效。 """ + fields = {"Message": fields.Str(required=False, load_from="Message")} + + +""" +API: DescribeCertificate + +查询证书 +""" + + +class DescribeCertificateRequestSchema(schema.RequestSchema): + """ DescribeCertificate - 查询证书 + """ + 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"), + "CertificateIDs": fields.List(fields.Str()), + "CertificateType": fields.Str( + required=False, dump_to="CertificateType" + ), + "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 DescribeCertificateResponseSchema(schema.ResponseSchema): + """ DescribeCertificate - 查询证书 + """ + + fields = { + "Infos": fields.List( + models.CertificateInfoSchema(), required=False, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), } @@ -1205,10 +1307,12 @@ class DescribeImageResponseSchema(schema.ResponseSchema): """ fields = { + "Action": fields.Str(required=True, load_from="Action"), "Infos": fields.List( models.ImageInfoSchema(), required=True, load_from="Infos" ), "Message": fields.Str(required=True, load_from="Message"), + "RetCode": fields.Int(required=True, load_from="RetCode"), "TotalCount": fields.Int(required=True, load_from="TotalCount"), } @@ -1352,6 +1456,43 @@ class DescribeNATGWRuleResponseSchema(schema.ResponseSchema): } +""" +API: DescribeOPLogs + +查询操作日志 +""" + + +class DescribeOPLogsRequestSchema(schema.RequestSchema): + """ DescribeOPLogs - 查询操作日志 + """ + + fields = { + "BeginTime": fields.Int(required=True, dump_to="BeginTime"), + "EndTime": fields.Int(required=True, dump_to="EndTime"), + "IsSuccess": fields.Str(required=False, dump_to="IsSuccess"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "Region": fields.Str(required=True, dump_to="Region"), + "ResourceID": fields.Str(required=False, dump_to="ResourceID"), + "ResourceType": fields.Str(required=False, dump_to="ResourceType"), + "Zone": fields.Str(required=True, dump_to="Zone"), + } + + +class DescribeOPLogsResponseSchema(schema.ResponseSchema): + """ DescribeOPLogs - 查询操作日志 + """ + + fields = { + "Infos": fields.List( + models.OPLogInfoSchema(), required=True, load_from="Infos" + ), + "Message": fields.Str(required=True, load_from="Message"), + "TotalCount": fields.Int(required=True, load_from="TotalCount"), + } + + """ API: DescribePhysicalIP @@ -2491,11 +2632,7 @@ 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"), - } + fields = {"Message": fields.Str(required=False, load_from="Message")} """ @@ -2568,11 +2705,7 @@ 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"), - } + fields = {"Message": fields.Str(required=False, load_from="Message")} """ diff --git a/ucloud/services/ucloudstack/schemas/models.py b/ucloud/services/ucloudstack/schemas/models.py index 0bf3674..fe8964f 100644 --- a/ucloud/services/ucloudstack/schemas/models.py +++ b/ucloud/services/ucloudstack/schemas/models.py @@ -4,6 +4,45 @@ from ucloud.core.typesystem import schema, fields +class BindVSInfoSchema(schema.ResponseSchema): + """ BindVSInfo - 证书绑定的vs信息 + """ + + fields = { + "LBID": fields.Str(required=False, load_from="LBID"), + "LBName": fields.Str(required=False, load_from="LBName"), + "Port": fields.Int(required=False, load_from="Port"), + "Protocol": fields.Str(required=False, load_from="Protocol"), + "VSID": fields.Str(required=False, load_from="VSID"), + } + + +class CertificateInfoSchema(schema.ResponseSchema): + """ CertificateInfo - 证书信息 + """ + + fields = { + "CertificateContent": fields.Str( + required=False, load_from="CertificateContent" + ), + "CertificateID": fields.Str(required=False, load_from="CertificateID"), + "CertificateType": fields.Str( + required=False, load_from="CertificateType" + ), + "CommonName": fields.Str(required=False, load_from="CommonName"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "ExpireTime": fields.Int(required=False, load_from="ExpireTime"), + "Fingerprint": fields.Str(required=False, load_from="Fingerprint"), + "Name": fields.Str(required=False, load_from="Name"), + "Privatekey": fields.Str(required=False, load_from="Privatekey"), + "Region": fields.Str(required=False, load_from="Region"), + "Remark": fields.Str(required=False, load_from="Remark"), + "SubjectAlternativeNames": fields.List(fields.Str()), + "VSInfos": fields.List(BindVSInfoSchema()), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + class DiskInfoSchema(schema.ResponseSchema): """ DiskInfo - 磁盘信息 """ @@ -161,6 +200,26 @@ class NATGWRuleInfoSchema(schema.ResponseSchema): } +class OPLogInfoSchema(schema.ResponseSchema): + """ OPLogInfo - 操作日志 + """ + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "IsSuccess": fields.Str(required=False, load_from="IsSuccess"), + "OPLogsID": fields.Str(required=False, load_from="OPLogsID"), + "OPName": fields.Str(required=False, load_from="OPName"), + "OPTime": fields.Int(required=False, load_from="OPTime"), + "OpMessage": fields.Str(required=False, load_from="OpMessage"), + "Region": fields.Str(required=False, load_from="Region"), + "ResourceID": fields.Str(required=False, load_from="ResourceID"), + "ResourceType": fields.Int(required=False, load_from="ResourceType"), + "RetCode": fields.Int(required=False, load_from="RetCode"), + "UserEmail": fields.Str(required=False, load_from="UserEmail"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + class PhysicalIPInfoSchema(schema.ResponseSchema): """ PhysicalIPInfo - 物理IP信息 """ @@ -309,12 +368,27 @@ class UserInfoSchema(schema.ResponseSchema): } +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 VMIPInfoSchema(schema.ResponseSchema): """ VMIPInfo - UCloudStack虚拟机IP信息 """ fields = { "IP": fields.Str(required=False, load_from="IP"), + "IPVersion": fields.Str(required=False, load_from="IPVersion"), "InterfaceID": fields.Str(required=False, load_from="InterfaceID"), "IsElastic": fields.Str(required=False, load_from="IsElastic"), "MAC": fields.Str(required=False, load_from="MAC"), @@ -328,20 +402,6 @@ class VMIPInfoSchema(schema.ResponseSchema): } -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虚拟机信息 """ diff --git a/ucloud/version.py b/ucloud/version.py index 8166ff6..3a06d93 100644 --- a/ucloud/version.py +++ b/ucloud/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -version = "0.9.0" +version = "0.9.1"