Skip to content

Commit 2af39a5

Browse files
committed
auto codegen for UCDN
1 parent a068473 commit 2af39a5

6 files changed

Lines changed: 14 additions & 187 deletions

File tree

docs/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
UCloud SDK Services
22
===================
33

4+
PathX
5+
-----
6+
7+
.. autoclass:: ucloud.services.pathx.client.PathXClient
8+
:members:
9+
410
StepFlow
511
--------
612

tests/test_services/test_set_4140.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def batch_describe_new_ucdn_domain_04(client: utest.Client, variables: dict):
155155
d = {}
156156

157157
try:
158-
resp = client.ucdn().batch_describe_new_ucdn_domain(d)
158+
resp = client.invoke("BatchDescribeNewUcdnDomain", d)
159159
except exc.RetCodeException as e:
160160
resp = e.json()
161161

ucloud/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ def __init__(self, config: dict, transport=None, middleware=None):
88
self._config = config
99
super(Client, self).__init__(config, transport, middleware)
1010

11+
def pathx(self):
12+
from ucloud.services.pathx.client import PathXClient
13+
14+
return PathXClient(
15+
self._config, self.transport, self.middleware, self.logger
16+
)
17+
1118
def stepflow(self):
1219
from ucloud.services.stepflow.client import StepFlowClient
1320

ucloud/services/ucdn/client.py

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -13,83 +13,6 @@ def __init__(
1313
):
1414
super(UCDNClient, self).__init__(config, transport, middleware, logger)
1515

