bce-python-sdk 0.9.57__py3-none-any.whl → 0.9.60__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.57'
21
+ SDK_VERSION = b'0.9.60'
22
22
  DEFAULT_SERVICE_DOMAIN = b'bcebos.com'
23
23
  URL_PREFIX = b'/v1'
24
24
  DEFAULT_ENCODING = 'UTF-8'
@@ -237,9 +237,18 @@ def send_request(
237
237
  if http_method == b'GET' and 300 <= http_response.status < 400:
238
238
  headers_map = {k: v for k, v in headers_list}
239
239
  if 'location' in headers_map:
240
+ try:
241
+ http_response.read()
242
+ except Exception:
243
+ _logger.info("ignore read response body error")
244
+ try:
245
+ http_response.close()
246
+ except Exception:
247
+ _logger.info("ignore close response connection error")
240
248
  location = headers_map.get('location')
241
249
  _logger.debug('request auto follow redirect location is %s', location)
242
250
  parsed_url = urlparse(location)
251
+ redirect_conn = None
243
252
  if protocol.name == baidubce.protocol.HTTP.name:
244
253
  redirect_conn = http.client.HTTPConnection(parsed_url.netloc,
245
254
  timeout=config.connection_timeout_in_mills / 1000)
@@ -248,8 +257,10 @@ def send_request(
248
257
  timeout=config.connection_timeout_in_mills / 1000)
249
258
  else:
250
259
  raise ValueError('Invalid protocol: %s, either HTTP or HTTPS is expected.' % protocol)
251
- redirect_conn.request("GET", parsed_url.path + "?" + parsed_url.query,
260
+ redirect_conn.putrequest("GET", parsed_url.path + "?" + parsed_url.query,
252
261
  skip_host=True, skip_accept_encoding=True)
262
+ redirect_conn.putheader("Host", parsed_url.netloc)
263
+ redirect_conn.endheaders()
253
264
  http_response = redirect_conn.getresponse()
254
265
  for handler_function in response_handler_functions:
255
266
  if handler_function(http_response, response):
@@ -118,6 +118,16 @@ BOS_PROCESS = b"x-bce-process"
118
118
 
119
119
  BOS_BASE_ALLOW_HEADERS = set([BOS_TRAFFIC_LIMIT, BOS_VERSIONING, BOS_TAGGING, BOS_PROCESS, BOS_OBJECT_EXPIRES])
120
120
 
121
+ BOS_IF_MATCH = b"If-Match"
122
+
123
+ BOS_IF_NONE_MATCH = b"If-None-Match"
124
+
125
+ BOS_IF_MODIFIED_SINCE = b"If-Modified-Since"
126
+
127
+ BOS_IF_UNMODIFIED_SINCE = b"If-Unmodified-Since"
128
+
129
+ BOS_COND_READ_WRITE_HEADERS = set([BOS_IF_UNMODIFIED_SINCE, BOS_IF_MATCH, BOS_IF_NONE_MATCH])
130
+
121
131
  # BOS HTTP Headers END
122
132
 
123
133
  # STS HTTP Headers
@@ -41,7 +41,7 @@ class JobClient(AIHCBaseClient):
41
41
  参考文档:https://cloud.baidu.com/doc/AIHC/s/xmayvctia
42
42
 
43
43
  Args:
44
- resourcePoolId: 资源池唯一标识符(必填)
44
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
45
45
  queueID: 托管资源池需传入该参数,为队列Id(可选,Query参数)
46
46
  queue: 训练任务所属队列,通用资源池须填入队列名称,不填时返回所有。托管资源池须填入队列Id(可选,Body参数)
47
47
  status: 基于状态筛选任务(可选,Body参数)
@@ -105,7 +105,7 @@ class JobClient(AIHCBaseClient):
105
105
  参考文档:https://cloud.baidu.com/doc/AIHC/s/Kmayvejf0
106
106
 
107
107
  Args:
108
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
108
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
109
109
  queueID: 训练任务所属队列,自运维资源池须填入队列名称,托管资源池须填入队列Id(必填,Query参数)
110
110
  jobId: 任务ID(必填,Body参数)
111
111
  needDetail: 是否需要详细信息(可选)
@@ -137,8 +137,7 @@ class JobClient(AIHCBaseClient):
137
137
  参考文档:https://cloud.baidu.com/doc/AIHC/s/rmayvfzxj
138
138
 
139
139
  Args:
140
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
141
- resourcePoolId: string
140
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
142
141
  jobId: 训练任务ID(必填,Body参数)
143
142
  jobId: string
144
143
 
@@ -166,7 +165,7 @@ class JobClient(AIHCBaseClient):
166
165
  参考文档:https://cloud.baidu.com/doc/AIHC/s/Smayvhq0w
167
166
 
168
167
  Args:
169
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
168
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
170
169
  jobId: 训练任务ID(必填,Body参数)
171
170
  priority: 优先级(必填,Body参数),如 "normal"
172
171
 
@@ -201,7 +200,7 @@ class JobClient(AIHCBaseClient):
201
200
  参考文档:https://cloud.baidu.com/doc/AIHC/s/fmayvjaeq
202
201
 
203
202
  Args:
204
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
203
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
205
204
  jobId: 训练任务ID(必填,Body参数)
206
205
  startTime: 获取任务事件的起始时间(可选,Body参数)
207
206
  endTime: 获取任务事件的结束时间(可选,Body参数)
@@ -245,7 +244,7 @@ class JobClient(AIHCBaseClient):
245
244
  参考文档:https://cloud.baidu.com/doc/AIHC/s/Hmayvkw26
246
245
 
247
246
  Args:
248
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
247
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
249
248
  jobId: 训练任务ID(必填,Body参数)
250
249
  podName: Pod名称(必填,Body参数)
251
250
  keywords: 日志查询关键字(可选,Body参数)
@@ -306,7 +305,7 @@ class JobClient(AIHCBaseClient):
306
305
  参考文档:https://cloud.baidu.com/doc/AIHC/s/mmayvm8tb
307
306
 
308
307
  Args:
309
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
308
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
310
309
  jobId: 训练任务ID(必填,Body参数)
311
310
  podName: 训练任务节点名称(必填,Body参数)
312
311
  startTime: 事件起始时间,Unix时间格式(可选,Body参数)
@@ -347,7 +346,7 @@ class JobClient(AIHCBaseClient):
347
346
  参考文档:https://cloud.baidu.com/doc/AIHC/s/0mayvnkik
348
347
 
349
348
  Args:
350
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
349
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
351
350
  jobId: 训练任务ID(必填,Body参数)
352
351
 
353
352
  Returns:
@@ -379,7 +378,7 @@ class JobClient(AIHCBaseClient):
379
378
  参考文档:https://cloud.baidu.com/doc/AIHC/s/2mayvq994
380
379
 
381
380
  Args:
382
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
381
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
383
382
  jobId: 训练任务ID(必填,Body参数)
384
383
 
385
384
  Returns:
@@ -418,7 +417,7 @@ class JobClient(AIHCBaseClient):
418
417
  参考文档:https://cloud.baidu.com/doc/AIHC/s/9mayvri1t
419
418
 
420
419
  Args:
421
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
420
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
422
421
  jobId: 训练任务ID(必填,Body参数)
423
422
  podName: 训练任务节点名称(必填,Body参数)
424
423
  handshakeTimeoutSecond: 连接超时参数,单位秒(可选,Body参数)
@@ -475,7 +474,7 @@ class JobClient(AIHCBaseClient):
475
474
  参考文档:https://cloud.baidu.com/doc/AIHC/s/Hmayv96tj
476
475
 
477
476
  Args:
478
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
477
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
479
478
  queueID: 训练任务所属队列,通用资源池须填入队列名称,托管资源池须填入队列Id(必填,Query参数)
480
479
  name: 训练任务名称(必填,Body参数)
481
480
  command: 启动命令(必填,Body参数)
@@ -550,7 +549,7 @@ class JobClient(AIHCBaseClient):
550
549
  参考文档:https://cloud.baidu.com/doc/AIHC/s/fmayvjaeq
551
550
 
552
551
  Args:
553
- resourcePoolId: 资源池唯一标识符(必填,Query参数)
552
+ resourcePoolId: 注意区分资源池类型,自运维资源池传递资源池唯一标识(示例:cce-1uji3ib5),托管资源池固定传递 aihc-serverless(必填)
554
553
  jobId: 任务ID(必填,Body参数)
555
554
  metricType: 查询监控数据的指标类型(必填,Body参数)
556
555
  startTime: 开始时间,Unix时间格式(可选,Body参数)
@@ -587,4 +586,4 @@ class JobClient(AIHCBaseClient):
587
586
  path,
588
587
  body=json.dumps(body),
589
588
  params=params
590
- )
589
+ )
@@ -4058,7 +4058,7 @@ class BccClient(bce_base_client.BceBaseClient):
4058
4058
  hosteye_type=None, res_group_id=None, enable_ht=None, data_partition_type=None,
