Skip to content

Commit 84ca927

Browse files
authored
auto codegen for URocketMQ
1 parent 019c088 commit 84ca927

File tree

7 files changed

+241
-0
lines changed

7 files changed

+241
-0
lines changed

docs/services.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ UK8S
129129
:members:
130130

131131

132+
URocketMQ
133+
---------
134+
135+
.. autoclass:: ucloud.services.urocketmq.client.URocketMQClient
136+
:members:
137+
138+
132139
VPC
133140
---
134141

ucloud/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ def uphost(self):
192192
self.logger,
193193
)
194194

195+
def urocketmq(self):
196+
from ucloud.services.urocketmq.client import URocketMQClient
197+
198+
return URocketMQClient(
199+
self._auto_config("urocketmq"),
200+
self.transport,
201+
self.middleware,
202+
self.logger,
203+
)
204+
195205
def usms(self):
196206
from ucloud.services.usms.client import USMSClient
197207

ucloud/services/urocketmq/__init__.py

Whitespace-only changes.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
import typing
4+
5+
6+
from ucloud.core.client import Client
7+
from ucloud.services.urocketmq.schemas import apis
8+
9+
10+
class URocketMQClient(Client):
11+
def __init__(
12+
self, config: dict, transport=None, middleware=None, logger=None
13+
):
14+
super(URocketMQClient, self).__init__(
15+
config, transport, middleware, logger
16+
)
17+
18+
def create_u_rocket_mq_group(
19+
self, req: typing.Optional[dict] = None, **kwargs
20+
) -> dict:
21+
"""CreateURocketMQGroup - 创建一个 Group, 如果同名 Group 在当前 Service 中已存在, 则会失败.
22+
23+
**Request**
24+
25+
- **ProjectId** (str) - (Config) 项目ID。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
26+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
27+
- **Name** (str) - (Required) Group 名称,支持大小写字母、数字及-, _ ,长度1~36
28+
- **ServiceId** (str) - (Required) Service ID
29+
- **Remark** (str) - Group 描述.
30+
31+
**Response**
32+
33+
- **GroupId** (str) - 新建 Group 的 ID
34+
- **Message** (str) - 返回信息
35+
36+
"""
37+
# build request
38+
d = {
39+
"ProjectId": self.config.project_id,
40+
"Region": self.config.region,
41+
}
42+
req and d.update(req)
43+
d = apis.CreateURocketMQGroupRequestSchema().dumps(d)
44+
45+
# build options
46+
kwargs["max_retries"] = 0 # ignore retry when api is not idempotent
47+
48+
resp = self.invoke("CreateURocketMQGroup", d, **kwargs)
49+
return apis.CreateURocketMQGroupResponseSchema().loads(resp)
50+
51+
def delete_u_rocket_mq_group(
52+
self, req: typing.Optional[dict] = None, **kwargs
53+
) -> dict:
54+
"""DeleteURocketMQGroup - 删除一个已存在的 Group
55+
56+
**Request**
57+
58+
- **ProjectId** (str) - (Config) 项目ID。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
59+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
60+
- **GroupName** (str) - (Required) Group名称
61+
- **ServiceId** (str) - (Required) Service ID
62+
63+
**Response**
64+
65+
- **Message** (str) - 返回信息
66+
67+
"""
68+
# build request
69+
d = {
70+
"ProjectId": self.config.project_id,
71+
"Region": self.config.region,
72+
}
73+
req and d.update(req)
74+
d = apis.DeleteURocketMQGroupRequestSchema().dumps(d)
75+
76+
resp = self.invoke("DeleteURocketMQGroup", d, **kwargs)
77+
return apis.DeleteURocketMQGroupResponseSchema().loads(resp)
78+
79+
def list_u_rocket_mq_group(
80+
self, req: typing.Optional[dict] = None, **kwargs
81+
) -> dict:
82+
"""ListURocketMQGroup - 获取一个 RocketMQ 服务下的所有 Group
83+
84+
**Request**
85+
86+
- **ProjectId** (str) - (Config) 项目ID。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list>`_
87+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist>`_
88+
- **ServiceId** (str) - (Required) Service ID
89+
- **Limit** (int) - 最多返回的条目数量, (0, 1000], 默认 50 条
90+
- **Offset** (int) - 查询起始位置, [0, ∞)
91+
92+
**Response**
93+
94+
- **GroupList** (list) - 见 **GroupBaseInfo** 模型定义
95+
- **Message** (str) - 返回信息
96+
- **TotalCount** (int) - 记录总数
97+
98+
**Response Model**
99+
100+
**GroupBaseInfo**
101+
- **CreateTime** (int) - Group 创建时间
102+
- **GroupName** (str) - Group 名称
103+
- **Id** (str) - Group ID
104+
- **Remark** (str) - Group 描述
105+
106+
107+
"""
108+
# build request
109+
d = {
110+
"ProjectId": self.config.project_id,
111+
"Region": self.config.region,
112+
}
113+
req and d.update(req)
114+
d = apis.ListURocketMQGroupRequestSchema().dumps(d)
115+
116+
resp = self.invoke("ListURocketMQGroup", d, **kwargs)
117+
return apis.ListURocketMQGroupResponseSchema().loads(resp)

