From 03295bea2a181c15ce195e05220ab0a9793aab5c Mon Sep 17 00:00:00 2001 From: Yufei Li Date: Wed, 23 Oct 2019 23:20:50 +0800 Subject: [PATCH] migrate from python3 (#12) FEATURES: - add `UCDN` product ENHANCEMENTS: - Add toolkit for auto release --- docs/services.rst | 18 +- tests/test_services/test_set_4140.py | 546 ++++++++++++++++++++ ucloud/_compat.py | 23 + ucloud/client.py | 25 +- ucloud/core/utils/compat.py | 2 +- ucloud/services/ucdn/__init__.py | 1 + ucloud/services/ucdn/client.py | 609 +++++++++++++++++++++++ ucloud/services/ucdn/schemas/__init__.py | 1 + ucloud/services/ucdn/schemas/apis.py | 534 ++++++++++++++++++++ ucloud/services/ucdn/schemas/models.py | 266 ++++++++++ ucloud/testing/funcs.py | 2 +- ucloud/version.py | 2 +- 12 files changed, 1998 insertions(+), 31 deletions(-) create mode 100644 tests/test_services/test_set_4140.py create mode 100644 ucloud/_compat.py create mode 100644 ucloud/services/ucdn/__init__.py create mode 100644 ucloud/services/ucdn/client.py create mode 100644 ucloud/services/ucdn/schemas/__init__.py create mode 100644 ucloud/services/ucdn/schemas/apis.py create mode 100644 ucloud/services/ucdn/schemas/models.py diff --git a/docs/services.rst b/docs/services.rst index 5084cdb..36846ef 100644 --- a/docs/services.rst +++ b/docs/services.rst @@ -1,12 +1,6 @@ UCloud SDK Services =================== -PathX ------ - -.. autoclass:: ucloud.services.pathx.client.PathXClient - :members: - StepFlow -------- @@ -19,6 +13,12 @@ UAccount .. autoclass:: ucloud.services.uaccount.client.UAccountClient :members: +UCDN +---- + +.. autoclass:: ucloud.services.ucdn.client.UCDNClient + :members: + UDB --- @@ -73,9 +73,3 @@ USMS .. autoclass:: ucloud.services.usms.client.USMSClient :members: -VPC ---- - -.. autoclass:: ucloud.services.vpc.client.VPCClient - :members: - diff --git a/tests/test_services/test_set_4140.py b/tests/test_services/test_set_4140.py new file mode 100644 index 0000000..0ec13c9 --- /dev/null +++ b/tests/test_services/test_set_4140.py @@ -0,0 +1,546 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +import pytest +import logging +from ucloud.core import exc +from ucloud.testing import env, funcs, op, utest + +logger = logging.getLogger(__name__) +scenario = utest.Scenario(4140) + + +@pytest.mark.skipif(env.is_ut(), reason=env.get_skip_reason()) +def test_set_4140(client, variables): + scenario.initial(variables) + scenario.variables["BucketName_test"] = funcs.concat( + "ucdntest-", funcs.get_timestamp(10) + ) + scenario.variables["time_granule_type"] = 1 + scenario.run(client) + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "CreateBucketResponse"), + ], + action="CreateBucket", +) +def create_bucket_00(client, variables): + d = { + "Region": variables.get("Region"), + "BucketName": variables.get("BucketName_test"), + } + try: + resp = client.invoke("CreateBucket", d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "StartUcdnTestDomainResponse"), + ], + action="StartUcdnTestDomain", +) +def start_ucdn_test_domain_01(client, variables): + d = { + "Region": variables.get("Region"), + "BucketName": variables.get("BucketName_test"), + } + try: + resp = client.invoke("StartUcdnTestDomain", d) + except exc.RetCodeException as e: + resp = e.json() + variables["domainId"] = utest.value_at_path(resp, "DomainId") + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=3, + fast_fail=True, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeUcdnDomainResponse"), + ("str_eq", "DomainSet.0.ChannelType", "ucdn"), + ( + "str_eq", + "DomainSet.0.Domain", + funcs.concat( + variables.get("BucketName_test"), ".ufile.ucloud.com.cn" + ), + ), + ("str_eq", "DomainSet.0.DomainId", variables.get("domainId")), + ("str_eq", "DomainSet.0.Status", "check"), + ], + action="DescribeUcdnDomain", +) +def describe_ucdn_domain_02(client, variables): + d = {"DomainId": [variables.get("domainId")]} + try: + resp = client.invoke("DescribeUcdnDomain", d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=30, + retry_interval=10, + startup_delay=200, + fast_fail=True, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeUcdnDomainResponse"), + ("str_eq", "DomainSet.0.ChannelType", "ucdn"), + ( + "str_eq", + "DomainSet.0.Domain", + funcs.concat( + variables.get("BucketName_test"), ".ufile.ucloud.com.cn" + ), + ), + ("str_eq", "DomainSet.0.DomainId", variables.get("domainId")), + ("str_eq", "DomainSet.0.Status", "enable"), + ], + action="DescribeUcdnDomain", +) +def describe_ucdn_domain_03(client, variables): + d = {"DomainId": [variables.get("domainId")]} + try: + resp = client.invoke("DescribeUcdnDomain", d) + except exc.RetCodeException as e: + resp = e.json() + variables["domain"] = utest.value_at_path(resp, "DomainSet.0.Domain") + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "BatchDescribeNewUcdnDomainResponse"), + ], + action="BatchDescribeNewUcdnDomain", +) +def batch_describe_new_ucdn_domain_04(client, variables): + d = {} + try: + resp = client.ucdn().batch_describe_new_ucdn_domain(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetNewUcdnDomainHttpCodeV2Response"), + ], + action="GetNewUcdnDomainHttpCodeV2", +) +def get_new_ucdn_domain_http_code_v2_05(client, variables): + d = { + "Type": variables.get("time_granule_type"), + "EndTime": funcs.get_timestamp(10), + "BeginTime": funcs.get_timestamp(10) - 10000, + } + try: + resp = client.ucdn().get_new_ucdn_domain_http_code_v2(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetNewUcdnDomainHitRateResponse"), + ], + action="GetNewUcdnDomainHitRate", +) +def get_new_ucdn_domain_hit_rate_06(client, variables): + d = { + "Type": variables.get("time_granule_type"), + "EndTime": funcs.get_timestamp(10), + "BeginTime": funcs.get_timestamp(10) - 1000, + } + try: + resp = client.ucdn().get_new_ucdn_domain_hit_rate(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetNewUcdnDomainHttpCodeResponse"), + ], + action="GetNewUcdnDomainHttpCode", +) +def get_new_ucdn_domain_http_code_07(client, variables): + d = { + "Type": variables.get("time_granule_type"), + "EndTime": funcs.get_timestamp(10), + "BeginTime": funcs.get_timestamp(10) - 10000, + } + try: + resp = client.ucdn().get_new_ucdn_domain_http_code(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "PrefetchNewUcdnDomainCacheResponse"), + ], + action="PrefetchNewUcdnDomainCache", +) +def prefetch_new_ucdn_domain_cache_08(client, variables): + d = {"UrlList": [funcs.concat("http://", variables.get("domain"), "/")]} + try: + resp = client.ucdn().prefetch_new_ucdn_domain_cache(d) + except exc.RetCodeException as e: + resp = e.json() + variables["PrefetchCache_TaskId"] = utest.value_at_path(resp, "TaskId") + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeNewUcdnPrefetchCacheTaskResponse"), + ], + action="DescribeNewUcdnPrefetchCacheTask", +) +def describe_new_ucdn_prefetch_cache_task_09(client, variables): + d = {"TaskId": [variables.get("PrefetchCache_TaskId")]} + try: + resp = client.ucdn().describe_new_ucdn_prefetch_cache_task(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeNewUcdnRefreshCacheTaskResponse"), + ], + action="DescribeNewUcdnRefreshCacheTask", +) +def describe_new_ucdn_refresh_cache_task_10(client, variables): + d = {"TaskId": [variables.get("PrefetchCache_TaskId")]} + try: + resp = client.ucdn().describe_new_ucdn_refresh_cache_task(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "RefreshNewUcdnDomainCacheResponse"), + ], + action="RefreshNewUcdnDomainCache", +) +def refresh_new_ucdn_domain_cache_11(client, variables): + d = { + "UrlList": [funcs.concat("http://", variables.get("domain"), "/")], + "Type": "file", + } + try: + resp = client.ucdn().refresh_new_ucdn_domain_cache(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetNewUcdnDomainBandwidthResponse"), + ], + action="GetNewUcdnDomainBandwidth", +) +def get_new_ucdn_domain_bandwidth_12(client, variables): + d = {"Type": variables.get("time_granule_type")} + try: + resp = client.ucdn().get_new_ucdn_domain_bandwidth(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetUcdnPassBandwidthResponse"), + ], + action="GetUcdnPassBandwidth", +) +def get_ucdn_pass_bandwidth_13(client, variables): + d = {"Type": variables.get("time_granule_type")} + try: + resp = client.ucdn().get_ucdn_pass_bandwidth(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetUcdnDomainRequestNumV2Response"), + ], + action="GetUcdnDomainRequestNumV2", +) +def get_ucdn_domain_request_num_v2_14(client, variables): + d = { + "Type": variables.get("time_granule_type"), + "EndTime": funcs.get_timestamp(10), + "DomainId": [variables.get("domainId")], + "BeginTime": funcs.get_timestamp(10) - 1000, + } + try: + resp = client.ucdn().get_ucdn_domain_request_num_v2(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetUcdnDomainLogResponse"), + ], + action="GetUcdnDomainLog", +) +def get_ucdn_domain_log_15(client, variables): + d = { + "Type": variables.get("time_granule_type"), + "DomainId": [variables.get("domainId")], + } + try: + resp = client.ucdn().get_ucdn_domain_log(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetUcdnTrafficResponse"), + ], + action="GetUcdnTraffic", +) +def get_ucdn_traffic_16(client, variables): + d = {} + try: + resp = client.ucdn().get_ucdn_traffic(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetUcdnDomainTrafficResponse"), + ], + action="GetUcdnDomainTraffic", +) +def get_ucdn_domain_traffic_17(client, variables): + d = {"AccountType": "top"} + try: + resp = client.ucdn().get_ucdn_domain_traffic(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "GetUcdnDomainPrefetchEnableResponse"), + ("str_eq", "Enable", 1), + ], + action="GetUcdnDomainPrefetchEnable", +) +def get_ucdn_domain_prefetch_enable_18(client, variables): + d = {"DomainId": variables.get("domainId")} + try: + resp = client.ucdn().get_ucdn_domain_prefetch_enable(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "SwitchUcdnChargeTypeResponse"), + ], + action="SwitchUcdnChargeType", +) +def switch_ucdn_charge_type_19(client, variables): + d = {"ChargeType": "traffic"} + try: + resp = client.ucdn().switch_ucdn_charge_type(d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "StopUcdnTestDomainResponse"), + ], + action="StopUcdnTestDomain", +) +def stop_ucdn_test_domain_20(client, variables): + d = { + "Region": variables.get("Region"), + "BucketName": variables.get("BucketName_test"), + } + try: + resp = client.invoke("StopUcdnTestDomain", d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=3, + retry_interval=1, + startup_delay=0, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DescribeUcdnDomainResponse"), + ("str_eq", "DomainSet.0.ChannelType", "ucdn"), + ( + "str_eq", + "DomainSet.0.Domain", + funcs.concat( + variables.get("BucketName_test"), ".ufile.ucloud.com.cn" + ), + ), + ("str_eq", "DomainSet.0.DomainId", variables.get("domainId")), + ("str_eq", "DomainSet.0.Status", "deleteing"), + ], + action="DescribeUcdnDomain", +) +def describe_ucdn_domain_21(client, variables): + d = {"DomainId": [variables.get("domainId")]} + try: + resp = client.invoke("DescribeUcdnDomain", d) + except exc.RetCodeException as e: + resp = e.json() + return resp + + +@scenario.step( + max_retries=10, + retry_interval=10, + startup_delay=120, + fast_fail=False, + validators=lambda variables: [ + ("str_eq", "RetCode", 0), + ("str_eq", "Action", "DeleteBucketResponse"), + ], + action="DeleteBucket", +) +def delete_bucket_22(client, variables): + d = {"BucketName": variables.get("BucketName_test")} + try: + resp = client.invoke("DeleteBucket", d) + except exc.RetCodeException as e: + resp = e.json() + return resp diff --git a/ucloud/_compat.py b/ucloud/_compat.py new file mode 100644 index 0000000..330c642 --- /dev/null +++ b/ucloud/_compat.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +from ucloud.core import client + + +class CompactClient(client.Client): + def __init__(self, config, transport=None, middleware=None): + self._config = config + super(CompactClient, self).__init__(config, transport, middleware) + + def pathx(self): + from ucloud.services.pathx.client import PathXClient + + return PathXClient( + self._config, self.transport, self.middleware, self.logger + ) + + def vpc(self): + from ucloud.services.vpc.client import VPCClient + + return VPCClient( + self._config, self.transport, self.middleware, self.logger + ) diff --git a/ucloud/client.py b/ucloud/client.py index e17da7b..348f0a0 100644 --- a/ucloud/client.py +++ b/ucloud/client.py @@ -1,21 +1,14 @@ # -*- coding: utf-8 -*- """ Code is generated by ucloud-model, DO NOT EDIT IT. """ -from ucloud.core import client +from ucloud._compat import CompactClient -class Client(client.Client): +class Client(CompactClient): def __init__(self, config, transport=None, middleware=None): self._config = config super(Client, self).__init__(config, transport, middleware) - def pathx(self): - from ucloud.services.pathx.client import PathXClient - - return PathXClient( - self._config, self.transport, self.middleware, self.logger - ) - def stepflow(self): from ucloud.services.stepflow.client import StepFlowClient @@ -30,6 +23,13 @@ def uaccount(self): self._config, self.transport, self.middleware, self.logger ) + def ucdn(self): + from ucloud.services.ucdn.client import UCDNClient + + return UCDNClient( + self._config, self.transport, self.middleware, self.logger + ) + def udb(self): from ucloud.services.udb.client import UDBClient @@ -92,10 +92,3 @@ def usms(self): return USMSClient( self._config, self.transport, self.middleware, self.logger ) - - def vpc(self): - from ucloud.services.vpc.client import VPCClient - - return VPCClient( - self._config, self.transport, self.middleware, self.logger - ) diff --git a/ucloud/core/utils/compat.py b/ucloud/core/utils/compat.py index 33e9dbc..443799e 100644 --- a/ucloud/core/utils/compat.py +++ b/ucloud/core/utils/compat.py @@ -10,6 +10,6 @@ else: import types - str = unicode + str = unicode # noqa: F821 string_types = types.StringTypes from collections import Callable diff --git a/ucloud/services/ucdn/__init__.py b/ucloud/services/ucdn/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/ucloud/services/ucdn/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/ucloud/services/ucdn/client.py b/ucloud/services/ucdn/client.py new file mode 100644 index 0000000..0f439c2 --- /dev/null +++ b/ucloud/services/ucdn/client.py @@ -0,0 +1,609 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +from ucloud.core.client import Client +from ucloud.services.ucdn.schemas import apis + + +class UCDNClient(Client): + def __init__(self, config, transport=None, middleware=None, logger=None): + super(UCDNClient, self).__init__(config, transport, middleware, logger) + + def batch_describe_new_ucdn_domain(self, req=None, **kwargs): + """ BatchDescribeNewUcdnDomain - 批量获取加速域名配置 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **ChannelType** (str) - 渠道ucdn、ufile、uvideo + - **DomainId** (list) - 域名id,创建域名时生成的资源id,默认获取账号下的所有域名信息,n为自然数 + - **Limit** (int) - 返回数据长度,如果制定了Offset,则默认20,否则默认全部,非负整数 + - **Offset** (int) - 数据偏移量,默认0,非负整数 + + **Response** + + - **Arrearage** (list) - 标识欠费的数组,数组含有下列元素值, 1=国内流量有欠费 2=国外流量有欠费 3=国内带宽有欠费 4=国外带宽有欠费 + - **ChargeType** (int) - 当前计费方式,10=流量付费 20=带宽日峰值 30=按月后付费 + - **DomainList** (list) - 见 **DomainInfo** 模型定义 + - **LastChargeType** (int) - 表示最后一次切换的计费方式,10=流量付费 20=带宽日峰值 30=按月后付费 40=未选择计费方式 + - **MaxDomainNum** (int) - 最大域名数量,默认20 + - **TotalCount** (int) - 满足条件的域名个数 + - **Vip** (str) - vip标示,yes-是 no-否 + + **Response Model** + + **AccessConf** + + - **IpBlacklist** (str) - 多个ip用逗号隔开 + + **CacheConf** + + - **CacheBehavior** (bool) - 是否缓存,true为缓存,false为不缓存。为false的情况下,CacheTTL和CacheUnit强制不生效 + - **CacheTTL** (int) - 缓存时间 + - **CacheUnit** (str) - 缓存时间的单位。sec(秒),min(分钟),hour(小时),day(天) + - **Description** (str) - 缓存规则描述 + - **FollowOriginRule** (bool) - 是否优先遵循源站头部缓存策略,false为不优先遵循源站,true为优先遵循源站缓存头部。默认为false + - **HttpCodePattern** (str) - 状态码默认情况只缓存200类状态码,支持正则 + - **IgnoreQueryString** (bool) - 是否忽略参数缓存(false为不忽略,true为忽略,默认为false) + - **PathPattern** (str) - 路径模式,支持正则 + + **DomainInfo** + + - **AccessConf** (dict) - 见 **AccessConf** 模型定义 + - **AreaCode** (str) - 查询带宽区域 cn代表国内 abroad代表海外 不填默认为全部区域 + - **CacheConf** (list) - 见 **CacheConf** 模型定义 + - **CacheHost** (str) - 缓存Host,不同的域名可以配置为同一个CacheHost来实现缓存共享,默认为加速域名 + - **CdnProtocol** (str) - 加速类型http,http|https + - **CdnType** (str) - 加速域名的业务类型,web代表网站,stream代表视频,download代表下载。 + - **CertName** (str) - 证书名称 + - **Cname** (str) - cdn域名。创建加速域名生成的cdn域名,用于设置CNAME记录 + - **CreateTime** (int) - 域名创建的时间。格式:时间戳 + - **Domain** (str) - 域名,用户创建加速的域名 + - **DomainId** (str) - 域名id,创建域名时生成的id + - **HttpsStatusAbroad** (str) - 国外https状态 enableing-开启中 fail-开启失败 enable-启用 disable-未启用 + - **HttpsStatusCn** (str) - 国内https状态 enableing-开启中 fail-开启失败 enable-启用 disable-未启用 + - **NullRefer** (bool) - ReferType为白名单时,NullRefer为false代表不允许NULL refer访问,为true代表允许Null refer访问 + - **OriginHost** (str) - 回源Http请求头部Host,默认是加速域名 + - **OriginIp** (list) - 源站ip即cdn服务器回源访问的ip地址。支持多个源站ip,多个源站ip,可表述为如:[1.1.1.1,2.2.2.2] + - **OriginPort** (int) - 回源端口 + - **OriginProtocol** (str) - 源站协议http,http|https 默认http + - **ReferList** (list) - Refer列表,支持正则表达式 + - **ReferStatus** (bool) - refer配置开关,true打开,false关闭 + - **ReferType** (int) - 0白名单,1黑名单 + - **Status** (str) - 创建的加速域名的当前的状态。check代表审核中,checkSuccess代表审核通过,checkFail代表审核失败,enable代表加速中,disable代表停止加速,delete代表删除加速 enableing代表正在开启加速,disableing代表正在停止加速中,deleteing代表删除中 + - **Tag** (str) - 业务组,默认为Default + - **TestUrl** (str) - 测试url,用于域名创建加速时的测试 + - **ValidTime** (int) - 开始分配Cname时间。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.BatchDescribeNewUcdnDomainRequestSchema().dumps(d) + resp = self.invoke("BatchDescribeNewUcdnDomain", d, **kwargs) + return apis.BatchDescribeNewUcdnDomainResponseSchema().loads(resp) + + def describe_new_ucdn_prefetch_cache_task(self, req=None, **kwargs): + """ DescribeNewUcdnPrefetchCacheTask - 获取预取任务状态 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + - **Limit** (int) - 返回数据长度,默认全部,自然数 + - **Offset** (int) - 数据偏移量,默认为0,自然数 + - **Status** (str) - 需要获取的内容预热的状态,枚举值:success:成功;wait:等待处理;process:正在处理;failure:失败; unknow:未知,默认选择所有状态 + - **TaskId** (list) - 提交任务时返回的任务ID + + **Response** + + - **TaskList** (list) - 见 **TaskInfo** 模型定义 + - **TotalCount** (int) - 预热任务的总数 + + **Response Model** + + **UrlProgressInfo** + + - **CreateTime** (int) - 刷新任务创建的时间。格式为Unix Timestamp + - **FinishTime** (int) - 任务完成时间。格式为Unix Timestamp + - **Progress** (int) - 刷新进度,单位% + - **Status** (str) - 刷新任务的当前状态,枚举值:success:成功;wait:排队中;process:处理中;failure:失败; unknow:未知 + - **Url** (str) - 刷新的单条url + + **TaskInfo** + + - **CreateTime** (int) - 刷新任务创建的时间。格式为Unix Timestamp + - **Status** (str) - 刷新任务的当前状态,枚举值:success:成功;wait:排队中;process:处理中;failure:失败; unknow:未知 + - **TaskId** (str) - 提交任务时返回的任务ID + - **Type** (str) - file/dir 刷新任务会返回Type,预取任务没有 + - **UrlLists** (list) - 见 **UrlProgressInfo** 模型定义 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.DescribeNewUcdnPrefetchCacheTaskRequestSchema().dumps(d) + resp = self.invoke("DescribeNewUcdnPrefetchCacheTask", d, **kwargs) + return apis.DescribeNewUcdnPrefetchCacheTaskResponseSchema().loads(resp) + + def describe_new_ucdn_refresh_cache_task(self, req=None, **kwargs): + """ DescribeNewUcdnRefreshCacheTask - 获取域名刷新任务状态 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + - **Limit** (int) - 返回数据长度,默认全部,自然数 + - **Offset** (int) - 数据偏移量,默认为0,自然数 + - **Status** (str) - 需要获取的内容刷新的状态,枚举值:success:成功;wait:等待处理;process:正在处理;failure:失败; unknow:未知,默认选择所有状态 + - **TaskId** (list) - 提交任务时返回的任务ID + + **Response** + + - **TaskList** (list) - 见 **TaskInfo** 模型定义 + - **TotalCount** (int) - 刷新任务的总数 + + **Response Model** + + **UrlProgressInfo** + + - **CreateTime** (int) - 刷新任务创建的时间。格式为Unix Timestamp + - **FinishTime** (int) - 任务完成时间。格式为Unix Timestamp + - **Progress** (int) - 刷新进度,单位% + - **Status** (str) - 刷新任务的当前状态,枚举值:success:成功;wait:排队中;process:处理中;failure:失败; unknow:未知 + - **Url** (str) - 刷新的单条url + + **TaskInfo** + + - **CreateTime** (int) - 刷新任务创建的时间。格式为Unix Timestamp + - **Status** (str) - 刷新任务的当前状态,枚举值:success:成功;wait:排队中;process:处理中;failure:失败; unknow:未知 + - **TaskId** (str) - 提交任务时返回的任务ID + - **Type** (str) - file/dir 刷新任务会返回Type,预取任务没有 + - **UrlLists** (list) - 见 **UrlProgressInfo** 模型定义 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.DescribeNewUcdnRefreshCacheTaskRequestSchema().dumps(d) + resp = self.invoke("DescribeNewUcdnRefreshCacheTask", d, **kwargs) + return apis.DescribeNewUcdnRefreshCacheTaskResponseSchema().loads(resp) + + def get_new_ucdn_domain_bandwidth(self, req=None, **kwargs): + """ GetNewUcdnDomainBandwidth - 获取域名带宽数据 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天的粒度) + - **Areacode** (str) - 查询带宽区域 cn代表国内 abroad代表海外 不填默认为全部区域 + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。如没有赋值,则返回缺少参 数错误,如果没有EndTime,BeginTime也可以不赋值,EndTime默认当前时间,BeginTime 默认前一天的当前时间。 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + + **Response** + + - **BandwidthList** (list) - 见 **BandwidthInfo** 模型定义 + - **Traffic** (str) - 从起始时间到结束时间内的所使用的CDN总流量,单位GB + + **Response Model** + + **BandwidthInfo** + + - **CdnBandwidth** (str) - 返回值返回指定时间区间内CDN的带宽峰值,单位Mbps(如果请求参数Type为0,则Value是五分钟粒度的带宽值,如果Type为1,则Value是1小时的带宽峰值,如果Type为2,则Value是一天内的带宽峰值) + - **Time** (int) - 带宽获取的时间点。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetNewUcdnDomainBandwidthRequestSchema().dumps(d) + resp = self.invoke("GetNewUcdnDomainBandwidth", d, **kwargs) + return apis.GetNewUcdnDomainBandwidthResponseSchema().loads(resp) + + def get_new_ucdn_domain_hit_rate(self, req=None, **kwargs): + """ GetNewUcdnDomainHitRate - 获取域名命中率 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天的粒度) + - **Areacode** (str) - 查询带宽区域 cn代表国内 abroad代表海外,只支持国内 + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。如没有赋值,则返回缺少参 数错误,如果没有EndTime,BeginTime也可以不赋值,EndTime默认当前时间,BeginTime 默认前一天的当前时间。 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + + **Response** + + - **HitRateList** (list) - 见 **HitRateInfo** 模型定义 + + **Response Model** + + **HitRateInfo** + + - **FlowHitRate** (float) - 流量命中率,单位% + - **RequestHitRate** (float) - 请求数命中率,单位% + - **Time** (int) - 带宽获取的时间点。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetNewUcdnDomainHitRateRequestSchema().dumps(d) + resp = self.invoke("GetNewUcdnDomainHitRate", d, **kwargs) + return apis.GetNewUcdnDomainHitRateResponseSchema().loads(resp) + + def get_new_ucdn_domain_http_code(self, req=None, **kwargs): + """ GetNewUcdnDomainHttpCode - 获取域名状态码监控 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天的粒度) + - **Areacode** (str) - 查询带宽区域 cn代表国内 abroad代表海外,只支持国内 + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。如没有赋值,则返回缺少参 数错误,如果没有EndTime,BeginTime也可以不赋值,EndTime默认当前时间,BeginTime 默认前一天的当前时间。 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + + **Response** + + - **HttpCodeDetail** (list) - 见 **HttpCodeInfo** 模型定义 + + **Response Model** + + **HttpCodeInfo** + + - **HttpFiveXX** (int) - 5xx数量 + - **HttpFourXX** (int) - 4xx数量 + - **HttpOneXX** (int) - 1xx数量 + - **HttpThreeXX** (int) - 3xx数量 + - **HttpTwoXX** (int) - 2xx数量 + - **Time** (int) - 带宽获取的时间点。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetNewUcdnDomainHttpCodeRequestSchema().dumps(d) + resp = self.invoke("GetNewUcdnDomainHttpCode", d, **kwargs) + return apis.GetNewUcdnDomainHttpCodeResponseSchema().loads(resp) + + def get_new_ucdn_domain_http_code_v2(self, req=None, **kwargs): + """ GetNewUcdnDomainHttpCodeV2 - 获取域名详细状态码监控 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **BeginTime** (int) - (Required) 查询的起始时间,格式为Unix Timestamp。 + - **EndTime** (int) - (Required) 查询的结束时间,格式为Unix Timestamp。 + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天粒度,3表示按照一分钟粒度) + - **Areacode** (str) - 查询带宽区域 cn代表国内 abroad代表海外,只支持国内 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + + **Response** + + - **HttpCodeV2Detail** (list) - 见 **HttpCodeV2Detail** 模型定义 + + **Response Model** + + **HttpCodeV2Detail** + + - **Http100** (int) - http100数量 + - **Http101** (int) - http101数量 + - **Http102** (int) - http102数量 + - **Http200** (int) - http200数量 + - **Http201** (int) - http201数量 + - **Http202** (int) - http202数量 + - **Http203** (int) - http203数量 + - **Http204** (int) - http204数量 + - **Http205** (int) - http205数量 + - **Http206** (int) - http206数量 + - **Http207** (int) - http207数量 + - **Http300** (int) - http300数量 + - **Http301** (int) - http301数量 + - **Http302** (int) - http302数量 + - **Http303** (int) - http303数量 + - **Http304** (int) - http304数量 + - **Http305** (int) - http305数量 + - **Http306** (int) - http306数量 + - **Http307** (int) - http307数量 + - **Http400** (int) - http400数量 + - **Http401** (int) - http401数量 + - **Http402** (int) - http402数量 + - **Http403** (int) - http403数量 + - **Http404** (int) - http404数量 + - **Http405** (int) - http405数量 + - **Http406** (int) - http406数量 + - **Http407** (int) - http407数量 + - **Http408** (int) - http408数量 + - **Http409** (int) - http409数量 + - **Http410** (int) - http410数量 + - **Http411** (int) - http411数量 + - **Http412** (int) - http412数量 + - **Http413** (int) - http413数量 + - **Http414** (int) - http414数量 + - **Http415** (int) - http415数量 + - **Http416** (int) - http416数量 + - **Http417** (int) - http417数量 + - **Http418** (int) - http418数量 + - **Http421** (int) - http421数量 + - **Http422** (int) - http422数量 + - **Http423** (int) - http423数量 + - **Http424** (int) - http424数量 + - **Http425** (int) - http425数量 + - **Http426** (int) - http426数量 + - **Http449** (int) - http449数量 + - **Http451** (int) - http451数量 + - **Http500** (int) - http500数量 + - **Http501** (int) - http501数量 + - **Http502** (int) - http502数量 + - **Http503** (int) - http503数量 + - **Http504** (int) - http504数量 + - **Http505** (int) - http505数量 + - **Http506** (int) - http506数量 + - **Http507** (int) - http507数量 + - **Http509** (int) - http509数量 + - **Http510** (int) - http510数量 + - **Time** (int) - 时间 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetNewUcdnDomainHttpCodeV2RequestSchema().dumps(d) + resp = self.invoke("GetNewUcdnDomainHttpCodeV2", d, **kwargs) + return apis.GetNewUcdnDomainHttpCodeV2ResponseSchema().loads(resp) + + def get_new_ucdn_domain_request_num(self, req=None, **kwargs): + """ GetNewUcdnDomainRequestNum - 获取域名请求数 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天的粒度) + - **Areacode** (str) - 查询区域 cn代表国内 abroad代表海外,只支持国内 + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。如没有赋值,则返回缺少参 数错误,如果没有EndTime,BeginTime也可以不赋值,EndTime默认当前时间,BeginTime 默认前一天的当前时间。 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + + **Response** + + - **RequestList** (list) - 见 **RequestInfo** 模型定义 + + **Response Model** + + **RequestInfo** + + - **CdnRequest** (float) - 返回值返回指定时间区间内的cdn收到的请求次数之和 + - **OriginRequest** (float) - 返回值返回指定时间区间内的cdn回源的请求次数之和 + - **Time** (int) - 带宽获取的时间点。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetNewUcdnDomainRequestNumRequestSchema().dumps(d) + resp = self.invoke("GetNewUcdnDomainRequestNum", d, **kwargs) + return apis.GetNewUcdnDomainRequestNumResponseSchema().loads(resp) + + def get_ucdn_domain_log(self, req=None, **kwargs): + """ GetUcdnDomainLog - 获取加速域名原始日志 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。 + - **DomainId** (list) - 域名ID,创建加速域名时生成。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + - **Type** (int) - 查询粒度 0=default(没有粒度) 1=按小时 2=按天 + + **Response** + + - **LogSet** (list) - 见 **LogSetList** 模型定义 + + **Response Model** + + **LogSetInfo** + + - **AbroadLog** (list) - 国外日志url列表 + - **CnLog** (list) - 国内日志url列表 + - **Time** (int) - 日志时间UnixTime + + **LogSetList** + + - **Domain** (str) - 域名 + - **Logs** (list) - 见 **LogSetInfo** 模型定义 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetUcdnDomainLogRequestSchema().dumps(d) + resp = self.invoke("GetUcdnDomainLog", d, **kwargs) + return apis.GetUcdnDomainLogResponseSchema().loads(resp) + + def get_ucdn_domain_prefetch_enable(self, req=None, **kwargs): + """ GetUcdnDomainPrefetchEnable - 获取域名预取开启状态 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **DomainId** (str) - (Required) 域名ID,创建加速域名时生成。 + + **Response** + + - **Enable** (int) - 0表示该域名未开启预取,1表示该域名已开启预取 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetUcdnDomainPrefetchEnableRequestSchema().dumps(d) + resp = self.invoke("GetUcdnDomainPrefetchEnable", d, **kwargs) + return apis.GetUcdnDomainPrefetchEnableResponseSchema().loads(resp) + + def get_ucdn_domain_request_num_v2(self, req=None, **kwargs): + """ GetUcdnDomainRequestNumV2 - 获取域名请求数 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **BeginTime** (int) - (Required) 查询的起始时间,格式为Unix Timestamp + - **EndTime** (int) - (Required) 查询的结束时间,格式为Unix Timestamp + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天的粒度, 3=按1分钟) + - **Areacode** (str) - 查询区域 cn代表国内 abroad代表海外,只支持国内 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + + **Response** + + - **RequestList** (list) - 见 **RequestInfo** 模型定义 + + **Response Model** + + **RequestInfo** + + - **CdnRequest** (float) - 返回值返回指定时间区间内的cdn收到的请求次数之和 + - **OriginRequest** (float) - 返回值返回指定时间区间内的cdn回源的请求次数之和 + - **Time** (int) - 带宽获取的时间点。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetUcdnDomainRequestNumV2RequestSchema().dumps(d) + resp = self.invoke("GetUcdnDomainRequestNumV2", d, **kwargs) + return apis.GetUcdnDomainRequestNumV2ResponseSchema().loads(resp) + + def get_ucdn_domain_traffic(self, req=None, **kwargs): + """ GetUcdnDomainTraffic - 获取加速域名流量使用信息 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Areacode** (str) - 查询流量区域 cn代表国内 abroad代表海外,默认全部区域。 + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。 + - **DomainId** (list) - 域名ID,创建加速域名时生成。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + + **Response** + + - **TrafficSet** (list) - 见 **UcdnDomainTrafficSet** 模型定义 + + **Response Model** + + **UcdnDomainTrafficSet** + + - **Time** (int) - 流量获取的时间点,格式为Unix Timestamp + - **Value** (float) - 查询每日流量总值,单位:GB + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetUcdnDomainTrafficRequestSchema().dumps(d) + resp = self.invoke("GetUcdnDomainTraffic", d, **kwargs) + return apis.GetUcdnDomainTrafficResponseSchema().loads(resp) + + def get_ucdn_pass_bandwidth(self, req=None, **kwargs): + """ GetUcdnPassBandwidth - 获取回源带宽数据(cdn回客户源站部分) + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Type** (int) - (Required) 时间粒度(0表示按照5分钟粒度,1表示按照1小时粒度,2表示按照一天的粒度) + - **Areacode** (str) - 查询带宽区域 cn代表国内 abroad代表海外,只支持国内 + - **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。如没有赋值,则返回缺少参 数错误,如果没有EndTime,BeginTime也可以不赋值,EndTime默认当前时间,BeginTime 默认前一天的当前时间。 + - **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名 + - **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。 + + **Response** + + - **BandwidthDetail** (list) - 见 **BandwidthInfoDetail** 模型定义 + + **Response Model** + + **BandwidthInfoDetail** + + - **Bandwidth** (float) - 返回值带宽值数据。 + - **Time** (int) - 宽获取的时间点。格式:时间戳 + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetUcdnPassBandwidthRequestSchema().dumps(d) + resp = self.invoke("GetUcdnPassBandwidth", d, **kwargs) + return apis.GetUcdnPassBandwidthResponseSchema().loads(resp) + + def get_ucdn_traffic(self, req=None, **kwargs): + """ GetUcdnTraffic - 获取流量信息 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + + **Response** + + - **TrafficSet** (list) - 见 **TrafficSet** 模型定义 + + **Response Model** + + **TrafficSet** + + - **Areacode** (str) - 购买流量的区域, cn: 国内; abroad: 国外 + - **TrafficLeft** (str) - Areacode区域内总剩余流量, 单位GB + - **TrafficTotal** (str) - Areacode区域内总购买流量, 单位GB + - **TrafficUsed** (str) - Areacode区域内总使用流量, 单位GB + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.GetUcdnTrafficRequestSchema().dumps(d) + resp = self.invoke("GetUcdnTraffic", d, **kwargs) + return apis.GetUcdnTrafficResponseSchema().loads(resp) + + def prefetch_new_ucdn_domain_cache(self, req=None, **kwargs): + """ PrefetchNewUcdnDomainCache - 提交预取任务 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **UrlList** (list) - (Required) 预热URL列表,n从自然数0开始。UrlList.n字段必须以”http://域名/”开始。目录要以”/”结尾, 如刷新目录a下所有文件,格式为:http://abc.ucloud.cn/a/;如刷新文件目录a下面img.png文件, 格式为http://abc.ucloud.cn/a/img.png。请正确提交需要刷新的域名 + + **Response** + + - **TaskId** (str) - 本次提交url对应的任务id + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.PrefetchNewUcdnDomainCacheRequestSchema().dumps(d) + resp = self.invoke("PrefetchNewUcdnDomainCache", d, **kwargs) + return apis.PrefetchNewUcdnDomainCacheResponseSchema().loads(resp) + + def refresh_new_ucdn_domain_cache(self, req=None, **kwargs): + """ RefreshNewUcdnDomainCache - 刷新缓存 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **Type** (str) - (Required) 刷新类型,file代表文件刷新,dir 代表路径刷新 + - **UrlList** (list) - (Required) 刷新多个URL列表时,一次最多提交30个。必须以”http://域名/”开始。目录要以”/”结尾, 如刷新目录a下所有文件,格式为:http://abc.ucloud.cn/a/;如刷新文件目录a下面img.png文件, 格式为http://abc.ucloud.cn/a/img.png。请正确提交需要刷新的域名 + + **Response** + + - **TaskId** (str) - 本次提交url对应的任务id + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.RefreshNewUcdnDomainCacheRequestSchema().dumps(d) + resp = self.invoke("RefreshNewUcdnDomainCache", d, **kwargs) + return apis.RefreshNewUcdnDomainCacheResponseSchema().loads(resp) + + def switch_ucdn_charge_type(self, req=None, **kwargs): + """ SwitchUcdnChargeType - 切换账号计费方式 + + **Request** + + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 `_ + - **ChargeType** (str) - (Required) 计费方式。traffic代表按流量包计费,bandwidth按带宽付费 + + **Response** + + + """ + d = {"ProjectId": self.config.project_id} + req and d.update(req) + d = apis.SwitchUcdnChargeTypeRequestSchema().dumps(d) + resp = self.invoke("SwitchUcdnChargeType", d, **kwargs) + return apis.SwitchUcdnChargeTypeResponseSchema().loads(resp) diff --git a/ucloud/services/ucdn/schemas/__init__.py b/ucloud/services/ucdn/schemas/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/ucloud/services/ucdn/schemas/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/ucloud/services/ucdn/schemas/apis.py b/ucloud/services/ucdn/schemas/apis.py new file mode 100644 index 0000000..4dab73e --- /dev/null +++ b/ucloud/services/ucdn/schemas/apis.py @@ -0,0 +1,534 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +from ucloud.core.typesystem import schema, fields +from ucloud.services.ucdn.schemas import models + +""" UCDN API Schema +""" +""" +API: BatchDescribeNewUcdnDomain + +批量获取加速域名配置 +""" + + +class BatchDescribeNewUcdnDomainRequestSchema(schema.RequestSchema): + """ BatchDescribeNewUcdnDomain - 批量获取加速域名配置 + """ + + fields = { + "ChannelType": fields.Str(required=False, dump_to="ChannelType"), + "DomainId": fields.List(fields.Str()), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + } + + +class BatchDescribeNewUcdnDomainResponseSchema(schema.ResponseSchema): + """ BatchDescribeNewUcdnDomain - 批量获取加速域名配置 + """ + + fields = { + "Arrearage": fields.List( + fields.Str(), required=False, load_from="Arrearage" + ), + "ChargeType": fields.Int(required=False, load_from="ChargeType"), + "DomainList": fields.List( + models.DomainInfoSchema(), required=False, load_from="DomainList" + ), + "LastChargeType": fields.Int( + required=False, load_from="LastChargeType" + ), + "MaxDomainNum": fields.Int(required=False, load_from="MaxDomainNum"), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + "Vip": fields.Str(required=False, load_from="Vip"), + } + + +""" +API: DescribeNewUcdnPrefetchCacheTask + +获取预取任务状态 +""" + + +class DescribeNewUcdnPrefetchCacheTaskRequestSchema(schema.RequestSchema): + """ DescribeNewUcdnPrefetchCacheTask - 获取预取任务状态 + """ + + fields = { + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Status": fields.Str(required=False, dump_to="Status"), + "TaskId": fields.List(fields.Str()), + } + + +class DescribeNewUcdnPrefetchCacheTaskResponseSchema(schema.ResponseSchema): + """ DescribeNewUcdnPrefetchCacheTask - 获取预取任务状态 + """ + + fields = { + "TaskList": fields.List( + models.TaskInfoSchema(), required=False, load_from="TaskList" + ), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: DescribeNewUcdnRefreshCacheTask + +获取域名刷新任务状态 +""" + + +class DescribeNewUcdnRefreshCacheTaskRequestSchema(schema.RequestSchema): + """ DescribeNewUcdnRefreshCacheTask - 获取域名刷新任务状态 + """ + + fields = { + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "Limit": fields.Int(required=False, dump_to="Limit"), + "Offset": fields.Int(required=False, dump_to="Offset"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Status": fields.Str(required=False, dump_to="Status"), + "TaskId": fields.List(fields.Str()), + } + + +class DescribeNewUcdnRefreshCacheTaskResponseSchema(schema.ResponseSchema): + """ DescribeNewUcdnRefreshCacheTask - 获取域名刷新任务状态 + """ + + fields = { + "TaskList": fields.List( + models.TaskInfoSchema(), required=False, load_from="TaskList" + ), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + } + + +""" +API: GetNewUcdnDomainBandwidth + +获取域名带宽数据 +""" + + +class GetNewUcdnDomainBandwidthRequestSchema(schema.RequestSchema): + """ GetNewUcdnDomainBandwidth - 获取域名带宽数据 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetNewUcdnDomainBandwidthResponseSchema(schema.ResponseSchema): + """ GetNewUcdnDomainBandwidth - 获取域名带宽数据 + """ + + fields = { + "BandwidthList": fields.List( + models.BandwidthInfoSchema(), + required=False, + load_from="BandwidthList", + ), + "Traffic": fields.Str(required=False, load_from="Traffic"), + } + + +""" +API: GetNewUcdnDomainHitRate + +获取域名命中率 +""" + + +class GetNewUcdnDomainHitRateRequestSchema(schema.RequestSchema): + """ GetNewUcdnDomainHitRate - 获取域名命中率 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetNewUcdnDomainHitRateResponseSchema(schema.ResponseSchema): + """ GetNewUcdnDomainHitRate - 获取域名命中率 + """ + + fields = { + "HitRateList": fields.List( + models.HitRateInfoSchema(), required=False, load_from="HitRateList" + ) + } + + +""" +API: GetNewUcdnDomainHttpCode + +获取域名状态码监控 +""" + + +class GetNewUcdnDomainHttpCodeRequestSchema(schema.RequestSchema): + """ GetNewUcdnDomainHttpCode - 获取域名状态码监控 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetNewUcdnDomainHttpCodeResponseSchema(schema.ResponseSchema): + """ GetNewUcdnDomainHttpCode - 获取域名状态码监控 + """ + + fields = { + "HttpCodeDetail": fields.List( + models.HttpCodeInfoSchema(), + required=False, + load_from="HttpCodeDetail", + ) + } + + +""" +API: GetNewUcdnDomainHttpCodeV2 + +获取域名详细状态码监控 +""" + + +class GetNewUcdnDomainHttpCodeV2RequestSchema(schema.RequestSchema): + """ GetNewUcdnDomainHttpCodeV2 - 获取域名详细状态码监控 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=True, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=True, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetNewUcdnDomainHttpCodeV2ResponseSchema(schema.ResponseSchema): + """ GetNewUcdnDomainHttpCodeV2 - 获取域名详细状态码监控 + """ + + fields = { + "HttpCodeV2Detail": fields.List( + models.HttpCodeV2DetailSchema(), + required=False, + load_from="HttpCodeV2Detail", + ) + } + + +""" +API: GetNewUcdnDomainRequestNum + +获取域名请求数 +""" + + +class GetNewUcdnDomainRequestNumRequestSchema(schema.RequestSchema): + """ GetNewUcdnDomainRequestNum - 获取域名请求数 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetNewUcdnDomainRequestNumResponseSchema(schema.ResponseSchema): + """ GetNewUcdnDomainRequestNum - 获取域名请求数 + """ + + fields = { + "RequestList": fields.List( + models.RequestInfoSchema(), required=False, load_from="RequestList" + ) + } + + +""" +API: GetUcdnDomainLog + +获取加速域名原始日志 +""" + + +class GetUcdnDomainLogRequestSchema(schema.RequestSchema): + """ GetUcdnDomainLog - 获取加速域名原始日志 + """ + + fields = { + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=False, dump_to="Type"), + } + + +class GetUcdnDomainLogResponseSchema(schema.ResponseSchema): + """ GetUcdnDomainLog - 获取加速域名原始日志 + """ + + fields = { + "LogSet": fields.List( + models.LogSetListSchema(), required=False, load_from="LogSet" + ) + } + + +""" +API: GetUcdnDomainPrefetchEnable + +获取域名预取开启状态 +""" + + +class GetUcdnDomainPrefetchEnableRequestSchema(schema.RequestSchema): + """ GetUcdnDomainPrefetchEnable - 获取域名预取开启状态 + """ + + fields = { + "DomainId": fields.Str(required=True, dump_to="DomainId"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + } + + +class GetUcdnDomainPrefetchEnableResponseSchema(schema.ResponseSchema): + """ GetUcdnDomainPrefetchEnable - 获取域名预取开启状态 + """ + + fields = {"Enable": fields.Int(required=False, load_from="Enable")} + + +""" +API: GetUcdnDomainRequestNumV2 + +获取域名请求数 +""" + + +class GetUcdnDomainRequestNumV2RequestSchema(schema.RequestSchema): + """ GetUcdnDomainRequestNumV2 - 获取域名请求数 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=True, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=True, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetUcdnDomainRequestNumV2ResponseSchema(schema.ResponseSchema): + """ GetUcdnDomainRequestNumV2 - 获取域名请求数 + """ + + fields = { + "RequestList": fields.List( + models.RequestInfoSchema(), required=False, load_from="RequestList" + ) + } + + +""" +API: GetUcdnDomainTraffic + +获取加速域名流量使用信息 +""" + + +class GetUcdnDomainTrafficRequestSchema(schema.RequestSchema): + """ GetUcdnDomainTraffic - 获取加速域名流量使用信息 + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + } + + +class GetUcdnDomainTrafficResponseSchema(schema.ResponseSchema): + """ GetUcdnDomainTraffic - 获取加速域名流量使用信息 + """ + + fields = { + "TrafficSet": fields.List( + models.UcdnDomainTrafficSetSchema(), + required=False, + load_from="TrafficSet", + ) + } + + +""" +API: GetUcdnPassBandwidth + +获取回源带宽数据(cdn回客户源站部分) +""" + + +class GetUcdnPassBandwidthRequestSchema(schema.RequestSchema): + """ GetUcdnPassBandwidth - 获取回源带宽数据(cdn回客户源站部分) + """ + + fields = { + "Areacode": fields.Str(required=False, dump_to="Areacode"), + "BeginTime": fields.Int(required=False, dump_to="BeginTime"), + "DomainId": fields.List(fields.Str()), + "EndTime": fields.Int(required=False, dump_to="EndTime"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Int(required=True, dump_to="Type"), + } + + +class GetUcdnPassBandwidthResponseSchema(schema.ResponseSchema): + """ GetUcdnPassBandwidth - 获取回源带宽数据(cdn回客户源站部分) + """ + + fields = { + "BandwidthDetail": fields.List( + models.BandwidthInfoDetailSchema(), + required=False, + load_from="BandwidthDetail", + ) + } + + +""" +API: GetUcdnTraffic + +获取流量信息 +""" + + +class GetUcdnTrafficRequestSchema(schema.RequestSchema): + """ GetUcdnTraffic - 获取流量信息 + """ + + fields = {"ProjectId": fields.Str(required=False, dump_to="ProjectId")} + + +class GetUcdnTrafficResponseSchema(schema.ResponseSchema): + """ GetUcdnTraffic - 获取流量信息 + """ + + fields = { + "TrafficSet": fields.List( + models.TrafficSetSchema(), required=False, load_from="TrafficSet" + ) + } + + +""" +API: PrefetchNewUcdnDomainCache + +提交预取任务 +""" + + +class PrefetchNewUcdnDomainCacheRequestSchema(schema.RequestSchema): + """ PrefetchNewUcdnDomainCache - 提交预取任务 + """ + + fields = { + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "UrlList": fields.List(fields.Str()), + } + + +class PrefetchNewUcdnDomainCacheResponseSchema(schema.ResponseSchema): + """ PrefetchNewUcdnDomainCache - 提交预取任务 + """ + + fields = {"TaskId": fields.Str(required=False, load_from="TaskId")} + + +""" +API: RefreshNewUcdnDomainCache + +刷新缓存 +""" + + +class RefreshNewUcdnDomainCacheRequestSchema(schema.RequestSchema): + """ RefreshNewUcdnDomainCache - 刷新缓存 + """ + + fields = { + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Type": fields.Str(required=True, dump_to="Type"), + "UrlList": fields.List(fields.Str()), + } + + +class RefreshNewUcdnDomainCacheResponseSchema(schema.ResponseSchema): + """ RefreshNewUcdnDomainCache - 刷新缓存 + """ + + fields = {"TaskId": fields.Str(required=False, load_from="TaskId")} + + +""" +API: SwitchUcdnChargeType + +切换账号计费方式 +""" + + +class SwitchUcdnChargeTypeRequestSchema(schema.RequestSchema): + """ SwitchUcdnChargeType - 切换账号计费方式 + """ + + fields = { + "ChargeType": fields.Str(required=True, dump_to="ChargeType"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + } + + +class SwitchUcdnChargeTypeResponseSchema(schema.ResponseSchema): + """ SwitchUcdnChargeType - 切换账号计费方式 + """ + + fields = {} diff --git a/ucloud/services/ucdn/schemas/models.py b/ucloud/services/ucdn/schemas/models.py new file mode 100644 index 0000000..1b53d5b --- /dev/null +++ b/ucloud/services/ucdn/schemas/models.py @@ -0,0 +1,266 @@ +# -*- coding: utf-8 -*- + +""" Code is generated by ucloud-model, DO NOT EDIT IT. """ +from ucloud.core.typesystem import schema, fields + + +class AccessConfSchema(schema.ResponseSchema): + """ AccessConf - 访问控制 + """ + + fields = { + "IpBlacklist": fields.Str(required=False, load_from="IpBlacklist") + } + + +class CacheConfSchema(schema.ResponseSchema): + """ CacheConf - 缓存配置 + """ + + fields = { + "CacheBehavior": fields.Bool(required=False, load_from="CacheBehavior"), + "CacheTTL": fields.Int(required=False, load_from="CacheTTL"), + "CacheUnit": fields.Str(required=False, load_from="CacheUnit"), + "Description": fields.Str(required=False, load_from="Description"), + "FollowOriginRule": fields.Bool( + required=False, load_from="FollowOriginRule" + ), + "HttpCodePattern": fields.Str( + required=False, load_from="HttpCodePattern" + ), + "IgnoreQueryString": fields.Bool( + required=False, load_from="IgnoreQueryString" + ), + "PathPattern": fields.Str(required=False, load_from="PathPattern"), + } + + +class DomainInfoSchema(schema.ResponseSchema): + """ DomainInfo - 域名配置 + """ + + fields = { + "AccessConf": AccessConfSchema(), + "AreaCode": fields.Str(required=False, load_from="AreaCode"), + "CacheConf": fields.List(CacheConfSchema()), + "CacheHost": fields.Str(required=False, load_from="CacheHost"), + "CdnProtocol": fields.Str(required=False, load_from="CdnProtocol"), + "CdnType": fields.Str(required=True, load_from="CdnType"), + "CertName": fields.Str(required=False, load_from="CertName"), + "Cname": fields.Str(required=False, load_from="Cname"), + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Domain": fields.Str(required=False, load_from="Domain"), + "DomainId": fields.Str(required=False, load_from="DomainId"), + "HttpsStatusAbroad": fields.Str( + required=False, load_from="HttpsStatusAbroad" + ), + "HttpsStatusCn": fields.Str(required=False, load_from="HttpsStatusCn"), + "NullRefer": fields.Bool(required=False, load_from="NullRefer"), + "OriginHost": fields.Str(required=False, load_from="OriginHost"), + "OriginIp": fields.List(fields.Str()), + "OriginPort": fields.Int(required=False, load_from="OriginPort"), + "OriginProtocol": fields.Str( + required=False, load_from="OriginProtocol" + ), + "ReferList": fields.List(fields.Str()), + "ReferStatus": fields.Bool(required=False, load_from="ReferStatus"), + "ReferType": fields.Int(required=False, load_from="ReferType"), + "Status": fields.Str(required=False, load_from="Status"), + "Tag": fields.Str(required=False, load_from="Tag"), + "TestUrl": fields.Str(required=True, load_from="TestUrl"), + "ValidTime": fields.Int(required=False, load_from="ValidTime"), + } + + +class UrlProgressInfoSchema(schema.ResponseSchema): + """ UrlProgressInfo - UrlProgressInfo + """ + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "FinishTime": fields.Int(required=False, load_from="FinishTime"), + "Progress": fields.Int(required=False, load_from="Progress"), + "Status": fields.Str(required=False, load_from="Status"), + "Url": fields.Str(required=False, load_from="Url"), + } + + +class TaskInfoSchema(schema.ResponseSchema): + """ TaskInfo - 预取刷新的任务信息 + """ + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Status": fields.Str(required=False, load_from="Status"), + "TaskId": fields.Str(required=False, load_from="TaskId"), + "Type": fields.Str(required=False, load_from="Type"), + "UrlLists": fields.List(UrlProgressInfoSchema()), + } + + +class BandwidthInfoSchema(schema.ResponseSchema): + """ BandwidthInfo - BandwidthInfo + """ + + fields = { + "CdnBandwidth": fields.Str(required=False, load_from="CdnBandwidth"), + "Time": fields.Int(required=False, load_from="Time"), + } + + +class HitRateInfoSchema(schema.ResponseSchema): + """ HitRateInfo - HitRateInfo + """ + + fields = { + "FlowHitRate": fields.Float(required=False, load_from="FlowHitRate"), + "RequestHitRate": fields.Float( + required=False, load_from="RequestHitRate" + ), + "Time": fields.Int(required=False, load_from="Time"), + } + + +class HttpCodeInfoSchema(schema.ResponseSchema): + """ HttpCodeInfo - HttpCodeInfo + """ + + fields = { + "HttpFiveXX": fields.Int(required=False, load_from="HttpFiveXX"), + "HttpFourXX": fields.Int(required=False, load_from="HttpFourXX"), + "HttpOneXX": fields.Int(required=False, load_from="HttpOneXX"), + "HttpThreeXX": fields.Int(required=False, load_from="HttpThreeXX"), + "HttpTwoXX": fields.Int(required=False, load_from="HttpTwoXX"), + "Time": fields.Int(required=False, load_from="Time"), + } + + +class HttpCodeV2DetailSchema(schema.ResponseSchema): + """ HttpCodeV2Detail - HTTP状态码详细信息 + """ + + fields = { + "Http100": fields.Int(required=False, load_from="Http100"), + "Http101": fields.Int(required=False, load_from="Http101"), + "Http102": fields.Int(required=False, load_from="Http102"), + "Http200": fields.Int(required=False, load_from="Http200"), + "Http201": fields.Int(required=False, load_from="Http201"), + "Http202": fields.Int(required=False, load_from="Http202"), + "Http203": fields.Int(required=False, load_from="Http203"), + "Http204": fields.Int(required=False, load_from="Http204"), + "Http205": fields.Int(required=False, load_from="Http205"), + "Http206": fields.Int(required=False, load_from="Http206"), + "Http207": fields.Int(required=False, load_from="Http207"), + "Http300": fields.Int(required=False, load_from="Http300"), + "Http301": fields.Int(required=False, load_from="Http301"), + "Http302": fields.Int(required=False, load_from="Http302"), + "Http303": fields.Int(required=False, load_from="Http303"), + "Http304": fields.Int(required=False, load_from="Http304"), + "Http305": fields.Int(required=False, load_from="Http305"), + "Http306": fields.Int(required=False, load_from="Http306"), + "Http307": fields.Int(required=False, load_from="Http307"), + "Http400": fields.Int(required=False, load_from="Http400"), + "Http401": fields.Int(required=False, load_from="Http401"), + "Http402": fields.Int(required=False, load_from="Http402"), + "Http403": fields.Int(required=False, load_from="Http403"), + "Http404": fields.Int(required=False, load_from="Http404"), + "Http405": fields.Int(required=False, load_from="Http405"), + "Http406": fields.Int(required=False, load_from="Http406"), + "Http407": fields.Int(required=False, load_from="Http407"), + "Http408": fields.Int(required=False, load_from="Http408"), + "Http409": fields.Int(required=False, load_from="Http409"), + "Http410": fields.Int(required=False, load_from="Http410"), + "Http411": fields.Int(required=False, load_from="Http411"), + "Http412": fields.Int(required=False, load_from="Http412"), + "Http413": fields.Int(required=False, load_from="Http413"), + "Http414": fields.Int(required=False, load_from="Http414"), + "Http415": fields.Int(required=False, load_from="Http415"), + "Http416": fields.Int(required=False, load_from="Http416"), + "Http417": fields.Int(required=False, load_from="Http417"), + "Http418": fields.Int(required=False, load_from="Http418"), + "Http421": fields.Int(required=False, load_from="Http421"), + "Http422": fields.Int(required=False, load_from="Http422"), + "Http423": fields.Int(required=False, load_from="Http423"), + "Http424": fields.Int(required=False, load_from="Http424"), + "Http425": fields.Int(required=False, load_from="Http425"), + "Http426": fields.Int(required=False, load_from="Http426"), + "Http449": fields.Int(required=False, load_from="Http449"), + "Http451": fields.Int(required=False, load_from="Http451"), + "Http500": fields.Int(required=False, load_from="Http500"), + "Http501": fields.Int(required=False, load_from="Http501"), + "Http502": fields.Int(required=False, load_from="Http502"), + "Http503": fields.Int(required=False, load_from="Http503"), + "Http504": fields.Int(required=False, load_from="Http504"), + "Http505": fields.Int(required=False, load_from="Http505"), + "Http506": fields.Int(required=False, load_from="Http506"), + "Http507": fields.Int(required=False, load_from="Http507"), + "Http509": fields.Int(required=False, load_from="Http509"), + "Http510": fields.Int(required=False, load_from="Http510"), + "Time": fields.Int(required=True, load_from="Time"), + } + + +class RequestInfoSchema(schema.ResponseSchema): + """ RequestInfo - RequestInfo + """ + + fields = { + "CdnRequest": fields.Float(required=False, load_from="CdnRequest"), + "OriginRequest": fields.Float( + required=False, load_from="OriginRequest" + ), + "Time": fields.Int(required=False, load_from="Time"), + } + + +class LogSetInfoSchema(schema.ResponseSchema): + """ LogSetInfo - 日志信息 + """ + + fields = { + "AbroadLog": fields.List(fields.Str()), + "CnLog": fields.List(fields.Str()), + "Time": fields.Int(required=False, load_from="Time"), + } + + +class LogSetListSchema(schema.ResponseSchema): + """ LogSetList - 日志信息列表 + """ + + fields = { + "Domain": fields.Str(required=False, load_from="Domain"), + "Logs": fields.List(LogSetInfoSchema()), + } + + +class UcdnDomainTrafficSetSchema(schema.ResponseSchema): + """ UcdnDomainTrafficSet - GetUcdnDomainTraffic + """ + + fields = { + "Time": fields.Int(required=False, load_from="Time"), + "Value": fields.Float(required=False, load_from="Value"), + } + + +class BandwidthInfoDetailSchema(schema.ResponseSchema): + """ BandwidthInfoDetail - 带宽值信息模型(时间-带宽) + """ + + fields = { + "Bandwidth": fields.Float(required=True, load_from="Bandwidth"), + "Time": fields.Int(required=True, load_from="Time"), + } + + +class TrafficSetSchema(schema.ResponseSchema): + """ TrafficSet - GetUcdnTraffic + """ + + fields = { + "Areacode": fields.Str(required=False, load_from="Areacode"), + "TrafficLeft": fields.Str(required=False, load_from="TrafficLeft"), + "TrafficTotal": fields.Str(required=False, load_from="TrafficTotal"), + "TrafficUsed": fields.Str(required=False, load_from="TrafficUsed"), + } diff --git a/ucloud/testing/funcs.py b/ucloud/testing/funcs.py index 613a3b1..2d5b7ad 100644 --- a/ucloud/testing/funcs.py +++ b/ucloud/testing/funcs.py @@ -65,5 +65,5 @@ def get_timestamp(length=13): :return: """ if isinstance(length, int) and 0 < length < 17: - return float("{:.6f}".format(time.time()).replace(".", "")[:length]) + return int("{:.6f}".format(time.time()).replace(".", "")[:length]) raise ValueError("timestamp length can only between 0 and 16.") diff --git a/ucloud/version.py b/ucloud/version.py index a486b39..4e9e634 100644 --- a/ucloud/version.py +++ b/ucloud/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -version = "0.5.1" +version = "0.6.0"