4059
4059
  root_partition_type=None, file_systems=None, disable_root_disk_serial=None,
4060
4060
  internal_ips=None, network_purchase_type=None, is_keep_image_login=None,
4061
- reserved_instance=None):
4061
+ reserved_instance=None, is_eip_auto_related_delete=None):
4062
4062
  """
4063
4063
  Create a bcc Instance with the specified options.
4064
4064
  You must fill the field of clientToken,which is especially for keeping idempotent.
@@ -4321,6 +4321,11 @@ class BccClient(bce_base_client.BceBaseClient):
4321
4321
  EIP line type, including Standard BGP (BGP) and Enhanced BGP (BGP_S).The default value is Standard BGP.
4322
4322
  :type network_purchase_type: string
4323
4323
 
4324
+ :param is_eip_auto_related_delete
4325
+ Whether to automatically delete the EIP associated with the instance after the instance is released.
4326
+ The default value is False.
4327
+ :type is_eip_auto_related_delete: boolean
4328
+
4324
4329
  :return:
4325
4330
  :rtype baidubce.bce_response.BceResponse
4326
4331
  """
@@ -4357,6 +4362,8 @@ class BccClient(bce_base_client.BceBaseClient):
4357
4362
  body['autoSeqSuffix'] = auto_seq_suffix
4358
4363
  if is_open_hostname_domain is not None:
4359
4364
  body['isOpenHostnameDomain'] = is_open_hostname_domain
4365
+ if is_eip_auto_related_delete is not None:
4366
+ body['isEipAutoRelatedDelete'] = is_eip_auto_related_delete
4360
4367
  if admin_pass is not None:
4361
4368
  secret_access_key = self.config.credentials.secret_access_key
4362
4369
  cipher_admin_pass = aes128_encrypt_16char_key(admin_pass, secret_access_key)
@@ -4450,7 +4457,8 @@ class BccClient(bce_base_client.BceBaseClient):
4450
4457
  params=params, config=config)
4451
4458
 
4452
4459
  @required(instance_id=(bytes, str))
4453
- def auto_release_instance(self, instance_id, release_time=None, client_token=None, config=None):
4460
+ def auto_release_instance(self, instance_id, release_time=None, client_token=None, config=None,
4461
+ is_eip_auto_related_delete=None):
4454
4462
  """
4455
4463
  set instance auto release.
4456
4464
 
@@ -4462,6 +4470,9 @@ class BccClient(bce_base_client.BceBaseClient):
4462
4470
  The new value for instance's name.
4463
4471
  :type release_time: string in format yyyy-MM-dd'T'HH:mm:ss'Z'.
4464
4472
 
4473
+ :param is_eip_auto_related_delete:
4474
+ Auto delete eip when instance is released.
4475
+
4465
4476
  :param client_token:
4466
4477
  An ASCII string whose length is less than 64.
4467
4478
  The request will be idempotent if client token is provided.
@@ -4485,7 +4496,8 @@ class BccClient(bce_base_client.BceBaseClient):
4485
4496
  # instance_id = instance_id.encode(encoding='utf-8')
4486
4497
  path = b'/instance/%s' % instance_id
4487
4498
  body = {
4488
- 'releaseTime': release_time
4499
+ 'releaseTime': release_time,
4500
+ 'isEipAutoRelatedDelete': is_eip_auto_related_delete
4489
4501
  }
4490
4502
  return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
4491
4503
 
@@ -64,7 +64,7 @@ class UploadTaskHandle:
64
64
  handle to control multi upload file with multi-thread
65
65
  """
66
66
  def __init__(self):
67
- self.cancel_flag= False
67
+ self.cancel_flag = False
68
68
  self.cancel_lock = threading.Lock()
69
69
 
70
70
  def cancel(self):
@@ -956,12 +956,16 @@ class BosClient(BceBaseClient):
956
956
  return True
957
957
 
958
958
  @required(bucket_name=(bytes, str), key=(bytes, str))
959
- def get_object(self, bucket_name, key, range=None, traffic_limit=None, version_id=None, config=None):
959
+ def get_object(self, bucket_name, key, range=None, traffic_limit=None, version_id=None,
960
+ cond_read_write=None, config=None):
960
961
  """
961
962
 
962
963
  :param bucket_name:
963
964
  :param key:
964
965
  :param range:
966
+ :param traffic_limit:
967
+ :param version_id:
968
+ :param cond_read_write:
965
969
  :param config:
966
970
  :return:
967
971
  """
@@ -973,10 +977,17 @@ class BosClient(BceBaseClient):
973
977
  if len(key) == 0 or key.startswith(b"/"):
974
978
  raise BceClientError("Key can not be empty or start with '/' .")
975
979
  range_header = BosClient._get_range_header_dict(range)
980
+
976
981
  if traffic_limit is not None:
977
982
  if range_header is None:
978
983
  range_header = {}
979
984
  range_header[http_headers.BOS_TRAFFIC_LIMIT] = traffic_limit
985
+
986
+ if cond_read_write is not None:
987
+ if range_header is None:
988
+ range_header = {}
989
+ range_header = self._get_cond_read_write_headers(http_methods.GET, range_header, cond_read_write)
990
+
980
991
  return self._send_request(
981
992
  http_methods.GET,
982
993
  bucket_name,
@@ -985,7 +996,8 @@ class BosClient(BceBaseClient):
985
996
  params=query_params,
986
997
  config=config,
987
998
  body_parser=BosClient._parse_bos_object)
988
- # restore object
999
+
1000
+ # restore object
989
1001
  @required(bucket_name=(bytes, str), key=(bytes, str))
990
1002
  def restore_object(self, bucket_name, key, days=None, tier="Standard", config=None):
