bce-python-sdk 0.9.25__py3-none-any.whl → 0.9.35__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 CHANGED
@@ -18,7 +18,7 @@ from builtins import bytes
18
18
  from . import protocol
19
19
 
20
20
 
21
- SDK_VERSION = b'0.9.25'
21
+ SDK_VERSION = b'0.9.35'
22
22
  DEFAULT_SERVICE_DOMAIN = b'bcebos.com'
23
23
  URL_PREFIX = b'/v1'
24
24
  DEFAULT_ENCODING = 'UTF-8'
@@ -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, config=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 = {
@@ -1851,7 +1873,8 @@ class BccClient(bce_base_client.BceBaseClient):
1851
1873
  billing=None,
1852
1874
  related_renew_flag=None,
1853
1875
  client_token=None,
1854
- config=None):
1876
+ config=None,
1877
+ cds_custom_period=None):
1855
1878
  """
1856
1879
  PurchaseReserved the instance with fixed duration.
1857
1880
  You can not purchaseReserved the instance which is resizing.
@@ -1870,6 +1893,10 @@ class BccClient(bce_base_client.BceBaseClient):
1870
1893
  Detailed information see: https://cloud.baidu.com/doc/BCC/s/6jwvyo0q2#relatedrenewflag
1871
1894
  :type related_renew_flag: string
1872
1895
 
1896
+ :param cds_custom_period:
1897
+ Custom renew period for CDS.
1898
+ :type cds_custom_period: list
1899
+
1873
1900
  :param client_token:
1874
1901
  An ASCII string whose length is less than 64.
1875
1902
  The request will be idempotent if client token is provided.
@@ -1886,8 +1913,12 @@ class BccClient(bce_base_client.BceBaseClient):
1886
1913
  path = b'/instance/%s' % instance_id
1887
1914
  if billing is None:
1888
1915
  billing = default_billing_to_purchase_reserved
1916
+ cds_custom_period_list = []
1917
+ if cds_custom_period is not None:
1918
+ cds_custom_period_list = [custom_period.__dict__ for custom_period in cds_custom_period]
1889
1919
  body = {
1890
- 'billing': billing.__dict__
1920
+ 'billing': billing.__dict__,
1921
+ "cdsCustomPeriod": cds_custom_period_list
1891
1922
  }
1892
1923
  params = None
1893
1924
  if client_token is None:
@@ -2201,6 +2232,7 @@ class BccClient(bce_base_client.BceBaseClient):
2201
2232
 
2202
2233
  def list_volumes(self, instance_id=None, zone_name=None, marker=None, max_keys=None,
2203
2234
  cluster_id=None,
2235
+ volume_ids=None,
2204
2236
  config=None):
2205
2237
  """
2206
2238
  Listing volumes owned by the authenticated user.
@@ -2229,6 +2261,9 @@ class BccClient(bce_base_client.BceBaseClient):
2229
2261
  :param cluster_id:
2230
2262
  :type cluster_id: string
2231
2263
 
2264
+ :param volume_ids:
2265
+ :type volume_ids: string
2266
+
2232
2267
  :return:
2233
2268
  :rtype baidubce.bce_response.BceResponse
2234
2269
  """
@@ -2244,6 +2279,8 @@ class BccClient(bce_base_client.BceBaseClient):
2244
2279
  params['maxKeys'] = max_keys
2245
2280
  if cluster_id is not None:
2246
2281
  params['clusterId'] = cluster_id
2282
+ if volume_ids is not None:
2283
+ params['volumeIds'] = volume_ids
2247
2284
  return self._send_request(http_methods.GET, path, params=params, config=config)
2248
2285
 
2249
2286
  @required(volume_id=(bytes, str)) # ***Unicode***
@@ -2461,7 +2498,8 @@ class BccClient(bce_base_client.BceBaseClient):
2461
2498
  volume_id,
2462
2499
  billing=None,
2463
2500
  client_token=None,
2464
- config=None):
2501
+ config=None,
2502
+ instance_id=None):
2465
2503
  """
2466
2504
  PurchaseReserved the instance with fixed duration.
2467
2505
  You can not purchaseReserved the instance which is resizing.
@@ -2476,6 +2514,9 @@ class BccClient(bce_base_client.BceBaseClient):
2476
2514
  Billing information.
2477
2515
  :type billing: bcc_model.Billing
2478
2516
 
2517
+ :param instance_id:
2518
+ The id of instance to align renew duarion.
2519
+
2479
2520
  :param client_token:
2480
2521
  An ASCII string whose length is less than 64.
