yicloud-sdk-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- version.py +9 -0
- yicloud/__init__.py +7 -0
- yicloud/base/__init__.py +58 -0
- yicloud/base/auth/__init__.py +10 -0
- yicloud/base/auth/credential.py +64 -0
- yicloud/base/auth/sign.py +80 -0
- yicloud/base/client.py +313 -0
- yicloud/base/config.py +62 -0
- yicloud/base/errs/__init__.py +292 -0
- yicloud/base/log/__init__.py +43 -0
- yicloud/base/log/logger.py +123 -0
- yicloud/base/log/std.py +70 -0
- yicloud/base/msgs/__init__.py +226 -0
- yicloud/base/utils/__init__.py +6 -0
- yicloud/base/utils/helps.py +110 -0
- yicloud/base/utils/retry/__init__.py +27 -0
- yicloud/base/utils/retry/retry.py +162 -0
- yicloud/services/__init__.py +24 -0
- yicloud/services/bc/__init__.py +9 -0
- yicloud/services/bc/actions.py +23 -0
- yicloud/services/bc/client.py +19 -0
- yicloud/services/bc/models.py +61 -0
- yicloud/services/fs/__init__.py +29 -0
- yicloud/services/fs/actions.py +109 -0
- yicloud/services/fs/client.py +19 -0
- yicloud/services/fs/models.py +152 -0
- yicloud/services/iam/__init__.py +27 -0
- yicloud/services/iam/actions.py +304 -0
- yicloud/services/iam/client.py +19 -0
- yicloud/services/iam/models.py +276 -0
- yicloud/services/job/__init__.py +44 -0
- yicloud/services/job/actions.py +167 -0
- yicloud/services/job/client.py +19 -0
- yicloud/services/job/models.py +268 -0
- yicloud/services/mc/__init__.py +59 -0
- yicloud/services/mc/actions.py +221 -0
- yicloud/services/mc/client.py +21 -0
- yicloud/services/mc/models.py +322 -0
- yicloud/services/modelrepo/__init__.py +33 -0
- yicloud/services/modelrepo/actions.py +163 -0
- yicloud/services/modelrepo/client.py +19 -0
- yicloud/services/modelrepo/models.py +146 -0
- yicloud/services/modelset/__init__.py +45 -0
- yicloud/services/modelset/actions.py +130 -0
- yicloud/services/modelset/client.py +19 -0
- yicloud/services/modelset/models.py +356 -0
- yicloud/services/oss/__init__.py +25 -0
- yicloud/services/oss/actions.py +83 -0
- yicloud/services/oss/client.py +19 -0
- yicloud/services/oss/models.py +113 -0
- yicloud/services/registry/__init__.py +42 -0
- yicloud/services/registry/actions.py +208 -0
- yicloud/services/registry/client.py +19 -0
- yicloud/services/registry/models.py +183 -0
- yicloud_sdk_python-0.1.0.dist-info/METADATA +145 -0
- yicloud_sdk_python-0.1.0.dist-info/RECORD +59 -0
- yicloud_sdk_python-0.1.0.dist-info/WHEEL +5 -0
- yicloud_sdk_python-0.1.0.dist-info/licenses/LICENSE +202 -0
- yicloud_sdk_python-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Code generated from Go SDK's services/job/models.go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass, field
|
|
4
|
+
from typing import Optional, List, Dict
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class TaskSpec:
|
|
9
|
+
"""Task specification for job."""
|
|
10
|
+
Replicas: Optional[int] = None # *int32 in Go, using Optional[int]
|
|
11
|
+
PositiveTags: List[str] = field(default_factory=list)
|
|
12
|
+
NegativeTags: List[str] = field(default_factory=list)
|
|
13
|
+
MaxWaitDuration: Optional[str] = None
|
|
14
|
+
MaxRunningDuration: Optional[str] = None
|
|
15
|
+
Image: str = ""
|
|
16
|
+
Command: List[str] = field(default_factory=list)
|
|
17
|
+
Env: Dict[str, str] = field(default_factory=dict)
|
|
18
|
+
CPU: Optional[str] = None
|
|
19
|
+
Memory: Optional[str] = None
|
|
20
|
+
GPU: Optional[str] = None
|
|
21
|
+
SKUId: Optional[str] = None
|
|
22
|
+
MountGpfs: Optional[str] = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass
|
|
26
|
+
class TaskSpecResponse:
|
|
27
|
+
"""Task specification response."""
|
|
28
|
+
Replicas: Optional[int] = None
|
|
29
|
+
PositiveTags: List[str] = field(default_factory=list)
|
|
30
|
+
NegativeTags: List[str] = field(default_factory=list)
|
|
31
|
+
MaxWaitDuration: Optional[str] = None
|
|
32
|
+
MaxRunningDuration: Optional[str] = None
|
|
33
|
+
Image: Optional[str] = None
|
|
34
|
+
Command: List[str] = field(default_factory=list)
|
|
35
|
+
Env: Dict[str, str] = field(default_factory=dict)
|
|
36
|
+
CPU: Optional[str] = None
|
|
37
|
+
Memory: Optional[str] = None
|
|
38
|
+
GPU: Optional[str] = None
|
|
39
|
+
SKUId: Optional[str] = None
|
|
40
|
+
MountGpfs: Optional[str] = None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass
|
|
44
|
+
class JobData:
|
|
45
|
+
"""Job data."""
|
|
46
|
+
Name: Optional[str] = None
|
|
47
|
+
Project: Optional[str] = None
|
|
48
|
+
Labels: Dict[str, str] = field(default_factory=dict)
|
|
49
|
+
JobId: Optional[str] = None
|
|
50
|
+
TaskType: Optional[str] = None
|
|
51
|
+
QuotaGroup: Optional[str] = None
|
|
52
|
+
UsePrivateMachine: bool = False
|
|
53
|
+
SKUPrivate: bool = False
|
|
54
|
+
SKUPublic: bool = False
|
|
55
|
+
SKUPrivateTenant: bool = False
|
|
56
|
+
SKUPrivateProject: bool = False
|
|
57
|
+
Mount: Optional[str] = None
|
|
58
|
+
CreationTime: Optional[str] = None
|
|
59
|
+
Phase: Optional[str] = None
|
|
60
|
+
TaskSpecs: Dict[str, TaskSpecResponse] = field(default_factory=dict)
|
|
61
|
+
BackoffLimit: Optional[int] = None # *int32 in Go
|
|
62
|
+
StopTime: Optional[str] = None
|
|
63
|
+
AutoDeleteDuration: Optional[str] = None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass
|
|
67
|
+
class ListJobsData:
|
|
68
|
+
"""List jobs response data."""
|
|
69
|
+
Items: List[JobData] = field(default_factory=list)
|
|
70
|
+
Total: int = 0
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass
|
|
74
|
+
class ListJobsReq:
|
|
75
|
+
"""List jobs request."""
|
|
76
|
+
Project: str = ""
|
|
77
|
+
Offset: int = 0
|
|
78
|
+
Limit: int = 0
|
|
79
|
+
SortBy: str = ""
|
|
80
|
+
Creators: str = ""
|
|
81
|
+
JobNames: str = ""
|
|
82
|
+
JobIds: str = ""
|
|
83
|
+
Self: bool = False
|
|
84
|
+
JobType: str = ""
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass
|
|
88
|
+
class GetJobReq:
|
|
89
|
+
"""Get job request."""
|
|
90
|
+
Project: str = ""
|
|
91
|
+
JobId: str = ""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dataclass
|
|
95
|
+
class CreateJobReq:
|
|
96
|
+
"""Create job request."""
|
|
97
|
+
Name: str = ""
|
|
98
|
+
Project: str = ""
|
|
99
|
+
Labels: Dict[str, str] = field(default_factory=dict)
|
|
100
|
+
JobId: str = ""
|
|
101
|
+
TaskType: str = ""
|
|
102
|
+
QuotaGroup: str = ""
|
|
103
|
+
UsePrivateMachine: bool = False
|
|
104
|
+
SKUPrivate: bool = False
|
|
105
|
+
SKUPublic: bool = False
|
|
106
|
+
SKUPrivateTenant: bool = False
|
|
107
|
+
SKUPrivateProject: bool = False
|
|
108
|
+
Mount: str = ""
|
|
109
|
+
TaskSpecs: Dict[str, TaskSpec] = field(default_factory=dict)
|
|
110
|
+
BackoffLimit: Optional[int] = None
|
|
111
|
+
AutoDeleteDuration: str = ""
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@dataclass
|
|
115
|
+
class CreateJobData:
|
|
116
|
+
"""Create job response data."""
|
|
117
|
+
Name: str = ""
|
|
118
|
+
Project: str = ""
|
|
119
|
+
CreationTime: Optional[str] = None
|
|
120
|
+
JobId: str = ""
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass
|
|
124
|
+
class EditJobReq:
|
|
125
|
+
"""Edit job request."""
|
|
126
|
+
Project: str = ""
|
|
127
|
+
JobId: str = ""
|
|
128
|
+
Operation: str = ""
|
|
129
|
+
Priority: str = ""
|
|
130
|
+
TopAction: str = ""
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@dataclass
|
|
134
|
+
class BatchDeleteJobsReq:
|
|
135
|
+
"""Batch delete jobs request."""
|
|
136
|
+
Project: str = ""
|
|
137
|
+
JobIds: List[str] = field(default_factory=list)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@dataclass
|
|
141
|
+
class BatchStopJobsReq:
|
|
142
|
+
"""Batch stop jobs request."""
|
|
143
|
+
Project: str = ""
|
|
144
|
+
JobIds: List[str] = field(default_factory=list)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@dataclass
|
|
148
|
+
class BatchStopJobsData:
|
|
149
|
+
"""Batch stop jobs response data."""
|
|
150
|
+
Message: str = ""
|
|
151
|
+
Failed: List[str] = field(default_factory=list)
|
|
152
|
+
Reasons: Dict[str, str] = field(default_factory=dict)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@dataclass
|
|
156
|
+
class GetLogsReq:
|
|
157
|
+
"""Get logs request."""
|
|
158
|
+
Project: str = ""
|
|
159
|
+
JobId: str = ""
|
|
160
|
+
Start: int = 0
|
|
161
|
+
End: int = 0
|
|
162
|
+
Limit: int = 0
|
|
163
|
+
Direction: str = ""
|
|
164
|
+
Keyword: str = ""
|
|
165
|
+
Regex: bool = False
|
|
166
|
+
CaseSensitive: bool = False
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
@dataclass
|
|
170
|
+
class LogEntry:
|
|
171
|
+
"""Log entry."""
|
|
172
|
+
Timestamp: str = ""
|
|
173
|
+
Line: str = ""
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@dataclass
|
|
177
|
+
class GetLogsResponse:
|
|
178
|
+
"""Get logs response."""
|
|
179
|
+
Items: List[LogEntry] = field(default_factory=list)
|
|
180
|
+
Total: int = 0
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@dataclass
|
|
184
|
+
class GetLogsVolumeReq:
|
|
185
|
+
"""Get logs volume request."""
|
|
186
|
+
Project: str = ""
|
|
187
|
+
JobId: str = ""
|
|
188
|
+
Start: int = 0
|
|
189
|
+
End: int = 0
|
|
190
|
+
Keyword: str = ""
|
|
191
|
+
Regex: bool = False
|
|
192
|
+
CaseSensitive: bool = False
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@dataclass
|
|
196
|
+
class VolumeDataPoint:
|
|
197
|
+
"""Volume data point."""
|
|
198
|
+
Timestamp: int = 0
|
|
199
|
+
Count: str = ""
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@dataclass
|
|
203
|
+
class VolumeResultItem:
|
|
204
|
+
"""Volume result item."""
|
|
205
|
+
Metric: Dict[str, str] = field(default_factory=dict)
|
|
206
|
+
Values: List[VolumeDataPoint] = field(default_factory=list)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@dataclass
|
|
210
|
+
class VolumeMetadata:
|
|
211
|
+
"""Volume metadata."""
|
|
212
|
+
Step: int = 0
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@dataclass
|
|
216
|
+
class GetLogsVolumeResponse:
|
|
217
|
+
"""Get logs volume response."""
|
|
218
|
+
Metadata: VolumeMetadata = field(default_factory=VolumeMetadata)
|
|
219
|
+
Result: List[VolumeResultItem] = field(default_factory=list)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@dataclass
|
|
223
|
+
class ListJobReplicasReq:
|
|
224
|
+
"""List job replicas request."""
|
|
225
|
+
JobId: str = ""
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
@dataclass
|
|
229
|
+
class ReplicaData:
|
|
230
|
+
"""Replica data."""
|
|
231
|
+
Name: str = ""
|
|
232
|
+
Project: str = ""
|
|
233
|
+
Phase: str = ""
|
|
234
|
+
NodeName: str = ""
|
|
235
|
+
PodIp: str = ""
|
|
236
|
+
StartTime: str = ""
|
|
237
|
+
TaskType: str = ""
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
@dataclass
|
|
241
|
+
class ListJobReplicasData:
|
|
242
|
+
"""List job replicas response."""
|
|
243
|
+
Items: List[ReplicaData] = field(default_factory=list)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
@dataclass
|
|
247
|
+
class GetJobReplicaReq:
|
|
248
|
+
"""Get job replica request."""
|
|
249
|
+
JobId: str = ""
|
|
250
|
+
ReplicaName: str = ""
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@dataclass
|
|
254
|
+
class GetJobReplicaPidReq:
|
|
255
|
+
"""Get job replica PID request."""
|
|
256
|
+
JobId: str = ""
|
|
257
|
+
ReplicaName: str = ""
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
@dataclass
|
|
261
|
+
class PidInfoData:
|
|
262
|
+
"""PID info data."""
|
|
263
|
+
Pid: str = ""
|
|
264
|
+
Ppid: str = ""
|
|
265
|
+
Pcpu: str = ""
|
|
266
|
+
Rss: str = ""
|
|
267
|
+
State: str = ""
|
|
268
|
+
Args: str = ""
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from yicloud.services.mc.client import MCClient as Client, client, use_client
|
|
2
|
+
from . import actions, models
|
|
3
|
+
|
|
4
|
+
from .actions import (
|
|
5
|
+
assign_nodes,
|
|
6
|
+
list_nodes,
|
|
7
|
+
list_skus,
|
|
8
|
+
bind_project_user,
|
|
9
|
+
create_project,
|
|
10
|
+
delete_project,
|
|
11
|
+
get_project,
|
|
12
|
+
list_project_users,
|
|
13
|
+
list_projects,
|
|
14
|
+
remove_project_user,
|
|
15
|
+
update_project,
|
|
16
|
+
create_quota_group,
|
|
17
|
+
delete_quota_group,
|
|
18
|
+
get_quota_group,
|
|
19
|
+
list_quota_groups,
|
|
20
|
+
update_quota_group,
|
|
21
|
+
)
|
|
22
|
+
from .models import (
|
|
23
|
+
Role,
|
|
24
|
+
AssignNodeReq,
|
|
25
|
+
ResourceDetail,
|
|
26
|
+
NodeConfig,
|
|
27
|
+
NodeData,
|
|
28
|
+
ListNodesData,
|
|
29
|
+
SKUData,
|
|
30
|
+
ListSKUsData,
|
|
31
|
+
BindProjectUserReq,
|
|
32
|
+
Quota,
|
|
33
|
+
CreateProjectReq,
|
|
34
|
+
DeleteProjectReq,
|
|
35
|
+
ProjectStatus,
|
|
36
|
+
QuotaStatus,
|
|
37
|
+
ProjectData,
|
|
38
|
+
ProjectUser,
|
|
39
|
+
ListProjectUsersData,
|
|
40
|
+
ListProjectsData,
|
|
41
|
+
RemoveProjectUserReq,
|
|
42
|
+
UpdateProjectReq,
|
|
43
|
+
QuotaGroupUser,
|
|
44
|
+
UsageType,
|
|
45
|
+
MachineType,
|
|
46
|
+
CreateQuotaGroupReq,
|
|
47
|
+
QuotaGroupData,
|
|
48
|
+
QuotaGroupBasicData,
|
|
49
|
+
ListQuotaGroupData,
|
|
50
|
+
UpdateQuotaGroupReq,
|
|
51
|
+
ListNodesReq,
|
|
52
|
+
ListSKUsReq,
|
|
53
|
+
GetProjectReq,
|
|
54
|
+
ListProjectUsersReq,
|
|
55
|
+
ListProjectsReq,
|
|
56
|
+
DeleteQuotaGroupReq,
|
|
57
|
+
GetQuotaGroupReq,
|
|
58
|
+
ListQuotaGroupsReq,
|
|
59
|
+
)
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from yicloud.base import msgs
|
|
4
|
+
from yicloud.services.mc import models
|
|
5
|
+
from yicloud.services.mc.client import client
|
|
6
|
+
|
|
7
|
+
_PRODUCT_CODE = "mc"
|
|
8
|
+
_LAST_VERSION = "v1alpha1"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def assign_nodes(ctx: Optional[dict], req: models.AssignNodeReq) -> None:
|
|
12
|
+
"""
|
|
13
|
+
POST /mc/v1alpha1/AssignNodes
|
|
14
|
+
Action: AssignNodes
|
|
15
|
+
|
|
16
|
+
Raises YiCloudException on error.
|
|
17
|
+
"""
|
|
18
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/AssignNodes"
|
|
19
|
+
rsp = msgs.Rsp[None].empty()
|
|
20
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def list_nodes(ctx: Optional[dict], req: models.ListNodesReq) -> models.ListNodesData:
|
|
24
|
+
"""
|
|
25
|
+
GET /mc/v1alpha1/ListNodes
|
|
26
|
+
Action: ListNodes
|
|
27
|
+
|
|
28
|
+
Returns ListNodesData on success.
|
|
29
|
+
|
|
30
|
+
Raises YiCloudException on error.
|
|
31
|
+
"""
|
|
32
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListNodes"
|
|
33
|
+
rsp = msgs.Rsp[models.ListNodesData]()
|
|
34
|
+
client.base.get(ctx, path, req, rsp)
|
|
35
|
+
return rsp.get_typed_data()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def list_skus(ctx: Optional[dict], req: models.ListSKUsReq) -> models.ListSKUsData:
|
|
39
|
+
"""
|
|
40
|
+
GET /mc/v1alpha1/ListSKUs
|
|
41
|
+
Action: ListSKUs
|
|
42
|
+
|
|
43
|
+
Returns ListSKUsData on success.
|
|
44
|
+
|
|
45
|
+
Raises YiCloudException on error.
|
|
46
|
+
"""
|
|
47
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListSKUs"
|
|
48
|
+
rsp = msgs.Rsp[models.ListSKUsData]()
|
|
49
|
+
client.base.get(ctx, path, req, rsp)
|
|
50
|
+
return rsp.get_typed_data()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def bind_project_user(ctx: Optional[dict], req: models.BindProjectUserReq) -> None:
|
|
54
|
+
"""
|
|
55
|
+
POST /mc/v1alpha1/BindProjectUser
|
|
56
|
+
Action: BindProjectUser
|
|
57
|
+
|
|
58
|
+
Raises YiCloudException on error.
|
|
59
|
+
"""
|
|
60
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/BindProjectUser"
|
|
61
|
+
rsp = msgs.Rsp[None].empty()
|
|
62
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def create_project(ctx: Optional[dict], req: models.CreateProjectReq) -> None:
|
|
66
|
+
"""
|
|
67
|
+
POST /mc/v1alpha1/CreateProject
|
|
68
|
+
Action: CreateProject
|
|
69
|
+
|
|
70
|
+
Raises YiCloudException on error.
|
|
71
|
+
"""
|
|
72
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateProject"
|
|
73
|
+
rsp = msgs.Rsp[None].empty()
|
|
74
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def delete_project(ctx: Optional[dict], req: models.DeleteProjectReq) -> None:
|
|
78
|
+
"""
|
|
79
|
+
POST /mc/v1alpha1/DeleteProject
|
|
80
|
+
Action: DeleteProject
|
|
81
|
+
|
|
82
|
+
Raises YiCloudException on error.
|
|
83
|
+
"""
|
|
84
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteProject"
|
|
85
|
+
rsp = msgs.Rsp[None].empty()
|
|
86
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def get_project(ctx: Optional[dict], req: models.GetProjectReq) -> models.ProjectData:
|
|
90
|
+
"""
|
|
91
|
+
GET /mc/v1alpha1/GetProject
|
|
92
|
+
Action: GetProject
|
|
93
|
+
|
|
94
|
+
Returns ProjectData on success.
|
|
95
|
+
|
|
96
|
+
Raises YiCloudException on error.
|
|
97
|
+
"""
|
|
98
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetProject"
|
|
99
|
+
rsp = msgs.Rsp[models.ProjectData]()
|
|
100
|
+
client.base.get(ctx, path, req, rsp)
|
|
101
|
+
return rsp.get_typed_data()
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def list_project_users(ctx: Optional[dict], req: models.ListProjectUsersReq) -> models.ListProjectUsersData:
|
|
105
|
+
"""
|
|
106
|
+
GET /mc/v1alpha1/ListProjectUsers
|
|
107
|
+
Action: ListProjectUsers
|
|
108
|
+
|
|
109
|
+
Returns ListProjectUsersData on success.
|
|
110
|
+
|
|
111
|
+
Raises YiCloudException on error.
|
|
112
|
+
"""
|
|
113
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListProjectUsers"
|
|
114
|
+
rsp = msgs.Rsp[models.ListProjectUsersData]()
|
|
115
|
+
client.base.get(ctx, path, req, rsp)
|
|
116
|
+
return rsp.get_typed_data()
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def list_projects(ctx: Optional[dict], req: models.ListProjectsReq) -> models.ListProjectsData:
|
|
120
|
+
"""
|
|
121
|
+
GET /mc/v1alpha1/ListProjects
|
|
122
|
+
Action: ListProjects
|
|
123
|
+
|
|
124
|
+
Returns ListProjectsData on success.
|
|
125
|
+
|
|
126
|
+
Raises YiCloudException on error.
|
|
127
|
+
"""
|
|
128
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListProjects"
|
|
129
|
+
rsp = msgs.Rsp[models.ListProjectsData]()
|
|
130
|
+
client.base.get(ctx, path, req, rsp)
|
|
131
|
+
return rsp.get_typed_data()
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def remove_project_user(ctx: Optional[dict], req: models.RemoveProjectUserReq) -> None:
|
|
135
|
+
"""
|
|
136
|
+
POST /mc/v1alpha1/RemoveProjectUser
|
|
137
|
+
Action: RemoveProjectUser
|
|
138
|
+
|
|
139
|
+
Raises YiCloudException on error.
|
|
140
|
+
"""
|
|
141
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/RemoveProjectUser"
|
|
142
|
+
rsp = msgs.Rsp[None].empty()
|
|
143
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def update_project(ctx: Optional[dict], req: models.UpdateProjectReq) -> None:
|
|
147
|
+
"""
|
|
148
|
+
POST /mc/v1alpha1/UpdateProject
|
|
149
|
+
Action: UpdateProject
|
|
150
|
+
|
|
151
|
+
Raises YiCloudException on error.
|
|
152
|
+
"""
|
|
153
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/UpdateProject"
|
|
154
|
+
rsp = msgs.Rsp[None].empty()
|
|
155
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def create_quota_group(ctx: Optional[dict], req: models.CreateQuotaGroupReq) -> None:
|
|
159
|
+
"""
|
|
160
|
+
POST /mc/v1alpha1/CreateQuotaGroup
|
|
161
|
+
Action: CreateQuotaGroup
|
|
162
|
+
|
|
163
|
+
Raises YiCloudException on error.
|
|
164
|
+
"""
|
|
165
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateQuotaGroup"
|
|
166
|
+
rsp = msgs.Rsp[None].empty()
|
|
167
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def delete_quota_group(ctx: Optional[dict], req: models.DeleteQuotaGroupReq) -> None:
|
|
171
|
+
"""
|
|
172
|
+
POST /mc/v1alpha1/DeleteQuotaGroup
|
|
173
|
+
Action: DeleteQuotaGroup
|
|
174
|
+
|
|
175
|
+
Raises YiCloudException on error.
|
|
176
|
+
"""
|
|
177
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteQuotaGroup"
|
|
178
|
+
rsp = msgs.Rsp[None].empty()
|
|
179
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def get_quota_group(ctx: Optional[dict], req: models.GetQuotaGroupReq) -> models.QuotaGroupData:
|
|
183
|
+
"""
|
|
184
|
+
GET /mc/v1alpha1/GetQuotaGroup
|
|
185
|
+
Action: GetQuotaGroup
|
|
186
|
+
|
|
187
|
+
Returns QuotaGroupData on success.
|
|
188
|
+
|
|
189
|
+
Raises YiCloudException on error.
|
|
190
|
+
"""
|
|
191
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetQuotaGroup"
|
|
192
|
+
rsp = msgs.Rsp[models.QuotaGroupData]()
|
|
193
|
+
client.base.get(ctx, path, req, rsp)
|
|
194
|
+
return rsp.get_typed_data()
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def list_quota_groups(ctx: Optional[dict], req: models.ListQuotaGroupsReq) -> models.ListQuotaGroupData:
|
|
198
|
+
"""
|
|
199
|
+
GET /mc/v1alpha1/ListQuotaGroups
|
|
200
|
+
Action: ListQuotaGroups
|
|
201
|
+
|
|
202
|
+
Returns ListQuotaGroupData on success.
|
|
203
|
+
|
|
204
|
+
Raises YiCloudException on error.
|
|
205
|
+
"""
|
|
206
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListQuotaGroups"
|
|
207
|
+
rsp = msgs.Rsp[models.ListQuotaGroupData]()
|
|
208
|
+
client.base.get(ctx, path, req, rsp)
|
|
209
|
+
return rsp.get_typed_data()
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def update_quota_group(ctx: Optional[dict], req: models.UpdateQuotaGroupReq) -> None:
|
|
213
|
+
"""
|
|
214
|
+
POST /mc/v1alpha1/UpdateQuotaGroup
|
|
215
|
+
Action: UpdateQuotaGroup
|
|
216
|
+
|
|
217
|
+
Raises YiCloudException on error.
|
|
218
|
+
"""
|
|
219
|
+
path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/UpdateQuotaGroup"
|
|
220
|
+
rsp = msgs.Rsp[None].empty()
|
|
221
|
+
client.base.post(ctx, path, req.__dict__, rsp)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Code generated from Go SDK's services/mc/client.go. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
from yicloud.base import Client
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class MCClient:
|
|
7
|
+
"""Machine Cluster service client, matching Go SDK's services/mc/client.go."""
|
|
8
|
+
|
|
9
|
+
def __init__(self, base_client: Client = None):
|
|
10
|
+
self.base = base_client
|
|
11
|
+
self.product_code = "mc"
|
|
12
|
+
self.last_version = "v1alpha1"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Singleton matching Go SDK
|
|
16
|
+
client: MCClient = MCClient()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def use_client(cli: Client) -> None:
|
|
20
|
+
"""Set the base client for MC service."""
|
|
21
|
+
client.base = cli
|