ucloud/services/urocketmq/schemas/__init__.py

Whitespace-only changes.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
4+
from ucloud.core.typesystem import schema, fields
5+
from ucloud.services.urocketmq.schemas import models
6+
7+
""" URocketMQ API Schema
8+
"""
9+
10+
11+
"""
12+
API: CreateURocketMQGroup
13+
14+
创建一个 Group, 如果同名 Group 在当前 Service 中已存在, 则会失败.
15+
"""
16+
17+
18+
class CreateURocketMQGroupRequestSchema(schema.RequestSchema):
19+
"""CreateURocketMQGroup - 创建一个 Group, 如果同名 Group 在当前 Service 中已存在, 则会失败."""
20+
21+
fields = {
22+
"Name": fields.Str(required=True, dump_to="Name"),
23+
"ProjectId": fields.Str(required=True, dump_to="ProjectId"),
24+
"Region": fields.Str(required=True, dump_to="Region"),
25+
"Remark": fields.Str(required=False, dump_to="Remark"),
26+
"ServiceId": fields.Str(required=True, dump_to="ServiceId"),
27+
}
28+
29+
30+
class CreateURocketMQGroupResponseSchema(schema.ResponseSchema):
31+
"""CreateURocketMQGroup - 创建一个 Group, 如果同名 Group 在当前 Service 中已存在, 则会失败."""
32+
33+
fields = {
34+
"GroupId": fields.Str(required=True, load_from="GroupId"),
35+
"Message": fields.Str(required=False, load_from="Message"),
36+
}
37+
38+
39+
"""
40+
API: DeleteURocketMQGroup
41+
42+
删除一个已存在的 Group
43+
"""
44+
45+
46+
class DeleteURocketMQGroupRequestSchema(schema.RequestSchema):
47+
"""DeleteURocketMQGroup - 删除一个已存在的 Group"""
48+
49+
fields = {
50+
"GroupName": fields.Str(required=True, dump_to="GroupName"),
51+
"ProjectId": fields.Str(required=True, dump_to="ProjectId"),
52+
"Region": fields.Str(required=True, dump_to="Region"),
53+
"ServiceId": fields.Str(required=True, dump_to="ServiceId"),
54+
}
55+
56+
57+
class DeleteURocketMQGroupResponseSchema(schema.ResponseSchema):
58+
"""DeleteURocketMQGroup - 删除一个已存在的 Group"""
59+
60+
fields = {
61+
"Message": fields.Str(required=False, load_from="Message"),
62+
}
63+
64+
65+
"""
66+
API: ListURocketMQGroup
67+
68+
获取一个 RocketMQ 服务下的所有 Group
69+
"""
70+
71+
72+
class ListURocketMQGroupRequestSchema(schema.RequestSchema):
73+
"""ListURocketMQGroup - 获取一个 RocketMQ 服务下的所有 Group"""
74+
75+
fields = {
76+
"Limit": fields.Int(required=False, dump_to="Limit"),
77+
"Offset": fields.Int(required=False, dump_to="Offset"),
78+
"ProjectId": fields.Str(required=True, dump_to="ProjectId"),
79+
"Region": fields.Str(required=True, dump_to="Region"),
80+
"ServiceId": fields.Str(required=True, dump_to="ServiceId"),
81+
}
82+
83+
84+
class ListURocketMQGroupResponseSchema(schema.ResponseSchema):
85+
"""ListURocketMQGroup - 获取一个 RocketMQ 服务下的所有 Group"""
86+
87+
fields = {
88+
"GroupList": fields.List(
89+
models.GroupBaseInfoSchema(), required=False, load_from="GroupList"
90+
),
91+
"Message": fields.Str(required=False, load_from="Message"),
92+
"TotalCount": fields.Int(required=False, load_from="TotalCount"),
93+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
from ucloud.core.typesystem import schema, fields
4+
5+
6+
class GroupBaseInfoSchema(schema.ResponseSchema):
7+
"""GroupBaseInfo - Group基础信息"""
8+
9+
fields = {
10+
"CreateTime": fields.Int(required=True, load_from="CreateTime"),
11+
"GroupName": fields.Str(required=True, load_from="GroupName"),
12+
"Id": fields.Str(required=True, load_from="Id"),
13+
"Remark": fields.Str(required=True, load_from="Remark"),
14+
}

0 commit comments

Comments
 (0)