2481
2522
  The request will be idempotent if client token is provided.
@@ -2493,7 +2534,8 @@ class BccClient(bce_base_client.BceBaseClient):
2493
2534
  if billing is None:
2494
2535
  billing = default_billing_to_purchase_reserved
2495
2536
  body = {
2496
- 'billing': billing.__dict__
2537
+ 'billing': billing.__dict__,
2538
+ 'instanceId': instance_id
2497
2539
  }
2498
2540
  params = None
2499
2541
  if client_token is None:
@@ -2581,7 +2623,8 @@ class BccClient(bce_base_client.BceBaseClient):
2581
2623
  encrypt_key=None,
2582
2624
  relate_cds=False,
2583
2625
  client_token=None,
2584
- config=None):
2626
+ config=None,
2627
+ detection=None):
2585
2628
  """
2586
2629
  Creating a customized image which can be used for creating instance.
2587
2630
  You can create an image from an instance with this method.
@@ -2636,6 +2679,8 @@ class BccClient(bce_base_client.BceBaseClient):
2636
2679
  body['encryptKey'] = encrypt_key
2637
2680
  if relate_cds is not None:
2638
2681
  body['relateCds'] = relate_cds
2682
+ if detection:
2683
+ body['detection'] = detection
2639
2684
  return self._send_request(http_methods.POST, path, json.dumps(body),
2640
2685
  params=params, config=config)
2641
2686
 
@@ -2646,7 +2691,8 @@ class BccClient(bce_base_client.BceBaseClient):
2646
2691
  snapshot_id,
2647
2692
  encrypt_key=None,
2648
2693
  client_token=None,
2649
- config=None):
2694
+ config=None,
2695
+ detection=None):
2650
2696
  """
2651
2697
  Creating a customized image which can be used for creating instance.
2652
2698
  You can create an image from an snapshot with tihs method.
@@ -2693,6 +2739,8 @@ class BccClient(bce_base_client.BceBaseClient):
2693
2739
  }
2694
2740
  if encrypt_key is not None:
2695
2741
  body['encryptKey'] = encrypt_key
2742
+ if detection:
2743
+ body['detection'] = detection
2696
2744
  return self._send_request(http_methods.POST, path, json.dumps(body),
2697
2745
  params=params, config=config)
2698
2746
 
@@ -3344,6 +3392,22 @@ class BccClient(bce_base_client.BceBaseClient):
3344
3392
  path = b'/securityGroup/rule/%s' % security_group_rule_id
3345
3393
  return self._send_request(http_methods.DELETE, path, params=None, config=config)
3346
3394
 
3395
+ @required(security_group_id=(bytes, str)) # ***Unicode***
3396
+ def get_security_group_detail(self, security_group_id, config=None):
3397
+ """
3398
+ get a security group detail from the specified security group
3399
+ :param security_group_id:
3400
+ The id of security_group that will be deleted.
3401
+ :type security_group_id: string
3402
+ :param config:
3403
+ :type config: baidubce.BceClientConfiguration
3404
+ :return:
3405
+ :rtype baidubce.bce_response.BceResponse
3406
+ """
3407
+ security_group_id = compat.convert_to_bytes(security_group_id)
3408
+ path = b'/securityGroup/%s' % security_group_id
3409
+ return self._send_request(http_methods.GET, path, params=None, config=config)
3410
+
3347
3411
  def list_zones(self, config=None):
3348
3412
  """
3349
3413
  Get zone detail list within current region
@@ -3912,6 +3976,7 @@ class BccClient(bce_base_client.BceBaseClient):
3912
3976
  is_open_ipv6=None, tags=None, key_pair_id=None, auto_renew_time_unit=None,
3913
3977
  auto_renew_time=0, cds_auto_renew=None, asp_id=None, bid_model=None, bid_price=None,
3914
3978
  dedicate_host_id=None, deploy_id=None, deploy_id_list=None, enable_jumbo_frame=None,
3979
+ cpu_thread_config=None, numa_config=None, eni_ids=None,
3915
3980
  client_token=None, config=None):
3916
3981
  """
3917
3982
  Create a bcc Instance with the specified options.
@@ -4115,6 +4180,20 @@ class BccClient(bce_base_client.BceBaseClient):
4115
4180
  True indicates enabled, false indicates disabled,
4116
4181
  :type enable_jumbo_frame: bool
4117
4182
 