16-
def batch_describe_new_ucdn_domain(
17-
self, req: typing.Optional[dict] = None, **kwargs
18-
) -> dict:
19-
""" BatchDescribeNewUcdnDomain - 批量获取加速域名配置
20-
21-
**Request**
22-
23-
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_
24-
- **ChannelType** (str) - 渠道ucdn、ufile、uvideo
25-
- **DomainId** (list) - 域名id,创建域名时生成的资源id,默认获取账号下的所有域名信息,n为自然数
26-
- **Limit** (int) - 返回数据长度,如果制定了Offset,则默认20,否则默认全部,非负整数
27-
- **Offset** (int) - 数据偏移量,默认0,非负整数
28-
29-
**Response**
30-
31-
- **Arrearage** (list) - 标识欠费的数组,数组含有下列元素值, 1=国内流量有欠费 2=国外流量有欠费 3=国内带宽有欠费 4=国外带宽有欠费
32-
- **ChargeType** (int) - 当前计费方式,10=流量付费 20=带宽日峰值 30=按月后付费
33-
- **DomainList** (list) - 见 **DomainInfo** 模型定义
34-
- **LastChargeType** (int) - 表示最后一次切换的计费方式,10=流量付费 20=带宽日峰值 30=按月后付费 40=未选择计费方式
35-
- **MaxDomainNum** (int) - 最大域名数量,默认20
36-
- **TotalCount** (int) - 满足条件的域名个数
37-
- **Vip** (str) - vip标示,yes-是 no-否
38-
39-
**Response Model**
40-
41-
**AccessConf**
42-
43-
- **IpBlacklist** (str) - 多个ip用逗号隔开
44-
45-
**CacheConf**
46-
47-
- **CacheBehavior** (bool) - 是否缓存,true为缓存,false为不缓存。为false的情况下,CacheTTL和CacheUnit强制不生效
48-
- **CacheTTL** (int) - 缓存时间
49-
- **CacheUnit** (str) - 缓存时间的单位。sec(秒),min(分钟),hour(小时),day(天)
50-
- **Description** (str) - 缓存规则描述
51-
- **FollowOriginRule** (bool) - 是否优先遵循源站头部缓存策略,false为不优先遵循源站,true为优先遵循源站缓存头部。默认为false
52-
- **HttpCodePattern** (str) - 状态码默认情况只缓存200类状态码,支持正则
53-
- **IgnoreQueryString** (bool) - 是否忽略参数缓存(false为不忽略,true为忽略,默认为false)
54-
- **PathPattern** (str) - 路径模式,支持正则
55-
56-
**DomainInfo**
57-
58-
- **AccessConf** (dict) - 见 **AccessConf** 模型定义
59-
- **AreaCode** (str) - 查询带宽区域 cn代表国内 abroad代表海外 不填默认为全部区域
60-
- **CacheConf** (list) - 见 **CacheConf** 模型定义
61-
- **CacheHost** (str) - 缓存Host,不同的域名可以配置为同一个CacheHost来实现缓存共享,默认为加速域名
62-
- **CdnProtocol** (str) - 加速类型http,http|https
63-
- **CdnType** (str) - 加速域名的业务类型,web代表网站,stream代表视频,download代表下载。
64-
- **CertName** (str) - 证书名称
65-
- **Cname** (str) - cdn域名。创建加速域名生成的cdn域名,用于设置CNAME记录
66-
- **CreateTime** (int) - 域名创建的时间。格式:时间戳
67-
- **Domain** (str) - 域名,用户创建加速的域名
68-
- **DomainId** (str) - 域名id,创建域名时生成的id
69-
- **HttpsStatusAbroad** (str) - 国外https状态 enableing-开启中 fail-开启失败 enable-启用 disable-未启用
70-
- **HttpsStatusCn** (str) - 国内https状态 enableing-开启中 fail-开启失败 enable-启用 disable-未启用
71-
- **NullRefer** (bool) - ReferType为白名单时,NullRefer为false代表不允许NULL refer访问,为true代表允许Null refer访问
72-
- **OriginHost** (str) - 回源Http请求头部Host,默认是加速域名
73-
- **OriginIp** (list) - 源站ip即cdn服务器回源访问的ip地址。支持多个源站ip,多个源站ip,可表述为如:[1.1.1.1,2.2.2.2]
74-
- **OriginPort** (int) - 回源端口
75-
- **OriginProtocol** (str) - 源站协议http,http|https 默认http
76-
- **ReferList** (list) - Refer列表,支持正则表达式
77-
- **ReferStatus** (bool) - refer配置开关,true打开,false关闭
78-
- **ReferType** (int) - 0白名单,1黑名单
79-
- **Status** (str) - 创建的加速域名的当前的状态。check代表审核中,checkSuccess代表审核通过,checkFail代表审核失败,enable代表加速中,disable代表停止加速,delete代表删除加速 enableing代表正在开启加速,disableing代表正在停止加速中,deleteing代表删除中
80-
- **Tag** (str) - 业务组,默认为Default
81-
- **TestUrl** (str) - 测试url,用于域名创建加速时的测试
82-
- **ValidTime** (int) - 开始分配Cname时间。格式:时间戳
83-
84-
"""
85-
# build request
86-
d = {"ProjectId": self.config.project_id}
87-
req and d.update(req)
88-
d = apis.BatchDescribeNewUcdnDomainRequestSchema().dumps(d)
89-
90-
resp = self.invoke("BatchDescribeNewUcdnDomain", d, **kwargs)
91-
return apis.BatchDescribeNewUcdnDomainResponseSchema().loads(resp)
92-
9316
def describe_new_ucdn_prefetch_cache_task(
9417
self, req: typing.Optional[dict] = None, **kwargs
9518
) -> dict:

ucloud/services/ucdn/schemas/apis.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,6 @@
88
"""
99

1010

11-
"""
12-
API: BatchDescribeNewUcdnDomain
13-
14-
批量获取加速域名配置
15-
"""
16-
17-
18-
class BatchDescribeNewUcdnDomainRequestSchema(schema.RequestSchema):
19-
""" BatchDescribeNewUcdnDomain - 批量获取加速域名配置
20-
"""
21-
22-
fields = {
23-
"ChannelType": fields.Str(required=False, dump_to="ChannelType"),
24-
"DomainId": fields.List(fields.Str()),
25-
"Limit": fields.Int(required=False, dump_to="Limit"),
26-
"Offset": fields.Int(required=False, dump_to="Offset"),
27-
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
28-
}
29-
30-
31-
class BatchDescribeNewUcdnDomainResponseSchema(schema.ResponseSchema):
32-
""" BatchDescribeNewUcdnDomain - 批量获取加速域名配置
33-
"""
34-
35-
fields = {
36-
"Arrearage": fields.List(
37-
fields.Str(), required=False, load_from="Arrearage"
38-
),
39-
"ChargeType": fields.Int(required=False, load_from="ChargeType"),
40-
"DomainList": fields.List(
41-
models.DomainInfoSchema(), required=False, load_from="DomainList"
42-
),
43-
"LastChargeType": fields.Int(
44-
required=False, load_from="LastChargeType"
45-
),
46-
"MaxDomainNum": fields.Int(required=False, load_from="MaxDomainNum"),
47-
"TotalCount": fields.Int(required=False, load_from="TotalCount"),
48-
"Vip": fields.Str(required=False, load_from="Vip"),
49-
}
50-
51-
5211
"""
5312
API: DescribeNewUcdnPrefetchCacheTask
5413

