Skip to content

sdk: rolling update for 0.11.64 #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 77 additions & 7 deletions ucloud/services/ucdn/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ def batch_refresh_new_ucdn_domain_cache(
def control_ucdn_domain_cache_access(
self, req: typing.Optional[dict] = None, **kwargs
) -> dict:
"""ControlUcdnDomainCacheAccess - 封禁解封缓存访问
"""ControlUcdnDomainCacheAccess -

**Request**

- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
- **Type** (str) - (Required) forbid=封禁 unforbid=解封 其他值非法
- **UrlList** (list) - (Required) 待封禁的Url,一次封禁多个Url时最多一次30条,只能对表示文件的Url进行操作
- **ProjectId** (str) - (Config)
- **Type** (str) - (Required)
- **UrlList** (list) -

**Response**

Expand All @@ -169,6 +169,9 @@ def control_ucdn_domain_cache_access(
req and d.update(req)
d = apis.ControlUcdnDomainCacheAccessRequestSchema().dumps(d)

# build options
kwargs["max_retries"] = 0 # ignore retry when api is not idempotent

resp = self.invoke("ControlUcdnDomainCacheAccess", d, **kwargs)
return apis.ControlUcdnDomainCacheAccessResponseSchema().loads(resp)

Expand Down Expand Up @@ -623,6 +626,47 @@ def get_new_ucdn_domain_request_num(
resp = self.invoke("GetNewUcdnDomainRequestNum", d, **kwargs)
return apis.GetNewUcdnDomainRequestNumResponseSchema().loads(resp)

def get_new_ucdn_log_client_ip_statistics(
self, req: typing.Optional[dict] = None, **kwargs
) -> dict:
"""GetNewUcdnLogClientIpStatistics - 获取日志客户端ip统计

**Request**

- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
- **DomainId** (str) - (Required) 域名id,创建域名时生成的id
- **BeginTime** (int) - 查询的日期,单位:Unix时间戳。只支持按天查询
- **Limit** (str) - 返回结果数量限制,返回最多100条
- **OrderBy** (int) - 0表示按照下载次数降序排列,1表示按流量降序排列,默认为0
- **Type** (int) - 1表示按照1小时粒度,2表示按照一天的粒度 默认是天

**Response**

- **Action** (str) - 操作名称
- **ClientIpStatisticsList** (list) - 见 **ClientIpStatisticsList** 模型定义
- **RetCode** (int) - 返回码

**Response Model**

**ClientIpStatisticsList**
- **Flow** (int) - 流量单位字节
- **FlowPercent** (float) - 流量占比
- **IP** (str) - 客户端IP
- **RequestPercent** (float) - 请求数占比
- **Requst** (int) - 请求数


"""
# build request
d = {
"ProjectId": self.config.project_id,
}
req and d.update(req)
d = apis.GetNewUcdnLogClientIpStatisticsRequestSchema().dumps(d)

resp = self.invoke("GetNewUcdnLogClientIpStatistics", d, **kwargs)
return apis.GetNewUcdnLogClientIpStatisticsResponseSchema().loads(resp)

def get_new_ucdn_log_referer_statistics(
self, req: typing.Optional[dict] = None, **kwargs
) -> dict:
Expand Down Expand Up @@ -937,7 +981,7 @@ def get_ucdn_domain_hit_rate(
- **BeginTime** (int) - 查询的起始时间,格式为Unix Timestamp。如果有EndTime,BeginTime必须赋值。如没有赋值,则返回缺少参 数错误,如果没有EndTime,BeginTime也可以不赋值,EndTime默认当前时间,BeginTime 默认前一天的当前时间。
- **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名
- **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。
- **HitType** (int) - 命中类型:0=整体命中 1=边缘命中 默认是0
- **HitType** (int) - 默认是0
- **IsDcdn** (bool) - 是否全站加速,默认false

**Response**
Expand Down Expand Up @@ -977,7 +1021,7 @@ def get_ucdn_domain_http_code_v2(
- **DomainId** (list) - 域名id,创建域名时生成的id。默认全部域名
- **EndTime** (int) - 查询的结束时间,格式为Unix Timestamp。EndTime默认为当前时间,BeginTime默认为当前时间前一天时间。
- **IsDcdn** (bool) - 是否全站加速 默认false
- **Layer** (str) - 指定获取的状态码是边缘还是上层 edge 表示边缘 layer 表示上层
- **Layer** (str) - edge 表示边缘

**Response**

Expand Down Expand Up @@ -1766,7 +1810,7 @@ def prefetch_new_ucdn_domain_cache(
**Request**

- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
- **UrlList** (list) - (Required) 预热URL列表,n从自然数0开始。UrlList.n字段必须以”http://域名/”开始。如刷新文件目录a下面img.png文件, 格式为http://abc.ucloud.cn/a/img.png。请正确提交需要刷新的域名
- **UrlList** (list) - (Required) 预热URL列表,n从自然数0开始。UrlList.n字段必须以”http://域名/”开始。如刷新文件目录a下面img.png文件, 格式为http://abc.ucloud.cn/a/img.png。请正确提交需要刷新的域名,一次性可提交1000条,最少每10S调用一次

**Response**

Expand Down Expand Up @@ -1865,6 +1909,32 @@ def switch_ucdn_charge_type(
resp = self.invoke("SwitchUcdnChargeType", d, **kwargs)
return apis.SwitchUcdnChargeTypeResponseSchema().loads(resp)

def update_ucdn_domain_https_config_v2(
self, req: typing.Optional[dict] = None, **kwargs
) -> dict:
"""UpdateUcdnDomainHttpsConfigV2 - https加速配置,国内,国外一起配置(兼容全站加速域名)

**Request**

- **DomainId** (str) - (Required) 域名对应的资源Id
- **CertId** (int) - 证书id(可能是ucdn的id,也可能是ussl的id)
- **CertName** (str) - 证书名称,开启加速必传
- **CertType** (str) - 证书类型 ucdn/ussl
- **HttpsStatusAbroad** (str) - 开启或关闭加速 enable或disable 当加速区域含国外的时候,此参数为必传
- **HttpsStatusCn** (str) - 开启或关闭加速 enable或disable 当加速区域含国内的时候,此参数为必传

**Response**


"""
# build request
d = {}
req and d.update(req)
d = apis.UpdateUcdnDomainHttpsConfigV2RequestSchema().dumps(d)

resp = self.invoke("UpdateUcdnDomainHttpsConfigV2", d, **kwargs)
return apis.UpdateUcdnDomainHttpsConfigV2ResponseSchema().loads(resp)

def update_ucdn_domain_status(
self, req: typing.Optional[dict] = None, **kwargs
) -> dict:
Expand Down
68 changes: 65 additions & 3 deletions ucloud/services/ucdn/schemas/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ class BatchRefreshNewUcdnDomainCacheResponseSchema(schema.ResponseSchema):
"""
API: ControlUcdnDomainCacheAccess

封禁解封缓存访问

"""


class ControlUcdnDomainCacheAccessRequestSchema(schema.RequestSchema):
"""ControlUcdnDomainCacheAccess - 封禁解封缓存访问"""
"""ControlUcdnDomainCacheAccess -"""

fields = {
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
Expand All @@ -115,7 +115,7 @@ class ControlUcdnDomainCacheAccessRequestSchema(schema.RequestSchema):


class ControlUcdnDomainCacheAccessResponseSchema(schema.ResponseSchema):
"""ControlUcdnDomainCacheAccess - 封禁解封缓存访问"""
"""ControlUcdnDomainCacheAccess -"""

fields = {}

Expand Down Expand Up @@ -423,6 +423,40 @@ class GetNewUcdnDomainRequestNumResponseSchema(schema.ResponseSchema):
}


"""
API: GetNewUcdnLogClientIpStatistics

获取日志客户端ip统计
"""


class GetNewUcdnLogClientIpStatisticsRequestSchema(schema.RequestSchema):
"""GetNewUcdnLogClientIpStatistics - 获取日志客户端ip统计"""

fields = {
"BeginTime": fields.Int(required=False, dump_to="BeginTime"),
"DomainId": fields.Str(required=True, dump_to="DomainId"),
"Limit": fields.Str(required=False, dump_to="Limit"),
"OrderBy": fields.Int(required=False, dump_to="OrderBy"),
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
"Type": fields.Int(required=False, dump_to="Type"),
}


class GetNewUcdnLogClientIpStatisticsResponseSchema(schema.ResponseSchema):
"""GetNewUcdnLogClientIpStatistics - 获取日志客户端ip统计"""

fields = {
"Action": fields.Str(required=True, load_from="Action"),
"ClientIpStatisticsList": fields.List(
models.ClientIpStatisticsListSchema(),
required=False,
load_from="ClientIpStatisticsList",
),
"RetCode": fields.Int(required=True, load_from="RetCode"),
}


"""
API: GetNewUcdnLogRefererStatistics

Expand Down Expand Up @@ -1308,6 +1342,34 @@ class SwitchUcdnChargeTypeResponseSchema(schema.ResponseSchema):
fields = {}


"""
API: UpdateUcdnDomainHttpsConfigV2

https加速配置,国内,国外一起配置(兼容全站加速域名)
"""


class UpdateUcdnDomainHttpsConfigV2RequestSchema(schema.RequestSchema):
"""UpdateUcdnDomainHttpsConfigV2 - https加速配置,国内,国外一起配置(兼容全站加速域名)"""

fields = {
"CertId": fields.Int(required=False, dump_to="CertId"),
"CertName": fields.Str(required=False, dump_to="CertName"),
"CertType": fields.Str(required=False, dump_to="CertType"),
"DomainId": fields.Str(required=True, dump_to="DomainId"),
"HttpsStatusAbroad": fields.Str(
required=False, dump_to="HttpsStatusAbroad"
),
"HttpsStatusCn": fields.Str(required=False, dump_to="HttpsStatusCn"),
}


class UpdateUcdnDomainHttpsConfigV2ResponseSchema(schema.ResponseSchema):
"""UpdateUcdnDomainHttpsConfigV2 - https加速配置,国内,国外一起配置(兼容全站加速域名)"""

fields = {}


"""
API: UpdateUcdnDomainStatus

Expand Down
90 changes: 52 additions & 38 deletions ucloud/services/ucdn/schemas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
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 - 缓存配置"""

Expand All @@ -21,14 +29,6 @@ class CacheConfSchema(schema.ResponseSchema):
}


class AccessConfSchema(schema.ResponseSchema):
"""AccessConf - 访问控制"""

fields = {
"IpBlacklist": fields.Str(required=False, load_from="IpBlacklist"),
}


class DomainInfoSchema(schema.ResponseSchema):
"""DomainInfo - 域名配置"""

Expand Down Expand Up @@ -245,6 +245,20 @@ class RequestInfoSchema(schema.ResponseSchema):
}


class ClientIpStatisticsListSchema(schema.ResponseSchema):
"""ClientIpStatisticsList - ClientIpStatisticsList"""

fields = {
"Flow": fields.Int(required=False, load_from="Flow"),
"FlowPercent": fields.Float(required=False, load_from="FlowPercent"),
"IP": fields.Str(required=False, load_from="IP"),
"RequestPercent": fields.Float(
required=False, load_from="RequestPercent"
),
"Requst": fields.Int(required=False, load_from="Requst"),
}


class RefererListSchema(schema.ResponseSchema):
"""RefererList - RefererList"""

Expand Down Expand Up @@ -294,6 +308,16 @@ class BandwidthTrafficInfoSchema(schema.ResponseSchema):
}


class CacheKeyInfoSchema(schema.ResponseSchema):
"""CacheKeyInfo - 忽略参数缓存配置"""

fields = {
"Ignore": fields.Bool(required=False, load_from="Ignore"),
"PathPattern": fields.Str(required=False, load_from="PathPattern"),
"QueryString": fields.Str(required=False, load_from="QueryString"),
}


class ReferConfSchema(schema.ResponseSchema):
"""ReferConf - refer配置"""

Expand All @@ -304,13 +328,28 @@ class ReferConfSchema(schema.ResponseSchema):
}


class CacheKeyInfoSchema(schema.ResponseSchema):
"""CacheKeyInfo - 忽略参数缓存配置"""
class AdvancedConfSchema(schema.ResponseSchema):
"""AdvancedConf - 域名高级配置"""

fields = {
"Ignore": fields.Bool(required=False, load_from="Ignore"),
"PathPattern": fields.Str(required=False, load_from="PathPattern"),
"QueryString": fields.Str(required=False, load_from="QueryString"),
"Http2Https": fields.Bool(required=False, load_from="Http2Https"),
"HttpClientHeader": fields.List(fields.Str()),
"HttpOriginHeader": fields.List(fields.Str()),
"QuicEnable": fields.Bool(required=False, load_from="QuicEnable"),
"WebSocketEnable": fields.Bool(
required=False, load_from="WebSocketEnable"
),
}


class CacheAllConfigSchema(schema.ResponseSchema):
"""CacheAllConfig - 缓存相关的配置"""

fields = {
"CacheHost": fields.Str(required=False, load_from="CacheHost"),
"CacheKeyList": fields.List(CacheKeyInfoSchema()),
"CacheList": fields.List(CacheConfSchema()),
"HttpCodeCacheList": fields.List(CacheConfSchema()),
}


Expand Down Expand Up @@ -352,31 +391,6 @@ class OriginConfSchema(schema.ResponseSchema):
}


class CacheAllConfigSchema(schema.ResponseSchema):
"""CacheAllConfig - 缓存相关的配置"""

fields = {
"CacheHost": fields.Str(required=False, load_from="CacheHost"),
"CacheKeyList": fields.List(CacheKeyInfoSchema()),
"CacheList": fields.List(CacheConfSchema()),
"HttpCodeCacheList": fields.List(CacheConfSchema()),
}


class AdvancedConfSchema(schema.ResponseSchema):
"""AdvancedConf - 域名高级配置"""

fields = {
"Http2Https": fields.Bool(required=False, load_from="Http2Https"),
"HttpClientHeader": fields.List(fields.Str()),
"HttpOriginHeader": fields.List(fields.Str()),
"QuicEnable": fields.Bool(required=False, load_from="QuicEnable"),
"WebSocketEnable": fields.Bool(
required=False, load_from="WebSocketEnable"
),
}


class DomainConfigInfoSchema(schema.ResponseSchema):
"""DomainConfigInfo - 更新域名配置"""

Expand Down
Loading