diff --git a/ucloud/services/unet/client.py b/ucloud/services/unet/client.py index c029bce5..69b02052 100644 --- a/ucloud/services/unet/client.py +++ b/ucloud/services/unet/client.py @@ -96,6 +96,51 @@ def allocate_share_bandwidth( resp = self.invoke("AllocateShareBandwidth", d, **kwargs) return apis.AllocateShareBandwidthResponseSchema().loads(resp) + def allocate_vip(self, req: typing.Optional[dict] = None, **kwargs) -> dict: + """AllocateVIP - + + **Request** + + - **ProjectId** (str) - (Config) + - **Region** (str) - (Config) + - **SubnetId** (str) - (Required) + - **VPCId** (str) - (Required) + - **BusinessId** (str) - + - **Count** (int) - + - **Ip** (str) - + - **Name** (str) - + - **Remark** (str) - + - **Tag** (str) - + - **Zone** (str) - + + **Response** + + - **DataSet** (list) - + - **VIPSet** (list) - 见 **VIPSet** 模型定义 + + **Response Model** + + **VIPSet** + - **VIP** (str) - + - **VIPId** (str) - + - **VPCId** (str) - + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.AllocateVIPRequestSchema().dumps(d) + + # build options + kwargs["max_retries"] = 0 # ignore retry when api is not idempotent + + resp = self.invoke("AllocateVIP", d, **kwargs) + return apis.AllocateVIPResponseSchema().loads(resp) + def associate_eip_with_share_bandwidth( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -575,6 +620,53 @@ def describe_share_bandwidth( resp = self.invoke("DescribeShareBandwidth", d, **kwargs) return apis.DescribeShareBandwidthResponseSchema().loads(resp) + def describe_vip(self, req: typing.Optional[dict] = None, **kwargs) -> dict: + """DescribeVIP - + + **Request** + + - **ProjectId** (str) - (Config) + - **Region** (str) - (Config) + - **BusinessId** (str) - + - **SubnetId** (str) - + - **Tag** (str) - + - **VPCId** (str) - + - **Zone** (str) - + + **Response** + + - **DataSet** (list) - + - **TotalCount** (int) - + - **VIPSet** (list) - 见 **VIPDetailSet** 模型定义 + + **Response Model** + + **VIPDetailSet** + - **CreateTime** (int) - + - **Name** (str) - + - **RealIp** (str) - + - **SubnetId** (str) - + - **VIP** (str) - + - **VIPId** (str) - + - **VPCId** (str) - + - **Zone** (str) - + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.DescribeVIPRequestSchema().dumps(d) + + # build options + kwargs["max_retries"] = 0 # ignore retry when api is not idempotent + + resp = self.invoke("DescribeVIP", d, **kwargs) + return apis.DescribeVIPResponseSchema().loads(resp) + def disassociate_eip_with_share_bandwidth( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: @@ -843,6 +935,34 @@ def release_share_bandwidth( resp = self.invoke("ReleaseShareBandwidth", d, **kwargs) return apis.ReleaseShareBandwidthResponseSchema().loads(resp) + def release_vip(self, req: typing.Optional[dict] = None, **kwargs) -> dict: + """ReleaseVIP - + + **Request** + + - **ProjectId** (str) - (Config) + - **Region** (str) - (Config) + - **VIPId** (str) - (Required) + - **Zone** (str) - + + **Response** + + + """ + # build request + d = { + "ProjectId": self.config.project_id, + "Region": self.config.region, + } + req and d.update(req) + d = apis.ReleaseVIPRequestSchema().dumps(d) + + # build options + kwargs["max_retries"] = 0 # ignore retry when api is not idempotent + + resp = self.invoke("ReleaseVIP", d, **kwargs) + return apis.ReleaseVIPResponseSchema().loads(resp) + def resize_share_bandwidth( self, req: typing.Optional[dict] = None, **kwargs ) -> dict: diff --git a/ucloud/services/unet/schemas/apis.py b/ucloud/services/unet/schemas/apis.py index 636dc2c7..321f0556 100644 --- a/ucloud/services/unet/schemas/apis.py +++ b/ucloud/services/unet/schemas/apis.py @@ -85,6 +85,44 @@ class AllocateShareBandwidthResponseSchema(schema.ResponseSchema): } +""" +API: AllocateVIP + + +""" + + +class AllocateVIPRequestSchema(schema.RequestSchema): + """AllocateVIP -""" + + fields = { + "BusinessId": fields.Str(required=False, dump_to="BusinessId"), + "Count": fields.Int(required=False, dump_to="Count"), + "Ip": fields.Str(required=False, dump_to="Ip"), + "Name": fields.Str(required=False, dump_to="Name"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "Remark": fields.Str(required=False, dump_to="Remark"), + "SubnetId": fields.Str(required=True, dump_to="SubnetId"), + "Tag": fields.Str(required=False, dump_to="Tag"), + "VPCId": fields.Str(required=True, dump_to="VPCId"), + "Zone": fields.Str(required=False, dump_to="Zone"), + } + + +class AllocateVIPResponseSchema(schema.ResponseSchema): + """AllocateVIP -""" + + fields = { + "DataSet": fields.List( + fields.Str(), required=False, load_from="DataSet" + ), + "VIPSet": fields.List( + models.VIPSetSchema(), required=False, load_from="VIPSet" + ), + } + + """ API: AssociateEIPWithShareBandwidth @@ -436,6 +474,41 @@ class DescribeShareBandwidthResponseSchema(schema.ResponseSchema): } +""" +API: DescribeVIP + + +""" + + +class DescribeVIPRequestSchema(schema.RequestSchema): + """DescribeVIP -""" + + fields = { + "BusinessId": fields.Str(required=False, dump_to="BusinessId"), + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "SubnetId": fields.Str(required=False, dump_to="SubnetId"), + "Tag": fields.Str(required=False, dump_to="Tag"), + "VPCId": fields.Str(required=False, dump_to="VPCId"), + "Zone": fields.Str(required=False, dump_to="Zone"), + } + + +class DescribeVIPResponseSchema(schema.ResponseSchema): + """DescribeVIP -""" + + fields = { + "DataSet": fields.List( + fields.Str(), required=False, load_from="DataSet" + ), + "TotalCount": fields.Int(required=False, load_from="TotalCount"), + "VIPSet": fields.List( + models.VIPDetailSetSchema(), required=False, load_from="VIPSet" + ), + } + + """ API: DisassociateEIPWithShareBandwidth @@ -674,6 +747,30 @@ class ReleaseShareBandwidthResponseSchema(schema.ResponseSchema): fields = {} +""" +API: ReleaseVIP + + +""" + + +class ReleaseVIPRequestSchema(schema.RequestSchema): + """ReleaseVIP -""" + + fields = { + "ProjectId": fields.Str(required=False, dump_to="ProjectId"), + "Region": fields.Str(required=True, dump_to="Region"), + "VIPId": fields.Str(required=True, dump_to="VIPId"), + "Zone": fields.Str(required=False, dump_to="Zone"), + } + + +class ReleaseVIPResponseSchema(schema.ResponseSchema): + """ReleaseVIP -""" + + fields = {} + + """ API: ResizeShareBandwidth diff --git a/ucloud/services/unet/schemas/models.py b/ucloud/services/unet/schemas/models.py index 528a096f..988579fc 100644 --- a/ucloud/services/unet/schemas/models.py +++ b/ucloud/services/unet/schemas/models.py @@ -21,6 +21,16 @@ class UnetAllocateEIPSetSchema(schema.ResponseSchema): } +class VIPSetSchema(schema.ResponseSchema): + """VIPSet -""" + + fields = { + "VIP": fields.Str(required=False, load_from="VIP"), + "VIPId": fields.Str(required=False, load_from="VIPId"), + "VPCId": fields.Str(required=False, load_from="VPCId"), + } + + class EIPAddrSetSchema(schema.ResponseSchema): """EIPAddrSet - DescribeBandwidthPackage""" @@ -55,6 +65,22 @@ class UnetBandwidthUsageEIPSetSchema(schema.ResponseSchema): } +class ShareBandwidthSetSchema(schema.ResponseSchema): + """ShareBandwidthSet - DescribeEIP""" + + fields = { + "ShareBandwidth": fields.Int( + required=False, load_from="ShareBandwidth" + ), + "ShareBandwidthId": fields.Str( + required=False, load_from="ShareBandwidthId" + ), + "ShareBandwidthName": fields.Str( + required=False, load_from="ShareBandwidthName" + ), + } + + class UnetEIPResourceSetSchema(schema.ResponseSchema): """UnetEIPResourceSet - DescribeEIP""" @@ -76,22 +102,6 @@ class UnetEIPResourceSetSchema(schema.ResponseSchema): } -class ShareBandwidthSetSchema(schema.ResponseSchema): - """ShareBandwidthSet - DescribeEIP""" - - fields = { - "ShareBandwidth": fields.Int( - required=False, load_from="ShareBandwidth" - ), - "ShareBandwidthId": fields.Str( - required=False, load_from="ShareBandwidthId" - ), - "ShareBandwidthName": fields.Str( - required=False, load_from="ShareBandwidthName" - ), - } - - class UnetEIPSetSchema(schema.ResponseSchema): """UnetEIPSet - DescribeEIP""" @@ -194,6 +204,21 @@ class UnetShareBandwidthSetSchema(schema.ResponseSchema): } +class VIPDetailSetSchema(schema.ResponseSchema): + """VIPDetailSet -""" + + fields = { + "CreateTime": fields.Int(required=False, load_from="CreateTime"), + "Name": fields.Str(required=False, load_from="Name"), + "RealIp": fields.Str(required=False, load_from="RealIp"), + "SubnetId": fields.Str(required=False, load_from="SubnetId"), + "VIP": fields.Str(required=False, load_from="VIP"), + "VIPId": fields.Str(required=False, load_from="VIPId"), + "VPCId": fields.Str(required=False, load_from="VPCId"), + "Zone": fields.Str(required=False, load_from="Zone"), + } + + class EIPPayModeSetSchema(schema.ResponseSchema): """EIPPayModeSet - GetEIPPayModeEIP"""