4183
+ :param cpu_thread_config:
4184
+ Manage hyper - threading, which is the same on both Intel and AMD platforms.
4185
+ :type cpu_thread_config: string
4186
+
4187
+ :param numa_config:
4188
+ Manage NPS on AMD platforms. Manage NUMA on Intel platforms.
4189
+ :type numa_config: string
4190
+
4191
+ :param eni_ids:
4192
+ The optional list of eni short ids to attach.
4193
+ The number of eniIds must be an integer multiple of the number of instances.
4194
+ The enis must in the same vpc and available zone with instance.
4195
+ :type eni_ids: list<string>
4196
+
4118
4197
  :return:
4119
4198
  :rtype baidubce.bce_response.BceResponse
4120
4199
  """
@@ -4202,6 +4281,12 @@ class BccClient(bce_base_client.BceBaseClient):
4202
4281
  body['tags'] = tag_list
4203
4282
  if enable_jumbo_frame is not None:
4204
4283
  body['enableJumboFrame'] = enable_jumbo_frame
4284
+ if cpu_thread_config is not None:
4285
+ body['cpuThreadConfig'] = cpu_thread_config
4286
+ if numa_config is not None:
4287
+ body['numaConfig'] = numa_config
4288
+ if eni_ids is not None:
4289
+ body['eniIds'] = eni_ids
4205
4290
  body['cdsAutoRenew'] = cds_auto_renew
4206
4291
 
4207
4292
  return self._send_request(http_methods.POST, path, json.dumps(body),
@@ -4338,7 +4423,6 @@ class BccClient(bce_base_client.BceBaseClient):
4338
4423
  params['clientToken'] = generate_client_token()
4339
4424
  else:
4340
4425
  params['clientToken'] = client_token
4341
- instance_id = compat.convert_to_bytes(instance_id)
4342
4426
  path = b'/instance/delete'
4343
4427
  body = {}
4344
4428
  body['instanceId'] = instance_id
@@ -5382,7 +5466,7 @@ class BccClient(bce_base_client.BceBaseClient):
5382
5466
 
5383
5467
  return self._send_request(http_methods.GET, path, params=params, config=config)
5384
5468
 
5385
- def resize_instance_by_spec(self, instance_id, spec, client_token=None, config=None):
5469
+ def resize_instance_by_spec(self, instance_id, spec, enable_jumbo_frame=None, client_token=None, config=None):
5386
5470
  """
5387
5471
  Resize instance by spec.
5388
5472
 
@@ -5394,6 +5478,18 @@ class BccClient(bce_base_client.BceBaseClient):
5394
5478
  The name of spec.
5395
5479
  :type spec: string
5396
5480
 
5481
+ :param enable_jumbo_frame:
5482
+ The parameter of specified the instance enable/disable jumbo frame.
5483
+ True means enable jumbo frame, false means disable jumbo frame.
5484
+ enable_jumbo_frame default None which means:
5485
+ When you change to the spec which doesn't support jumbo frame, the jumbo frame will be disabled.
5486
+ When the original instance don't support jumbo frame and you change to the spec which support jumbo frame,
5487
+ the jumbo frame will be disabled.
5488
+ When the original spec of the instance support jumbo frame , then you change to the spec which support jumbo
5489
+ frame, if the original instance enable jumbo frame, the jumbo frame will be enabled, if the original instance
5490
+ disable jumbo frame, the jumbo frame will be disabled.
5491
+ :type enable_jumbo_frame: bool
5492
+
5397
5493
  :return:
5398
5494
  :rtype baidubce.bce_response.BceResponse
5399
5495
  """
@@ -5409,6 +5505,8 @@ class BccClient(bce_base_client.BceBaseClient):
5409
5505
  body = {
5410
5506
  "spec": spec
5411
5507
  }
5508
+ if enable_jumbo_frame is not None:
5509
+ body['enableJumboFrame'] = enable_jumbo_frame
5412
5510
 
5413
5511
  return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
5414
5512
 
@@ -5873,7 +5971,7 @@ class BccClient(bce_base_client.BceBaseClient):
5873
5971
  return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
5874
5972
 
5875
5973
  def batch_resize_instance(self, instance_ids, spec, subnet_id=None, logical_zone=None, internal_ip_v4=None,
5876
- client_token=None, config=None):
5974
+ enable_jumbo_frame=None, client_token=None, config=None):
5877
5975
  """
5878
5976
  batch resize instance
5879
5977
 
@@ -5897,6 +5995,18 @@ class BccClient(bce_base_client.BceBaseClient):
5897
5995
  internal ip for ipv4
5898
5996
  :type internal_ip_v4: string
5899
5997
 
