bce-python-sdk 0.9.59__py3-none-any.whl → 0.9.63__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.59'
21
+ SDK_VERSION = b'0.9.63'
22
22
  DEFAULT_SERVICE_DOMAIN = b'bcebos.com'
23
23
  URL_PREFIX = b'/v1'
24
24
  DEFAULT_ENCODING = 'UTF-8'
@@ -38,6 +38,9 @@ def _get_canonical_headers(headers, headers_to_sign=None):
38
38
  for k in headers:
39
39
  k_lower = k.strip().lower()
40
40
  value = utils.convert_to_standard_string(headers[k]).strip()
41
+ # 值为空字符的header不参与签名计算
42
+ if not value:
43
+ continue
41
44
  if k_lower.startswith(http_headers.BCE_PREFIX) \
42
45
  or k_lower in headers_to_sign:
43
46
  str_tmp = b"%s:%s" % (utils.normalize_string(k_lower), utils.normalize_string(value))
@@ -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
+ )
@@ -2469,7 +2469,7 @@ class BccClient(bce_base_client.BceBaseClient):
2469
2469
  @required(volume_id=(bytes, str), # ***Unicode***
2470
2470
  new_cds_size=int)
2471
2471
  def resize_volume(self, volume_id, new_cds_size, new_volume_type,
2472
- client_token=None, config=None):
2472
+ client_token=None, config=None, new_extra_io=None):
2473
2473
  """
2474
2474
  Resizing the specified volume with newly size.
2475
2475
  You can resize the specified volume only when the volume is Available,
@@ -2499,6 +2499,10 @@ class BccClient(bce_base_client.BceBaseClient):
2499
2499
  https://bce.baidu.com/doc/BCC/API.html#.E5.B9.82.E7.AD.89.E6.80.A7
2500
2500
  :type client_token: string
2501
2501
 
2502
+ :param new_extra_io:
2503
+ The number of adjusted additional IOPS, supporting configuration upgrade and downgrade.
2504
+ :type new_extra_io: int
2505
+
2502
2506
  :return:
2503
2507
  :rtype baidubce.bce_response.BceResponse
2504
2508
  """
@@ -2509,6 +2513,8 @@ class BccClient(bce_base_client.BceBaseClient):
2509
2513
  }
2510
2514
  if new_volume_type is not None:
2511
2515
  body['newVolumeType'] = new_volume_type
2516
+ if new_extra_io is not None:
2517
+ body['newExtraIO'] = new_extra_io
2512
2518
  params = None
2513
2519
  if client_token is None:
