bce-python-sdk 0.9.60__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 +1 -1
- baidubce/auth/bce_v1_signer.py +3 -0
- baidubce/services/bcc/bcc_client.py +260 -51
- baidubce/services/blb/app_blb_client.py +115 -20
- baidubce/services/blb/blb_client.py +237 -34
- baidubce/services/eip/eip_bp_client.py +10 -1
- baidubce/services/eip/eip_client.py +152 -9
- baidubce/services/eip/eip_group_client.py +59 -15
- baidubce/services/eip/eip_tp_client.py +54 -0
- baidubce/services/eni/eni_client.py +20 -48
- baidubce/services/esg/esg_client.py +72 -16
- baidubce/services/esg/esg_model.py +14 -1
- baidubce/services/route/route_client.py +5 -5
- baidubce/services/vpc/vpc_client.py +61 -11
- {bce_python_sdk-0.9.60.dist-info → bce_python_sdk-0.9.63.dist-info}/METADATA +1 -1
- {bce_python_sdk-0.9.60.dist-info → bce_python_sdk-0.9.63.dist-info}/RECORD +18 -18
- {bce_python_sdk-0.9.60.dist-info → bce_python_sdk-0.9.63.dist-info}/WHEEL +1 -1
- {bce_python_sdk-0.9.60.dist-info → bce_python_sdk-0.9.63.dist-info}/top_level.txt +0 -0
baidubce/__init__.py
CHANGED
baidubce/auth/bce_v1_signer.py
CHANGED
|
@@ -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))
|
|
@@ -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,
|
|
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
|
-
|
|
3431
|
+
sg_version=None,
|
|
3432
|
+
client_token=None,
|
|
3433
|
+
config=None,):
|
|
3410
3434
|
"""
|
|
3411
|
-
|
|
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
|
|
3435
|
-
|
|
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
|
-
|
|
3443
|
-
|
|
3444
|
-
'
|
|
3445
|
-
|
|
3446
|
-
'
|
|
3447
|
-
|
|
3448
|
-
'
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
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
|
|
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
|
-
|
|
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):
|
|
@@ -7136,6 +7192,95 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
7136
7192
|
return self._send_request(http_methods.POST, path, json.dumps(body),
|
|
7137
7193
|
params=params, config=config)
|
|
7138
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
|
+
|
|
7139
7284
|
def enter_rescue_mode(self, instance_id, force_stop, password, client_token=None, config=None):
|
|
7140
7285
|
"""
|
|
7141
7286
|
进入救援模式。
|
|
@@ -7873,6 +8018,96 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
7873
8018
|
return self._send_request(http_methods.POST, path, json.dumps(body),
|
|
7874
8019
|
params=params, config=config)
|
|
7875
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
|
+
|
|
7876
8111
|
|
|
7877
8112
|
def generate_client_token_by_uuid():
|
|
7878
8113
|
"""
|
|
@@ -7894,30 +8129,4 @@ def generate_client_token_by_random():
|
|
|
7894
8129
|
client_token = ''.join(random.sample(string.ascii_letters + string.digits, 36))
|
|
7895
8130
|
return client_token
|
|
7896
8131
|
|
|
7897
|
-
|
|
7898
|
-
def get_cds_price(self, purchase_length, payment_timing, storage_type, cds_size_in_gb, purchase_count, zone_name,
|
|
7899
|
-
encrypt_key=None, client_token=None, config=None):
|
|
7900
|
-
"""
|
|
7901
|
-
get_deploy_set
|
|
7902
|
-
"""
|
|
7903
|
-
path = b'/volume/getPrice'
|
|
7904
|
-
params = {}
|
|
7905
|
-
if client_token is None:
|
|
7906
|
-
params['clientToken'] = generate_client_token()
|
|
7907
|
-
else:
|
|
7908
|
-
params['clientToken'] = client_token
|
|
7909
|
-
body = {
|
|
7910
|
-
'purchaseLength': purchase_length,
|
|
7911
|
-
'paymentTiming': payment_timing,
|
|
7912
|
-
'storageType': storage_type,
|
|
7913
|
-
'cdsSizeInGB': cds_size_in_gb,
|
|
7914
|
-
'purchaseCount': purchase_count,
|
|
7915
|
-
'zoneName': zone_name
|
|
7916
|
-
}
|
|
7917
|
-
if encrypt_key is not None:
|
|
7918
|
-
body['encryptKey'] = encrypt_key
|
|
7919
|
-
return self._send_request(http_methods.POST, path, json.dumps(body),
|
|
7920
|
-
params=params, config=config)
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
8132
|
generate_client_token = generate_client_token_by_uuid
|
|
@@ -76,10 +76,26 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
76
76
|
@required(vpc_id=(bytes, str),
|
|
77
77
|
subnet_id=(bytes, str))
|
|
78
78
|
def create_app_loadbalancer(self, vpc_id, subnet_id, name=None,
|
|
79
|
-
desc=None,
|
|
79
|
+
desc=None, address=None, type=None,
|
|
80
|
+
eip=None, tags=None, billing=None,
|
|
81
|
+
performance_level=None,
|
|
82
|
+
auto_renew_length=None,
|
|
83
|
+
auto_renew_time_unit=None,
|
|
84
|
+
resource_group_id=None,
|
|
85
|
+
allow_delete=None,
|
|
86
|
+
allocate_ipv6=None,
|
|
87
|
+
client_token=None, config=None):
|
|
80
88
|
"""
|
|
81
89
|
Create a app LoadBalancer with the specified options.
|
|
82
90
|
|
|
91
|
+
:param vpc_id:
|
|
92
|
+
id of vpc which the LoadBalancer belong to
|
|
93
|
+
:type vpc_id: string
|
|
94
|
+
|
|
95
|
+
:param subnet_id:
|
|
96
|
+
id of subnet which the LoadBalancer belong to
|
|
97
|
+
:type subnet_id: string
|
|
98
|
+
|
|
83
99
|
:param name:
|
|
84
100
|
the name of LoadBalancer to create
|
|
85
101
|
:type name: string
|
|
@@ -88,13 +104,49 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
88
104
|
The description of LoadBalancer
|
|
89
105
|
:type desc: string
|
|
90
106
|
|
|
91
|
-
:param
|
|
92
|
-
|
|
93
|
-
:type
|
|
107
|
+
:param type:
|
|
108
|
+
LoadBalancer type, default is "application"
|
|
109
|
+
:type type: string
|
|
94
110
|
|
|
95
|
-
:param
|
|
96
|
-
|
|
97
|
-
:type
|
|
111
|
+
:param address:
|
|
112
|
+
specify the private IP address of LoadBalancer
|
|
113
|
+
:type address: string
|
|
114
|
+
|
|
115
|
+
:param eip:
|
|
116
|
+
bind an existing eip to the LoadBalancer
|
|
117
|
+
:type eip: string
|
|
118
|
+
|
|
119
|
+
:param tags:
|
|
120
|
+
list of tag key-value pairs
|
|
121
|
+
:type tags: list
|
|
122
|
+
|
|
123
|
+
:param billing:
|
|
124
|
+
billing information, required for prepaid LoadBalancer
|
|
125
|
+
:type billing: dict
|
|
126
|
+
|
|
127
|
+
:param performance_level:
|
|
128
|
+
performance level parameter
|
|
129
|
+
:type performance_level: string
|
|
130
|
+
|
|
131
|
+
:param auto_renew_length:
|
|
132
|
+
auto renew length
|
|
133
|
+
:type auto_renew_length: int
|
|
134
|
+
|
|
135
|
+
:param auto_renew_time_unit:
|
|
136
|
+
auto renew time unit, "month" or "year"
|
|
137
|
+
:type auto_renew_time_unit: string
|
|
138
|
+
|
|
139
|
+
:param resource_group_id:
|
|
140
|
+
resource group id
|
|
141
|
+
:type resource_group_id: string
|
|
142
|
+
|
|
143
|
+
:param allow_delete:
|
|
144
|
+
whether allow to delete, default is true
|
|
145
|
+
:type allow_delete: bool
|
|
146
|
+
|
|
147
|
+
:param allocate_ipv6:
|
|
148
|
+
whether allocate ipv6 address
|
|
149
|
+
:type allocate_ipv6: bool
|
|
98
150
|
|
|
99
151
|
:param client_token:
|
|
100
152
|
If the clientToken is not specified by the user, a random String
|
|
@@ -116,12 +168,35 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
116
168
|
params[b'clientToken'] = client_token
|
|
117
169
|
|
|
118
170
|
body = {}
|
|
171
|
+
body['vpcId'] = compat.convert_to_string(vpc_id)
|
|
172
|
+
body['subnetId'] = compat.convert_to_string(subnet_id)
|
|
173
|
+
|
|
119
174
|
if name is not None:
|
|
120
175
|
body['name'] = compat.convert_to_string(name)
|
|
121
176
|
if desc is not None:
|
|
122
177
|
body['desc'] = compat.convert_to_string(desc)
|
|
123
|
-
|
|
124
|
-
|
|
178
|
+
if address is not None:
|
|
179
|
+
body['address'] = compat.convert_to_string(address)
|
|
180
|
+
if type is not None:
|
|
181
|
+
body['type'] = compat.convert_to_string(type)
|
|
182
|
+
if eip is not None:
|
|
183
|
+
body['eip'] = compat.convert_to_string(eip)
|
|
184
|
+
if tags is not None:
|
|
185
|
+
body['tags'] = tags
|
|
186
|
+
if billing is not None:
|
|
187
|
+
body['billing'] = billing
|
|
188
|
+
if performance_level is not None:
|
|
189
|
+
body['performanceLevel'] = compat.convert_to_string(performance_level)
|
|
190
|
+
if auto_renew_length is not None:
|
|
191
|
+
body['autoRenewLength'] = auto_renew_length
|
|
192
|
+
if auto_renew_time_unit is not None:
|
|
193
|
+
body['autoRenewTimeUnit'] = compat.convert_to_string(auto_renew_time_unit)
|
|
194
|
+
if resource_group_id is not None:
|
|
195
|
+
body['resourceGroupId'] = compat.convert_to_string(resource_group_id)
|
|
196
|
+
if allow_delete is not None:
|
|
197
|
+
body['allowDelete'] = allow_delete
|
|
198
|
+
if allocate_ipv6 is not None:
|
|
199
|
+
body['allocateIpv6'] = allocate_ipv6
|
|
125
200
|
|
|
126
201
|
return self._send_request(http_methods.POST, path,
|
|
127
202
|
body=json.dumps(body), params=params,
|
|
@@ -129,23 +204,32 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
129
204
|
|
|
130
205
|
@required(blb_id=(bytes, str))
|
|
131
206
|
def update_app_loadbalancer(self, blb_id, name=None, desc=None,
|
|
207
|
+
allow_delete=None, allocate_ipv6=None,
|
|
132
208
|
client_token=None, config=None):
|
|
133
209
|
"""
|
|
134
210
|
Modify the special attribute to new value of the LoadBalancer
|
|
135
211
|
owned by the user.
|
|
136
212
|
|
|
137
|
-
:param name:
|
|
138
|
-
name of LoadBalancer to describe
|
|
139
|
-
:type name: string
|
|
140
|
-
|
|
141
213
|
:param blb_id:
|
|
142
|
-
id of LoadBalancer to
|
|
214
|
+
id of LoadBalancer to update
|
|
143
215
|
:type blb_id: string
|
|
144
216
|
|
|
217
|
+
:param name:
|
|
218
|
+
name of LoadBalancer
|
|
219
|
+
:type name: string
|
|
220
|
+
|
|
145
221
|
:param desc:
|
|
146
222
|
The description of LoadBalancer
|
|
147
223
|
:type desc: string
|
|
148
224
|
|
|
225
|
+
:param allow_delete:
|
|
226
|
+
whether allow to delete, default is true
|
|
227
|
+
:type allow_delete: bool
|
|
228
|
+
|
|
229
|
+
:param allocate_ipv6:
|
|
230
|
+
whether allocate ipv6 address
|
|
231
|
+
:type allocate_ipv6: bool
|
|
232
|
+
|
|
149
233
|
:param client_token:
|
|
150
234
|
If the clientToken is not specified by the user,
|
|
151
235
|
a random String generated by default algorithm
|
|
@@ -171,12 +255,17 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
171
255
|
body['name'] = compat.convert_to_string(name)
|
|
172
256
|
if desc is not None:
|
|
173
257
|
body['desc'] = compat.convert_to_string(desc)
|
|
258
|
+
if allow_delete is not None:
|
|
259
|
+
body['allowDelete'] = allow_delete
|
|
260
|
+
if allocate_ipv6 is not None:
|
|
261
|
+
body['allocateIpv6'] = allocate_ipv6
|
|
174
262
|
|
|
175
263
|
return self._send_request(http_methods.PUT, path, json.dumps(body),
|
|
176
264
|
params=params, config=config)
|
|
177
265
|
|
|
178
266
|
def describe_app_loadbalancers(self, address=None, name=None, blb_id=None,
|
|
179
|
-
bcc_id=None,
|
|
267
|
+
bcc_id=None, exactly_match=None,
|
|
268
|
+
marker=None, max_keys=None,
|
|
180
269
|
config=None):
|
|
181
270
|
"""
|
|
182
271
|
Return a list of LoadBalancers
|
|
@@ -190,13 +279,17 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
190
279
|
:type name: string
|
|
191
280
|
|
|
192
281
|
:param blb_id:
|
|
193
|
-
id of LoadBalancer to describe
|
|
282
|
+
id of LoadBalancer to describe (exact match only)
|
|
194
283
|
:type blb_id: string
|
|
195
284
|
|
|
196
285
|
:param bcc_id:
|
|
197
|
-
bcc which bind the LoadBalancers
|
|
286
|
+
bcc which bind the LoadBalancers (exact match only)
|
|
198
287
|
:type bcc_id: string
|
|
199
288
|
|
|
289
|
+
:param exactly_match:
|
|
290
|
+
true for exact match, false for fuzzy match, default is false
|
|
291
|
+
:type exactly_match: bool
|
|
292
|
+
|
|
200
293
|
:param marker:
|
|
201
294
|
The optional parameter marker specified in the original
|
|
202
295
|
request to specify where in the results to begin listing.
|
|
@@ -206,9 +299,9 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
206
299
|
listing from the first one.
|
|
207
300
|
:type marker: string
|
|
208
301
|
|
|
209
|
-
:param max_keys
|
|
210
|
-
|
|
211
|
-
|
|
302
|
+
:param max_keys:
|
|
303
|
+
The optional parameter to specifies the max number of list
|
|
304
|
+
result to return.
|
|
212
305
|
The default value is 1000.
|
|
213
306
|
:type max_keys: int
|
|
214
307
|
|
|
@@ -229,6 +322,8 @@ class AppBlbClient(bce_base_client.BceBaseClient):
|
|
|
229
322
|
params[b'blbId'] = blb_id
|
|
230
323
|
if bcc_id is not None:
|
|
231
324
|
params[b'bccId'] = bcc_id
|
|
325
|
+
if exactly_match is not None:
|
|
326
|
+
params[b'exactlyMatch'] = exactly_match
|
|
232
327
|
if marker is not None:
|
|
233
328
|
params[b'marker'] = marker
|
|
234
329
|
if max_keys is not None:
|