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.
Files changed (59) hide show
  1. version.py +9 -0
  2. yicloud/__init__.py +7 -0
  3. yicloud/base/__init__.py +58 -0
  4. yicloud/base/auth/__init__.py +10 -0
  5. yicloud/base/auth/credential.py +64 -0
  6. yicloud/base/auth/sign.py +80 -0
  7. yicloud/base/client.py +313 -0
  8. yicloud/base/config.py +62 -0
  9. yicloud/base/errs/__init__.py +292 -0
  10. yicloud/base/log/__init__.py +43 -0
  11. yicloud/base/log/logger.py +123 -0
  12. yicloud/base/log/std.py +70 -0
  13. yicloud/base/msgs/__init__.py +226 -0
  14. yicloud/base/utils/__init__.py +6 -0
  15. yicloud/base/utils/helps.py +110 -0
  16. yicloud/base/utils/retry/__init__.py +27 -0
  17. yicloud/base/utils/retry/retry.py +162 -0
  18. yicloud/services/__init__.py +24 -0
  19. yicloud/services/bc/__init__.py +9 -0
  20. yicloud/services/bc/actions.py +23 -0
  21. yicloud/services/bc/client.py +19 -0
  22. yicloud/services/bc/models.py +61 -0
  23. yicloud/services/fs/__init__.py +29 -0
  24. yicloud/services/fs/actions.py +109 -0
  25. yicloud/services/fs/client.py +19 -0
  26. yicloud/services/fs/models.py +152 -0
  27. yicloud/services/iam/__init__.py +27 -0
  28. yicloud/services/iam/actions.py +304 -0
  29. yicloud/services/iam/client.py +19 -0
  30. yicloud/services/iam/models.py +276 -0
  31. yicloud/services/job/__init__.py +44 -0
  32. yicloud/services/job/actions.py +167 -0
  33. yicloud/services/job/client.py +19 -0
  34. yicloud/services/job/models.py +268 -0
  35. yicloud/services/mc/__init__.py +59 -0
  36. yicloud/services/mc/actions.py +221 -0
  37. yicloud/services/mc/client.py +21 -0
  38. yicloud/services/mc/models.py +322 -0
  39. yicloud/services/modelrepo/__init__.py +33 -0
  40. yicloud/services/modelrepo/actions.py +163 -0
  41. yicloud/services/modelrepo/client.py +19 -0
  42. yicloud/services/modelrepo/models.py +146 -0
  43. yicloud/services/modelset/__init__.py +45 -0
  44. yicloud/services/modelset/actions.py +130 -0
  45. yicloud/services/modelset/client.py +19 -0
  46. yicloud/services/modelset/models.py +356 -0
  47. yicloud/services/oss/__init__.py +25 -0
  48. yicloud/services/oss/actions.py +83 -0
  49. yicloud/services/oss/client.py +19 -0
  50. yicloud/services/oss/models.py +113 -0
  51. yicloud/services/registry/__init__.py +42 -0
  52. yicloud/services/registry/actions.py +208 -0
  53. yicloud/services/registry/client.py +19 -0
  54. yicloud/services/registry/models.py +183 -0
  55. yicloud_sdk_python-0.1.0.dist-info/METADATA +145 -0
  56. yicloud_sdk_python-0.1.0.dist-info/RECORD +59 -0
  57. yicloud_sdk_python-0.1.0.dist-info/WHEEL +5 -0
  58. yicloud_sdk_python-0.1.0.dist-info/licenses/LICENSE +202 -0
  59. yicloud_sdk_python-0.1.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,109 @@
