Skip to content

Commit c694c92

Browse files
authored
auto codegen for UFS
1 parent a23bc4f commit c694c92

File tree

7 files changed

+326
-0
lines changed

7 files changed

+326
-0
lines changed

docs/services.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,11 @@ USMS
7979
.. autoclass:: ucloud.services.usms.client.USMSClient
8080
:members:
8181

82+
83+
84+
UFS
85+
---
86+
87+
.. autoclass:: ucloud.services.ufs.client.UFSClient
88+
:members:
89+

ucloud/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,10 @@ def usms(self):
9898
return USMSClient(
9999
self._config, self.transport, self.middleware, self.logger
100100
)
101+
102+
def ufs(self):
103+
from ucloud.services.ufs.client import UFSClient
104+
105+
return UFSClient(
106+
self._config, self.transport, self.middleware, self.logger
107+
)

ucloud/services/ufs/__init__.py

Whitespace-only changes.

ucloud/services/ufs/client.py

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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.ufs.schemas import apis
8+
9+
10+
class UFSClient(Client):
11+
def __init__(
12+
self, config: dict, transport=None, middleware=None, logger=None
13+
):
14+
super(UFSClient, self).__init__(config, transport, middleware, logger)
15+
16+
def create_ufs_volume(
17+
self, req: typing.Optional[dict] = None, **kwargs
18+
) -> dict:
19+
""" CreateUFSVolume - 创建文件系统
20+
21+
**Request**
22+
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+
- **ProtocolType** (str) - (Required) 文件系统协议,枚举值,NFSv3表示NFS V3协议,NFSv4表示NFS V4协议
26+
- **Size** (int) - (Required) 文件系统大小,单位为GB,最大不超过20T,香港容量型必须为100的整数倍,Size最小为500GB,北京,上海,广州的容量型必须为1024的整数倍,Size最小为1024GB。性能型文件系统Size最小为100GB
27+
- **StorageType** (str) - (Required) 文件系统存储类型,枚举值,Basic表示容量型,Advanced表示性能型
28+
- **ChargeType** (str) - 计费模式,枚举值为: Year,按年付费; Month,按月付费; Dynamic,按需付费(需开启权限); Trial,试用(需开启权限) 默认为Dynamic
29+
- **CouponId** (str) - 使用的代金券id
30+
- **Quantity** (int) - 购买时长 默认: 1
31+
- **Remark** (str) - 备注
32+
- **Tag** (str) - 文件系统所属业务组
33+
- **VolumeName** (str) - 文件系统名称
34+
35+
**Response**
36+
37+
- **VolumeId** (str) - 文件系统ID
38+
- **VolumeName** (str) - 文件系统名称
39+
- **VolumeStatus** (str) - 文件系统挂载点状态
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.CreateUFSVolumeRequestSchema().dumps(d)
49+
50+
# build options
51+
kwargs["max_retries"] = 0 # ignore retry when api is not idempotent
52+
53+
resp = self.invoke("CreateUFSVolume", d, **kwargs)
54+
return apis.CreateUFSVolumeResponseSchema().loads(resp)
55+
56+
def describe_ufs_volume_2(
57+
self, req: typing.Optional[dict] = None, **kwargs
58+
) -> dict:
59+
""" DescribeUFSVolume2 - 获取文件系统列表
60+
61+
**Request**
62+
63+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_
64+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
65+
- **Limit** (int) - 文件列表长度
66+
- **Offset** (int) - 文件列表起始
67+
- **VolumeId** (str) - 文件系统ID
68+
69+
**Response**
70+
71+
- **DataSet** (list) - 见 **UFSVolumeInfo2** 模型定义
72+
- **TotalCount** (int) - 文件系统总数
73+
74+
**Response Model**
75+
76+
**UFSVolumeInfo2**
77+
78+
- **CreateTime** (int) - 文件系统创建时间(unix时间戳)
79+
- **ExpiredTime** (int) - 文件系统过期时间(unix时间戳)
80+
- **IsExpired** (str) - 是否过期
81+
- **MaxMountPointNum** (int) - 文件系统允许创建的最大挂载点数目
82+
- **ProtocolType** (str) - 文件系统协议,枚举值,NFSv3表示NFS V3协议,NFSv4表示NFS V4协议
83+
- **Remark** (str) - 文件系统备注信息
84+
- **Size** (int) - 文件系统大小,单位GB
85+
- **StorageType** (str) - 文件系统存储类型,枚举值,Basic表示容量型,Advanced表示性能型
86+
- **Tag** (str) - 文件系统所属业务组
87+
- **TotalMountPointNum** (int) - 当前文件系统已创建的挂载点数目
88+
- **UsedSize** (int) - 文件系统当前使用容量,单位GB
89+
- **VolumeId** (str) - 文件系统ID
90+
- **VolumeName** (str) - 文件系统名称
91+
92+
"""
93+
# build request
94+
d = {
95+
"ProjectId": self.config.project_id,
96+
"Region": self.config.region,
97+
}
98+
req and d.update(req)
99+
d = apis.DescribeUFSVolume2RequestSchema().dumps(d)
100+
101+
resp = self.invoke("DescribeUFSVolume2", d, **kwargs)
102+
return apis.DescribeUFSVolume2ResponseSchema().loads(resp)
103+
104+
def extend_ufs_volume(
105+
self, req: typing.Optional[dict] = None, **kwargs
106+
) -> dict:
107+
""" ExtendUFSVolume - 文件系统扩容
108+
109+
**Request**
110+
111+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_
112+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
113+
- **Size** (int) - (Required) 文件系统大小,单位为GB,最大不超过20T,香港容量型必须为100的整数倍,Size最小为500GB,北京,上海,广州的容量型必须为1024的整数倍,Size最小为1024GB。性能型文件系统Size最小为100GB
114+
- **VolumeId** (str) - (Required) 文件系统ID
115+
116+
**Response**
117+
118+
119+
"""
120+
# build request
121+
d = {
122+
"ProjectId": self.config.project_id,
123+
"Region": self.config.region,
124+
}
125+
req and d.update(req)
126+
d = apis.ExtendUFSVolumeRequestSchema().dumps(d)
127+
128+
resp = self.invoke("ExtendUFSVolume", d, **kwargs)
129+
return apis.ExtendUFSVolumeResponseSchema().loads(resp)
130+
131+
def remove_ufs_volume(
132+
self, req: typing.Optional[dict] = None, **kwargs
133+
) -> dict:
134+
""" RemoveUFSVolume - 删除UFS文件系统
135+
136+
**Request**
137+
138+
- **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_
139+
- **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_
140+
- **VolumeId** (str) - (Required) 文件系统ID
141+
142+
**Response**
143+
144+
145+
"""
146+
# build request
147+
d = {
148+
"ProjectId": self.config.project_id,
149+
"Region": self.config.region,
150+
}
151+
req and d.update(req)
152+
d = apis.RemoveUFSVolumeRequestSchema().dumps(d)
153+
154+
resp = self.invoke("RemoveUFSVolume", d, **kwargs)
155+
return apis.RemoveUFSVolumeResponseSchema().loads(resp)

ucloud/services/ufs/schemas/__init__.py

Whitespace-only changes.
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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.ufs.schemas import models
6+
7+
""" UFS API Schema
8+
"""
9+
10+
11+
"""
12+
API: CreateUFSVolume
13+
14+
创建文件系统
15+
"""
16+
17+
18+
class CreateUFSVolumeRequestSchema(schema.RequestSchema):
19+
""" CreateUFSVolume - 创建文件系统
20+
"""
21+
22+
fields = {
23+
"ChargeType": fields.Str(required=False, dump_to="ChargeType"),
24+
"CouponId": fields.Str(required=False, dump_to="CouponId"),
25+
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
26+
"ProtocolType": fields.Str(required=True, dump_to="ProtocolType"),
27+
"Quantity": fields.Int(required=False, dump_to="Quantity"),
28+
"Region": fields.Str(required=True, dump_to="Region"),
29+
"Remark": fields.Str(required=False, dump_to="Remark"),
30+
"Size": fields.Int(required=True, dump_to="Size"),
31+
"StorageType": fields.Str(required=True, dump_to="StorageType"),
32+
"Tag": fields.Str(required=False, dump_to="Tag"),
33+
"VolumeName": fields.Str(required=False, dump_to="VolumeName"),
34+
}
35+
36+
37+
class CreateUFSVolumeResponseSchema(schema.ResponseSchema):
38+
""" CreateUFSVolume - 创建文件系统
39+
"""
40+
41+
fields = {
42+
"VolumeId": fields.Str(required=True, load_from="VolumeId"),
43+
"VolumeName": fields.Str(required=True, load_from="VolumeName"),
44+
"VolumeStatus": fields.Str(required=True, load_from="VolumeStatus"),
45+
}
46+
47+
48+
"""
49+
API: DescribeUFSVolume2
50+
51+
获取文件系统列表
52+
"""
53+
54+
55+
class DescribeUFSVolume2RequestSchema(schema.RequestSchema):
56+
""" DescribeUFSVolume2 - 获取文件系统列表
57+
"""
58+
59+
fields = {
60+
"Limit": fields.Int(required=False, dump_to="Limit"),
61+
"Offset": fields.Int(required=False, dump_to="Offset"),
62+
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
63+
"Region": fields.Str(required=True, dump_to="Region"),
64+
"VolumeId": fields.Str(required=False, dump_to="VolumeId"),
65+
}
66+
67+
68+
class DescribeUFSVolume2ResponseSchema(schema.ResponseSchema):
69+
""" DescribeUFSVolume2 - 获取文件系统列表
70+
"""
71+
72+
fields = {
73+
"DataSet": fields.List(
74+
models.UFSVolumeInfo2Schema(), required=True, load_from="DataSet"
75+
),
76+
"TotalCount": fields.Int(required=True, load_from="TotalCount"),
77+
}
78+
79+
80+
"""
81+
API: ExtendUFSVolume
82+
83+
文件系统扩容
84+
"""
85+
86+
87+
class ExtendUFSVolumeRequestSchema(schema.RequestSchema):
88+
""" ExtendUFSVolume - 文件系统扩容
89+
"""
90+
91+
fields = {
92+
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
93+
"Region": fields.Str(required=True, dump_to="Region"),
94+
"Size": fields.Int(required=True, dump_to="Size"),
95+
"VolumeId": fields.Str(required=True, dump_to="VolumeId"),
96+
}
97+
98+
99+
class ExtendUFSVolumeResponseSchema(schema.ResponseSchema):
100+
""" ExtendUFSVolume - 文件系统扩容
101+
"""
102+
103+
fields = {}
104+
105+
106+
"""
107+
API: RemoveUFSVolume
108+
109+
删除UFS文件系统
110+
"""
111+
112+
113+
class RemoveUFSVolumeRequestSchema(schema.RequestSchema):
114+
""" RemoveUFSVolume - 删除UFS文件系统
115+
"""
116+
117+
fields = {
118+
"ProjectId": fields.Str(required=False, dump_to="ProjectId"),
119+
"Region": fields.Str(required=True, dump_to="Region"),
120+
"VolumeId": fields.Str(required=True, dump_to="VolumeId"),
121+
}
122+
123+
124+
class RemoveUFSVolumeResponseSchema(schema.ResponseSchema):
125+
""" RemoveUFSVolume - 删除UFS文件系统
126+
"""
127+
128+
fields = {}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
from ucloud.core.typesystem import schema, fields
4+
5+
6+
class UFSVolumeInfo2Schema(schema.ResponseSchema):
7+
""" UFSVolumeInfo2 - 文件系统信息
8+
"""
9+
10+
fields = {
11+
"CreateTime": fields.Int(required=False, load_from="CreateTime"),
12+
"ExpiredTime": fields.Int(required=False, load_from="ExpiredTime"),
13+
"IsExpired": fields.Str(required=False, load_from="IsExpired"),
14+
"MaxMountPointNum": fields.Int(
15+
required=True, load_from="MaxMountPointNum"
16+
),
17+
"ProtocolType": fields.Str(required=True, load_from="ProtocolType"),
18+
"Remark": fields.Str(required=False, load_from="Remark"),
19+
"Size": fields.Int(required=False, load_from="Size"),
20+
"StorageType": fields.Str(required=True, load_from="StorageType"),
21+
"Tag": fields.Str(required=False, load_from="Tag"),
22+
"TotalMountPointNum": fields.Int(
23+
required=True, load_from="TotalMountPointNum"
24+
),
25+
"UsedSize": fields.Int(required=False, load_from="UsedSize"),
26+
"VolumeId": fields.Str(required=True, load_from="VolumeId"),
27+
"VolumeName": fields.Str(required=True, load_from="VolumeName"),
28+
}

0 commit comments

Comments
 (0)