991
1003
  """
@@ -1035,7 +1047,7 @@ class BosClient(BceBaseClient):
1035
1047
  return True
1036
1048
 
1037
1049
  @required(bucket_name=(bytes, str), key=(bytes, str))
1038
- def get_object_as_string(self, bucket_name, key, range=None, version_id=None, config=None):
1050
+ def get_object_as_string(self, bucket_name, key, range=None, version_id=None, cond_read_write=None, config=None):
1039
1051
  """
1040
1052
 
1041
1053
  :param bucket_name:
@@ -1045,14 +1057,15 @@ class BosClient(BceBaseClient):
1045
1057
  :return:
1046
1058
  """
1047
1059
  key = compat.convert_to_bytes(key)
1048
- response = self.get_object(bucket_name, key, range=range, version_id = version_id, config=config)
1060
+ response = self.get_object(bucket_name, key, range=range, version_id = version_id,
1061
+ cond_read_write = cond_read_write, config=config)
1049
1062
  s = response.data.read()
1050
1063
  response.data.close()
1051
1064
  return s
1052
1065
 
1053
1066
  @required(bucket_name=(bytes, str), key=(bytes, str), file_name=(bytes, str))
1054
1067
  def get_object_to_file(self, bucket_name, key, file_name, range=None, config=None,
1055
- progress_callback=None, traffic_limit=None, version_id=None):
1068
+ progress_callback=None, traffic_limit=None, cond_read_write=None, version_id=None):
1056
1069
  """
1057
1070
  Get Content of Object and Put Content to File
1058
1071
 
@@ -1084,6 +1097,11 @@ class BosClient(BceBaseClient):
1084
1097
  range_header = {}
1085
1098
  range_header[http_headers.BOS_TRAFFIC_LIMIT] = traffic_limit
1086
1099
 
1100
+ if cond_read_write is not None:
1101
+ if range_header is None:
1102
+ range_header = {}
1103
+ range_header = self._get_cond_read_write_headers(http_methods.GET, range_header, cond_read_write)
1104
+
1087
1105
  return self._send_request(
1088
1106
  http_methods.GET,
1089
1107
  bucket_name,
@@ -1100,7 +1118,7 @@ class BosClient(BceBaseClient):
1100
1118
 
1101
1119
 
1102
1120
  @required(bucket_name=(bytes, str), key=(bytes, str))
1103
- def get_object_meta_data(self, bucket_name, key, version_id=None, config=None):
1121
+ def get_object_meta_data(self, bucket_name, key, version_id=None, cond_read_write=None, config=None):
1104
1122
  """
1105
1123
  Get head of object
1106
1124
 
@@ -1116,9 +1134,14 @@ class BosClient(BceBaseClient):
1116
1134
  if version_id is not None:
1117
1135
  version_id = compat.convert_to_bytes(version_id)
1118
1136
  query_params={b'versionId': version_id}
1137
+
1138
+ headers = {}
1139
+ if cond_read_write is not None:
1140
+ headers = self._get_cond_read_write_headers(http_methods.HEAD, headers, cond_read_write)
1141
+
1119
1142
  key = compat.convert_to_bytes(key)
1120
1143
  return self._send_request(http_methods.HEAD, bucket_name, key,
1121
- params=query_params, config=config)
1144
+ headers=headers, params=query_params, config=config)
1122
1145
 
1123
1146
  @required(bucket_name=(bytes, str),
1124
1147
  key=(bytes, str),
@@ -1251,6 +1274,7 @@ class BosClient(BceBaseClient):
1251
1274
  progress_callback=None,
1252
1275
  traffic_limit=None,
1253
1276
  object_tagging=None,
1277
+ cond_read_write=None,
1254
1278
  config=None):
1255
1279
  """
1256
1280
  Put object and put content of file to the object
@@ -1283,6 +1307,9 @@ class BosClient(BceBaseClient):
1283
1307
  traffic_limit=traffic_limit,
1284
1308
  object_tagging=object_tagging,)
1285
1309
 
1310
+ if cond_read_write is not None:
1311
+ headers = self._get_cond_read_write_headers(http_methods.PUT, headers, cond_read_write)
1312
+
1286
1313
  buf_size = self._get_config_parameter(config, 'recv_buf_size')
1287
1314
 
1288
1315
  if content_length > bos.MAX_PUT_OBJECT_LENGTH:
@@ -1314,6 +1341,7 @@ class BosClient(BceBaseClient):
1314
1341
  progress_callback=None,
1315
1342
  traffic_limit=None,
1316
1343
  object_tagging=None,
1344
+ cond_read_write=None,
1317
1345
  config=None):
1318
1346
  """
1319
1347
  Create object and put content of string to the object
@@ -1356,6 +1384,7 @@ class BosClient(BceBaseClient):
1356
1384
  progress_callback = progress_callback,
1357
1385
  traffic_limit=traffic_limit,
1358
1386
  object_tagging=object_tagging,
1387
+ cond_read_write=cond_read_write,
1359
1388
  config=config)
1360
1389
  finally:
1361
1390
  if fp is not None:
@@ -1376,6 +1405,7 @@ class BosClient(BceBaseClient):
1376
1405
  progress_callback=None,
1377
1406
  traffic_limit=None,
1378
1407
  object_tagging=None,
1408
+ cond_read_write=None,
1379
1409
  config=None,
1380
1410
  ):
1381
1411
 
@@ -1423,6 +1453,7 @@ class BosClient(BceBaseClient):
1423
1453
  progress_callback=progress_callback,
1424
1454
  traffic_limit=traffic_limit,
1425
1455
  object_tagging=object_tagging,
1456
+ cond_read_write=cond_read_write,
1426
1457
  config=config)
1427
1458
  finally:
1428
1459
  fp.close()
@@ -1805,8 +1836,9 @@ class BosClient(BceBaseClient):
1805
1836
  part_list=list)
1806
1837
  def complete_multipart_upload(self, bucket_name, key,
1807
1838
  upload_id, part_list,
1808
- user_metadata=None,
1809
1839
  user_headers=None,
1840
+ user_metadata=None,
1841
+ cond_read_write=None,
1810
1842
  config=None):
1811
1843
  """
1812
1844
  After finish all the task, complete multi_upload_file.
@@ -1832,6 +1864,9 @@ class BosClient(BceBaseClient):
1832
1864
  user_metadata=user_metadata,
1833
1865
  user_headers=user_headers)
1834
1866
 
1867
+ if cond_read_write is not None:
1868
+ headers = self._get_cond_read_write_headers(http_methods.POST, headers, cond_read_write)
1869
+
1835
1870
  return self._send_request(
1836
1871
  http_methods.POST,
1837
1872
  bucket_name,
@@ -2011,6 +2046,7 @@ class BosClient(BceBaseClient):
2011
2046
  user_headers=None,
2012
2047
  progress_callback=None,
2013
2048
  traffic_limit=None,
2049
+ cond_read_write=None,
2014
2050
  config=None):