2514
2520
  params = {
@@ -3253,8 +3259,8 @@ class BccClient(bce_base_client.BceBaseClient):
3253
3259
  return self._send_request(http_methods.POST, path, json.dumps(body),
3254
3260
  params=params, config=config)
3255
3261
 
3256
- def list_security_groups(self, instance_id=None, vpc_id=None, security_group_ids=None, marker=None, max_keys=None,
3257
- config=None):
3262
+ def list_security_groups(self, instance_id=None, vpc_id=None, security_group_id=None, security_group_ids=None,
3263
+ marker=None, max_keys=None, config=None):
3258
3264
  """
3259
3265
  Listing SecurityGroup owned by the authenticated user.
3260
3266
 
@@ -3267,6 +3273,10 @@ class BccClient(bce_base_client.BceBaseClient):
3267
3273
  filter by vpcId, optional parameter
3268
3274
  :type vpc_id: string
3269
3275
 
3276
+ :param security_group_id:
3277
+ filter by securityGroupId, optional parameter
3278
+ :type security_group_id: string
3279
+
3270
3280
  :param security_group_ids:
3271
3281
  filter by securityGroupIds, optional parameter
3272
3282
  :type security_group_ids: string
@@ -3298,6 +3308,8 @@ class BccClient(bce_base_client.BceBaseClient):
3298
3308
  params['marker'] = marker
3299
3309
  if max_keys is not None:
3300
3310
  params['maxKeys'] = max_keys
3311
+ if security_group_id is not None:
3312
+ params['securityGroupId'] = security_group_id
3301
3313
 
3302
3314
  return self._send_request(http_methods.GET, path,
3303
3315
  params=params, config=config)
@@ -3321,7 +3333,7 @@ class BccClient(bce_base_client.BceBaseClient):
3321
3333
  @required(security_group_id=(bytes, str), # ***Unicode***
3322
3334
  rule=bcc_model.SecurityGroupRuleModel)
3323
3335
  def authorize_security_group_rule(self, security_group_id, rule, client_token=None,
3324
- config=None):
3336
+ sg_version=None, config=None):
3325
3337
  """
3326
3338
  authorize a security group rule to the specified security group
3327
3339
 
@@ -3343,6 +3355,10 @@ class BccClient(bce_base_client.BceBaseClient):
3343
3355
  https://bce.baidu.com/doc/BCC/API.html#.E5.B9.82.E7.AD.89.E6.80.A7
3344
3356
  :type client_token: string
3345
3357
 
3358
+ :param sg_version:
3359
+ Security group version number for optimistic locking.
3360
+ :type sg_version: int
3361
+
3346
3362
  :return:
3347
3363
  :rtype baidubce.bce_response.BceResponse
3348
3364
  """
@@ -3353,6 +3369,8 @@ class BccClient(bce_base_client.BceBaseClient):
3353
3369
  params['clientToken'] = generate_client_token()
3354
3370
  else:
3355
3371
  params['clientToken'] = client_token
3372
+ if sg_version is not None:
3373
+ params['sgVersion'] = sg_version
3356
3374
  body = {
3357
3375
  'rule': rule.__dict__
3358
3376
  }
@@ -3362,7 +3380,7 @@ class BccClient(bce_base_client.BceBaseClient):
3362
3380
 
3363
3381
  @required(security_group_id=(bytes, str), # ***Unicode***
3364
3382
  rule=bcc_model.SecurityGroupRuleModel)
3365
- def revoke_security_group_rule(self, security_group_id, rule, client_token=None, config=None):
3383
+ def revoke_security_group_rule(self, security_group_id, rule, client_token=None, sg_version=None, config=None):
3366
3384
  """
3367
3385
  revoke a security group rule from the specified security group
3368
3386
  :param security_group_id:
@@ -3380,6 +3398,9 @@ class BccClient(bce_base_client.BceBaseClient):
3380
3398
  See more detail at
3381
3399
  https://bce.baidu.com/doc/BCC/API.html#.E5.B9.82.E7.AD.89.E6.80.A7
3382
3400
  :type client_token: string
3401
+ :param sg_version:
3402
+ Security group version number for optimistic locking.
3403
+ :type sg_version: int
3383
3404
  :return:
3384
3405
  :rtype baidubce.bce_response.BceResponse
3385
3406
  """
@@ -3390,6 +3411,8 @@ class BccClient(bce_base_client.BceBaseClient):
3390
3411
  params['clientToken'] = generate_client_token()
3391
3412
  else:
3392
3413
  params['clientToken'] = client_token
3414
+ if sg_version is not None:
3415
+ params['sgVersion'] = sg_version
3393
3416
  body = {
3394
3417
  'rule': rule.__dict__
3395
3418
  }
@@ -3399,16 +3422,17 @@ class BccClient(bce_base_client.BceBaseClient):
3399
3422
 
3400
3423
  def update_security_group_rule(self, security_group_rule_id,
3401
3424
  remark=None,
3402
- direction=None,
3403
3425
  protocol=None,
3404
3426
  portrange=None,
3405
3427
  source_ip=None,
3406
3428
  sourcegroup_id=None,
3407
3429
  dest_ip=None,
3408
3430
  destgroup_id=None,
3409
- config=None):
3431
+ sg_version=None,
3432
+ client_token=None,
3433
+ config=None,):
3410
3434
  """
3411
- uodate a security group rule from the specified security group
3435
+ update a security group rule from the specified security group
3412
3436
  :param security_group_rule_id:
3413
3437
  security group rule id.
3414
3438
  :param: remark:
@@ -3431,35 +3455,60 @@ class BccClient(bce_base_client.BceBaseClient):
3431
3455
  Only works for direction = "egress".
3432
3456
  :param: destgroup_id:
3433
3457
  The destination security group id. Cannot coexist with destIP.
3434
- :param: priority:
3435
- The parameter specify the priority of the rule(range 1-1000).
3458
+ :param sg_version:
3459
+ Security group version number for optimistic locking.
3460
+ :type sg_version: int
3461
+ :param client_token:
3462
+ An ASCII string whose length is less than 64.
3463
+ The request will be idempotent if client token is provided.
3464
+ :type client_token: string
3436
3465
  :param config:
3437
3466
  :type config: baidubce.BceClientConfiguration
3438
3467
  :return:
3439
3468
  :rtype baidubce.bce_response.BceResponse
3440
3469
  """
3441
3470
  path = b'/securityGroup/rule/update'
3442
- body = {
3443
- 'securityGroupRuleId': security_group_rule_id,
3444
- 'remark': remark,
3445
- 'direction': direction,
3446
- 'protocol': protocol,
3447
- 'portRange': portrange,
3448
- 'sourceIp': source_ip,
3449
- 'sourceGroupId': sourcegroup_id,
3450
- 'destIp': dest_ip,
3451
- 'destGroupId': destgroup_id
3452
- }
3471
+ params = {}
3472
+ if sg_version is not None:
3473
+ params['sgVersion'] = sg_version
3474
+ if client_token is None:
3475
+ params['clientToken'] = generate_client_token()
3476
+ else:
3477
+ params['clientToken'] = client_token
3478
+
3479
+ body = {'securityGroupRuleId': security_group_rule_id}
3480
+ if remark is not None:
3481
+ body['remark'] = remark
3482
+ if protocol is not None:
3483
+ body['protocol'] = protocol
3484
+ if portrange is not None:
3485
+ body['portRange'] = portrange
3486
+ if source_ip is not None:
3487
+ body['sourceIp'] = source_ip
3488
+ if sourcegroup_id is not None:
3489
+ body['sourceGroupId'] = sourcegroup_id
3490
+ if dest_ip is not None:
3491
+ body['destIp'] = dest_ip
3492
+ if destgroup_id is not None:
3493
+ body['destGroupId'] = destgroup_id
3494
+
3453
3495
  return self._send_request(http_methods.PUT, path, json.dumps(body),
3454
- params=None, config=config)
3496
+ params=params if params else None, config=config)
3455
3497
 
3456
3498
  @required(security_group_rule_id=(bytes, str)) # ***Unicode***
3457
- def delete_security_group_rule(self, security_group_rule_id, config=None):
3499
+ def delete_security_group_rule(self, security_group_rule_id, sg_version=None, client_token=None, config=None):
3458
3500
  """
3459
3501
  delete a security group rule from the specified security group
3460
3502
  :param security_group_rule_id:
3461
3503
  The id of SecurityGroupRule that will be deleted.
3462
- :type security_group_id: string
3504
+ :type security_group_rule_id: string
3505
+ :param sg_version:
3506
+ Security group version number for optimistic locking.
3507
+ :type sg_version: int
3508
+ :param client_token:
3509
+ An ASCII string whose length is less than 64.
3510
+ The request will be idempotent if client token is provided.
3511
+ :type client_token: string
3463
3512
  :param config:
3464
3513
  :type config: baidubce.BceClientConfiguration
3465
3514
  :return:
@@ -3467,7 +3516,14 @@ class BccClient(bce_base_client.BceBaseClient):
3467
3516
  """
3468
3517
  security_group_rule_id = compat.convert_to_bytes(security_group_rule_id)
3469
3518
  path = b'/securityGroup/rule/%s' % security_group_rule_id
3470
- return self._send_request(http_methods.DELETE, path, params=None, config=config)
3519
+ params = {}
3520
+ if sg_version is not None:
3521
+ params['sgVersion'] = sg_version
3522
+ if client_token is None:
3523
+ params['clientToken'] = generate_client_token()
3524
+ else:
3525
+ params['clientToken'] = client_token
3526
+ return self._send_request(http_methods.DELETE, path, params=params if params else None, config=config)
3471
3527
 
3472
3528
  @required(security_group_id=(bytes, str)) # ***Unicode***
3473
3529
  def get_security_group_detail(self, security_group_id, config=None):
@@ -4058,7 +4114,7 @@ class BccClient(bce_base_client.BceBaseClient):
4058
4114
  hosteye_type=None, res_group_id=None, enable_ht=None, data_partition_type=None,
4059
4115
  root_partition_type=None, file_systems=None, disable_root_disk_serial=None,
4060
4116
  internal_ips=None, network_purchase_type=None, is_keep_image_login=None,
4061
- reserved_instance=None):
4117
+ reserved_instance=None, is_eip_auto_related_delete=None):
4062
4118
  """
4063
4119
  Create a bcc Instance with the specified options.
4064
4120
  You must fill the field of clientToken,which is especially for keeping idempotent.
@@ -4321,6 +4377,11 @@ class BccClient(bce_base_client.BceBaseClient):
4321
4377
  EIP line type, including Standard BGP (BGP) and Enhanced BGP (BGP_S).The default value is Standard BGP.
4322
4378
  :type network_purchase_type: string
4323
4379
 
4380
+ :param is_eip_auto_related_delete
4381
+ Whether to automatically delete the EIP associated with the instance after the instance is released.
4382
+ The default value is False.
4383
+ :type is_eip_auto_related_delete: boolean
4384
+
4324
4385
  :return:
4325
4386
  :rtype baidubce.bce_response.BceResponse
4326
4387
  """
@@ -4357,6 +4418,8 @@ class BccClient(bce_base_client.BceBaseClient):
4357
4418
  body['autoSeqSuffix'] = auto_seq_suffix
4358
4419
  if is_open_hostname_domain is not None:
4359
4420
  body['isOpenHostnameDomain'] = is_open_hostname_domain
4421
+ if is_eip_auto_related_delete is not None:
4422
+ body['isEipAutoRelatedDelete'] = is_eip_auto_related_delete
4360
4423
  if admin_pass is not None:
4361
4424
  secret_access_key = self.config.credentials.secret_access_key
4362
4425
  cipher_admin_pass = aes128_encrypt_16char_key(admin_pass, secret_access_key)
@@ -4450,7 +4513,8 @@ class BccClient(bce_base_client.BceBaseClient):
4450
4513
  params=params, config=config)
4451
4514
 
4452
4515
  @required(instance_id=(bytes, str))
4453
- def auto_release_instance(self, instance_id, release_time=None, client_token=None, config=None):
4516
+ def auto_release_instance(self, instance_id, release_time=None, client_token=None, config=None,
4517
+ is_eip_auto_related_delete=None):
4454
4518
  """
4455
4519
  set instance auto release.
4456
4520
 
@@ -4462,6 +4526,9 @@ class BccClient(bce_base_client.BceBaseClient):
4462
4526
  The new value for instance's name.
4463
4527
  :type release_time: string in format yyyy-MM-dd'T'HH:mm:ss'Z'.
4464
4528
 
4529
+ :param is_eip_auto_related_delete:
4530
+ Auto delete eip when instance is released.
4531
+
4465
4532
  :param client_token:
4466
4533
  An ASCII string whose length is less than 64.
4467
4534
  The request will be idempotent if client token is provided.
@@ -4485,7 +4552,8 @@ class BccClient(bce_base_client.BceBaseClient):
4485
4552
  # instance_id = instance_id.encode(encoding='utf-8')
4486
4553
  path = b'/instance/%s' % instance_id
4487
4554
  body = {
4488
- 'releaseTime': release_time
4555
+ 'releaseTime': release_time,
4556
+ 'isEipAutoRelatedDelete': is_eip_auto_related_delete
4489
4557
  }
4490
4558
  return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
4491
4559
 
@@ -7124,6 +7192,95 @@ class BccClient(bce_base_client.BceBaseClient):
7124
7192
  return self._send_request(http_methods.POST, path, json.dumps(body),
7125
7193
  params=params, config=config)
7126
7194
 
7195
+ def create_snapshot_share(self, snapshot_id, account_ids, client_token=None, config=None):
7196
+ """
7197
+ Create a share link for the specified snapshot.
7198
+
7199
+ :param snapshot_id:
7200
+ Snapshot id.
7201
+ :type snapshot_id: string
7202
+
7203
+ :param account_ids:
7204
+ Account ids that can access the snapshot.
7205
+ :type account_ids: list
7206
+
7207
+ :return:
7208
+ :rtype baidubce.bce_response.BceResponse
7209
+ """
7210
+ path = b'/snapshot/share'
7211
+ params = {}
7212
+ if client_token is None:
7213
+ params['clientToken'] = generate_client_token()
7214
+ else:
7215
+ params['clientToken'] = client_token
7216
+ body = {
7217
+ 'snapshotId': snapshot_id,
7218
+ 'accountIds': account_ids
7219
+ }
7220
+ return self._send_request(http_methods.POST, path, json.dumps(body),
7221
+ params=params, config=config)
7222
+
7223
+ def cancel_snapshot_share(self, source_snapshot_id, account_ids, share_snapshot_id, client_token=None, config=None):
7224
+ """
7225
+ Cancel a share link for the specified snapshot.
7226
+
7227
+ :param source_snapshot_id:
7228
+ Source snapshot id.
7229
+ :type source_snapshot_id: string
7230
+
7231
+ :param account_ids:
7232
+ Account ids that can access the snapshot.
7233
+ :type account_ids: list
7234
+
7235
+ :param share_snapshot_id:
7236
+ Share snapshot id.
7237
+ :type share_snapshot_id: string
7238
+
7239
+ :return:
7240
+ :rtype baidubce.bce_response.BceResponse
7241
+ """
7242
+ path = b'/snapshot/unShare'
7243
+ params = {}
7244
+ if client_token is None:
7245
+ params['clientToken'] = generate_client_token()
7246
+ else:
7247
+ params['clientToken'] = client_token
7248
+ body = {
7249
+ 'sourceSnapshotId': source_snapshot_id,
7250
+ 'accountIds': account_ids,
7251
+ 'shareSnapshotId': share_snapshot_id
7252
+ }
7253
+ return self._send_request(http_methods.POST, path, json.dumps(body),
7254
+ params=params, config=config)
7255
+
7256
+ def list_snapshot_share(self, marker, max_keys, client_token=None, config=None):
7257
+ """
7258
+ List all snapshots shared with you.
7259
+
7260
+ :param marker:
7261
+ The marker used for pagination.
7262
+ :type marker: string
7263
+
7264
+ :param max_keys:
7265
+ Maximum number of results returned per request.
7266
+ :type max_keys: int
7267
+
7268
+ :return:
7269
+ :rtype baidubce.bce_response.BceResponse
7270
+ """
7271
+ path = b'/snapshot/snapshotShare/list'
7272
+ params = {}
7273
+ if client_token is None:
7274
+ params['clientToken'] = generate_client_token()
7275
+ else:
7276
+ params['clientToken'] = client_token
7277
+ body = {
7278
+ 'marker': marker,
7279
+ 'maxKeys': max_keys
7280
+ }
7281
+ return self._send_request(http_methods.POST, path, json.dumps(body), params=params, config=config)
7282
+
7283
+
7127
7284
  def enter_rescue_mode(self, instance_id, force_stop, password, client_token=None, config=None):
7128
7285
  """
7129
7286
  进入救援模式。
@@ -7861,6 +8018,96 @@ class BccClient(bce_base_client.BceBaseClient):
7861
8018
  return self._send_request(http_methods.POST, path, json.dumps(body),
7862
8019
  params=params, config=config)
7863
8020
 
8021
+ def get_cds_price(self, purchase_length, payment_timing, storage_type, cds_size_in_gb, purchase_count, zone_name,
8022
+ encrypt_key=None, client_token=None, config=None):
8023
+ """
8024
+ get_deploy_set
8025
+ """
8026
+ path = b'/volume/getPrice'
8027
+ params = {}
8028
+ if client_token is None:
8029
+ params['clientToken'] = generate_client_token()
8030
+ else:
8031
+ params['clientToken'] = client_token
8032
+ body = {
8033
+ 'purchaseLength': purchase_length,
8034
+ 'paymentTiming': payment_timing,
8035
+ 'storageType': storage_type,
8036
+ 'cdsSizeInGB': cds_size_in_gb,
8037
+ 'purchaseCount': purchase_count,
8038
+ 'zoneName': zone_name
8039
+ }
8040
+ if encrypt_key is not None:
8041
+ body['encryptKey'] = encrypt_key
8042
+ return self._send_request(http_methods.POST, path, json.dumps(body),
8043
+ params=params, config=config)
8044
+
8045
+ def get_diagnostic_schemas(self, config=None):
8046
+ """
8047
+ get_deploy_set
8048
+ """
8049
+ path = b'/instance/diagnosticReport/schemas'
8050
+ return self._send_request(http_methods.GET, path, config=config)
8051
+
8052
+ def list_diagnostic_report(self, report_id, instance_id, status,
8053
+ severity, instance_type="bcc", max_keys=100, client_token=None, config=None):
8054
+ """
8055
+ list_diagnostic_report
8056
+ """
8057
+ path = b'/instance/diagnosticReport/list'
8058
+ params = {}
8059
+ if client_token is None:
8060
+ params['clientToken'] = generate_client_token()
8061
+ else:
8062
+ params['clientToken'] = client_token
8063
+ body = {
8064
+ 'maxKeys': max_keys,
8065
+ 'reportId': report_id,
8066
+ 'instanceType': instance_type,
8067
+ 'instanceId': instance_id,
8068
+ 'status': status,
8069
+ 'severity': severity
8070
+ }
8071
+ return self._send_request(http_methods.POST, path, json.dumps(body),
8072
+ params=params, config=config)
8073
+
8074
+ def create_diagnostic(self, metric_set_id, instance_id, pid, instance_type="bcc", duration=180,
8075
+ client_token=None, config=None):
8076
+ """
8077
+ create_diagnostic
8078
+ """
8079
+ path = b'/instance/diagnosticReport/create'
8080
+ params = {}
8081
+ if client_token is None:
8082
+ params['clientToken'] = generate_client_token()
8083
+ else:
8084
+ params['clientToken'] = client_token
8085
+ body = {
8086
+ 'metricSetId': metric_set_id,
8087
+ 'instanceType': instance_type,
8088
+ 'instanceId': instance_id,
8089
+ 'pid': pid,
8090
+ 'duration': duration
8091
+ }
8092
+ return self._send_request(http_methods.POST, path, json.dumps(body),
8093
+ params=params, config=config)
8094
+
8095
+ def delete_diagnostic_report(self, report_ids, client_token=None, config=None):
8096
+ """
8097
+ delete_diagnostic_report
8098
+ """
8099
+ path = b'/instance/diagnosticReport/delete'
8100
+ params = {}
8101
+ if client_token is None:
8102
+ params['clientToken'] = generate_client_token()
8103
+ else:
8104
+ params['clientToken'] = client_token
8105
+ body = {
8106
+ 'reportIds': report_ids
8107
+ }
8108
+ return self._send_request(http_methods.POST, path, json.dumps(body),
8109
+ params=params, config=config)
8110
+
7864
8111
 
7865
8112
  def generate_client_token_by_uuid():
7866
8113
  """
@@ -7882,30 +8129,4 @@ def generate_client_token_by_random():
7882
8129
  client_token = ''.join(random.sample(string.ascii_letters + string.digits, 36))
7883
8130
  return client_token
7884
8131
 
7885
-
7886
- def get_cds_price(self, purchase_length, payment_timing, storage_type, cds_size_in_gb, purchase_count, zone_name,
7887
- encrypt_key=None, client_token=None, config=None):
7888
- """
7889
- get_deploy_set
7890
- """
7891
- path = b'/volume/getPrice'
7892
- params = {}
7893
- if client_token is None:
7894
- params['clientToken'] = generate_client_token()
7895
- else:
7896
- params['clientToken'] = client_token
7897
- body = {
7898
- 'purchaseLength': purchase_length,
7899
- 'paymentTiming': payment_timing,
7900
- 'storageType': storage_type,
7901
- 'cdsSizeInGB': cds_size_in_gb,
7902
- 'purchaseCount': purchase_count,
7903
- 'zoneName': zone_name
7904
- }
7905
- if encrypt_key is not None:
7906
- body['encryptKey'] = encrypt_key
7907
- return self._send_request(http_methods.POST, path, json.dumps(body),
7908
- params=params, config=config)
7909
-
7910
-
7911
8132
  generate_client_token = generate_client_token_by_uuid