Skip to content

Commit 30be524

Browse files
authored
auto codegen for UFile
1 parent 87c0b99 commit 30be524

File tree

3 files changed

+137
-11
lines changed

3 files changed

+137
-11
lines changed

ucloud/services/ufile/client.py

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ def describe_bucket(
150150
151151
**Response Model**
152152
153-
**UFileDomainSet**
154-
- **Cdn** (list) - UCDN加速域名
155-
- **CustomCdn** (list) - 用户自定义CDN加速域名
156-
- **CustomSrc** (list) - 用户自定义源站域名
157-
- **Src** (list) - 源站域名
158-
159-
160153
**UFileBucketSet**
161154
- **Biz** (str) - Bucket所属业务, general或vod或udb general: 普通业务; vod: 视频云业务; udb: 云数据库业务
162155
- **BucketId** (str) - Bucket的ID
@@ -171,6 +164,13 @@ def describe_bucket(
171164
- **Type** (str) - Bucket访问类型
172165
173166
167+
**UFileDomainSet**
168+
- **Cdn** (list) - UCDN加速域名
169+
- **CustomCdn** (list) - 用户自定义CDN加速域名
170+
- **CustomSrc** (list) - 用户自定义源站域名
171+
- **Src** (list) - 源站域名
172+
173+
174174
"""
175175
# build request
176176
d = {
@@ -228,6 +228,64 @@ def describe_ufile_token(
228228
resp = self.invoke("DescribeUFileToken", d, **kwargs)
229229
return apis.DescribeUFileTokenResponseSchema().loads(resp)
230230

231+
def get_ufile_daily_report(
232+
self, req: typing.Optional[dict] = None, **kwargs
233+
) -> dict:
234+
"""GetUFileDailyReport - 查看日消费报表
235+
236+
**Request**
237+
238+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
239+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
240+
- **EndTime** (int) - (Required) 查询结束时间;unix时间戳,单位s
241+
- **StartTime** (int) - (Required) 查询开始时间;unix时间戳,单位s
242+
- **BucketName** (str) - 空间名称。此字段不为空,返回此Bucket日使用量;否则,返回这个项目的日使用量
243+
244+
**Response**
245+
246+
- **DataSet** (list) - 见 **UFileReportItem** 模型定义
247+
248+
**Response Model**
249+
250+
**UFileDailyReportItem**
251+
- **AcRestore** (float) - 冷存激活量,即归档数据取回量;单位byte
252+
- **AcStorage** (float) - 冷存(归档)存储量;单位byte
253+
- **ApiTimes** (float) - API请求次数(次)
254+
- **BusyFlow** (float) - 忙时流量;单位byte;海外无此字段
255+
- **CdnFlow** (float) - cdn回源流量;单位byte
256+
- **Date** (int) - 配额消费时间,unix时间戳(单位s),精确到日期
257+
- **Flow** (float) - 下载流量:单位byte;国内无此字段
258+
- **IaGetSize** (float) - 低频数据取回量;单位byte
259+
- **IaStorage** (float) - 低频存储量;单位byte
260+
- **IdleFlow** (float) - 闲时流量;单位byte;海外无此字段
261+
- **Storage** (float) - 标准存储量;单位byte
262+
263+
264+
**UFileTotalReportItem**
265+
- **ApiTimes** (float) - API请求次数(次)
266+
- **BusyFlow** (float) - 忙时流量;单位byte;海外无此字段
267+
- **CdnFlow** (float) - cdn回源流量;单位byte
268+
- **Flow** (float) - 下载流量:单位byte;国内无此字段
269+
- **IdleFlow** (float) - 闲时流量;单位byte;海外无此字段
270+
271+
272+
**UFileReportItem**
273+
- **Daily** (list) - 见 **UFileDailyReportItem** 模型定义
274+
- **Total** (list) - 见 **UFileTotalReportItem** 模型定义
275+
276+
277+
"""
278+
# build request
279+
d = {
280+
"ProjectId": self.config.project_id,
281+
"Region": self.config.region,
282+
}
283+
req and d.update(req)
284+
d = apis.GetUFileDailyReportRequestSchema().dumps(d)
285+
286+
resp = self.invoke("GetUFileDailyReport", d, **kwargs)
287+
return apis.GetUFileDailyReportResponseSchema().loads(resp)
288+
231289
def get_ufile_quota(
232290
self, req: typing.Optional[dict] = None, **kwargs
233291
) -> dict:
@@ -270,10 +328,6 @@ def get_ufile_quota_info(
270328
271329
**Response Model**
272330
273-
**UFileQuotaLeft**
274-
- **Left** (float) - 配额剩余量
275-
276-
277331
**UFileQuotaDataSetItem**
278332
- **DownloadFlow** (dict) - 见 **UFileQuotaLeft** 模型定义
279333
- **Owe** (int) - 是否欠费:1表示欠费;0表示未欠费
@@ -282,6 +336,10 @@ def get_ufile_quota_info(
282336
- **Storage** (dict) - 见 **UFileQuotaLeft** 模型定义
283337
284338
339+
**UFileQuotaLeft**
340+
- **Left** (float) - 配额剩余量
341+
342+
285343
"""
286344
# build request
287345
d = {

ucloud/services/ufile/schemas/apis.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,35 @@ class DescribeUFileTokenResponseSchema(schema.ResponseSchema):
170170
}
171171

172172

173+
"""
174+
API: GetUFileDailyReport
175+
176+
查看日消费报表
177+
"""
178+
179+
180+
class GetUFileDailyReportRequestSchema(schema.RequestSchema):
181+
"""GetUFileDailyReport - 查看日消费报表"""
182+
183+
fields = {
184+
"BucketName": fields.Str(required=False, dump_to="BucketName"),
185+
"EndTime": fields.Int(required=True, dump_to="EndTime"),
186+
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
187+
"Region": fields.Str(required=True, dump_to="Region"),
188+
"StartTime": fields.Int(required=True, dump_to="StartTime"),
189+
}
190+
191+
192+
class GetUFileDailyReportResponseSchema(schema.ResponseSchema):
193+
"""GetUFileDailyReport - 查看日消费报表"""
194+
195+
fields = {
196+
"DataSet": fields.List(
197+
models.UFileReportItemSchema(), required=True, load_from="DataSet"
198+
),
199+
}
200+
201+
173202
"""
174203
API: GetUFileQuota
175204

ucloud/services/ufile/schemas/models.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,45 @@ class UFileTokenSetSchema(schema.ResponseSchema):
5050
}
5151

5252

53+
class UFileTotalReportItemSchema(schema.ResponseSchema):
54+
"""UFileTotalReportItem - 总消费信息"""
55+
56+
fields = {
57+
"ApiTimes": fields.Float(required=False, load_from="ApiTimes"),
58+
"BusyFlow": fields.Float(required=False, load_from="BusyFlow"),
59+
"CdnFlow": fields.Float(required=False, load_from="CdnFlow"),
60+
"Flow": fields.Float(required=False, load_from="Flow"),
61+
"IdleFlow": fields.Float(required=False, load_from="IdleFlow"),
62+
}
63+
64+
65+
class UFileDailyReportItemSchema(schema.ResponseSchema):
66+
"""UFileDailyReportItem -"""
67+
68+
fields = {
69+
"AcRestore": fields.Float(required=False, load_from="AcRestore"),
70+
"AcStorage": fields.Float(required=False, load_from="AcStorage"),
71+
"ApiTimes": fields.Float(required=False, load_from="ApiTimes"),
72+
"BusyFlow": fields.Float(required=False, load_from="BusyFlow"),
73+
"CdnFlow": fields.Float(required=False, load_from="CdnFlow"),
74+
"Date": fields.Int(required=False, load_from="Date"),
75+
"Flow": fields.Float(required=False, load_from="Flow"),
76+
"IaGetSize": fields.Float(required=False, load_from="IaGetSize"),
77+
"IaStorage": fields.Float(required=False, load_from="IaStorage"),
78+
"IdleFlow": fields.Float(required=False, load_from="IdleFlow"),
79+
"Storage": fields.Float(required=False, load_from="Storage"),
80+
}
81+
82+
83+
class UFileReportItemSchema(schema.ResponseSchema):
84+
"""UFileReportItem -"""
85+
86+
fields = {
87+
"Daily": fields.List(UFileDailyReportItemSchema()),
88+
"Total": fields.List(UFileTotalReportItemSchema()),
89+
}
90+
91+
5392
class UFileQuotaLeftSchema(schema.ResponseSchema):
5493
"""UFileQuotaLeft - 配额剩余量"""
5594

0 commit comments

Comments
 (0)