2015
2051
  """
2016
2052
  Multipart Upload file to bos
@@ -2066,7 +2102,7 @@ class BosClient(BceBaseClient):
2066
2102
  # sort
2067
2103
  part_list.sort(key=lambda x: x["partNumber"])
2068
2104
  # complete_multipart_upload
2069
- self.complete_multipart_upload(bucket_name, key, upload_id, part_list)
2105
+ self.complete_multipart_upload(bucket_name, key, upload_id, part_list, cond_read_write)
2070
2106
  return True
2071
2107
 
2072
2108
  @required(bucket_name=(bytes, str), key=(bytes, str), acl=(list, dict))
@@ -2890,6 +2926,37 @@ class BosClient(BceBaseClient):
2890
2926
 
2891
2927
  if object_tagging is not None:
2892
2928
  headers[http_headers.BOS_TAGGING] = compat.convert_to_bytes(object_tagging)
2929
+
2930
+ return headers
2931
+
2932
+
2933
+ @staticmethod
2934
+ def _get_cond_read_write_headers(http_method, headers, cond_read_write):
2935
+ """
2936
+ get if condition headers
2937
+ :type http_method: string
2938
+ :param http_method: GET, HEAD, PUT, POST
2939
+
2940
+ :type cond_read_write: string
2941
+ :param cond_read_write: put_object, complete_multipart_upload, get_object, get_object_meta_data
2942
+
2943
+ :return: headers
2944
+ """
2945
+ cond_read_write_set = http_headers.BOS_COND_READ_WRITE_HEADERS
2946
+
2947
+ if http_method == http_methods.GET or http_method == http_methods.HEAD:
2948
+ cond_read_write_set = cond_read_write_set.union(set(
2949
+ [http_headers.BOS_IF_MODIFIED_SINCE,
2950
+ http_headers.BOS_IF_UNMODIFIED_SINCE,
2951
+ http_headers.BOS_IF_MATCH,
2952
+ http_headers.BOS_IF_NONE_MATCH]))
2953
+
2954
+ for k, v in iteritems(cond_read_write):
2955
+ k = utils.convert_to_standard_string(k)
2956
+ if k in cond_read_write_set:
2957
+ headers[k] = v
2958
+ else:
2959
+ raise ValueError('%s is not valid in %s' % (k, http_method))
2893
2960
  return headers
2894
2961
 
2895
2962
 
@@ -2995,6 +3062,19 @@ class BosClient(BceBaseClient):
2995
3062
 
2996
3063
  return config.endpoint
2997
3064
 
3065
+ @staticmethod
3066
+ def _need_retry_for_bos(config, error):
3067
+
3068
+ if not isinstance(error, BceServerError):
3069
+ return False
3070
+
3071
+ # if you need add more retry condition, please add it here
3072
+ if error.status_code == http.client.FORBIDDEN:
3073
+ _logger.debug('BOS retry condition matched: 403 Forbidden')
3074
+ return True
3075
+
3076
+ return False
3077
+
2998
3078
  @staticmethod
2999
3079
  def _need_retry_backup_endpoint(error):
3000
3080
  # always retry on IOError
@@ -3009,6 +3089,8 @@ class BosClient(BceBaseClient):
3009
3089
  return True
3010
3090
  if error.code == BceServerError.REQUEST_EXPIRED:
3011
3091
  return True
3092
+ if error.status_code == http.client.FORBIDDEN:
3093
+ return True
3012
3094
  return False
3013
3095
 
3014
3096
  def _send_request(
@@ -3026,23 +3108,42 @@ class BosClient(BceBaseClient):
3026
3108
  headers = headers or {}
3027
3109
  headers[http_headers.STS_SECURITY_TOKEN] = config.security_token
3028
3110
 
3111
+ last_exception = None
3112
+ e = None
3029
3113
  try:
3030
3114
  return bce_http_client.send_request(
3031
3115
  config, bce_v1_signer.sign, [handler.parse_error, body_parser],
3032
3116
  http_method, path, body, headers, params)
3033
- except BceHttpClientError as e:
3034
- # retry backup endpoint
3035
- if config.backup_endpoint is None:
3036
- raise e
3037
- if BosClient._need_retry_backup_endpoint(e.last_error):
3038
- _logger.debug(b'Retry for backup endpoint.')
3117
+ except BceHttpClientError as ex:
3118
+ last_exception = ex
3119
+ e = ex
3120
+
3121
+ # retry backup endpoint
3122
+ if e is not None and config.backup_endpoint is not None and BosClient._need_retry_backup_endpoint(e):
3123
+ try:
3124
+ _logger.debug(b'Retry for backup endpoint error code: %d.', e.status_code)
3039
3125
  path = BosClient._get_path(config, bucket_name, key, True)
3040
- return bce_http_client.send_request_no_underlined(
3126
+ return bce_http_client.send_request(
3041
3127
  config, bce_v1_signer.sign, [handler.parse_error, body_parser],
3042
3128
  http_method, path, body, headers, params, True)
3043
- else:
3044
- raise e
3129
+ except BceHttpClientError as ex:
3130
+ last_exception = ex
3131
+ e = ex
3132
+
3133
+ # retry for bos error
3134
+ if e is not None and BosClient._need_retry_for_bos(config, e.last_error):
3135
+ try:
3136
+ _logger.debug(b'Retry for BOS error code: %d.', e.status_code)
3137
+ return bce_http_client.send_request(
3138
+ config, bce_v1_signer.sign, [handler.parse_error, body_parser],
3139
+ http_method, path, body, headers, params)
3140
+ except BceHttpClientError as ex:
3141
+ last_exception = ex
3142
+ e = ex
3045
3143
 
3144
+ if last_exception is None:
3145
+ raise
3146
+ raise last_exception
3046
3147
 
3047
3148
  class SelectMessage(object):
3048
3149
  """
@@ -3137,7 +3238,7 @@ class SelectResponse(object):
3137
3238
  msg.set_end_message(headers_map, crc)
3138
3239
  self.finish = True
3139
3240
  yield msg
3140
- raise StopIteration
3241
+ return
3141
3242
  finally:
3142
3243
  self.http_response.close()
3143
3244
 
@@ -40,6 +40,7 @@ class EtClient(bce_base_client.BceBaseClient):
40
40
  channel = 'channel'
41
41
  route = 'route'
42
42
  rule = 'rule'
43
+ bfd = 'bfd'
43
44
 
44
45
  def __init__(self, config=None):
45
46
  """
@@ -85,40 +86,46 @@ class EtClient(bce_base_client.BceBaseClient):
85
86
  http_method, path, body, headers, params)
86
87
 
87
88
  def create_et_dcphy(self, name, isp, intf_type, ap_type, ap_addr, user_name, user_phone, user_email,
88
- user_idc, client_token=None, description=None, config=None):
89
+ user_idc, client_token=None, description=None, billing=None, tags=None, config=None):
89
90
  """
90
91
  Create new ET
91
-
92
+
92
93
  :param name: the name of ET
93
94
  :type name: string
94
-
95
+
95
96
  :param description: description of ET
96
97
  :type description: string
97
-
98
+
98
99
  :param isp: the type of isp
99
100
  :type isp: string
100
-
101
+
101
102
  :param intf_type: the type of interface
102
103
  :type intf_type: string
103
-
104
+
104
105
  :param ap_type: the type of ap
105
106
  :type ap_type: string
106
-
107
+
107
108
  :param ap_addr: the type of ap Address
108
109
  :type ap_addr: string
109
-
110
+
110
111
  :param user_name: the name of user
111
112
  :type user_name: string
112
-
113
+
113
114
  :param user_phone: phone number of user
114
115
  :type user_phone: string
115
-
116
+
116
117
  :param user_email: email of user
117
118
  :type user_email: string
118
-
119
+
119
120
  :param user_idc: Idc of user
120
121
  :type user_idc: string
