Skip to content

Commit f01238c

Browse files
authored
auto codegen for Cube
1 parent 724c84c commit f01238c

File tree

3 files changed

+478
-16
lines changed

3 files changed

+478
-16
lines changed

ucloud/services/cube/client.py

Lines changed: 251 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,64 @@ def __init__(
1313
):
1414
super(CubeClient, self).__init__(config, transport, middleware, logger)
1515

16+
def create_cube_deployment(
17+
self, req: typing.Optional[dict] = None, **kwargs
18+
) -> dict:
19+
"""CreateCubeDeployment - 创建Cube的Deployment
20+
21+
**Request**
22+
23+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
24+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
25+
- **Deployment** (str) - (Required) base64编码的Deployment的yaml。大小不超过16KB
26+
- **SubnetId** (str) - (Required) 子网Id
27+
- **VPCId** (str) - (Required) VPCId
28+
- **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
29+
- **ChargeType** (str) - 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
30+
- **CpuPlatform** (str) - Cpu平台(V6:Intel、A2:AMD),默认V6。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
31+
- **KubeConfig** (str) - base64编码的kubeconfig。大小不超过16KB
32+
- **Name** (str) - Deployment名称
33+
- **Quantity** (int) - 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
34+
- **Tag** (str) - 业务组。默认:Default(Default即为未分组)
35+
36+
**Response**
37+
38+
- **Deployment** (str) - 经过base64编码的Deployment的yaml
39+
- **DeploymentId** (str) - 控制器ID
40+
41+
"""
42+
# build request
43+
d = {
44+
"ProjectId": self.config.project_id,
45+
"Region": self.config.region,
46+
}
47+
req and d.update(req)
48+
d = apis.CreateCubeDeploymentRequestSchema().dumps(d)
49+
50+
# build options
51+
kwargs["max_retries"] = 0 # ignore retry when api is not idempotent
52+
53+
resp = self.invoke("CreateCubeDeployment", d, **kwargs)
54+
return apis.CreateCubeDeploymentResponseSchema().loads(resp)
55+
1656
def create_cube_pod(
1757
self, req: typing.Optional[dict] = None, **kwargs
1858
) -> dict:
1959
"""CreateCubePod - 创建Pod
2060
2161
**Request**
2262
23-
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_
24-
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
25-
- **Pod** (str) - (Required) base64编码的Pod的yaml
63+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
64+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
65+
- **Pod** (str) - (Required) base64编码的Pod的yaml。大小不超过16KB
2666
- **SubnetId** (str) - (Required) 子网Id
2767
- **VPCId** (str) - (Required) VPCId
28-
- **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
68+
- **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
2969
- **ChargeType** (str) - 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费
30-
- **CpuPlatform** (str) - Cpu平台(V6、A2),默认V6
70+
- **CouponId** (str) - 代金券ID。请通过DescribeCoupon接口查询,或登录用户中心查看
71+
- **CpuPlatform** (str) - Cpu平台(V6:Intel、A2:AMD、Auto),默认Auto。支持的地域(北京2B、北京2E、上海2A、广东、香港 、东京)目前北京2E仅有A2,其余地域仅有V6
3172
- **Group** (str) - pod所在组
73+
- **KubeConfig** (str) - base64编码的kubeconfig。大小不超过16KB
3274
- **Name** (str) - pod的名字
3375
- **Quantity** (int) - 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。
3476
- **Tag** (str) - 业务组。默认:Default(Default即为未分组)
@@ -55,6 +97,33 @@ def create_cube_pod(
5597
resp = self.invoke("CreateCubePod", d, **kwargs)
5698
return apis.CreateCubePodResponseSchema().loads(resp)
5799

100+
def delete_cube_deployment(
101+
self, req: typing.Optional[dict] = None, **kwargs
102+
) -> dict:
103+
"""DeleteCubeDeployment - 删除Cube的Deployment
104+
105+
**Request**
106+
107+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
108+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
109+
- **DeploymentId** (str) - (Required) 控制器Id
110+
- **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
111+
112+
**Response**
113+
114+
115+
"""
116+
# build request
117+
d = {
118+
"ProjectId": self.config.project_id,
119+
"Region": self.config.region,
120+
}
121+
req and d.update(req)
122+
d = apis.DeleteCubeDeploymentRequestSchema().dumps(d)
123+
124+
resp = self.invoke("DeleteCubeDeployment", d, **kwargs)
125+
return apis.DeleteCubeDeploymentResponseSchema().loads(resp)
126+
58127
def delete_cube_pod(
59128
self, req: typing.Optional[dict] = None, **kwargs
60129
) -> dict:
@@ -84,6 +153,34 @@ def delete_cube_pod(
84153
resp = self.invoke("DeleteCubePod", d, **kwargs)
85154
return apis.DeleteCubePodResponseSchema().loads(resp)
86155

156+
def get_cube_deployment(
157+
self, req: typing.Optional[dict] = None, **kwargs
158+
) -> dict:
159+
"""GetCubeDeployment - 获取Deployment的详细信息
160+
161+
**Request**
162+
163+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
164+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
165+
- **DeploymentId** (str) - (Required) Deployment的Id
166+
- **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
167+
168+
**Response**
169+
170+
- **Deployment** (str) - 经过base64编码的Deployment的yaml
171+
172+
"""
173+
# build request
174+
d = {
175+
"ProjectId": self.config.project_id,
176+
"Region": self.config.region,
177+
}
178+
req and d.update(req)
179+
d = apis.GetCubeDeploymentRequestSchema().dumps(d)
180+
181+
resp = self.invoke("GetCubeDeployment", d, **kwargs)
182+
return apis.GetCubeDeploymentResponseSchema().loads(resp)
183+
87184
def get_cube_extend_info(
88185
self, req: typing.Optional[dict] = None, **kwargs
89186
) -> dict:
@@ -102,13 +199,15 @@ def get_cube_extend_info(
102199
103200
**Response Model**
104201
105-
**EIPAddr**
202+
**CubeExtendInfo**
203+
- **CubeId** (str) - Cube的Id
204+
- **Eip** (list) - 见 **EIPSet** 模型定义
205+
- **Expiration** (int) - 资源有效期
206+
- **Name** (str) - Cube的名称
207+
- **Tag** (str) - 业务组名称
106208
107-
- **IP** (str) - IP地址
108-
- **OperatorName** (str) - 线路名称BGP或者internalation
109209
110210
**EIPSet**
111-
112211
- **Bandwidth** (int) - EIP带宽值
113212
- **BandwidthType** (int) - 带宽类型0标准普通带宽,1表示共享带宽
114213
- **CreateTime** (int) - EIP创建时间
@@ -119,13 +218,11 @@ def get_cube_extend_info(
119218
- **Status** (str) - EIP状态,表示使用中或者空闲
120219
- **Weight** (int) - EIP权重
121220
122-
**CubeExtendInfo**
123221
124-
- **CubeId** (str) - Cube的Id
125-
- **Eip** (list) - 见 **EIPSet** 模型定义
126-
- **Expiration** (int) - 资源有效期
127-
- **Name** (str) - Cube的名称
128-
- **Tag** (str) - 业务组名称
222+
**EIPAddr**
223+
- **IP** (str) - IP地址
224+
- **OperatorName** (str) - 线路名称BGP或者internalation
225+
129226
130227
"""
131228
# build request
@@ -139,6 +236,51 @@ def get_cube_extend_info(
139236
resp = self.invoke("GetCubeExtendInfo", d, **kwargs)
140237
return apis.GetCubeExtendInfoResponseSchema().loads(resp)
141238

239+
def get_cube_metrics(
240+
self, req: typing.Optional[dict] = None, **kwargs
241+
) -> dict:
242+
"""GetCubeMetrics - 获取Cube实例(Pod,PodX,Deploy等)监控数据时间序列
243+
244+
**Request**
245+
246+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
247+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
248+
- **BeginTime** (int) - (Required) 开始时间
249+
- **ContainerName** (str) - (Required) Pod内容器名称
250+
- **EndTime** (int) - (Required) 结束时间,必须大于开始时间
251+
- **MetricName** (list) - (Required) 监控指标名称
252+
- **ResourceId** (str) - (Required) Cube实例资源ID
253+
- **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
254+
255+
**Response**
256+
257+
- **DataSets** (list) - 见 **MetricDataSet** 模型定义
258+
- **Message** (str) - 错误信息
259+
260+
**Response Model**
261+
262+
**ValueSet**
263+
- **Timestamp** (int) -
264+
- **Value** (float) -
265+
266+
267+
**MetricDataSet**
268+
- **MetricName** (str) -
269+
- **Values** (list) - 见 **ValueSet** 模型定义
270+
271+
272+
"""
273+
# build request
274+
d = {
275+
"ProjectId": self.config.project_id,
276+
"Region": self.config.region,
277+
}
278+
req and d.update(req)
279+
d = apis.GetCubeMetricsRequestSchema().dumps(d)
280+
281+
resp = self.invoke("GetCubeMetrics", d, **kwargs)
282+
return apis.GetCubeMetricsResponseSchema().loads(resp)
283+
142284
def get_cube_pod(self, req: typing.Optional[dict] = None, **kwargs) -> dict:
143285
"""GetCubePod - 获取Pod的详细信息
144286
@@ -166,6 +308,41 @@ def get_cube_pod(self, req: typing.Optional[dict] = None, **kwargs) -> dict:
166308
resp = self.invoke("GetCubePod", d, **kwargs)
167309
return apis.GetCubePodResponseSchema().loads(resp)
168310

311+
def get_cube_price(
312+
self, req: typing.Optional[dict] = None, **kwargs
313+
) -> dict:
314+
"""GetCubePrice - 获取cube的价格
315+
316+
**Request**
317+
318+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
319+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
320+
- **ChargeType** (str) - (Required) 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Dynamic,按小时预付费 \\ > Postpay,按秒后付费,默认为月付
321+
- **Count** (str) - (Required) 购买数量
322+
- **Cpu** (str) - (Required) CPU 配置,单位为毫核,例如如 1 核则须输入 1000
323+
- **Mem** (str) - (Required) 内存配置,单位为 Mi,例如 1Gi 须输入 1024
324+
- **Quantity** (int) - (Required) 购买时长。默认:值 1。按小时购买(Dynamic/Postpay)时无需此参数。 月付时,此参数传0,代表购买至月末。
325+
- **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
326+
327+
**Response**
328+
329+
- **Action** (str) - 操作名称
330+
- **OriginalPrice** (int) - 列表价格,单位为分
331+
- **Price** (int) - 折扣后价格,单位为分
332+
- **RetCode** (int) - 返回码
333+
334+
"""
335+
# build request
336+
d = {
337+
"ProjectId": self.config.project_id,
338+
"Region": self.config.region,
339+
}
340+
req and d.update(req)
341+
d = apis.GetCubePriceRequestSchema().dumps(d)
342+
343+
resp = self.invoke("GetCubePrice", d, **kwargs)
344+
return apis.GetCubePriceResponseSchema().loads(resp)
345+
169346
def list_cube_pod(
170347
self, req: typing.Optional[dict] = None, **kwargs
171348
) -> dict:
@@ -227,6 +404,35 @@ def modify_cube_extend_info(
227404
resp = self.invoke("ModifyCubeExtendInfo", d, **kwargs)
228405
return apis.ModifyCubeExtendInfoResponseSchema().loads(resp)
229406

407+
def modify_cube_tag(
408+
self, req: typing.Optional[dict] = None, **kwargs
409+
) -> dict:
410+
"""ModifyCubeTag - 修改业务组名字
411+
412+
**Request**
413+
414+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
415+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
416+
- **CubeId** (str) - (Required) CubeId
417+
- **Tag** (str) - (Required) 业务组名称
418+
- **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
419+
420+
**Response**
421+
422+
- **CubeId** (str) - CubeId
423+
424+
"""
425+
# build request
426+
d = {
427+
"ProjectId": self.config.project_id,
428+
"Region": self.config.region,
429+
}
430+
req and d.update(req)
431+
d = apis.ModifyCubeTagRequestSchema().dumps(d)
432+
433+
resp = self.invoke("ModifyCubeTag", d, **kwargs)
434+
return apis.ModifyCubeTagResponseSchema().loads(resp)
435+
230436
def renew_cube_pod(
231437
self, req: typing.Optional[dict] = None, **kwargs
232438
) -> dict:
@@ -255,3 +461,33 @@ def renew_cube_pod(
255461

256462
resp = self.invoke("RenewCubePod", d, **kwargs)
257463
return apis.RenewCubePodResponseSchema().loads(resp)
464+
465+
def update_cube_deployment(
466+
self, req: typing.Optional[dict] = None, **kwargs
467+
) -> dict:
468+
"""UpdateCubeDeployment - 更新Deployment
469+
470+
**Request**
471+
472+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
473+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
474+
- **Deployment** (str) - (Required) base64编码的Deployment的yaml。大小不超过16KB
475+
- **DeploymentId** (str) - (Required) Deployment的Id
476+
- **Name** (str) - Deployment的name
477+
- **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
478+
479+
**Response**
480+
481+
- **Deployment** (str) - 经过base64编码的Deployment的yaml
482+
483+
"""
484+
# build request
485+
d = {
486+
"ProjectId": self.config.project_id,
487+
"Region": self.config.region,
488+
}
489+
req and d.update(req)
490+
d = apis.UpdateCubeDeploymentRequestSchema().dumps(d)
491+
492+
resp = self.invoke("UpdateCubeDeployment", d, **kwargs)
493+
return apis.UpdateCubeDeploymentResponseSchema().loads(resp)

0 commit comments

Comments
 (0)