|
| 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.cube.schemas import apis |
| 8 | + |
| 9 | + |
| 10 | +class CubeClient(Client): |
| 11 | + def __init__( |
| 12 | + self, config: dict, transport=None, middleware=None, logger=None |
| 13 | + ): |
| 14 | + super(CubeClient, self).__init__(config, transport, middleware, logger) |
| 15 | + |
| 16 | + def create_cube_pod( |
| 17 | + self, req: typing.Optional[dict] = None, **kwargs |
| 18 | + ) -> dict: |
| 19 | + """CreateCubePod - 创建Pod |
| 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 | + - **Pod** (str) - (Required) base64编码的Pod的yaml |
| 26 | + - **SubnetId** (str) - (Required) 子网Id |
| 27 | + - **VPCId** (str) - (Required) VPCId |
| 28 | + - **Zone** (str) - (Required) 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 29 | + - **ChargeType** (str) - 计费模式。枚举值为: \\ > Year,按年付费; \\ > Month,按月付费;\\ > Postpay, \\ 后付费;默认为后付费 |
| 30 | + - **CpuPlatform** (str) - Cpu平台(V6、A2),默认V6 |
| 31 | + - **Group** (str) - pod所在组 |
| 32 | + - **Name** (str) - pod的名字 |
| 33 | + - **Quantity** (int) - 购买时长。默认:值 1。 月付时,此参数传0,代表购买至月末。 |
| 34 | + - **Tag** (str) - 业务组。默认:Default(Default即为未分组) |
| 35 | +
|
| 36 | + **Response** |
| 37 | +
|
| 38 | + - **Action** (str) - 操作名称 |
| 39 | + - **CubeId** (str) - cube的资源Id |
| 40 | + - **Pod** (str) - base64编码的yaml |
| 41 | + - **RetCode** (int) - 返回码 |
| 42 | +
|
| 43 | + """ |
| 44 | + # build request |
| 45 | + d = { |
| 46 | + "ProjectId": self.config.project_id, |
| 47 | + "Region": self.config.region, |
| 48 | + } |
| 49 | + req and d.update(req) |
| 50 | + d = apis.CreateCubePodRequestSchema().dumps(d) |
| 51 | + |
| 52 | + # build options |
| 53 | + kwargs["max_retries"] = 0 # ignore retry when api is not idempotent |
| 54 | + |
| 55 | + resp = self.invoke("CreateCubePod", d, **kwargs) |
| 56 | + return apis.CreateCubePodResponseSchema().loads(resp) |
| 57 | + |
| 58 | + def delete_cube_pod( |
| 59 | + self, req: typing.Optional[dict] = None, **kwargs |
| 60 | + ) -> dict: |
| 61 | + """DeleteCubePod - 删除Pod |
| 62 | +
|
| 63 | + **Request** |
| 64 | +
|
| 65 | + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ |
| 66 | + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 67 | + - **CubeId** (str) - cubeid和uid任意一个(必须) |
| 68 | + - **ReleaseEIP** (bool) - 删除cube时是否释放绑定的EIP。默认为false。 |
| 69 | + - **Uid** (str) - cubeid和uid任意一个(必须) |
| 70 | + - **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 71 | +
|
| 72 | + **Response** |
| 73 | +
|
| 74 | +
|
| 75 | + """ |
| 76 | + # build request |
| 77 | + d = { |
| 78 | + "ProjectId": self.config.project_id, |
| 79 | + "Region": self.config.region, |
| 80 | + } |
| 81 | + req and d.update(req) |
| 82 | + d = apis.DeleteCubePodRequestSchema().dumps(d) |
| 83 | + |
| 84 | + resp = self.invoke("DeleteCubePod", d, **kwargs) |
| 85 | + return apis.DeleteCubePodResponseSchema().loads(resp) |
| 86 | + |
| 87 | + def get_cube_extend_info( |
| 88 | + self, req: typing.Optional[dict] = None, **kwargs |
| 89 | + ) -> dict: |
| 90 | + """GetCubeExtendInfo - 获取Cube的额外信息 |
| 91 | +
|
| 92 | + **Request** |
| 93 | +
|
| 94 | + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ |
| 95 | + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 96 | + - **CubeIds** (str) - (Required) id列表以逗号(,)分割 |
| 97 | + - **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 98 | +
|
| 99 | + **Response** |
| 100 | +
|
| 101 | + - **ExtendInfo** (list) - 见 **CubeExtendInfo** 模型定义 |
| 102 | +
|
| 103 | + **Response Model** |
| 104 | +
|
| 105 | + **EIPAddr** |
| 106 | +
|
| 107 | + - **IP** (str) - IP地址 |
| 108 | + - **OperatorName** (str) - 线路名称BGP或者internalation |
| 109 | +
|
| 110 | + **EIPSet** |
| 111 | +
|
| 112 | + - **Bandwidth** (int) - EIP带宽值 |
| 113 | + - **BandwidthType** (int) - 带宽类型0标准普通带宽,1表示共享带宽 |
| 114 | + - **CreateTime** (int) - EIP创建时间 |
| 115 | + - **EIPAddr** (list) - 见 **EIPAddr** 模型定义 |
| 116 | + - **EIPId** (str) - EIPId |
| 117 | + - **PayMode** (str) - 付费模式,带宽付费或者流量付费 |
| 118 | + - **Resource** (str) - EIP绑定对象的资源Id |
| 119 | + - **Status** (str) - EIP状态,表示使用中或者空闲 |
| 120 | + - **Weight** (int) - EIP权重 |
| 121 | +
|
| 122 | + **CubeExtendInfo** |
| 123 | +
|
| 124 | + - **CubeId** (str) - Cube的Id |
| 125 | + - **Eip** (list) - 见 **EIPSet** 模型定义 |
| 126 | + - **Expiration** (int) - 资源有效期 |
| 127 | + - **Name** (str) - Cube的名称 |
| 128 | + - **Tag** (str) - 业务组名称 |
| 129 | +
|
| 130 | + """ |
| 131 | + # build request |
| 132 | + d = { |
| 133 | + "ProjectId": self.config.project_id, |
| 134 | + "Region": self.config.region, |
| 135 | + } |
| 136 | + req and d.update(req) |
| 137 | + d = apis.GetCubeExtendInfoRequestSchema().dumps(d) |
| 138 | + |
| 139 | + resp = self.invoke("GetCubeExtendInfo", d, **kwargs) |
| 140 | + return apis.GetCubeExtendInfoResponseSchema().loads(resp) |
| 141 | + |
| 142 | + def get_cube_pod(self, req: typing.Optional[dict] = None, **kwargs) -> dict: |
| 143 | + """GetCubePod - 获取Pod的详细信息 |
| 144 | +
|
| 145 | + **Request** |
| 146 | +
|
| 147 | + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ |
| 148 | + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 149 | + - **CubeId** (str) - CubeId和Uid任意一个 |
| 150 | + - **Uid** (str) - CubeId和Uid任意一个 |
| 151 | + - **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 152 | +
|
| 153 | + **Response** |
| 154 | +
|
| 155 | + - **Pod** (str) - base64编码的pod的yaml |
| 156 | +
|
| 157 | + """ |
| 158 | + # build request |
| 159 | + d = { |
| 160 | + "ProjectId": self.config.project_id, |
| 161 | + "Region": self.config.region, |
| 162 | + } |
| 163 | + req and d.update(req) |
| 164 | + d = apis.GetCubePodRequestSchema().dumps(d) |
| 165 | + |
| 166 | + resp = self.invoke("GetCubePod", d, **kwargs) |
| 167 | + return apis.GetCubePodResponseSchema().loads(resp) |
| 168 | + |
| 169 | + def list_cube_pod( |
| 170 | + self, req: typing.Optional[dict] = None, **kwargs |
| 171 | + ) -> dict: |
| 172 | + """ListCubePod - 获取Pods列表 |
| 173 | +
|
| 174 | + **Request** |
| 175 | +
|
| 176 | + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ |
| 177 | + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 178 | + - **Group** (str) - 组名称 |
| 179 | + - **Limit** (int) - 默认20 |
| 180 | + - **Offset** (int) - 默认0 |
| 181 | + - **SubnetId** (str) - 子网Id |
| 182 | + - **VPCId** (str) - VPC的Id |
| 183 | + - **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 184 | +
|
| 185 | + **Response** |
| 186 | +
|
| 187 | + - **Pods** (list) - Pod列表,每条数据都做了base64编码 |
| 188 | + - **TotalCount** (int) - Cube的总数 |
| 189 | +
|
| 190 | + """ |
| 191 | + # build request |
| 192 | + d = { |
| 193 | + "ProjectId": self.config.project_id, |
| 194 | + "Region": self.config.region, |
| 195 | + } |
| 196 | + req and d.update(req) |
| 197 | + d = apis.ListCubePodRequestSchema().dumps(d) |
| 198 | + |
| 199 | + resp = self.invoke("ListCubePod", d, **kwargs) |
| 200 | + return apis.ListCubePodResponseSchema().loads(resp) |
| 201 | + |
| 202 | + def modify_cube_extend_info( |
| 203 | + self, req: typing.Optional[dict] = None, **kwargs |
| 204 | + ) -> dict: |
| 205 | + """ModifyCubeExtendInfo - 修改Cube额外信息 |
| 206 | +
|
| 207 | + **Request** |
| 208 | +
|
| 209 | + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ |
| 210 | + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 211 | + - **CubeId** (str) - (Required) cube的id |
| 212 | + - **Name** (str) - 修改的名字,规则(^[a-zA-Z0-9-_.\u4e00-\u9fa5]{1,32}) |
| 213 | + - **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 214 | +
|
| 215 | + **Response** |
| 216 | +
|
| 217 | +
|
| 218 | + """ |
| 219 | + # build request |
| 220 | + d = { |
| 221 | + "ProjectId": self.config.project_id, |
| 222 | + "Region": self.config.region, |
| 223 | + } |
| 224 | + req and d.update(req) |
| 225 | + d = apis.ModifyCubeExtendInfoRequestSchema().dumps(d) |
| 226 | + |
| 227 | + resp = self.invoke("ModifyCubeExtendInfo", d, **kwargs) |
| 228 | + return apis.ModifyCubeExtendInfoResponseSchema().loads(resp) |
| 229 | + |
| 230 | + def renew_cube_pod( |
| 231 | + self, req: typing.Optional[dict] = None, **kwargs |
| 232 | + ) -> dict: |
| 233 | + """RenewCubePod - 更新Pod |
| 234 | +
|
| 235 | + **Request** |
| 236 | +
|
| 237 | + - **ProjectId** (str) - (Config) 项目ID。不填写为默认项目,子帐号必须填写。 请参考 `GetProjectList接口 <https://docs.ucloud.cn/api/summary/get_project_list.html>`_ |
| 238 | + - **Region** (str) - (Config) 地域。 参见 `地域和可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 239 | + - **CubeId** (str) - (Required) 容器Id |
| 240 | + - **Pod** (str) - (Required) base64编码的Pod的yaml |
| 241 | + - **Zone** (str) - 可用区。参见 `可用区列表 <https://docs.ucloud.cn/api/summary/regionlist.html>`_ |
| 242 | +
|
| 243 | + **Response** |
| 244 | +
|
| 245 | + - **Pod** (str) - base64编码过的yaml,需要解码获取信息 |
| 246 | +
|
| 247 | + """ |
| 248 | + # build request |
| 249 | + d = { |
| 250 | + "ProjectId": self.config.project_id, |
| 251 | + "Region": self.config.region, |
| 252 | + } |
| 253 | + req and d.update(req) |
| 254 | + d = apis.RenewCubePodRequestSchema().dumps(d) |
| 255 | + |
| 256 | + resp = self.invoke("RenewCubePod", d, **kwargs) |
| 257 | + return apis.RenewCubePodResponseSchema().loads(resp) |
0 commit comments