121
-
122
+
123
+ :param billing: billing information, currently only supports prepaid
124
+ :type billing: dict
125
+
126
+ :param tags: list of tag key-value pairs to be created
127
+ :type tags: list<dict>
128
+
122
129
  :param client_token:
123
130
  If the clientToken is not specified by the user, a random String
124
131
  generated by default algorithm will be used.
@@ -135,10 +142,9 @@ class EtClient(bce_base_client.BceBaseClient):
135
142
  params[b'clientToken'] = generate_client_token()
136
143
  else:
137
144
  params[b'clientToken'] = client_token
138
-
145
+
139
146
  body = {
140
147
  'name': name,
141
- 'description': description,
142
148
  'isp': isp,
143
149
  'intfType': intf_type,
144
150
  'apType': ap_type,
@@ -149,31 +155,40 @@ class EtClient(bce_base_client.BceBaseClient):
149
155
  'userIdc': user_idc,
150
156
  }
151
157
 
158
+ if description is not None:
159
+ body['description'] = description
160
+
161
+ if billing is not None:
162
+ body['billing'] = billing
163
+
164
+ if tags is not None:
165
+ body['tags'] = tags
166
+
152
167
  return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
153
168
 
154
169
  def update_et_dcphy(self, et_id, name=None, description=None, user_name=None,
155
170
  user_phone=None, user_email=None, client_token=None, config=None):
156
171
  """
157
172
  Update existed Et
158
-
173
+
159
174
  :param et_id: ET ID
160
175
  :type et_id: string
161
-
176
+
162
177
  :param user_name: the name of user
163
178
  :type user_name: string
164
-
179
+
165
180
  :param user_phone: phone number of user
166
181
  :type user_phone: string
167
-
182
+
168
183
  :param user_email: email of user
169
184
  :type user_email: string
170
-
185
+
171
186
  :param user_idc: Idc of user
172
187
  :type user_idc: string
173
-
188
+
174
189
  :param description: description of ET
175
190
  :type description: string
176
-
191
+
177
192
  :param client_token:
178
193
  If the clientToken is not specified by the user, a random String
179
194
  generated by default algorithm will be used.
@@ -258,10 +273,10 @@ class EtClient(bce_base_client.BceBaseClient):
258
273
  def list_et_dcphy_detail(self, et_id, config=None):
259
274
  """
260
275
  List specific ET detail
261
-
276
+
262
277
  :param et_id: ET ID
263
278
  :type et_id: string
264
-
279
+
265
280
  :param config:
266
281
  :type config: baidubce.BceClientConfiguration
267
282
 
@@ -292,10 +307,10 @@ class EtClient(bce_base_client.BceBaseClient):
292
307
  remote_ipv6=None, ipv6_networks=None, client_token=None, config=None):
293
308
  """
294
309
  Create new et channel
295
-
310
+
296
311
  :param et_id: et id
297
312
  :type et_id: string
298
-
313
+
299
314
  :param local_ip: baidu IPv4 address of et channel
300
315
  :type local_ip: string
301
316
 
@@ -307,21 +322,21 @@ class EtClient(bce_base_client.BceBaseClient):
307
322
 
308
323
  :param remote_ip: customer IPv4 address of et channel
309
324
  :type remote_ip: string
310
-
325
+
311
326
  :param description: description of channel
312
327
  :type description: string
313
-
328
+
314
329
  :param route_type: et channel route type
315
330
  :value "bgp" or "static"
316
331
  :type route_type: string
317
-
332
+
318
333
  :param vlan_id: et channel vlan id
319
334
  :value 0, 2-4009
320
335
  :type vlan_id: integer
321
-
336
+
322
337
  :param authorized_users: et channel authorized users
323
338
  :type authorized_users: list<string>
324
-
339
+
325
340
  :param enable_ipv6: et channel enable ipv6
326
341
  :value 0 or 1
327
342
  :type enable_ipv6: integer
@@ -334,13 +349,13 @@ class EtClient(bce_base_client.BceBaseClient):
334
349
 
335
350
  :param ipv6_networks: et channel IPv6 routes
336
351
  :type ipv6_networks: list<string>
337
-
352
+
338
353
  :param bgp_asn: BGP ASN
339
354
  :type bgp_asn: string
340
-
355
+
341
356
  :param bgp_key: BGP KEY
342
357
  :type bgp_key: string
343
-
358
+
344
359
  :param client_token:
345
360
  If the clientToken is not specified by the user, a random String
346
361
  generated by default algorithm will be used.
@@ -358,7 +373,7 @@ class EtClient(bce_base_client.BceBaseClient):
358
373
  params[b'clientToken'] = generate_client_token()
359
374
  else:
360
375
  params[b'clientToken'] = client_token
361
-
376
+
362
377
  body = {
363
378
  'etId': et_id,
364
379
  'baiduAddress': local_ip,
@@ -389,17 +404,27 @@ class EtClient(bce_base_client.BceBaseClient):
389
404
  if ipv6_networks is not None:
390
405
  body['ipv6Networks'] = ipv6_networks
391
406
 
407
+ if bgp_asn is not None:
408
+ body['bgpAsn'] = compat.convert_to_string(bgp_asn)
409
+
410
+ if bgp_key is not None:
411
+ body['bgpKey'] = compat.convert_to_string(bgp_key)
412
+
392
413
  return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
393
-
414
+
394
415
  @required(et_id=(bytes, str))
395
- def get_et_channel(self, et_id, client_token=None, config=None):
416
+ def get_et_channel(self, et_id, et_channel_id=None, client_token=None, config=None):
396
417
  """
397
418
  Get et channel.
398
-
419
+
399
420
  :param et_id:
400
421
  et id
401
422
  :type et_id: string
402
423
 
424
+ :param et_channel_id:
425
+ et channel id (optional)
426
+ :type et_channel_id: string
427
+
403
428
  :param client_token:
404
429
  If the clientToken is not specified by the user, a random String
405
430
  generated by default algorithm will be used.
@@ -418,8 +443,11 @@ class EtClient(bce_base_client.BceBaseClient):
418
443
  else:
419
444
  params[b'clientToken'] = client_token
420
445
 
446
+ if et_channel_id is not None:
447
+ params[b'etChannelId'] = et_channel_id
448
+
421
449
  return self._send_request(http_methods.GET, path, params=params, config=config)
422
-
450
+
423
451
  @required(et_id=(bytes, str), et_channel_id=(bytes, str), local_ip=(bytes, str), name=(bytes, str),
424
452
  networks=(list, tuple), remote_ip=(bytes, str), route_type=(bytes, str), vlan_id=int)
425
453
  def recommit_et_channel(self, et_id, et_channel_id, local_ip, name, networks, remote_ip, route_type, vlan_id,
@@ -427,7 +455,7 @@ class EtClient(bce_base_client.BceBaseClient):
427
455
  remote_ipv6=None, ipv6_networks=None, client_token=None, config=None):
428
456
  """
429
457
  Recommit et channel.
430
-
458
+
431
459
  :param et_id:
432
460
  et id
433
461
  :type et_id: string
@@ -505,7 +533,7 @@ class EtClient(bce_base_client.BceBaseClient):
505
533
  params[b'clientToken'] = generate_client_token()
506
534
  else:
507
535
  params[b'clientToken'] = client_token
508
-
536
+
509
537
  body = {
510
538
  'baiduAddress': local_ip,
511
539
  'name': name,
@@ -534,12 +562,12 @@ class EtClient(bce_base_client.BceBaseClient):
534
562
  body['ipv6Networks'] = ipv6_networks
535
563
 
536
564
  return self._send_request(http_methods.PUT, path, params=params, body=json.dumps(body), config=config)
537
-
565
+
538
566
  @required(et_id=(bytes, str), et_channel_id=(bytes, str))
539
567
  def update_et_channel(self, et_id, et_channel_id, name=None, description=None, client_token=None, config=None):
540
568
  """