5998
+ :param enable_jumbo_frame:
5999
+ The parameter of specified the instance enable/disable jumbo frame.
6000
+ True means enable jumbo frame, false means disable jumbo frame.
6001
+ enable_jumbo_frame default None which means:
6002
+ When you change to the spec which doesn't support jumbo frame, the jumbo frame will be disabled.
6003
+ When the original instance don't support jumbo frame and you change to the spec which support jumbo frame,
6004
+ the jumbo frame will be disabled.
6005
+ When the original spec of the instance support jumbo frame , then you change to the spec which support jumbo
6006
+ frame, if the original instance enable jumbo frame, the jumbo frame will be enabled, if the original instance
6007
+ disable jumbo frame, the jumbo frame will be disabled.
6008
+ :type enable_jumbo_frame: bool
6009
+
5900
6010
  :return:
5901
6011
  :rtype baidubce.bce_response.BceResponse
5902
6012
  """
@@ -5918,6 +6028,9 @@ class BccClient(bce_base_client.BceBaseClient):
5918
6028
  body['logicalZone'] = logical_zone
5919
6029
  if internal_ip_v4 is not None:
5920
6030
  body['internalIpV4'] = internal_ip_v4
6031
+ if enable_jumbo_frame is not None:
6032
+ body['enableJumboFrame'] = enable_jumbo_frame
6033
+
5921
6034
  return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
5922
6035
 
5923
6036
  def list_available_resize_specs(self, instance_ids, spec=None, spec_id=None, logical_zone=None,
@@ -6208,7 +6321,8 @@ class BccClient(bce_base_client.BceBaseClient):
6208
6321
  }
6209
6322
  return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
6210
6323
 
6211
- def import_custom_image(self, os_name, os_arch, os_type, os_version, name, bos_url, client_token=None, config=None):
6324
+ def import_custom_image(self, os_name, os_arch, os_type, os_version, name, bos_url, client_token=None, config=None,
6325
+ detection=None, generation_type=None):
6212
6326
  """
6213
6327
  import_custom_image
6214
6328
 
@@ -6253,6 +6367,10 @@ class BccClient(bce_base_client.BceBaseClient):
6253
6367
  'name': name,
6254
6368
  'bosUrl': bos_url
6255
6369
  }
6370
+ if detection:
6371
+ body['detection'] = detection
6372
+ if generation_type is not None:
6373
+ body['generationType'] = generation_type
6256
6374
  return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
6257
6375
 
6258
6376
  def create_remote_copy_snapshot(self, snapshot_id, dest_region_infos, client_token=None, config=None):
@@ -6324,10 +6442,13 @@ class BccClient(bce_base_client.BceBaseClient):
6324
6442
 
6325
6443
  return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
6326
6444
 
6327
- def list_deploy_sets(self, client_token=None, config=None):
6445
+ def list_deploy_sets(self, client_token=None, config=None, deployment_set_ids=None):
6328
6446
  """
6329
6447
  list_deploy_sets
6330
6448
 
6449
+ :param deployment_set_ids:
6450
+ :type deployment_set_ids: string
6451
+
6331
6452
  :return:
6332
6453
  :rtype baidubce.bce_response.BceResponse
6333
6454
  """
@@ -6337,6 +6458,8 @@ class BccClient(bce_base_client.BceBaseClient):
6337
6458
  params['clientToken'] = generate_client_token()
6338
6459
  else:
6339
6460
  params['clientToken'] = client_token
6461
+ if deployment_set_ids is not None:
6462
+ params['deploymentSetIds'] = deployment_set_ids
6340
6463
  return self._send_request(http_methods.GET, path, params=params, config=config)
6341
6464
 
6342
6465
  def delete_deploy_set(self, deploy_set_id, client_token=None, config=None):
@@ -6794,6 +6917,145 @@ class BccClient(bce_base_client.BceBaseClient):
6794
6917
  return self._send_request(http_methods.POST, path, json.dumps(body),
6795
6918
  params=params, config=config)
6796
6919
 
