bce-python-sdk 0.9.25__py3-none-any.whl → 0.9.29__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.
- baidubce/__init__.py +1 -1
- baidubce/http/bce_http_client.py +1 -1
- baidubce/services/bcc/bcc_client.py +83 -4
- baidubce/services/blb/app_blb_client.py +12 -0
- baidubce/services/blb/blb_client.py +14 -2
- baidubce/services/csn/csn_api.py +8 -0
- baidubce/services/csn/csn_client.py +55 -2
- baidubce/services/csn/csn_model.py +7 -1
- baidubce/services/eni/eni_client.py +7 -0
- baidubce/services/et/et_client.py +86 -0
- baidubce/services/localdns/api/ld_api.py +2 -0
- baidubce/services/localdns/ld_client.py +11 -1
- baidubce/services/route/route_client.py +5 -6
- baidubce/services/subnet/subnet_client.py +16 -2
- baidubce/services/vpc/peerconn_client.py +61 -2
- baidubce/services/vpc/template_client.py +640 -0
- baidubce/services/vpc/template_model.py +36 -0
- baidubce/services/vpc/vpc_client.py +61 -0
- baidubce/services/vpn/vpn_client.py +84 -4
- baidubce/services/vpn/vpn_model.py +1 -1
- {bce_python_sdk-0.9.25.dist-info → bce_python_sdk-0.9.29.dist-info}/METADATA +7 -2
- {bce_python_sdk-0.9.25.dist-info → bce_python_sdk-0.9.29.dist-info}/RECORD +24 -22
- {bce_python_sdk-0.9.25.dist-info → bce_python_sdk-0.9.29.dist-info}/WHEEL +1 -1
- {bce_python_sdk-0.9.25.dist-info → bce_python_sdk-0.9.29.dist-info}/top_level.txt +0 -0
baidubce/__init__.py
CHANGED
baidubce/http/bce_http_client.py
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
10
10
|
# either express or implied. See the License for the specific language governing permissions
|
|
11
11
|
# and limitations under the License.
|
|
12
|
-
|
|
12
|
+
# -*- coding: utf-8 -*-
|
|
13
13
|
"""
|
|
14
14
|
This module provide http request function for bce services.
|
|
15
15
|
"""
|
|
@@ -1083,7 +1083,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1083
1083
|
def list_instances(self, marker=None, max_keys=None, internal_ip=None, dedicated_host_id=None,
|
|
1084
1084
|
zone_name=None, instance_ids=None, instance_names=None, cds_ids=None, ehc_cluster_id=None,
|
|
1085
1085
|
deployset_ids=None, security_group_ids=None, payment_timing=None, status=None, tags=None,
|
|
1086
|
-
vpc_id=None, private_ips=None, ipv6_addresses=None, auto_renew=None,
|
|
1086
|
+
vpc_id=None, private_ips=None, ipv6_addresses=None, auto_renew=None, fuzzy_instance_name=None,
|
|
1087
|
+
config=None):
|
|
1087
1088
|
"""
|
|
1088
1089
|
Return a list of instances owned by the authenticated user.
|
|
1089
1090
|
|
|
@@ -1165,6 +1166,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1165
1166
|
:param auto_renew:
|
|
1166
1167
|
:type auto_renew: boolean
|
|
1167
1168
|
|
|
1169
|
+
:param fuzzy_instance_name:
|
|
1170
|
+
filter instance list with fuzzy instance name
|
|
1171
|
+
:type fuzzy_instance_name: string
|
|
1172
|
+
|
|
1168
1173
|
:return:
|
|
1169
1174
|
:rtype baidubce.bce_response.BceResponse
|
|
1170
1175
|
"""
|
|
@@ -1207,6 +1212,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1207
1212
|
params['ipv6Addresses'] = ipv6_addresses
|
|
1208
1213
|
if auto_renew is not None:
|
|
1209
1214
|
params['autoRenew'] = auto_renew
|
|
1215
|
+
if fuzzy_instance_name is not None:
|
|
1216
|
+
params['fuzzyInstanceName'] = fuzzy_instance_name
|
|
1210
1217
|
return self._send_request(http_methods.GET, path, params=params, config=config)
|
|
1211
1218
|
|
|
1212
1219
|
@required(instance_id=(bytes, str)) # ***Unicode***
|
|
@@ -1574,6 +1581,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1574
1581
|
memory_capacity_in_gb=int)
|
|
1575
1582
|
def resize_instance(self, instance_id, cpu_count, memory_capacity_in_gb,
|
|
1576
1583
|
live_resize=None, gpu_card_count=None, ephemeral_disk_in_gb=None,
|
|
1584
|
+
enable_jumbo_frame=None,
|
|
1577
1585
|
client_token=None, config=None):
|
|
1578
1586
|
"""
|
|
1579
1587
|
Resizing the instance owned by the user.
|
|
@@ -1595,6 +1603,18 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1595
1603
|
The parameter of specified the capacity of memory in GB to resize the instance.
|
|
1596
1604
|
:type memory_capacity_in_gb: int
|
|
1597
1605
|
|
|
1606
|
+
:param enable_jumbo_frame:
|
|
1607
|
+
The parameter of specified the instance enable/disable jumbo frame.
|
|
1608
|
+
True means enable jumbo frame, false means disable jumbo frame.
|
|
1609
|
+
enable_jumbo_frame default None which means:
|
|
1610
|
+
When you change to the spec which doesn't support jumbo frame, the jumbo frame will be disabled.
|
|
1611
|
+
When the original instance don't support jumbo frame and you change to the spec which support jumbo frame,
|
|
1612
|
+
the jumbo frame will be disabled.
|
|
1613
|
+
When the original spec of the instance support jumbo frame , then you change to the spec which support jumbo
|
|
1614
|
+
frame, if the original instance enable jumbo frame, the jumbo frame will be enabled, if the original instance
|
|
1615
|
+
disable jumbo frame, the jumbo frame will be disabled.
|
|
1616
|
+
:type enable_jumbo_frame: bool
|
|
1617
|
+
|
|
1598
1618
|
:param client_token:
|
|
1599
1619
|
An ASCII string whose length is less than 64.
|
|
1600
1620
|
The request will be idempotent if client token is provided.
|
|
@@ -1628,6 +1648,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1628
1648
|
body['gpuCardCount'] = gpu_card_count
|
|
1629
1649
|
if ephemeral_disk_in_gb is not None:
|
|
1630
1650
|
body['ephemeralDiskInGb'] = ephemeral_disk_in_gb
|
|
1651
|
+
if enable_jumbo_frame is not None:
|
|
1652
|
+
body['enableJumboFrame'] = enable_jumbo_frame
|
|
1631
1653
|
params = None
|
|
1632
1654
|
if client_token is None:
|
|
1633
1655
|
params = {
|
|
@@ -3344,6 +3366,22 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
3344
3366
|
path = b'/securityGroup/rule/%s' % security_group_rule_id
|
|
3345
3367
|
return self._send_request(http_methods.DELETE, path, params=None, config=config)
|
|
3346
3368
|
|
|
3369
|
+
@required(security_group_id=(bytes, str)) # ***Unicode***
|
|
3370
|
+
def get_security_group_detail(self, security_group_id, config=None):
|
|
3371
|
+
"""
|
|
3372
|
+
get a security group detail from the specified security group
|
|
3373
|
+
:param security_group_id:
|
|
3374
|
+
The id of security_group that will be deleted.
|
|
3375
|
+
:type security_group_id: string
|
|
3376
|
+
:param config:
|
|
3377
|
+
:type config: baidubce.BceClientConfiguration
|
|
3378
|
+
:return:
|
|
3379
|
+
:rtype baidubce.bce_response.BceResponse
|
|
3380
|
+
"""
|
|
3381
|
+
security_group_id = compat.convert_to_bytes(security_group_id)
|
|
3382
|
+
path = b'/securityGroup/%s' % security_group_id
|
|
3383
|
+
return self._send_request(http_methods.GET, path, params=None, config=config)
|
|
3384
|
+
|
|
3347
3385
|
def list_zones(self, config=None):
|
|
3348
3386
|
"""
|
|
3349
3387
|
Get zone detail list within current region
|
|
@@ -3912,6 +3950,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
3912
3950
|
is_open_ipv6=None, tags=None, key_pair_id=None, auto_renew_time_unit=None,
|
|
3913
3951
|
auto_renew_time=0, cds_auto_renew=None, asp_id=None, bid_model=None, bid_price=None,
|
|
3914
3952
|
dedicate_host_id=None, deploy_id=None, deploy_id_list=None, enable_jumbo_frame=None,
|
|
3953
|
+
cpu_thread_config=None, numa_config=None,
|
|
3915
3954
|
client_token=None, config=None):
|
|
3916
3955
|
"""
|
|
3917
3956
|
Create a bcc Instance with the specified options.
|
|
@@ -4115,6 +4154,14 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
4115
4154
|
True indicates enabled, false indicates disabled,
|
|
4116
4155
|
:type enable_jumbo_frame: bool
|
|
4117
4156
|
|
|
4157
|
+
:param cpu_thread_config:
|
|
4158
|
+
Manage hyper - threading, which is the same on both Intel and AMD platforms.
|
|
4159
|
+
:type cpu_thread_config: string
|
|
4160
|
+
|
|
4161
|
+
:param numa_config:
|
|
4162
|
+
Manage NPS on AMD platforms. Manage NUMA on Intel platforms.
|
|
4163
|
+
:type numa_config: string
|
|
4164
|
+
|
|
4118
4165
|
:return:
|
|
4119
4166
|
:rtype baidubce.bce_response.BceResponse
|
|
4120
4167
|
"""
|
|
@@ -4202,6 +4249,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
4202
4249
|
body['tags'] = tag_list
|
|
4203
4250
|
if enable_jumbo_frame is not None:
|
|
4204
4251
|
body['enableJumboFrame'] = enable_jumbo_frame
|
|
4252
|
+
if cpu_thread_config is not None:
|
|
4253
|
+
body['cpuThreadConfig'] = cpu_thread_config
|
|
4254
|
+
if numa_config is not None:
|
|
4255
|
+
body['numaConfig'] = numa_config
|
|
4205
4256
|
body['cdsAutoRenew'] = cds_auto_renew
|
|
4206
4257
|
|
|
4207
4258
|
return self._send_request(http_methods.POST, path, json.dumps(body),
|
|
@@ -4338,7 +4389,6 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
4338
4389
|
params['clientToken'] = generate_client_token()
|
|
4339
4390
|
else:
|
|
4340
4391
|
params['clientToken'] = client_token
|
|
4341
|
-
instance_id = compat.convert_to_bytes(instance_id)
|
|
4342
4392
|
path = b'/instance/delete'
|
|
4343
4393
|
body = {}
|
|
4344
4394
|
body['instanceId'] = instance_id
|
|
@@ -5382,7 +5432,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5382
5432
|
|
|
5383
5433
|
return self._send_request(http_methods.GET, path, params=params, config=config)
|
|
5384
5434
|
|
|
5385
|
-
def resize_instance_by_spec(self, instance_id, spec, client_token=None, config=None):
|
|
5435
|
+
def resize_instance_by_spec(self, instance_id, spec, enable_jumbo_frame=None, client_token=None, config=None):
|
|
5386
5436
|
"""
|
|
5387
5437
|
Resize instance by spec.
|
|
5388
5438
|
|
|
@@ -5394,6 +5444,18 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5394
5444
|
The name of spec.
|
|
5395
5445
|
:type spec: string
|
|
5396
5446
|
|
|
5447
|
+
:param enable_jumbo_frame:
|
|
5448
|
+
The parameter of specified the instance enable/disable jumbo frame.
|
|
5449
|
+
True means enable jumbo frame, false means disable jumbo frame.
|
|
5450
|
+
enable_jumbo_frame default None which means:
|
|
5451
|
+
When you change to the spec which doesn't support jumbo frame, the jumbo frame will be disabled.
|
|
5452
|
+
When the original instance don't support jumbo frame and you change to the spec which support jumbo frame,
|
|
5453
|
+
the jumbo frame will be disabled.
|
|
5454
|
+
When the original spec of the instance support jumbo frame , then you change to the spec which support jumbo
|
|
5455
|
+
frame, if the original instance enable jumbo frame, the jumbo frame will be enabled, if the original instance
|
|
5456
|
+
disable jumbo frame, the jumbo frame will be disabled.
|
|
5457
|
+
:type enable_jumbo_frame: bool
|
|
5458
|
+
|
|
5397
5459
|
:return:
|
|
5398
5460
|
:rtype baidubce.bce_response.BceResponse
|
|
5399
5461
|
"""
|
|
@@ -5409,6 +5471,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5409
5471
|
body = {
|
|
5410
5472
|
"spec": spec
|
|
5411
5473
|
}
|
|
5474
|
+
if enable_jumbo_frame is not None:
|
|
5475
|
+
body['enableJumboFrame'] = enable_jumbo_frame
|
|
5412
5476
|
|
|
5413
5477
|
return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
|
|
5414
5478
|
|
|
@@ -5873,7 +5937,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5873
5937
|
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
5874
5938
|
|
|
5875
5939
|
def batch_resize_instance(self, instance_ids, spec, subnet_id=None, logical_zone=None, internal_ip_v4=None,
|
|
5876
|
-
client_token=None, config=None):
|
|
5940
|
+
enable_jumbo_frame=None, client_token=None, config=None):
|
|
5877
5941
|
"""
|
|
5878
5942
|
batch resize instance
|
|
5879
5943
|
|
|
@@ -5897,6 +5961,18 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5897
5961
|
internal ip for ipv4
|
|
5898
5962
|
:type internal_ip_v4: string
|
|
5899
5963
|
|
|
5964
|
+
:param enable_jumbo_frame:
|
|
5965
|
+
The parameter of specified the instance enable/disable jumbo frame.
|
|
5966
|
+
True means enable jumbo frame, false means disable jumbo frame.
|
|
5967
|
+
enable_jumbo_frame default None which means:
|
|
5968
|
+
When you change to the spec which doesn't support jumbo frame, the jumbo frame will be disabled.
|
|
5969
|
+
When the original instance don't support jumbo frame and you change to the spec which support jumbo frame,
|
|
5970
|
+
the jumbo frame will be disabled.
|
|
5971
|
+
When the original spec of the instance support jumbo frame , then you change to the spec which support jumbo
|
|
5972
|
+
frame, if the original instance enable jumbo frame, the jumbo frame will be enabled, if the original instance
|
|
5973
|
+
disable jumbo frame, the jumbo frame will be disabled.
|
|
5974
|
+
:type enable_jumbo_frame: bool
|
|
5975
|
+
|
|
5900
5976
|
:return:
|
|
5901
5977
|
:rtype baidubce.bce_response.BceResponse
|
|
5902
5978
|
"""
|
|
@@ -5918,6 +5994,9 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5918
5994
|
body['logicalZone'] = logical_zone
|
|
5919
5995
|
if internal_ip_v4 is not None:
|
|
5920
5996
|
body['internalIpV4'] = internal_ip_v4
|
|
5997
|
+
if enable_jumbo_frame is not None:
|
|
5998
|
+
body['enableJumboFrame'] = enable_jumbo_frame
|
|
5999
|
+
|
|
5921
6000
|
return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
|
|
5922
6001
|
|
|
5923
6002
|
def list_available_resize_specs(self, instance_ids, spec=None, spec_id=None, logical_zone=None,
|
|
@@ -515,6 +515,7 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
515
515
|
ie6_compatible=None, encryption_type=None,
|
|
516
516
|
encryption_protocols=None,
|
|
517
517
|
dual_auth=None, client_certIds=None,
|
|
518
|
+
additional_cert_domains=None,
|
|
518
519
|
client_token=None, config=None):
|
|
519
520
|
"""
|
|
520
521
|
Create a app https listener rule with the specified options.
|
|
@@ -592,6 +593,9 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
592
593
|
If the clientToken is not specified by the user,
|
|
593
594
|
a random String generated by default algorithm will be used.
|
|
594
595
|
:type client_token: string
|
|
596
|
+
:param additional_cert_domains:
|
|
597
|
+
Additional domain,each element is an object that contains two attributes, namely "cert_id" and "host"
|
|
598
|
+
:type additional_cert_domains: list
|
|
595
599
|
:param config:
|
|
596
600
|
:type config: baidubce.BceClientConfiguration
|
|
597
601
|
:return
|
|
@@ -631,6 +635,8 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
631
635
|
body['dualAuth'] = dual_auth
|
|
632
636
|
if client_certIds is not None:
|
|
633
637
|
body['clientCertIds'] = client_certIds
|
|
638
|
+
if additional_cert_domains is not None:
|
|
639
|
+
body['additionalCertDomains'] = additional_cert_domains
|
|
634
640
|
return self._send_request(http_methods.POST, path,
|
|
635
641
|
body=json.dumps(body),
|
|
636
642
|
params=params, config=config)
|
|
@@ -946,6 +952,7 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
946
952
|
encryption_protocols=None,
|
|
947
953
|
dual_auth=None,
|
|
948
954
|
client_certIds=None,
|
|
955
|
+
additional_cert_domains=None,
|
|
949
956
|
client_token=None,
|
|
950
957
|
config=None):
|
|
951
958
|
"""
|
|
@@ -1020,6 +1027,9 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
1020
1027
|
:param client_certIds:
|
|
1021
1028
|
When dualAuth is true, the loaded client certificate chain
|
|
1022
1029
|
:type client_certIds: list
|
|
1030
|
+
:param additional_cert_domains:
|
|
1031
|
+
Additional domain name,each element is an object that contains two attributes, namely "cert_id" and "host"
|
|
1032
|
+
:type additional_cert_domains: list
|
|
1023
1033
|
:param client_token:
|
|
1024
1034
|
If the clientToken is not specified by the user,
|
|
1025
1035
|
a random String generated by default algorithm will be used.
|
|
@@ -1065,6 +1075,8 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
1065
1075
|
body['dualAuth'] = dual_auth
|
|
1066
1076
|
if client_certIds is not None:
|
|
1067
1077
|
body['clientCertIds'] = client_certIds
|
|
1078
|
+
if additional_cert_domains is not None:
|
|
1079
|
+
body['additionalCertDomains'] = additional_cert_domains
|
|
1068
1080
|
return self._send_request(http_methods.PUT, path,
|
|
1069
1081
|
body=json.dumps(body), params=params,
|
|
1070
1082
|
config=config)
|
|
@@ -829,6 +829,7 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
829
829
|
server_timeout=None, ie6_compatible=None,
|
|
830
830
|
encryption_type=None, encryption_protocols=None,
|
|
831
831
|
dual_auth=None, client_certIds=None,
|
|
832
|
+
additional_cert_domains=None,
|
|
832
833
|
client_token=None, config=None):
|
|
833
834
|
"""
|
|
834
835
|
Create a https listener rule with the specified options
|
|
@@ -943,6 +944,9 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
943
944
|
:param client_certIds:
|
|
944
945
|
When dualAuth is true, the loaded client certificate chain
|
|
945
946
|
:type client_certIds: list
|
|
947
|
+
:param additional_cert_domains:
|
|
948
|
+
Additional domain name,each element is an object that contains two attributes, namely "certId" and "host"
|
|
949
|
+
:type additional_cert_domains: list
|
|
946
950
|
:param client_token:
|
|
947
951
|
If the clientToken is not specified by the user,
|
|
948
952
|
a random String generated by default algorithm will be used.
|
|
@@ -1006,6 +1010,8 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
1006
1010
|
body['dualAuth'] = dual_auth
|
|
1007
1011
|
if client_certIds is not None:
|
|
1008
1012
|
body['clientCertIds'] = client_certIds
|
|
1013
|
+
if additional_cert_domains is not None:
|
|
1014
|
+
body['additionalCertDomains'] = additional_cert_domains
|
|
1009
1015
|
return self._send_request(http_methods.POST, path,
|
|
1010
1016
|
body=json.dumps(body),
|
|
1011
1017
|
params=params, config=config)
|
|
@@ -1771,8 +1777,8 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
1771
1777
|
unhealth_threshold=None, health_threshold=None,
|
|
1772
1778
|
health_check_normal_status=None,
|
|
1773
1779
|
server_timeout=None,
|
|
1774
|
-
cert_ids=None,
|
|
1775
|
-
config=None):
|
|
1780
|
+
cert_ids=None, additional_cert_domains=None,
|
|
1781
|
+
ie6_compatible=None, config=None):
|
|
1776
1782
|
"""
|
|
1777
1783
|
update a https listener rule with the specified options.
|
|
1778
1784
|
:param blb_id:
|
|
@@ -1860,6 +1866,9 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
1860
1866
|
The SSL certificate to be loaded by the listener.
|
|
1861
1867
|
Currently HTTPS listeners can only bind one SSL certificate.
|
|
1862
1868
|
:type cert_ids:List<String>
|
|
1869
|
+
:param: additional_cert_domains:
|
|
1870
|
+
Additional domain name,each element is an object that contains two attributes, namely "cert_id" and "host"
|
|
1871
|
+
:type additional_cert_domains: list
|
|
1863
1872
|
:param ie6_compatible:
|
|
1864
1873
|
Is it compatible with IE6 HTTPS request
|
|
1865
1874
|
(the protocol format is earlier SSL3.0, the security is poor)
|
|
@@ -1913,6 +1922,8 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
1913
1922
|
body['serverTimeout'] = server_timeout
|
|
1914
1923
|
if cert_ids is not None:
|
|
1915
1924
|
body['certIds'] = cert_ids
|
|
1925
|
+
if additional_cert_domains is not None:
|
|
1926
|
+
body['additionalCertDomains'] = additional_cert_domains
|
|
1916
1927
|
if ie6_compatible is not None:
|
|
1917
1928
|
body['ie6Compatible'] = ie6_compatible
|
|
1918
1929
|
return self._send_request(http_methods.PUT, path,
|
|
@@ -2550,6 +2561,7 @@ class BlbClient(bce_base_client.BceBaseClient):
|
|
|
2550
2561
|
return self._send_request(http_methods.GET, path, params=params,
|
|
2551
2562
|
config=config)
|
|
2552
2563
|
|
|
2564
|
+
|
|
2553
2565
|
def generate_client_token_by_uuid():
|
|
2554
2566
|
"""
|
|
2555
2567
|
The default method to generate the random string for client_token
|
baidubce/services/csn/csn_api.py
CHANGED
|
@@ -165,6 +165,14 @@ csn_apis = {
|
|
|
165
165
|
"headers": {
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
|
+
"get_csn_bp_price": {
|
|
169
|
+
"method": http_methods.POST,
|
|
170
|
+
"path": "/v1/csn/bp/price",
|
|
171
|
+
"queries":{
|
|
172
|
+
},
|
|
173
|
+
"headers":{
|
|
174
|
+
}
|
|
175
|
+
},
|
|
168
176
|
"list_association": {
|
|
169
177
|
"method": http_methods.GET,
|
|
170
178
|
"path": "/v1/csn/routeTable/[csnRtId]/association",
|
|
@@ -146,7 +146,7 @@ class CsnClient(bce_base_client.BceBaseClient):
|
|
|
146
146
|
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
147
147
|
api_config["queries"], json.dumps(body))
|
|
148
148
|
|
|
149
|
-
def create_csn(self, name, description=None, client_token=None):
|
|
149
|
+
def create_csn(self, name, description=None, tags=None, client_token=None):
|
|
150
150
|
"""
|
|
151
151
|
创建云智能网。
|
|
152
152
|
|
|
@@ -158,6 +158,10 @@ class CsnClient(bce_base_client.BceBaseClient):
|
|
|
158
158
|
:desc 云智能网的描述
|
|
159
159
|
:type description: str
|
|
160
160
|
|
|
161
|
+
:param tags:
|
|
162
|
+
:desc 云智能网的标签列表
|
|
163
|
+
:type tags: list[Tag]
|
|
164
|
+
|
|
161
165
|
:param client_token:
|
|
162
166
|
:desc 幂等性Token,是一个长度不超过64位的ASCII字符串,详见ClientToken幂等性
|
|
163
167
|
:type client_token: str
|
|
@@ -172,11 +176,14 @@ class CsnClient(bce_base_client.BceBaseClient):
|
|
|
172
176
|
'name': name,
|
|
173
177
|
'description': description,
|
|
174
178
|
}
|
|
179
|
+
if tags is not None:
|
|
180
|
+
tag_list = [tag.__dict__ for tag in tags]
|
|
181
|
+
body['tags'] = tag_list
|
|
175
182
|
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
176
183
|
api_config["queries"], json.dumps(body))
|
|
177
184
|
|
|
178
185
|
def create_csn_bp(self, name, bandwidth, geographic_a, geographic_b, billing,
|
|
179
|
-
interwork_type=None, client_token=None):
|
|
186
|
+
interwork_type=None, tags=None, client_token=None):
|
|
180
187
|
"""
|
|
181
188
|
创建云智能网共享带宽包。
|
|
182
189
|
|
|
@@ -204,6 +211,10 @@ class CsnClient(bce_base_client.BceBaseClient):
|
|
|
204
211
|
:desc 带宽包的计费信息
|
|
205
212
|
:type billing: Billing
|
|
206
213
|
|
|
214
|
+
:param tags:
|
|
215
|
+
:desc 带宽包的标签列表
|
|
216
|
+
:type tags: list[Tag]
|
|
217
|
+
|
|
207
218
|
:param client_token:
|
|
208
219
|
:desc 幂等性Token,是一个长度不超过64位的ASCII字符串
|
|
209
220
|
:type client_token: str
|
|
@@ -222,6 +233,9 @@ class CsnClient(bce_base_client.BceBaseClient):
|
|
|
222
233
|
'geographicB': geographic_b,
|
|
223
234
|
'billing': billing.__dict__,
|
|
224
235
|
}
|
|
236
|
+
if tags is not None:
|
|
237
|
+
tag_list = [tag.__dict__ for tag in tags]
|
|
238
|
+
body['tags'] = tag_list
|
|
225
239
|
|
|
226
240
|
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
227
241
|
api_config["queries"], json.dumps(body))
|
|
@@ -582,6 +596,45 @@ class CsnClient(bce_base_client.BceBaseClient):
|
|
|
582
596
|
|
|
583
597
|
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
584
598
|
api_config["queries"])
|
|
599
|
+
|
|
600
|
+
def get_csn_bp_price(self, name, geographic_a, geographic_b, billing, bandwidth=None):
|
|
601
|
+
"""
|
|
602
|
+
带宽包询价。
|
|
603
|
+
|
|
604
|
+
:param name:
|
|
605
|
+
:desc 带宽包名称
|
|
606
|
+
:type name: str
|
|
607
|
+
|
|
608
|
+
:param geographic_a:
|
|
609
|
+
:desc 网络实例所属的区域。取值 [ China | Asia-Pacific ],分别表示中国大陆、亚太区域
|
|
610
|
+
:type geographic_a: str
|
|
611
|
+
|
|
612
|
+
:param geographic_b:
|
|
613
|
+
:desc 另一个网络实例所属的区域。取值 [ China | Asia-Pacific ],分别表示中国大陆、亚太区域
|
|
614
|
+
:type geographic_b: str
|
|
615
|
+
|
|
616
|
+
:param billing:
|
|
617
|
+
:desc 计费信息
|
|
618
|
+
:type billing: Billing
|
|
619
|
+
|
|
620
|
+
:param bandwidth:
|
|
621
|
+
:desc 带宽包的带宽值,单位:Mbps,后付费按流量不需要该值
|
|
622
|
+
:type bandwidth: int
|
|
623
|
+
|
|
624
|
+
:return:
|
|
625
|
+
:rtype baidubce.bce_response.BceResponse
|
|
626
|
+
"""
|
|
627
|
+
api_config = self._get_config(csn_apis, "get_csn_bp_price")
|
|
628
|
+
body = {
|
|
629
|
+
'name': name,
|
|
630
|
+
'geographicA': geographic_a,
|
|
631
|
+
'geographicB': geographic_b,
|
|
632
|
+
'billing': billing.__dict__,
|
|
633
|
+
}
|
|
634
|
+
if bandwidth is not None:
|
|
635
|
+
body['bandwidth'] = bandwidth
|
|
636
|
+
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
637
|
+
api_config["queries"], json.dumps(body))
|
|
585
638
|
|
|
586
639
|
def list_association(self, csn_rt_id=None):
|
|
587
640
|
"""
|
|
@@ -19,7 +19,7 @@ class Billing(object):
|
|
|
19
19
|
billing information
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
def __init__(self, payment_timing=None, reservation_length=None, reservation_time_unit=None):
|
|
22
|
+
def __init__(self, payment_timing=None, reservation_length=None, reservation_time_unit=None, billing_method=None):
|
|
23
23
|
"""
|
|
24
24
|
:type payment_timing: string
|
|
25
25
|
:param payment_timing: The pay time of the payment
|
|
@@ -29,8 +29,14 @@ class Billing(object):
|
|
|
29
29
|
|
|
30
30
|
:type reservation_time_unit: string
|
|
31
31
|
:param reservation_time_unit: time unit of purchasing, default 'month'
|
|
32
|
+
|
|
33
|
+
:type billing_method: string
|
|
34
|
+
:param billing_method: The billing method of the payment, include ByTraffic, ByBandwidth,
|
|
35
|
+
PeakBandwidth_Percent_95, Enhanced_Percent_95
|
|
32
36
|
"""
|
|
33
37
|
self.paymentTiming = payment_timing
|
|
38
|
+
if billing_method:
|
|
39
|
+
self.billingMethod = billing_method
|
|
34
40
|
self.reservation = {
|
|
35
41
|
"reservationLength": reservation_length,
|
|
36
42
|
"reservationTimeUnit": reservation_time_unit
|
|
@@ -73,6 +73,7 @@ class EniClient(bce_base_client.BceBaseClient):
|
|
|
73
73
|
enterprise_security_group_ids=list, eni_ip_address_list=list, eni_ipv6_address_list=list)
|
|
74
74
|
def create_eni(self, name, subnet_id, security_group_ids=None, enterprise_security_group_ids=None,
|
|
75
75
|
eni_ip_address_list=None, eni_ipv6_address_list=None, description=None,
|
|
76
|
+
network_interface_traffic_mode=None,
|
|
76
77
|
client_token=None, config=None):
|
|
77
78
|
"""
|
|
78
79
|
:param name:
|
|
@@ -103,6 +104,10 @@ class EniClient(bce_base_client.BceBaseClient):
|
|
|
103
104
|
The description of the eni.
|
|
104
105
|
:type description: string
|
|
105
106
|
|
|
107
|
+
:param network_interface_traffic_mode:
|
|
108
|
+
The traffic mode of the eni.
|
|
109
|
+
:type network_interface_traffic_mode: string
|
|
110
|
+
|
|
106
111
|
:param client_token:
|
|
107
112
|
An ASCII string whose length is less than 64.
|
|
108
113
|
The request will be idempotent if clientToken is provided.
|
|
@@ -144,6 +149,8 @@ class EniClient(bce_base_client.BceBaseClient):
|
|
|
144
149
|
body['ipv6PrivateIpSet'] = pri_ipv6_set
|
|
145
150
|
if description is not None:
|
|
146
151
|
body['description'] = compat.convert_to_string(description)
|
|
152
|
+
if network_interface_traffic_mode is not None:
|
|
153
|
+
body['networkInterfaceTrafficMode'] = compat.convert_to_string(network_interface_traffic_mode)
|
|
147
154
|
|
|
148
155
|
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params,
|
|
149
156
|
config=config)
|
|
@@ -921,6 +921,92 @@ class EtClient(bce_base_client.BceBaseClient):
|
|
|
921
921
|
|
|
922
922
|
return self._send_request(http_methods.DELETE, path, params=params, config=config)
|
|
923
923
|
|
|
924
|
+
@required(et_id=(bytes, str), et_channel_id=(bytes, str), extra_channel_id=(bytes, str))
|
|
925
|
+
def associate_et_channel(self, et_id, et_channel_id, extra_channel_id, client_token=None, config=None):
|
|
926
|
+
"""
|
|
927
|
+
Associate et channel.
|
|
928
|
+
|
|
929
|
+
:param et_id:
|
|
930
|
+
et id
|
|
931
|
+
:type et_id: string
|
|
932
|
+
|
|
933
|
+
: param et_channel_id:
|
|
934
|
+
et channel id
|
|
935
|
+
:type et_channel_id: string
|
|
936
|
+
|
|
937
|
+
:param extra_channel_id:
|
|
938
|
+
extra channel id
|
|
939
|
+
:type extra_channel_id: string
|
|
940
|
+
|
|
941
|
+
:param client_token:
|
|
942
|
+
If the clientToken is not specified by the user, a random String
|
|
943
|
+
generated by default algorithm will be used.
|
|
944
|
+
:type client_token: string
|
|
945
|
+
|
|
946
|
+
:param config:
|
|
947
|
+
:type config: baidubce.BceClientConfiguration
|
|
948
|
+
|
|
949
|
+
:return:
|
|
950
|
+
:rtype baidubce.bce_response.BceResponse
|
|
951
|
+
|
|
952
|
+
"""
|
|
953
|
+
path = utils.append_uri(self.prefix, self.et, et_id, self.channel,
|
|
954
|
+
et_channel_id)
|
|
955
|
+
params = {b'associate': None}
|
|
956
|
+
if client_token is None:
|
|
957
|
+
params[b'clientToken'] = generate_client_token()
|
|
958
|
+
else:
|
|
959
|
+
params[b'clientToken'] = client_token
|
|
960
|
+
|
|
961
|
+
body = {
|
|
962
|
+
'extraChannelId': compat.convert_to_string(extra_channel_id),
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
return self._send_request(http_methods.PUT, path, params=params, body=json.dumps(body), config=config)
|
|
966
|
+
|
|
967
|
+
@required(et_id=(bytes, str), et_channel_id=(bytes, str), extra_channel_id=(bytes, str))
|
|
968
|
+
def disassociate_et_channel(self, et_id, et_channel_id, extra_channel_id, client_token=None, config=None):
|
|
969
|
+
"""
|
|
970
|
+
Disassociate et channel.
|
|
971
|
+
|
|
972
|
+
:param et_id:
|
|
973
|
+
et id
|
|
974
|
+
:type et_id: string
|
|
975
|
+
|
|
976
|
+
:param et_channel_id:
|
|
977
|
+
et channel id
|
|
978
|
+
:type et_channel_id: string
|
|
979
|
+
|
|
980
|
+
:param extra_channel_id:
|
|
981
|
+
extra channel id
|
|
982
|
+
:type extra_channel_id: string
|
|
983
|
+
|
|
984
|
+
:param client_token:
|
|
985
|
+
If the clientToken is not specified by the user, a random String
|
|
986
|
+
generated by default algorithm will be used.
|
|
987
|
+
:type client_token: string
|
|
988
|
+
|
|
989
|
+
:param config:
|
|
990
|
+
:type config: baidubce.BceClientConfiguration
|
|
991
|
+
|
|
992
|
+
:return:
|
|
993
|
+
:rtype baidubce.bce_response.BceResponse
|
|
994
|
+
|
|
995
|
+
"""
|
|
996
|
+
path = utils.append_uri(self.prefix, self.et, et_id, self.channel,
|
|
997
|
+
et_channel_id)
|
|
998
|
+
params = {b'disassociate': None}
|
|
999
|
+
if client_token is None:
|
|
1000
|
+
params[b'clientToken'] = generate_client_token()
|
|
1001
|
+
else:
|
|
1002
|
+
params[b'clientToken'] = client_token
|
|
1003
|
+
|
|
1004
|
+
body = {
|
|
1005
|
+
'extraChannelId': compat.convert_to_string(extra_channel_id),
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return self._send_request(http_methods.PUT, path, params=params, body=json.dumps(body), config=config)
|
|
1009
|
+
|
|
924
1010
|
|
|
925
1011
|
def generate_client_token_by_uuid():
|
|
926
1012
|
"""
|
|
@@ -244,7 +244,7 @@ class LdClient(bce_base_client.BceBaseClient):
|
|
|
244
244
|
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
245
245
|
api_config["queries"])
|
|
246
246
|
|
|
247
|
-
def list_record(self, zone_id=None):
|
|
247
|
+
def list_record(self, zone_id=None, marker=None, max_keys=None):
|
|
248
248
|
"""
|
|
249
249
|
|
|
250
250
|
|
|
@@ -252,12 +252,22 @@ class LdClient(bce_base_client.BceBaseClient):
|
|
|
252
252
|
:desc Zone的ID
|
|
253
253
|
:type zone_id: str
|
|
254
254
|
|
|
255
|
+
:param marker:
|
|
256
|
+
:desc 批量获取列表的查询的起始位置,是一个由系统生成的字符串
|
|
257
|
+
:type marker: str
|
|
258
|
+
|
|
259
|
+
:param max_keys:
|
|
260
|
+
:desc 每页包含的最大数量,最大数量通常不超过1000。缺省值为1000
|
|
261
|
+
:type max_keys: str
|
|
262
|
+
|
|
255
263
|
:return:
|
|
256
264
|
:rtype baidubce.bce_response.BceResponse
|
|
257
265
|
"""
|
|
258
266
|
|
|
259
267
|
api_config = self._get_config(ld_apis, "list_record")
|
|
260
268
|
self._add_path_param(api_config, "zoneId", zone_id)
|
|
269
|
+
self._add_query(api_config, "marker", marker)
|
|
270
|
+
self._add_query(api_config, "maxKeys", max_keys)
|
|
261
271
|
|
|
262
272
|
return self._send_request(api_config["method"], quote(api_config["path"]).encode("utf8"), api_config["headers"],
|
|
263
273
|
api_config["queries"])
|