541
569
  update et channel.
542
-
570
+
543
571
  :param et_id:
544
572
  et id
545
573
  :type et_id: string
@@ -574,7 +602,7 @@ class EtClient(bce_base_client.BceBaseClient):
574
602
  params[b'clientToken'] = generate_client_token()
575
603
  else:
576
604
  params[b'clientToken'] = client_token
577
-
605
+
578
606
  body = {}
579
607
 
580
608
  if name is not None:
@@ -584,12 +612,12 @@ class EtClient(bce_base_client.BceBaseClient):
584
612
  body['description'] = compat.convert_to_string(description)
585
613
 
586
614
  return self._send_request(http_methods.PUT, path, params=params, body=json.dumps(body), config=config)
587
-
615
+
588
616
  @required(et_id=(bytes, str), et_channel_id=(bytes, str))
589
617
  def delete_et_channel(self, et_id, et_channel_id, client_token=None, config=None):
590
618
  """
591
619
  Delete et channel.
592
-
620
+
593
621
  :param et_id:
594
622
  et id
595
623
  :type et_id: string
@@ -618,14 +646,14 @@ class EtClient(bce_base_client.BceBaseClient):
618
646
  params[b'clientToken'] = client_token
619
647
 
620
648
  return self._send_request(http_methods.DELETE, path, params=params, config=config)
621
-
649
+
622
650
  @required(et_id=(bytes, str), et_channel_id=(bytes, str),
623
651
  local_ipv6=(bytes, str), remote_ipv6=(bytes, str))
624
652
  def enable_et_channel_ipv6(self, et_id, et_channel_id, local_ipv6, remote_ipv6,
625
653
  ipv6_networks=None, client_token=None, config=None):
626
654
  """
627
655
  Enable IPv6 of the specific et channel.
628
-
656
+
629
657
  :param et_id:
630
658
  et id
631
659
  :type et_id: string
@@ -664,7 +692,7 @@ class EtClient(bce_base_client.BceBaseClient):
664
692
  params[b'clientToken'] = generate_client_token()
665
693
  else:
666
694
  params[b'clientToken'] = client_token
667
-
695
+
668
696
  body = {
669
697
  'baiduIpv6Address': compat.convert_to_string(local_ipv6),
670
698
  'customerIpv6Address': compat.convert_to_string(remote_ipv6),
@@ -679,7 +707,7 @@ class EtClient(bce_base_client.BceBaseClient):
679
707
  def disable_et_channel_ipv6(self, et_id, et_channel_id, client_token=None, config=None):
680
708
  """
681
709
  Disable IPv6 of the specific et channel.
682
-
710
+
683
711
  :param et_id:
684
712
  The id of et.
685
713
  :type et_id: string
@@ -715,37 +743,37 @@ class EtClient(bce_base_client.BceBaseClient):
715
743
  client_token=None, config=None):
716
744
  """
717
745
  Create a et channel route rule with the specified options.
718
-
746
+
719
747
  :param et_id:
720
748
  The id of et.
721
749
  :type et_id: string
722
-
750
+
723
751
  :param et_channel_id:
724
752
  The id of et channel.
725
753
  :type et_channel_id: string
726
-
754
+
727
755
  :param dest_address:
728
756
  Destination address of the route rule.
729
757
  :type dest_address: string
730
-
758
+
731
759
  :param nexthop_type
732
- The type of nexthop.
760
+ The type of nexthop.
733
761
  Value can be "etGateway" or "etChannel", respectively dedicated gateway, dedicated channel type.
734
762
  :type nexthop_type: string
735
-
763
+
736
764
  :param nexthop_id:
737
765
  The id of nexthop instance.
738
766
  :type nexthop_id: string
739
-
767
+
740
768
  :param description:
741
769
  The description of the route rule.
742
770
  :type description: string
743
-
771
+
744
772
  :param ip_version:
745
773
  The ip version of the route rule.
746
774
  Value can be 4 or 6, default 4.
747
775
  :type ip_version: int
748
-
776
+
749
777
  :param client_token:
750
778
  An ASCII string whose length is less than 64.
751
779
  The request will be idempotent if clientToken is provided.
@@ -773,14 +801,14 @@ class EtClient(bce_base_client.BceBaseClient):
773
801
  'nexthopType': compat.convert_to_string(nexthop_type),
774
802
  'nexthopId': compat.convert_to_string(nexthop_id),
775
803
  }
776
-
804
+
777
805
  if description is not None:
778
806
  body['description'] = compat.convert_to_string(description)
779
807
 
780
808
  return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params,
781
809
  config=config)
782
810
 