6920
+ def enter_rescue_mode(self, instance_id, force_stop, password, client_token=None, config=None):
6921
+ """
6922
+ 进入救援模式。
6923
+
6924
+ :param enter_rescue_mode_req:
6925
+ :desc
6926
+ :type enter_rescue_mode_req: json
6927
+
6928
+ :return:
6929
+ :rtype baidubce.bce_response.BceResponse
6930
+ """
6931
+ path = b'/instance/rescue/mode/enter'
6932
+
6933
+ params = {}
6934
+
6935
+ if client_token is None:
6936
+ params['clientToken'] = generate_client_token()
6937
+ else:
6938
+ params['clientToken'] = client_token
6939
+
6940
+ body = {
6941
+ 'instanceId': instance_id,
6942
+ 'forceStop': force_stop,
6943
+ 'password': password
6944
+ }
6945
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
6946
+ params=params, config=config)
6947
+
6948
+ def exit_rescue_mode(self, instance_id, client_token=None, config=None):
6949
+ """
6950
+ 退出救援模式。
6951
+
6952
+ :param exit_rescue_mode_req:
6953
+ :desc
6954
+ :type exit_rescue_mode_req: json
6955
+
6956
+ :return:
6957
+ :rtype baidubce.bce_response.BceResponse
6958
+ """
6959
+ path = b'/instance/rescue/mode/exit'
6960
+
6961
+ params = {}
6962
+
6963
+ if client_token is None:
6964
+ params['clientToken'] = generate_client_token()
6965
+ else:
6966
+ params['clientToken'] = client_token
6967
+
6968
+ body = {
6969
+ 'instanceId': instance_id
6970
+ }
6971
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
6972
+ params=params, config=config)
6973
+
6974
+
6975
+ def bind_sg(self, instance_ids, security_group_ids, security_group_type, client_token=None, config=None):
6976
+ """
6977
+ 绑定安全组。
6978
+
6979
+ :param bind_sg:
6980
+ :desc
6981
+ :type bind_sg: json
6982
+ :return:
6983
+ :rtype baidubce.bce_response.BceResponse
6984
+ """
6985
+ path = b'/securitygroup/bind'
6986
+
6987
+ params = {}
6988
+
6989
+ if client_token is None:
6990
+ params['clientToken'] = generate_client_token()
6991
+ else:
6992
+ params['clientToken'] = client_token
6993
+
6994
+ body = {
6995
+ 'instanceIds': instance_ids,
6996
+ 'securityGroupIds': security_group_ids,
6997
+ 'securityGroupType': security_group_type
6998
+ }
6999
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
7000
+ params=params, config=config)
7001
+
7002
+
7003
+ def replace_sg(self, instance_ids, security_group_ids, security_group_type, client_token=None, config=None):
7004
+ """
7005
+ 替换安全组。
7006
+
7007
+ :param replace_sg:
7008
+ :desc
7009
+ :type replace_sg: json
7010
+
7011
+ :return:
7012
+ :rtype baidubce.bce_response.BceResponse
7013
+ """
7014
+ path = b'/securitygroup/replace'
7015
+
7016
+ params = {}
7017
+
7018
+ if client_token is None:
7019
+ params['clientToken'] = generate_client_token()
7020
+ else:
7021
+ params['clientToken'] = client_token
7022
+
7023
+ body = {
7024
+ 'instanceIds': instance_ids,
7025
+ 'securityGroupIds': security_group_ids,
7026
+ 'securityGroupType': security_group_type
7027
+ }
7028
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
7029
+ params=params, config=config)
7030
+
7031
+ def unbind_sg(self, instance_ids, security_group_ids, security_group_type, client_token=None, config=None):
7032
+ """
7033
+ 解绑安全组。
7034
+
7035
+ :param unbind_sg:
7036
+ :desc
7037
+ :type unbind_sg: json
7038
+
7039
+ :return:
7040
+ :rtype baidubce.bce_response.BceResponse
7041
+ """
7042
+ path = b'/securitygroup/unbind'
7043
+
7044
+ params = {}
7045
+
7046
+ if client_token is None:
7047
+ params['clientToken'] = generate_client_token()
7048
+ else:
7049
+ params['clientToken'] = client_token
7050
+
7051
+ body = {
7052
+ 'instanceIds': instance_ids,
7053
+ 'securityGroupIds': security_group_ids,
7054
+ 'securityGroupType': security_group_type
7055
+ }
7056
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
7057
+ params=params, config=config)
7058
+
6797
7059
 
6798
7060
  def generate_client_token_by_uuid():
6799
7061
  """
@@ -185,6 +185,16 @@ class ModifyReservedInstanceModel(object):
185
185
  self.ehcClusterId = ehcClusterId
186
186
 
187
187
 
188
+ class CdsCustomPeriod(object):
189
+ """
190
+ This class define custom period.
191
+ """
192
+
193
+ def __init__(self, period=None, volume_id=None):
194
+ self.period = period
195
+ self.volumeId = volume_id
196
+
197
+
188
198
  class FileSystemModel(object):
189
199
  """
190
200
  This class define file system.
@@ -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, ie6_compatible=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