1
+ from typing import Optional
2
+ from yicloud.base import msgs
3
+ from yicloud.services.fs import models
4
+ from yicloud.services.fs.client import client
5
+
6
+ _PRODUCT_CODE = "fs"
7
+ _LAST_VERSION = "v1alpha2"
8
+
9
+
10
+ def list_dir(ctx: Optional[dict], req: models.ListDirRequest) -> models.PaginatedFileInfo:
11
+ """
12
+ GET /fs/v1alpha2/ListDir
13
+ Action: ListDir
14
+
15
+ Returns PaginatedFileInfo on success.
16
+
17
+ Raises YiCloudException on error.
18
+ """
19
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListDir"
20
+ rsp = msgs.Rsp[models.PaginatedFileInfo]()
21
+ client.base.get(ctx, path, req, rsp)
22
+ return rsp.get_typed_data()
23
+
24
+
25
+ def get_file_info(ctx: Optional[dict], req: models.GetFileInfoRequest) -> models.FileInfo:
26
+ """
27
+ GET /fs/v1alpha2/GetFileInfo
28
+ Action: GetFileInfo
29
+
30
+ Returns FileInfo on success.
31
+
32
+ Raises YiCloudException on error.
33
+ """
34
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetFileInfo"
35
+ rsp = msgs.Rsp[models.FileInfo]()
36
+ client.base.get(ctx, path, req, rsp)
37
+ return rsp.get_typed_data()
38
+
39
+
40
+ def create_fileset_with_quota(ctx: Optional[dict], req: models.CreateFilesetWithQuotaRequest) -> models.FilesetWithQuotaInfo:
41
+ """
42
+ POST /fs/v1alpha2/CreateFilesetWithQuota
43
+ Action: CreateFilesetWithQuota
44
+
45
+ Returns FilesetWithQuotaInfo on success.
46
+
47
+ Raises YiCloudException on error.
48
+ """
49
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateFilesetWithQuota"
50
+ rsp = msgs.Rsp[models.FilesetWithQuotaInfo]()
51
+ client.base.post(ctx, path, req.__dict__, rsp)
52
+ return rsp.get_typed_data()
53
+
54
+
55
+ def delete_fileset(ctx: Optional[dict], req: models.DeleteFilesetRequest) -> None:
56
+ """
57
+ POST /fs/v1alpha2/DeleteFileset
58
+ Action: DeleteFileset
59
+
60
+ Raises YiCloudException on error.
61
+ """
62
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteFileset"
63
+ rsp = msgs.Rsp[None].empty()
64
+ client.base.post(ctx, path, req.__dict__, rsp)
65
+
66
+
67
+ def list_filesets_with_quota_info(ctx: Optional[dict], req: models.ListFilesetsWithQuotaInfoRequest) -> models.PaginatedFileSetWithQuotaInfo:
68
+ """
69
+ GET /fs/v1alpha2/ListFilesetsWithQuotaInfo
70
+ Action: ListFilesetsWithQuotaInfo
71
+
72
+ Returns PaginatedFileSetWithQuotaInfo on success.
73
+
74
+ Raises YiCloudException on error.
75
+ """
76
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListFilesetsWithQuotaInfo"
77
+ rsp = msgs.Rsp[models.PaginatedFileSetWithQuotaInfo]()
78
+ client.base.get(ctx, path, req, rsp)
79
+ return rsp.get_typed_data()
80
+
81
+
82
+ def set_fileset_quota(ctx: Optional[dict], req: models.SetFilesetQuotaRequest) -> models.FilesetInfo:
83
+ """
84
+ POST /fs/v1alpha2/SetFilesetQuota
85
+ Action: SetFilesetQuota
86
+
87
+ Returns FilesetInfo on success.
88
+
89
+ Raises YiCloudException on error.
90
+ """
91
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/SetFilesetQuota"
92
+ rsp = msgs.Rsp[models.FilesetInfo]()
93
+ client.base.post(ctx, path, req.__dict__, rsp)
94
+ return rsp.get_typed_data()
95
+
96
+
97
+ def get_fileset(ctx: Optional[dict], req: models.GetFilesetRequest) -> models.FilesetInfo:
98
+ """
99
+ GET /fs/v1alpha2/GetFileset
100
+ Action: GetFileset
101
+
102
+ Returns FilesetInfo on success.
103
+
104
+ Raises YiCloudException on error.
105
+ """
106
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetFileset"
107
+ rsp = msgs.Rsp[models.FilesetInfo]()
108
+ client.base.get(ctx, path, req, rsp)
109
+ return rsp.get_typed_data()
@@ -0,0 +1,19 @@
1
+ from yicloud.base import Client
2
+
3
+
4
+ class FSClient:
5
+ """FS service client, matching Go SDK's services/fs/client.go."""
6
+
7
+ def __init__(self, base_client: Client = None):
8
+ self.base = base_client
9
+ self.product_code = "fs"
10
+ self.last_version = "v1alpha2"
11
+
12
+
13
+ # Singleton matching Go SDK
14
+ client: FSClient = FSClient()
15
+
16
+
17
+ def use_client(cli: Client) -> None:
18
+ """Set the base client for FS service."""
19
+ client.base = cli
@@ -0,0 +1,152 @@
1
+ from dataclasses import dataclass
2
+ from typing import Optional, List
3
+
4
+
5
+ # Models
6
+ @dataclass
7
+ class FileInfo:
8
+ """Represents a file or directory in the file system."""
9
+ Name: str # json:"Name"
10
+ Path: str # json:"Path"
11
+ Size: int # json:"Size"
12
+ IsDir: bool # json:"IsDir"
13
+ ModTime: str # json:"ModTime" - time.Time becomes str in JSON
14
+ Mode: str # json:"Mode"
15
+ IsFileset: bool = False # json:"IsFileset,omitempty"
16
+
17
+
18
+ @dataclass
19
+ class Authorization:
20
+ """Authorization for a fileset."""
21
+ Type: str # json:"Type"
22
+ Name: str # json:"Name"
23
+ Mode: str # json:"Mode"
24
+
25
+
26
+ @dataclass
27
+ class FilesetInfo:
28
+ """Information about a fileset."""
29
+ Name: str # json:"Name"
30
+ Capacity: str # json:"Capacity"
31
+ Used: str # json:"Used"
32
+ State: str # json:"State"
33
+ Owner: str # json:"Owner"
34
+ FsCluster: str # json:"FsCluster"
35
+ Fs: str # json:"Fs"
36
+ Id: str # json:"Id"
37
+ Permission: Optional[str] = None # json:"Permission,omitempty"
38
+ Authorizations: Optional[List[Authorization]] = None # json:"Authorizations,omitempty"
39
+ Tenant: Optional[str] = None # json:"Tenant,omitempty"
40
+ Project: Optional[str] = None # json:"Project,omitempty"
41
+ Description: Optional[str] = None # json:"Description,omitempty"
42
+ Created: Optional[str] = None # json:"Created,omitempty"
43
+
44
+
45
+ @dataclass
46
+ class PaginatedFileInfo:
47
+ """Paginated list of files and directories."""
48
+ Files: List[FileInfo] # json:"Files"
49
+ Total: int # json:"Total"
50
+ Offset: int # json:"Offset"
51
+ Limit: int # json:"Limit"
52
+
53
+
54
+ @dataclass
55
+ class FilesetWithQuotaInfo:
56
+ """Fileset information with optional quota."""
57
+ Quota: Optional[FilesetInfo] = None # json:"Quota"
58
+
59
+
60
+ @dataclass
61
+ class BucketResponse:
62
+ """Response for bucket information."""
63
+ Owner: str # json:"Owner"
64
+ Bucket: str # json:"Bucket"
65
+ State: Optional[str] = None # json:"State,omitempty"
66
+ Size: Optional[str] = None # json:"Size,omitempty"
67
+ Creator: Optional[str] = None # json:"Creator,omitempty"
68
+ Capacity: Optional[str] = None # json:"Capacity,omitempty"
69
+ Tenant: Optional[str] = None # json:"Tenant,omitempty"
70
+ Project: Optional[str] = None # json:"Project,omitempty"
71
+
72
+
73
+ @dataclass
74
+ class GetFSBucketResponse:
75
+ """Response for getting FS bucket with quota info."""
76
+ Id: str # json:"ID"
77
+ BucketResponse: Optional[BucketResponse] = None # json:"BucketResponse"
78
+
79
+
80
+ @dataclass
81
+ class PaginatedFileSetWithQuotaInfo:
82
+ """Paginated list of filesets with quota info."""
83
+ Total: int # json:"Total"
84
+ Items: List[GetFSBucketResponse] # json:"Items"
85
+
86
+
87
+ # Request models
88
+ @dataclass
89
+ class ListDirRequest:
90
+ """Request to list a directory."""
91
+ Path: str # json:"Path" form:"Path"
92
+ CalculateDirSize: bool = False # json:"CalculateDirSize" form:"CalculateDirSize"
93
+ Offset: int = 0 # json:"Offset" form:"Offset"
94
+ Limit: int = 10 # json:"Limit" form:"Limit"
95
+ SortBy: str = "" # json:"SortBy" form:"SortBy"
96
+ SortOrder: str = "" # json:"SortOrder" form:"SortOrder"
97
+
98
+
99
+ @dataclass
100
+ class GetFileInfoRequest:
101
+ """Request to get file information."""
102
+ Path: str # json:"Path" form:"Path"
103
+ CalculateDirSize: bool = False # json:"CalculateDirSize" form:"CalculateDirSize"
104
+
105
+
106
+ @dataclass
107
+ class CreateFilesetWithQuotaRequest:
108
+ """Request to create a fileset with quota."""
109
+ Name: str # json:"Name"
110
+ Capacity: int # json:"Capacity"
111
+ Fs: str # json:"Fs"
112
+ FsCluster: str # json:"FsCluster"
113
+ Authorizations: Optional[List[Authorization]] = None # json:"Authorizations,omitempty"
114
+ Description: Optional[str] = None # json:"Description,omitempty"
115
+ Project: Optional[str] = None # json:"Project,omitempty"
116
+
117
+
118
+ @dataclass
119
+ class DeleteFilesetRequest:
120
+ """Request to delete a fileset."""
121
+ Name: str # json:"Name" form:"Name"
122
+ Fs: str # json:"Fs" form:"Fs"
123
+ FsCluster: str # json:"FsCluster" form:"FsCluster"
124
+
125
+
126
+ @dataclass
127
+ class SetFilesetQuotaRequest:
128
+ """Request to set fileset quota."""
129
+ Name: str # json:"Name"
130
+ Capacity: int # json:"Capacity"
131
+ Fs: str # json:"Fs"
132
+ FsCluster: str # json:"FsCluster"
133
+
134
+
135
+ @dataclass
136
+ class GetFilesetRequest:
137
+ """Request to get fileset information."""
138
+ Name: str # json:"Name" form:"Name"
139
+ Fs: str # json:"Fs" form:"Fs"
140
+ FsCluster: str # json:"FsCluster" form:"FsCluster"
141
+
142
+
143
+ @dataclass
144
+ class ListFilesetsWithQuotaInfoRequest:
145
+ """Request to list filesets with quota info."""
146
+ SortBy: str = "" # json:"SortBy" form:"SortBy"
147
+ Offset: int = 0 # json:"Offset" form:"Offset"
148
+ Limit: int = 10 # json:"Limit" form:"Limit"
149
+ Fs: str = "" # json:"Fs" form:"Fs"
150
+ FsCluster: str = "" # json:"FsCluster" form:"FsCluster"
151
+ Keyword: str = "" # json:"Keyword" form:"Keyword"
152
+ Owner: str = "" # json:"Owner" form:"Owner"
@@ -0,0 +1,27 @@
1
+ from yicloud.services.iam.client import IAMClient as Client, client, use_client
2
+ from . import actions, models
3
+
4
+ # Re-export commonly used action functions for convenience
5
+ from .actions import (
6
+ get_user, list_users, create_user, delete_user,
7
+ create_access_key, delete_access_key, update_access_key,
8
+ get_access_key, list_access_keys, set_access_key_policy, get_access_key_policy,
9
+ create_project, delete_project, get_project, list_projects,
10
+ bind_project_user, remove_project_user, list_project_users,
11
+ create_quota_group, delete_quota_group, get_quota_group, list_quota_groups,
12
+ )
13
+
14
+ # Re-export request models for convenience
15
+ from .models import (
16
+ CreateUserReq, DeleteUserReq,
17
+ CreateAccessKeyReq, DeleteAccessKeyReq, UpdateAccessKeyReq,
18
+ SetAccessKeyPolicyReq,
19
+ CreateProjectReq, DeleteProjectReq,
20
+ BindProjectUserReq, RemoveProjectUserReq, ListProjectUsersReq,
21
+ CreateQuotaGroupReq,
22
+ GetUserReq, ListUsersReq,
23
+ GetAccessKeyReq, ListAccessKeysReq,
24
+ GetAccessKeyPolicyReq,
25
+ GetProjectReq, ListProjectsReq,
26
+ GetQuotaGroupReq, DeleteQuotaGroupReq, ListQuotaGroupsReq,
27
+ )
@@ -0,0 +1,304 @@
1
+ from typing import Optional
2
+ from yicloud.base import msgs
3
+ from yicloud.services.iam import models
4
+ from yicloud.services.iam.client import client
5
+
6
+ _PRODUCT_CODE = "iam"
7
+ _LAST_VERSION = "v1alpha1"
8
+
9
+
10
+ def create_user(ctx: Optional[dict], req: models.CreateUserReq) -> None:
11
+ """
12
+ POST /iam/v1alpha1/CreateUser
13
+ Action: CreateUser
14
+
15
+ Raises YiCloudException on error.
16
+ """
17
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateUser"
18
+ rsp = msgs.Rsp[None].empty()
19
+ client.base.post(ctx, path, req.__dict__, rsp)
20
+
21
+
22
+ def get_user(ctx: Optional[dict], req: models.GetUserReq) -> models.UserData:
23
+ """
24
+ GET /iam/v1alpha1/GetUser
25
+ Action: GetUser
26
+
27
+ Returns UserData on success.
28
+
29
+ Raises YiCloudException on error.
30
+ """
31
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetUser"
32
+ rsp = msgs.Rsp[models.UserData]()
33
+ client.base.get(ctx, path, req, rsp)
34
+ return rsp.get_typed_data()
35
+
36
+
37
+ def list_users(ctx: Optional[dict], req: models.ListUsersReq) -> models.ListUsersData:
38
+ """
39
+ GET /iam/v1alpha1/ListUsers
40
+ Action: ListUsers
41
+
42
+ Returns ListUsersData on success.
43
+
44
+ Raises YiCloudException on error.
45
+ """
46
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListUsers"
47
+ rsp = msgs.Rsp[models.ListUsersData]()
48
+ client.base.get(ctx, path, req, rsp)
49
+ return rsp.get_typed_data()
50
+
51
+
52
+ def delete_user(ctx: Optional[dict], req: models.DeleteUserReq) -> None:
53
+ """
54
+ POST /iam/v1alpha1/DeleteUser
55
+ Action: DeleteUser
56
+
57
+ Raises YiCloudException on error.
58
+ """
59
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteUser"
60
+ rsp = msgs.Rsp[None].empty()
61
+ client.base.post(ctx, path, req.__dict__, rsp)
62
+
63
+
64
+ def create_access_key(ctx: Optional[dict], req: models.CreateAccessKeyReq) -> models.AccessKeyData:
65
+ """
66
+ POST /iam/v1alpha1/CreateAccessKey
67
+ Action: CreateAccessKey
68
+
69
+ Returns AccessKeyData on success.
70
+
71
+ Raises YiCloudException on error.
72
+ """
73
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateAccessKey"
74
+ rsp = msgs.Rsp[models.AccessKeyData]()
75
+ client.base.post(ctx, path, req.__dict__, rsp)
76
+ return rsp.get_typed_data()
77
+
78
+
79
+ def delete_access_key(ctx: Optional[dict], req: models.DeleteAccessKeyReq) -> None:
80
+ """
81
+ POST /iam/v1alpha1/DeleteAccessKey
82
+ Action: DeleteAccessKey
83
+
84
+ Raises YiCloudException on error.
85
+ """
86
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteAccessKey"
87
+ rsp = msgs.Rsp[None].empty()
88
+ client.base.post(ctx, path, req.__dict__, rsp)
89
+
90
+
91
+ def update_access_key(ctx: Optional[dict], req: models.UpdateAccessKeyReq) -> None:
92
+ """
93
+ POST /iam/v1alpha1/UpdateAccessKey
94
+ Action: UpdateAccessKey
95
+
96
+ Raises YiCloudException on error.
97
+ """
98
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/UpdateAccessKey"
99
+ rsp = msgs.Rsp[None].empty()
100
+ client.base.post(ctx, path, req.__dict__, rsp)
101
+
102
+
103
+ def get_access_key(ctx: Optional[dict], req: models.GetAccessKeyReq) -> models.AccessKeyData:
104
+ """
105
+ GET /iam/v1alpha1/GetAccessKey
106
+ Action: GetAccessKey
107
+
108
+ Returns AccessKeyData on success.
109
+
110
+ Raises YiCloudException on error.
111
+ """
112
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetAccessKey"
113
+ rsp = msgs.Rsp[models.AccessKeyData]()
114
+ client.base.get(ctx, path, req, rsp)
115
+ return rsp.get_typed_data()
116
+
117
+
118
+ def list_access_keys(ctx: Optional[dict], req: models.ListAccessKeysReq) -> models.ListAccessKeyData:
119
+ """
120
+ GET /iam/v1alpha1/ListAccessKeys
121
+ Action: ListAccessKeys
122
+
123
+ Returns ListAccessKeyData on success.
124
+
125
+ Raises YiCloudException on error.
126
+ """
127
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListAccessKeys"
128
+ rsp = msgs.Rsp[models.ListAccessKeyData]()
129
+ client.base.get(ctx, path, req, rsp)
130
+ return rsp.get_typed_data()
131
+
132
+
133
+ def set_access_key_policy(ctx: Optional[dict], req: models.SetAccessKeyPolicyReq) -> None:
134
+ """
135
+ POST /iam/v1alpha1/SetAccessKeyPolicy
136
+ Action: SetAccessKeyPolicy
137
+
138
+ Raises YiCloudException on error.
139
+ """
140
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/SetAccessKeyPolicy"
141
+ rsp = msgs.Rsp[None].empty()
142
+ client.base.post(ctx, path, req.__dict__, rsp)
143
+
144
+
145
+ def get_access_key_policy(ctx: Optional[dict], req: models.GetAccessKeyPolicyReq) -> models.AccessKeyPolicyData:
146
+ """
147
+ GET /iam/v1alpha1/GetAccessKeyPolicy
148
+ Action: GetAccessKeyPolicy
149
+
150
+ Returns AccessKeyPolicyData on success.
151
+
152
+ Raises YiCloudException on error.
153
+ """
154
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetAccessKeyPolicy"
155
+ rsp = msgs.Rsp[models.AccessKeyPolicyData]()
156
+ client.base.get(ctx, path, req, rsp)
157
+ return rsp.get_typed_data()
158
+
159
+
160
+ def create_project(ctx: Optional[dict], req: models.CreateProjectReq) -> None:
161
+ """
162
+ POST /iam/v1alpha1/CreateProject
163
+ Action: CreateProject
164
+
165
+ Raises YiCloudException on error.
166
+ """
167
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateProject"
168
+ rsp = msgs.Rsp[None].empty()
169
+ client.base.post(ctx, path, req.__dict__, rsp)
170
+
171
+
172
+ def delete_project(ctx: Optional[dict], req: models.DeleteProjectReq) -> None:
173
+ """
174
+ POST /iam/v1alpha1/DeleteProject
175
+ Action: DeleteProject
176
+
177
+ Raises YiCloudException on error.
178
+ """
179
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteProject"
180
+ rsp = msgs.Rsp[None].empty()
181
+ client.base.post(ctx, path, req.__dict__, rsp)
182
+
183
+
184
+ def get_project(ctx: Optional[dict], req: models.GetProjectReq) -> models.ProjectData:
185
+ """
186
+ GET /iam/v1alpha1/GetProject
187
+ Action: GetProject
188
+
189
+ Returns ProjectData on success.
190
+
191
+ Raises YiCloudException on error.
192
+ """
193
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetProject"
194
+ rsp = msgs.Rsp[models.ProjectData]()
195
+ client.base.get(ctx, path, req, rsp)
196
+ return rsp.get_typed_data()
197
+
198
+
199
+ def list_projects(ctx: Optional[dict], req: models.ListProjectsReq) -> models.ListProjectsData:
200
+ """
201
+ GET /iam/v1alpha1/ListProjects
202
+ Action: ListProjects
203
+
204
+ Returns ListProjectsData on success.
205
+
206
+ Raises YiCloudException on error.
207
+ """
208
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListProjects"
209
+ rsp = msgs.Rsp[models.ListProjectsData]()
210
+ client.base.get(ctx, path, req, rsp)
211
+ return rsp.get_typed_data()
212
+
213
+
214
+ def bind_project_user(ctx: Optional[dict], req: models.BindProjectUserReq) -> None:
215
+ """
216
+ POST /iam/v1alpha1/BindProjectUser
217
+ Action: BindProjectUser
218
+
219
+ Raises YiCloudException on error.
220
+ """
221
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/BindProjectUser"
222
+ rsp = msgs.Rsp[None].empty()
223
+ client.base.post(ctx, path, req.__dict__, rsp)
224
+
225
+
226
+ def remove_project_user(ctx: Optional[dict], req: models.RemoveProjectUserReq) -> None:
227
+ """
228
+ POST /iam/v1alpha1/RemoveProjectUser
229
+ Action: RemoveProjectUser
230
+
231
+ Raises YiCloudException on error.
232
+ """
233
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/RemoveProjectUser"
234
+ rsp = msgs.Rsp[None].empty()
235
+ client.base.post(ctx, path, req.__dict__, rsp)
236
+
237
+
238
+ def list_project_users(ctx: Optional[dict], req: models.ListProjectUsersReq) -> models.ListProjectUsersData:
239
+ """
240
+ GET /iam/v1alpha1/ListProjectUsers
241
+ Action: ListProjectUsers
242
+
243
+ Returns ListProjectUsersData on success.
244
+
245
+ Raises YiCloudException on error.
246
+ """
247
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListProjectUsers"
248
+ rsp = msgs.Rsp[models.ListProjectUsersData]()
249
+ client.base.get(ctx, path, req, rsp)
250
+ return rsp.get_typed_data()
251
+
252
+
253
+ def create_quota_group(ctx: Optional[dict], req: models.CreateQuotaGroupReq) -> None:
254
+ """
255
+ POST /iam/v1alpha1/CreateQuotaGroup
256
+ Action: CreateQuotaGroup
257
+
258
+ Raises YiCloudException on error.
259
+ """
260
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/CreateQuotaGroup"
261
+ rsp = msgs.Rsp[None].empty()
262
+ client.base.post(ctx, path, req.__dict__, rsp)
263
+
264
+
265
+ def delete_quota_group(ctx: Optional[dict], req: models.DeleteQuotaGroupReq) -> None:
266
+ """
267
+ POST /iam/v1alpha1/DeleteQuotaGroup
268
+ Action: DeleteQuotaGroup
269
+
270
+ Raises YiCloudException on error.
271
+ """
272
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/DeleteQuotaGroup"
273
+ rsp = msgs.Rsp[None].empty()
274
+ client.base.post(ctx, path, req.__dict__, rsp)
275
+
276
+
277
+ def get_quota_group(ctx: Optional[dict], req: models.GetQuotaGroupReq) -> models.QuotaGroupData:
278
+ """
279
+ GET /iam/v1alpha1/GetQuotaGroup
280
+ Action: GetQuotaGroup
281
+
282
+ Returns QuotaGroupData on success.
283
+
284
+ Raises YiCloudException on error.
285
+ """
286
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/GetQuotaGroup"
287
+ rsp = msgs.Rsp[models.QuotaGroupData]()
288
+ client.base.get(ctx, path, req, rsp)
289
+ return rsp.get_typed_data()
290
+
291
+
292
+ def list_quota_groups(ctx: Optional[dict], req: models.ListQuotaGroupsReq) -> models.ListQuotaGroupData:
293
+ """
294
+ GET /iam/v1alpha1/ListQuotaGroups
295
+ Action: ListQuotaGroups
296
+
297
+ Returns ListQuotaGroupData on success.
298
+
299
+ Raises YiCloudException on error.
300
+ """
301
+ path = f"/{_PRODUCT_CODE}/{_LAST_VERSION}/ListQuotaGroups"
302
+ rsp = msgs.Rsp[models.ListQuotaGroupData]()
303
+ client.base.get(ctx, path, req, rsp)
304
+ return rsp.get_typed_data()
@@ -0,0 +1,19 @@
1
+ from yicloud.base import Client
2
+
3
+
4
+ class IAMClient:
5
+ """IAM service client, matching Go SDK's services/iam/client.go."""
6
+
7
+ def __init__(self, base_client: Client = None):
8
+ self.base = base_client
9
+ self.product_code = "iam"
10
+ self.last_version = "v1alpha1"
11
+
12
+
13
+ # Singleton matching Go SDK
14
+ client: IAMClient = IAMClient()
15
+
16
+
17
+ def use_client(cli: Client) -> None:
18
+ """Set the base client for IAM service."""
19
+ client.base = cli