783
- @required(et_id=(bytes, str), et_channel_id=(bytes, str),
811
+ @required(et_id=(bytes, str), et_channel_id=(bytes, str),
784
812
  marker=(bytes, str), max_Keys=int, dest_address=(bytes, str))
785
813
  def list_et_channel_route_rules(self, et_id, et_channel_id, marker=None,
786
814
  max_Keys=None, dest_address=None, config=None):
@@ -843,7 +871,7 @@ class EtClient(bce_base_client.BceBaseClient):
843
871
  :param et_channel_id:
844
872
  The id of et channel.
845
873
  :type et_channel_id: string
846
-
874
+
847
875
  :param et_channel_route_rule_id:
848
876
  The id of et channel route rule.
849
877
  :type et_channel_route_rule_id: string
@@ -893,7 +921,7 @@ class EtClient(bce_base_client.BceBaseClient):
893
921
  :param et_channel_id:
894
922
  The id of et channel.
895
923
  :type et_channel_id: string
896
-
924
+
897
925
  :param et_channel_route_rule_id:
898
926
  The id of et channel route rule.
899
927
  :type et_channel_route_rule_id: string
@@ -1007,6 +1035,151 @@ class EtClient(bce_base_client.BceBaseClient):
1007
1035
 
1008
1036
  return self._send_request(http_methods.PUT, path, params=params, body=json.dumps(body), config=config)
1009
1037
 
1038
+ @required(et_id=(bytes, str), et_channel_id=(bytes, str),
1039
+ detect_multiplier=int, send_interval=int, receive_interval=int)
1040
+ def create_et_channel_bfd(self, et_id, et_channel_id, detect_multiplier, send_interval,
1041
+ receive_interval, client_token=None, config=None):
1042
+ """
1043
+ Create BFD configuration for et channel.
1044
+
1045
+ :param et_id:
1046
+ The id of et.
1047
+ :type et_id: string
1048
+
1049
+ :param et_channel_id:
1050
+ The id of et channel.
1051
+ :type et_channel_id: string
1052
+
1053
+ :param detect_multiplier:
1054
+ Detection time multiplier, an integer between 3-10, recommended value is 4.
1055
+ :type detect_multiplier: int
1056
+
1057
+ :param send_interval:
1058
+ Message send interval, an integer between 200-1000 in milliseconds, recommended value is 300.
1059
+ :type send_interval: int
1060
+
1061
+ :param receive_interval:
1062
+ Message receive interval, an integer between 200-1000 in milliseconds, recommended value is 300.
1063
+ :type receive_interval: int
1064
+
1065
+ :param client_token:
1066
+ An ASCII string whose length is less than 64.
1067
+ The request will be idempotent if clientToken is provided.
1068
+ If the clientToken is not specified by the user,
1069
+ a random String generated by default algorithm will be used.
1070
+ :type client_token: string
1071
+
1072
+ :param config:
1073
+ :type config: baidubce.BceClientConfiguration
1074
+
1075
+ :return:
1076
+ :rtype baidubce.bce_response.BceResponse
1077
+ """
1078
+ path = utils.append_uri(self.prefix, self.et, et_id, self.channel, et_channel_id, self.bfd)
1079
+
1080
+ params = {}
1081
+ if client_token is None:
1082
+ params[b'clientToken'] = generate_client_token()
1083
+ else:
1084
+ params[b'clientToken'] = client_token
1085
+
1086
+ body = {
1087
+ 'detectMultiplier': detect_multiplier,
1088
+ 'sendInterval': send_interval,
1089
+ 'receivInterval': receive_interval
1090
+ }
1091
+ return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
1092
+
1093
+ @required(et_id=(bytes, str), et_channel_id=(bytes, str))
1094
+ def delete_et_channel_bfd(self, et_id, et_channel_id, client_token=None, config=None):
1095
+ """
1096
+ Delete BFD configuration for et channel.
1097
+
1098
+ :param et_id:
1099
+ The id of et.
1100
+ :type et_id: string
1101
+
1102
+ :param et_channel_id:
1103
+ The id of et channel.
1104
+ :type et_channel_id: string
1105
+
1106
+ :param client_token:
1107
+ An ASCII string whose length is less than 64.
1108
+ The request will be idempotent if clientToken is provided.
1109
+ If the clientToken is not specified by the user,
1110
+ a random String generated by default algorithm will be used.
1111
+ :type client_token: string
1112
+
1113
+ :param config:
1114
+ :type config: baidubce.BceClientConfiguration
1115
+
1116
+ :return:
1117
+ :rtype baidubce.bce_response.BceResponse
1118
+ """
1119
+ path = utils.append_uri(self.prefix, self.et, et_id, self.channel, et_channel_id, self.bfd)
1120
+
1121
+ params = {}
1122
+ if client_token is None:
1123
+ params[b'clientToken'] = generate_client_token()
1124
+ else:
1125
+ params[b'clientToken'] = client_token
1126
+
1127
+ return self._send_request(http_methods.DELETE, path, params=params, config=config)
1128
+
1129
+ @required(et_id=(bytes, str), et_channel_id=(bytes, str),
1130
+ detect_multiplier=int, send_interval=int, receive_interval=int)
1131
+ def update_et_channel_bfd(self, et_id, et_channel_id, detect_multiplier, send_interval,
1132
+ receive_interval, client_token=None, config=None):
1133
+ """
1134
+ Update BFD configuration for et channel.
1135
+
1136
+ :param et_id:
1137
+ The id of et.
1138
+ :type et_id: string
1139
+
1140
+ :param et_channel_id:
1141
+ The id of et channel.
1142
+ :type et_channel_id: string
1143
+
1144
+ :param detect_multiplier:
1145
+ Detection time multiplier, an integer between 3-10, recommended value is 4.
1146
+ :type detect_multiplier: int
1147
+
1148
+ :param send_interval:
1149
+ Message send interval, an integer between 200-1000 in milliseconds, recommended value is 300.
1150
+ :type send_interval: int
1151
+
1152
+ :param receive_interval:
1153
+ Message receive interval, an integer between 200-1000 in milliseconds, recommended value is 300.
1154
+ :type receive_interval: int
1155
+
1156
+ :param client_token:
1157
+ An ASCII string whose length is less than 64.
1158
+ The request will be idempotent if clientToken is provided.
1159
+ If the clientToken is not specified by the user,
1160
+ a random String generated by default algorithm will be used.
1161
+ :type client_token: string
1162
+
1163
+ :param config:
1164
+ :type config: baidubce.BceClientConfiguration
1165
+
1166
+ :return:
1167
+ :rtype baidubce.bce_response.BceResponse
1168
+ """
1169
+ path = utils.append_uri(self.prefix, self.et, et_id, self.channel, et_channel_id, self.bfd)
1170
+
1171
+ params = {}
1172
+ if client_token is None:
1173
+ params[b'clientToken'] = generate_client_token()
1174
+ else:
1175
+ params[b'clientToken'] = client_token
1176
+
1177
+ body = {
1178
+ 'detectMultiplier': detect_multiplier,
1179
+ 'sendInterval': send_interval,
1180
+ 'receivInterval': receive_interval
1181
+ }
1182
+ return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
1010
1183
 
1011
1184
  def generate_client_token_by_uuid():
1012
1185
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bce-python-sdk
3
- Version: 0.9.57
3
+ Version: 0.9.60
4
4
  Summary: BCE SDK for python
5
5
  Home-page: http://bce.baidu.com
6
6
  Author:
@@ -1,4 +1,4 @@
1
- baidubce/__init__.py,sha256=66DG7uYOPC5u0nJ383X0SiLTg2IrEMkeaoYGcUI6Svo,813
1
+ baidubce/__init__.py,sha256=rnZqSpe0-XrdYAhEaCOTgLUlBBsmZxhf9j8tIEljSSc,813
2
2
  baidubce/bce_base_client.py,sha256=7gjkRy_YlTTb6TXHYHyZRYMjdVO7FTtHMdwXx8bPgsE,3428
3
3
  baidubce/bce_client_configuration.py,sha256=i9z5wVXaRSlJxE0LD1odexza35KQyFy7m1Az5XclD_I,3252
4
4
  baidubce/bce_response.py,sha256=gOj48U6iurYJsChzFdrB7Rj3RpkU-fUdhtftrIj9o8U,1985
@@ -11,10 +11,10 @@ baidubce/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  baidubce/auth/bce_credentials.py,sha256=thRajmOSShtI5z0VTGHj9FuZvWj65noolDQCanj_pzs,1157
12
12
  baidubce/auth/bce_v1_signer.py,sha256=7VX6XWrUg32mbNRHrIG7kJGanQ7kbsd7cXtOXTvTmIE,5017
13
13
  baidubce/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- baidubce/http/bce_http_client.py,sha256=Hs2F8N-U59Z8542NK-I-y5ue87QEb7GGe2CV6Re12RM,11470
14
+ baidubce/http/bce_http_client.py,sha256=HJuocNM3tpbaXSy80E5682jtLcMjtIxYhyhaQ-4NtXw,12044
15
15
  baidubce/http/handler.py,sha256=FGotEXyM24t93E2Z4n9dJV9XD34im-gdmq8JDyncZA8,2930
16
16
  baidubce/http/http_content_types.py,sha256=tHTGDR9nK5beD9HmJ4Iwj42fc9avsMpJELbb6UdKtkQ,722
17
- baidubce/http/http_headers.py,sha256=fHZUEbzvTW9-JUAhBXXeag4mj7NbvMnwnRkyrxiFBUA,2978
17
+ baidubce/http/http_headers.py,sha256=H3tZqErXpbDmYBm2Mzwe23TZcGpLGvrsLq3s_0NH4Bo,3235
18
18
  baidubce/http/http_methods.py,sha256=Hn-A2fKoZiqmrtWVlHhk1cGxEoGDrbLfNykZuo1zDZc,782
19
19
  baidubce/retry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  baidubce/retry/retry_policy.py,sha256=A7cPvKxkVmd8PGA6_60sQU9hBzGbjXHVW0-QofP7-5E,4926
@@ -33,7 +33,7 @@ baidubce/services/aihc/modules/dataset/dataset_model.py,sha256=UGfUwL9J0iW1FRqNM
33
33
  baidubce/services/aihc/modules/dev_instance/__init__.py,sha256=2sBKuEWiVg7nVUdjB1gj_va2_VSmOM3lm9npLKw24DQ,757
34
34
  baidubce/services/aihc/modules/dev_instance/dev_instance_client.py,sha256=sK783JNRO4KIMy2ae-9zo6P00OwAsHodW5ckizWu57I,10888
35
35
  baidubce/services/aihc/modules/job/__init__.py,sha256=cgdV7f4DQ8bwzLU8xvrwQGBmg3jlEcrxF-r0Oh5KxTU,714
36
- baidubce/services/aihc/modules/job/job_client.py,sha256=kHEhTLMVD3cLEeJ_D8sS40ESGXk77V-pvCUyN83OGi8,19486
36
+ baidubce/services/aihc/modules/job/job_client.py,sha256=bud3xkv1m7p1MFvK3_ieHIOgsRoTh9ltTbTXRd5zbPo,20786
37
37
  baidubce/services/aihc/modules/job/job_model.py,sha256=kws5tI7IjHPDQ1wj2FJCkRMQdOFDCQYoMzf7bvRkh9A,7373
38
38
  baidubce/services/aihc/modules/model/__init__.py,sha256=JYO6XwyHsxqv6jMrEwZIkP7v4uZketKsTw15qXdpsUg,724
39
39
  baidubce/services/aihc/modules/model/model_client.py,sha256=T-i29o-6far4rUl7s-XPfIC-H2Vc00DZcjwujP94BaQ,9368
@@ -51,7 +51,7 @@ baidubce/services/bbc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
51
51
  baidubce/services/bbc/bbc_client.py,sha256=6x2fWmjyKSZ02WvsmQ1pryE0c_mtXHCjI0Ev80MfzbY,38951
52
52
  baidubce/services/bbc/bbc_model.py,sha256=Dy80LZ4ro_iS3UejJ_CL9kI7OyMSBoDitTE4J1XAC_g,1790
53
53
  baidubce/services/bcc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- baidubce/services/bcc/bcc_client.py,sha256=1XTHkkhgd59F6tEMNiniqTop0TytZiKW8lGsiTbdwlc,299976
54
+ baidubce/services/bcc/bcc_client.py,sha256=nDhtOWi5x0IyM1Fzdf6_VOctJj1PEn-QlBR6rtBXNXA,300606
55
55
  baidubce/services/bcc/bcc_model.py,sha256=xKYC4Z-gxWjFhe8b1AmMBEN_wYhnwcqAmer29ysS17k,6788
56
56
  baidubce/services/bcc/fpga_card_type.py,sha256=n6goqnapIgAC9_sciA_2he5HFqPRbRv109qitO7qpd8,948
57
57
  baidubce/services/bcc/gpu_card_type.py,sha256=HEfMzne-UC5F295JPrPUu7V9F5g-hbXF2TNBontEFes,1054
@@ -73,7 +73,7 @@ baidubce/services/bls/bls_model.py,sha256=A4kLRQo0aOlh2t4IFjd0aJbju-CmhZdryuXESu
73
73
  baidubce/services/bmr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
74
  baidubce/services/bmr/bmr_client.py,sha256=ntJie-R6qFxdd6znpfCj25RSoJ6gOV0o2Tn9asJThQg,20565
75
75
  baidubce/services/bos/__init__.py,sha256=bRvJAiFjUIBF64HeoZ7bkTjGfqkKJAvxYWBSEvbUOIc,813
76
- baidubce/services/bos/bos_client.py,sha256=zGPec65M8oFCpHHIReWqcR4_iEx2RZuhaXYbg0hmlY8,110444
76
+ baidubce/services/bos/bos_client.py,sha256=jMyAVbrLZbhOhbpQK5fiUMZBNZ2qimWEaX_o8OgzDA8,114425
77
77
  baidubce/services/bos/bos_handler.py,sha256=ZWVjezraJsdNy0tsX8fZkWPmSBYLSlGolKqZ1CcWE7A,1832
78
78
  baidubce/services/bos/canned_acl.py,sha256=Y2qvU81OI_nT0uu96MyTemXyR2EnNVVYrJxfPS1rhBA,723
79
79
  baidubce/services/bos/common.py,sha256=X2_PDLRR3Lpr7i2mzzyMBI2jCQ779hIx3XwBDTQAXhE,138
@@ -125,7 +125,7 @@ baidubce/services/esg/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
125
125
  baidubce/services/esg/esg_client.py,sha256=3yZ2V98mc0QxTYRtmMxERl9NjmRilF8c3-feOfB3AGY,13122
126
126
  baidubce/services/esg/esg_model.py,sha256=TNf5J7ZdDBa4fKD40qA8mHewxXK6YvvPqYkZth4sEJw,3646
127
127
  baidubce/services/et/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
128
- baidubce/services/et/et_client.py,sha256=skz620Hdk8c8mS1hkDbWAekvfWVytqkgb5AMeK0sDFw,34426
128
+ baidubce/services/et/et_client.py,sha256=yTKYQ7VU80EeRyuYhOqg5b793pF_v24ri6LDytF5-6Y,40322
129
129
  baidubce/services/et/model.py,sha256=H0IkBVtMWYldFcLoXb_pFbrGQWGD4ZPthdfI443VQcc,975
130
130
  baidubce/services/etGateway/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
131
  baidubce/services/etGateway/et_gateway_client.py,sha256=ZD4clsjS9CVqb-iQ53nJJx8aA9_OqadQNsrRABDaOT0,14970
@@ -198,7 +198,7 @@ baidubce/services/vpc/vpc_client.py,sha256=Cdg009gZdI1gPgGy08-kIOxT3_VvuQoPqI_82
198
198
  baidubce/services/vpn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
199
199
  baidubce/services/vpn/vpn_client.py,sha256=rrnQElD-LTttsqMbbIHoHK0Jdc7FrVVTZIdu-0Zthr8,31352
200
200
  baidubce/services/vpn/vpn_model.py,sha256=C9rEBYyFIDjrqvqJG4WEin6qVzEIvbhPvT5KwDYm1qA,3365
201
- bce_python_sdk-0.9.57.dist-info/METADATA,sha256=jH5Rp2qmBgTU2wbZe5IiIuPtks8vv74AvqZfhT-yp_M,416
202
- bce_python_sdk-0.9.57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
203
- bce_python_sdk-0.9.57.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
204
- bce_python_sdk-0.9.57.dist-info/RECORD,,
201
+ bce_python_sdk-0.9.60.dist-info/METADATA,sha256=hLgIlV_86FKyot0sB-UD0_dg68v7pJx-Q_PjPHXM9V0,416
202
+ bce_python_sdk-0.9.60.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
203
+ bce_python_sdk-0.9.60.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
204
+ bce_python_sdk-0.9.60.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5