Skip to content

Commit afa2c31

Browse files
author
caoshuqiang
committed
VPC-10675 【sdk】eip相关接口补齐
Change-Id: I9754a378d4a5e1505a55fe56bb347668134464e2
1 parent 2f98204 commit afa2c31

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

baidubce/services/eip/eip_client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ def create_eip(self, bandwidth_in_mbps, name=None, billing=None,
7474
"""
7575
body = {
7676
'name': name,
77-
'bandwidthInMbps': bandwidth_in_mbps,
78-
'routeType': route_type
77+
'bandwidthInMbps': bandwidth_in_mbps
7978
}
79+
if route_type is not None:
80+
body['routeType'] = route_type
8081
if billing is None:
8182
body['billing'] = {
8283
'paymentTiming': 'Postpaid',
@@ -281,9 +282,10 @@ def bind_eip(self, eip, instance_type, instance_id, instance_ip, client_token=No
281282
"""
282283
body = {
283284
'instanceType': instance_type,
284-
'instanceId': instance_id,
285-
'instanceIp': instance_ip
285+
'instanceId': instance_id
286286
}
287+
if instance_ip is not None:
288+
body['instanceIp'] = instance_ip
287289
path = utils.append_uri(self._get_path(), eip)
288290
if client_token is None:
289291
client_token = self._generate_default_client_token()

baidubce/services/eip/eip_group_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ def create_eip_group(self, eip_count, bandwidth_in_mbps,
130130
body = {
131131
'eipCount': eip_count,
132132
'bandwidthInMbps': bandwidth_in_mbps,
133-
'billing': billing.__dict__,
134-
"routeType": route_type
133+
'billing': billing.__dict__
135134
}
135+
if route_type is not None:
136+
body['routeType'] = route_type
136137
if name is not None:
137138
body['name'] = name
138139
return self._send_request(http_methods.POST,

0 commit comments

Comments
 (0)