ucloud/services/ucdn/schemas/models.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,74 +3,6 @@
33
from ucloud.core.typesystem import schema, fields
44

55

6-
class AccessConfSchema(schema.ResponseSchema):
7-
""" AccessConf - 访问控制
8-
"""
9-
10-
fields = {
11-
"IpBlacklist": fields.Str(required=False, load_from="IpBlacklist")
12-
}
13-
14-
15-
class CacheConfSchema(schema.ResponseSchema):
16-
""" CacheConf - 缓存配置
17-
"""
18-
19-
fields = {
20-
"CacheBehavior": fields.Bool(required=False, load_from="CacheBehavior"),
21-
"CacheTTL": fields.Int(required=False, load_from="CacheTTL"),
22-
"CacheUnit": fields.Str(required=False, load_from="CacheUnit"),
23-
"Description": fields.Str(required=False, load_from="Description"),
24-
"FollowOriginRule": fields.Bool(
25-
required=False, load_from="FollowOriginRule"
26-
),
27-
"HttpCodePattern": fields.Str(
28-
required=False, load_from="HttpCodePattern"
29-
),
30-
"IgnoreQueryString": fields.Bool(
31-
required=False, load_from="IgnoreQueryString"
32-
),
33-
"PathPattern": fields.Str(required=False, load_from="PathPattern"),
34-
}
35-
36-
37-
class DomainInfoSchema(schema.ResponseSchema):
38-
""" DomainInfo - 域名配置
39-
"""
40-
41-
fields = {
42-
"AccessConf": AccessConfSchema(),
43-
"AreaCode": fields.Str(required=False, load_from="AreaCode"),
44-
"CacheConf": fields.List(CacheConfSchema()),
45-
"CacheHost": fields.Str(required=False, load_from="CacheHost"),
46-
"CdnProtocol": fields.Str(required=False, load_from="CdnProtocol"),
47-
"CdnType": fields.Str(required=True, load_from="CdnType"),
48-
"CertName": fields.Str(required=False, load_from="CertName"),
49-
"Cname": fields.Str(required=False, load_from="Cname"),
50-
"CreateTime": fields.Int(required=False, load_from="CreateTime"),
51-
"Domain": fields.Str(required=False, load_from="Domain"),
52-
"DomainId": fields.Str(required=False, load_from="DomainId"),
53-
"HttpsStatusAbroad": fields.Str(
54-
required=False, load_from="HttpsStatusAbroad"
55-
),
56-
"HttpsStatusCn": fields.Str(required=False, load_from="HttpsStatusCn"),
57-
"NullRefer": fields.Bool(required=False, load_from="NullRefer"),
58-
"OriginHost": fields.Str(required=False, load_from="OriginHost"),
59-
"OriginIp": fields.List(fields.Str()),
60-
"OriginPort": fields.Int(required=False, load_from="OriginPort"),
61-
"OriginProtocol": fields.Str(
62-
required=False, load_from="OriginProtocol"
63-
),
64-
"ReferList": fields.List(fields.Str()),
65-
"ReferStatus": fields.Bool(required=False, load_from="ReferStatus"),
66-
"ReferType": fields.Int(required=False, load_from="ReferType"),
67-
"Status": fields.Str(required=False, load_from="Status"),
68-
"Tag": fields.Str(required=False, load_from="Tag"),
69-
"TestUrl": fields.Str(required=True, load_from="TestUrl"),
70-
"ValidTime": fields.Int(required=False, load_from="ValidTime"),
71-
}
72-
73-
746
class UrlProgressInfoSchema(schema.ResponseSchema):
757
""" UrlProgressInfo - UrlProgressInfo
768
"""

0 commit comments

Comments
 (0)