bce-python-sdk 0.9.14__py3-none-any.whl → 0.9.19__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/services/bcc/bcc_client.py +368 -13
- baidubce/services/bcc/bcc_model.py +12 -0
- baidubce/services/ca/__init__.py +0 -0
- baidubce/services/ca/ca_client.py +326 -0
- baidubce/services/ca/ca_handler.py +84 -0
- baidubce/services/ca/ca_model.py +129 -0
- baidubce/services/sms/sms_client.py +14 -4
- {bce_python_sdk-0.9.14.dist-info → bce_python_sdk-0.9.19.dist-info}/METADATA +1 -1
- {bce_python_sdk-0.9.14.dist-info → bce_python_sdk-0.9.19.dist-info}/RECORD +12 -8
- {bce_python_sdk-0.9.14.dist-info → bce_python_sdk-0.9.19.dist-info}/WHEEL +1 -1
- {bce_python_sdk-0.9.14.dist-info → bce_python_sdk-0.9.19.dist-info}/top_level.txt +0 -0
baidubce/__init__.py
CHANGED
|
@@ -88,7 +88,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
88
88
|
zone_name=None, subnet_id=None, security_group_id=None, gpuCard=None, fpgaCard=None,
|
|
89
89
|
spec=None, eip_name=None, hostname=None, auto_seq_suffix=False, is_open_hostname_domain=False,
|
|
90
90
|
relation_tag=None, is_open_ipv6=None, enterprise_security_group_id=None,
|
|
91
|
-
security_group_ids=None, enterprise_security_group_ids=None,
|
|
91
|
+
security_group_ids=None, enterprise_security_group_ids=None, ehc_cluster_id=None,
|
|
92
92
|
kunlunCard=None, isomerismCard=None, file_systems=None, user_data=None, is_open_hosteye=False,
|
|
93
93
|
deletion_protection=None, res_group_id=None,
|
|
94
94
|
client_token=None, config=None, card_count=1, isomerism_card=None):
|
|
@@ -315,6 +315,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
315
315
|
enterprise_security_group_ids
|
|
316
316
|
:type enterprise_security_group_ids: list<string>
|
|
317
317
|
|
|
318
|
+
:param ehc_cluster_id:
|
|
319
|
+
The id of ehcCluster.
|
|
320
|
+
:type ehc_cluster_id: string
|
|
321
|
+
|
|
318
322
|
:param kunlunCard:
|
|
319
323
|
This parameter is obsolete. Use parameter isomerism_card instead.
|
|
320
324
|
:type kunlunCard: string
|
|
@@ -418,6 +422,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
418
422
|
body['securityGroupIds'] = security_group_ids
|
|
419
423
|
if enterprise_security_group_ids is not None:
|
|
420
424
|
body['enterpriseSecurityGroupIds'] = enterprise_security_group_ids
|
|
425
|
+
if ehc_cluster_id is not None:
|
|
426
|
+
body['ehcClusterId'] = ehc_cluster_id
|
|
421
427
|
if gpuCard is not None:
|
|
422
428
|
body['gpuCard'] = gpuCard
|
|
423
429
|
body['cardCount'] = card_count if card_count > 1 else 1
|
|
@@ -1063,13 +1069,13 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1063
1069
|
body['userData'] = user_data
|
|
1064
1070
|
if res_group_id is not None:
|
|
1065
1071
|
body['resGroupId'] = res_group_id
|
|
1066
|
-
body['isEipAutoRelatedDelete'] = is_eip_auto_related_delete
|
|
1072
|
+
body['isEipAutoRelatedDelete'] = is_eip_auto_related_delete
|
|
1067
1073
|
|
|
1068
1074
|
return self._send_request(http_methods.POST, path, json.dumps(body),
|
|
1069
1075
|
params=params, config=config)
|
|
1070
1076
|
|
|
1071
1077
|
def list_instances(self, marker=None, max_keys=None, internal_ip=None, dedicated_host_id=None,
|
|
1072
|
-
zone_name=None, instance_ids=None, instance_names=None, cds_ids=None,
|
|
1078
|
+
zone_name=None, instance_ids=None, instance_names=None, cds_ids=None, ehc_cluster_id=None,
|
|
1073
1079
|
deployset_ids=None, security_group_ids=None, payment_timing=None, status=None, tags=None,
|
|
1074
1080
|
vpc_id=None, private_ips=None, ipv6_addresses=None, auto_renew=None, config=None):
|
|
1075
1081
|
"""
|
|
@@ -1111,6 +1117,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1111
1117
|
filter instance list with multiple cds ids join by ','
|
|
1112
1118
|
:type cds_ids: string
|
|
1113
1119
|
|
|
1120
|
+
:param ehc_cluster_id:
|
|
1121
|
+
get instance list filtered by id of ehc cluster
|
|
1122
|
+
:type ehc_cluster_id: string
|
|
1123
|
+
|
|
1114
1124
|
:param deployset_ids:
|
|
1115
1125
|
filter instance list with multiple deployset ids join by ','
|
|
1116
1126
|
:type deployset_ids: string
|
|
@@ -1171,6 +1181,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1171
1181
|
params['instanceNames'] = instance_names
|
|
1172
1182
|
if cds_ids is not None:
|
|
1173
1183
|
params['cdsIds'] = cds_ids
|
|
1184
|
+
if ehc_cluster_id is not None:
|
|
1185
|
+
params['ehcClusterId'] = ehc_cluster_id
|
|
1174
1186
|
if deployset_ids is not None:
|
|
1175
1187
|
params['deploySetIds'] = deployset_ids
|
|
1176
1188
|
if security_group_ids is not None:
|
|
@@ -1306,13 +1318,28 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1306
1318
|
params=params, config=config)
|
|
1307
1319
|
|
|
1308
1320
|
@required(instance_id=str)
|
|
1309
|
-
def batch_add_ip(self, instance_id, private_ips=None, secondary_private_ip_address_count=None,
|
|
1321
|
+
def batch_add_ip(self, instance_id, private_ips=None, secondary_private_ip_address_count=None,
|
|
1322
|
+
allocate_multi_ipv6_addr=None, config=None):
|
|
1310
1323
|
"""
|
|
1311
1324
|
batch_add_ip
|
|
1325
|
+
|
|
1312
1326
|
:param instance_id:
|
|
1327
|
+
The id of instance.
|
|
1328
|
+
:type instance_id: string
|
|
1329
|
+
|
|
1313
1330
|
:param private_ips:
|
|
1331
|
+
The IPV6/IPV4 address that needs to be added must exist with secondary_private_ip_address_count.
|
|
1332
|
+
:type private_ips: list
|
|
1333
|
+
|
|
1314
1334
|
:param secondary_private_ip_address_count:
|
|
1315
|
-
|
|
1335
|
+
The number of IPV6/IPV4 needs to be increased, and one with private_ips must exist.
|
|
1336
|
+
:type secondary_private_ip_address_count: list
|
|
1337
|
+
|
|
1338
|
+
:param allocate_multi_ipv6_addr:
|
|
1339
|
+
The parameter indicates whether to support multiple IPV6.
|
|
1340
|
+
It must be true to create IPV6.
|
|
1341
|
+
:type allocate_multi_ipv6_addr: bool
|
|
1342
|
+
|
|
1316
1343
|
:return:
|
|
1317
1344
|
:rtype baidubce.bce_response.BceResponse
|
|
1318
1345
|
"""
|
|
@@ -1324,6 +1351,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1324
1351
|
body['privateIps'] = private_ips
|
|
1325
1352
|
if secondary_private_ip_address_count is not None:
|
|
1326
1353
|
body['secondaryPrivateIpAddressCount'] = secondary_private_ip_address_count
|
|
1354
|
+
if allocate_multi_ipv6_addr is not None:
|
|
1355
|
+
body['allocateMultiIpv6Addr'] = allocate_multi_ipv6_addr
|
|
1327
1356
|
params = {
|
|
1328
1357
|
|
|
1329
1358
|
}
|
|
@@ -1387,7 +1416,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1387
1416
|
|
|
1388
1417
|
@required(instance_id=(bytes, str), # ***Unicode***
|
|
1389
1418
|
name=(bytes, str)) # ***Unicode***
|
|
1390
|
-
def modify_instance_attributes(self, instance_id, name=None, neteth_queuecount=None,
|
|
1419
|
+
def modify_instance_attributes(self, instance_id, name=None, neteth_queuecount=None,
|
|
1420
|
+
enable_jumbo_frame=None, config=None):
|
|
1391
1421
|
"""
|
|
1392
1422
|
Modifying the special attribute to new value of the instance.
|
|
1393
1423
|
You can reboot the instance only when the instance is Running or Stopped ,
|
|
@@ -1405,6 +1435,13 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1405
1435
|
The new value for instance's neteth_queuecount.
|
|
1406
1436
|
:type neteth_queuecount: string
|
|
1407
1437
|
|
|
1438
|
+
:param enable_jumbo_frame:
|
|
1439
|
+
The parameter indicates whether the instance is enabled for JumboFrame.
|
|
1440
|
+
It can only be enabled when the flavor support JumboFrame.
|
|
1441
|
+
True indicates enabled, false indicates disabled,
|
|
1442
|
+
:type enable_jumbo_frame: bool
|
|
1443
|
+
|
|
1444
|
+
|
|
1408
1445
|
:return:
|
|
1409
1446
|
:rtype baidubce.bce_response.BceResponse
|
|
1410
1447
|
"""
|
|
@@ -1414,6 +1451,8 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
1414
1451
|
'name': name,
|
|
1415
1452
|
'netEthQueueCount': neteth_queuecount
|
|
1416
1453
|
}
|
|
1454
|
+
if enable_jumbo_frame is not None:
|
|
1455
|
+
body['enableJumboFrame'] = enable_jumbo_frame
|
|
1417
1456
|
params = {
|
|
1418
1457
|
'modifyAttribute': None
|
|
1419
1458
|
}
|
|
@@ -3863,10 +3902,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
3863
3902
|
auto_seq_suffix=None, is_open_hostname_domain=None, admin_pass=None, billing=None,
|
|
3864
3903
|
zone_name=None, subnet_id=None, security_group_id=None,
|
|
3865
3904
|
enterprise_security_group_id=None, security_group_ids=None,
|
|
3866
|
-
enterprise_security_group_ids=None, relation_tag=None,
|
|
3905
|
+
enterprise_security_group_ids=None, relation_tag=None, ehc_cluster_id=None,
|
|
3867
3906
|
is_open_ipv6=None, tags=None, key_pair_id=None, auto_renew_time_unit=None,
|
|
3868
3907
|
auto_renew_time=0, cds_auto_renew=None, asp_id=None, bid_model=None, bid_price=None,
|
|
3869
|
-
dedicate_host_id=None, deploy_id=None, deploy_id_list=None,
|
|
3908
|
+
dedicate_host_id=None, deploy_id=None, deploy_id_list=None, enable_jumbo_frame=None,
|
|
3870
3909
|
client_token=None, config=None):
|
|
3871
3910
|
"""
|
|
3872
3911
|
Create a bcc Instance with the specified options.
|
|
@@ -3975,6 +4014,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
3975
4014
|
The parameter to specify whether the instance related to existing tags
|
|
3976
4015
|
:type relation_tag: boolean
|
|
3977
4016
|
|
|
4017
|
+
:param ehc_cluster_id:
|
|
4018
|
+
The id of ehcCluster.
|
|
4019
|
+
:type ehc_cluster_id: string
|
|
4020
|
+
|
|
3978
4021
|
:param is_open_ipv6:
|
|
3979
4022
|
The parameter indicates whether the instance to be created is enabled for IPv6.
|
|
3980
4023
|
It can only be enabled when both the image and subnet support IPv6.
|
|
@@ -4060,6 +4103,12 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
4060
4103
|
The default value is false.
|
|
4061
4104
|
:type cds_auto_renew: boolean
|
|
4062
4105
|
|
|
4106
|
+
:param enable_jumbo_frame:
|
|
4107
|
+
The parameter indicates whether the instance is enabled for JumboFrame.
|
|
4108
|
+
It can only be enabled when the flavor support JumboFrame.
|
|
4109
|
+
True indicates enabled, false indicates disabled,
|
|
4110
|
+
:type enable_jumbo_frame: bool
|
|
4111
|
+
|
|
4063
4112
|
:return:
|
|
4064
4113
|
:rtype baidubce.bce_response.BceResponse
|
|
4065
4114
|
"""
|
|
@@ -4138,11 +4187,15 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
4138
4187
|
body['aspId'] = asp_id
|
|
4139
4188
|
if relation_tag is not None:
|
|
4140
4189
|
body['relationTag'] = relation_tag
|
|
4190
|
+
if ehc_cluster_id is not None:
|
|
4191
|
+
body['ehcClusterId'] = ehc_cluster_id
|
|
4141
4192
|
if is_open_ipv6 is not None:
|
|
4142
4193
|
body['isOpenIpv6'] = is_open_ipv6
|
|
4143
4194
|
if tags is not None:
|
|
4144
4195
|
tag_list = [tag.__dict__ for tag in tags]
|
|
4145
4196
|
body['tags'] = tag_list
|
|
4197
|
+
if enable_jumbo_frame is not None:
|
|
4198
|
+
body['enableJumboFrame'] = enable_jumbo_frame
|
|
4146
4199
|
body['cdsAutoRenew'] = cds_auto_renew
|
|
4147
4200
|
|
|
4148
4201
|
return self._send_request(http_methods.POST, path, json.dumps(body),
|
|
@@ -4688,7 +4741,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
4688
4741
|
return self._send_request(http_methods.PUT, path, json.dumps(body), params=params, config=config)
|
|
4689
4742
|
|
|
4690
4743
|
@required(instance_id=(bytes, str), is_eip_auto_related_delete=bool)
|
|
4691
|
-
def modify_related_delete_policy(self, instance_id, is_eip_auto_related_delete, client_token=None, config=None):
|
|
4744
|
+
def modify_related_delete_policy(self, instance_id, is_eip_auto_related_delete, client_token=None, config=None):
|
|
4692
4745
|
"""
|
|
4693
4746
|
Set bid instance eip_auto_related_delete.
|
|
4694
4747
|
|
|
@@ -5175,7 +5228,9 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5175
5228
|
return self._send_request(http_methods.GET, path, prefix=b"/v1", params=params, config=config)
|
|
5176
5229
|
|
|
5177
5230
|
def instance_change_subnet(self, instance_id, subnet_id=None,
|
|
5178
|
-
internal_ip=None, reboot=None,
|
|
5231
|
+
internal_ip=None, reboot=None,
|
|
5232
|
+
security_group_ids=None, enterprise_security_group_ids=None,
|
|
5233
|
+
client_token=None, config=None):
|
|
5179
5234
|
"""
|
|
5180
5235
|
Change instance subnet by id.
|
|
5181
5236
|
|
|
@@ -5195,6 +5250,12 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5195
5250
|
Reboot instance or not. Default value is False.
|
|
5196
5251
|
:type reboot: bool
|
|
5197
5252
|
|
|
5253
|
+
:param security_group_ids:
|
|
5254
|
+
:type security_group_ids: list<string>
|
|
5255
|
+
|
|
5256
|
+
:param enterprise_security_group_ids:
|
|
5257
|
+
:type enterprise_security_group_ids: list<string>
|
|
5258
|
+
|
|
5198
5259
|
:return:
|
|
5199
5260
|
:rtype baidubce.bce_response.BceResponse
|
|
5200
5261
|
"""
|
|
@@ -5215,6 +5276,12 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5215
5276
|
if reboot is not None:
|
|
5216
5277
|
body['reboot'] = reboot
|
|
5217
5278
|
|
|
5279
|
+
if security_group_ids is not None:
|
|
5280
|
+
body['securityGroupIds'] = security_group_ids
|
|
5281
|
+
|
|
5282
|
+
if enterprise_security_group_ids is not None:
|
|
5283
|
+
body['enterpriseSecurityGroupIds'] = enterprise_security_group_ids
|
|
5284
|
+
|
|
5218
5285
|
return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
|
|
5219
5286
|
|
|
5220
5287
|
def instance_change_vpc(self, instance_id, subnet_id=None,
|
|
@@ -5489,7 +5556,7 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5489
5556
|
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
5490
5557
|
|
|
5491
5558
|
def batch_create_auto_renew_rules(self, instance_id, renew_time_unit="month", renew_time=1,
|
|
5492
|
-
client_token=None, config=None):
|
|
5559
|
+
renew_cds=None, renew_eip=None, client_token=None, config=None):
|
|
5493
5560
|
"""
|
|
5494
5561
|
create auto renew rules for instance
|
|
5495
5562
|
|
|
@@ -5504,6 +5571,10 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5504
5571
|
:param renew_time:
|
|
5505
5572
|
renew time of year, values: 1/2/3, default value: 1
|
|
5506
5573
|
:type renew_time: int
|
|
5574
|
+
:param renew_cds:
|
|
5575
|
+
renew cds, values: True/False, default value: True
|
|
5576
|
+
:param renew_eip:
|
|
5577
|
+
renew eip, values: True/False, default value: True
|
|
5507
5578
|
|
|
5508
5579
|
:return:
|
|
5509
5580
|
:rtype baidubce.bce_response.BceResponse
|
|
@@ -5519,16 +5590,25 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5519
5590
|
"renewTimeUnit": renew_time_unit,
|
|
5520
5591
|
"renewTime": renew_time
|
|
5521
5592
|
}
|
|
5593
|
+
if renew_cds is not None:
|
|
5594
|
+
body["renewCds"] = renew_cds
|
|
5595
|
+
if renew_eip is not None:
|
|
5596
|
+
body["renewEip"] = renew_eip
|
|
5597
|
+
|
|
5522
5598
|
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
5523
5599
|
|
|
5524
|
-
def batch_delete_auto_renew_rules(self, instance_id,
|
|
5600
|
+
def batch_delete_auto_renew_rules(self, instance_id, renew_cds=None, renew_eip=None,
|
|
5601
|
+
client_token=None, config=None):
|
|
5525
5602
|
"""
|
|
5526
5603
|
delete auto renew rules for instance
|
|
5527
5604
|
|
|
5528
5605
|
:param instance_id:
|
|
5529
5606
|
Identify of the instance to auto renew
|
|
5530
5607
|
:type instance_id: string
|
|
5531
|
-
|
|
5608
|
+
:param renew_cds:
|
|
5609
|
+
renew cds, values: True/False, default value: True
|
|
5610
|
+
:param renew_eip:
|
|
5611
|
+
renew eip, values: True/False, default value: True
|
|
5532
5612
|
:return:
|
|
5533
5613
|
:rtype baidubce.bce_response.BceResponse
|
|
5534
5614
|
"""
|
|
@@ -5541,6 +5621,12 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
5541
5621
|
body = {
|
|
5542
5622
|
"instanceId": instance_id
|
|
5543
5623
|
}
|
|
5624
|
+
|
|
5625
|
+
if renew_cds is not None:
|
|
5626
|
+
body["renewCds"] = renew_cds
|
|
5627
|
+
if renew_eip is not None:
|
|
5628
|
+
body["renewEip"] = renew_eip
|
|
5629
|
+
|
|
5544
5630
|
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
5545
5631
|
|
|
5546
5632
|
def delete_recycled_instance(self, instance_id, client_token=None, config=None):
|
|
@@ -6364,6 +6450,128 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
6364
6450
|
}
|
|
6365
6451
|
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
6366
6452
|
|
|
6453
|
+
def create_ehc_cluster(self, name, zone_name, description=None, client_token=None, config=None):
|
|
6454
|
+
"""
|
|
6455
|
+
create ehc cluster
|
|
6456
|
+
|
|
6457
|
+
:param name:
|
|
6458
|
+
The name of the EHC cluster. This parameter is required.
|
|
6459
|
+
:type name: string
|
|
6460
|
+
|
|
6461
|
+
:param zone_name:
|
|
6462
|
+
The availability zone name where the EHC cluster will be created.
|
|
6463
|
+
:type zone_name: string
|
|
6464
|
+
|
|
6465
|
+
:param description:
|
|
6466
|
+
Optional. A brief description of the EHC cluster. Default is an empty string.
|
|
6467
|
+
:type description: string
|
|
6468
|
+
|
|
6469
|
+
:return:
|
|
6470
|
+
:rtype baidubce.bce_response.BceResponse
|
|
6471
|
+
"""
|
|
6472
|
+
path = b'/instance/ehc/cluster/create'
|
|
6473
|
+
params = {}
|
|
6474
|
+
if client_token is None:
|
|
6475
|
+
params['clientToken'] = generate_client_token()
|
|
6476
|
+
else:
|
|
6477
|
+
params['clientToken'] = client_token
|
|
6478
|
+
body = {
|
|
6479
|
+
'name': name,
|
|
6480
|
+
'zoneName': zone_name
|
|
6481
|
+
}
|
|
6482
|
+
if description is not None:
|
|
6483
|
+
body['description'] = description
|
|
6484
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
6485
|
+
|
|
6486
|
+
def modify_ehc_cluster(self, ehc_cluster_id, name=None, description=None, client_token=None, config=None):
|
|
6487
|
+
"""
|
|
6488
|
+
Modifies the name and description of an EHC cluster.
|
|
6489
|
+
|
|
6490
|
+
:param ehc_cluster_id:
|
|
6491
|
+
The ID of the EHC cluster to be modified. This parameter is required.
|
|
6492
|
+
:type ehc_cluster_id: string
|
|
6493
|
+
|
|
6494
|
+
:param name:
|
|
6495
|
+
Optional. The new name for the EHC cluster. If not specified, the name will not be changed.
|
|
6496
|
+
:type name: string
|
|
6497
|
+
|
|
6498
|
+
:param description:
|
|
6499
|
+
Optional. The new description for the EHC cluster. If not specified, the description will not be changed.
|
|
6500
|
+
:type description: string
|
|
6501
|
+
|
|
6502
|
+
:return:
|
|
6503
|
+
:rtype baidubce.bce_response.BceResponse
|
|
6504
|
+
"""
|
|
6505
|
+
path = b'/instance/ehc/cluster/modify'
|
|
6506
|
+
params = {}
|
|
6507
|
+
if client_token is None:
|
|
6508
|
+
params['clientToken'] = generate_client_token()
|
|
6509
|
+
else:
|
|
6510
|
+
params['clientToken'] = client_token
|
|
6511
|
+
body = {
|
|
6512
|
+
'ehcClusterId': ehc_cluster_id
|
|
6513
|
+
}
|
|
6514
|
+
if name is not None:
|
|
6515
|
+
body['name'] = name
|
|
6516
|
+
if description is not None:
|
|
6517
|
+
body['description'] = description
|
|
6518
|
+
|
|
6519
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
6520
|
+
|
|
6521
|
+
def get_ehc_cluster_list(self, ehc_cluster_id_list=None, name_list=None, zone_name=None, config=None):
|
|
6522
|
+
"""
|
|
6523
|
+
get ehc cluster list
|
|
6524
|
+
|
|
6525
|
+
:param ehc_cluster_id_list:
|
|
6526
|
+
Optional. List of EHC cluster IDs to filter the results. If not specified, retrieves all clusters.
|
|
6527
|
+
:type ehc_cluster_id_list: list<string>
|
|
6528
|
+
|
|
6529
|
+
:param name_list:
|
|
6530
|
+
Optional. List of EHC cluster names to filter the results. If not specified, retrieves all clusters.
|
|
6531
|
+
:type name_list: list<string>
|
|
6532
|
+
|
|
6533
|
+
:param zone_name:
|
|
6534
|
+
Optional. The name of the availability zone to filter the results.
|
|
6535
|
+
:type zone_name: string
|
|
6536
|
+
|
|
6537
|
+
:return:
|
|
6538
|
+
:rtype baidubce.bce_response.BceResponse
|
|
6539
|
+
"""
|
|
6540
|
+
path = b'/instance/ehc/cluster/list'
|
|
6541
|
+
params = {}
|
|
6542
|
+
body = {}
|
|
6543
|
+
if ehc_cluster_id_list is not None:
|
|
6544
|
+
body['ehcClusterIdList'] = ehc_cluster_id_list
|
|
6545
|
+
if name_list is not None:
|
|
6546
|
+
body['nameList'] = name_list
|
|
6547
|
+
if zone_name is not None:
|
|
6548
|
+
body['zoneName'] = zone_name
|
|
6549
|
+
|
|
6550
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
6551
|
+
|
|
6552
|
+
def delete_ehc_cluster(self, ehc_cluster_id_list, client_token=None, config=None):
|
|
6553
|
+
"""
|
|
6554
|
+
Modifies the name and description of an EHC cluster.
|
|
6555
|
+
|
|
6556
|
+
:param ehc_cluster_id_list:
|
|
6557
|
+
A list of IDs of the EHC clusters to be deleted. This parameter is required.
|
|
6558
|
+
:type ehc_cluster_id_list: string
|
|
6559
|
+
|
|
6560
|
+
:return:
|
|
6561
|
+
:rtype baidubce.bce_response.BceResponse
|
|
6562
|
+
"""
|
|
6563
|
+
path = b'/instance/ehc/cluster/delete'
|
|
6564
|
+
params = {}
|
|
6565
|
+
if client_token is None:
|
|
6566
|
+
params['clientToken'] = generate_client_token()
|
|
6567
|
+
else:
|
|
6568
|
+
params['clientToken'] = client_token
|
|
6569
|
+
body = {
|
|
6570
|
+
'ehcClusterIdList': ehc_cluster_id_list
|
|
6571
|
+
}
|
|
6572
|
+
|
|
6573
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
6574
|
+
|
|
6367
6575
|
def get_available_images_by_spec(self, marker=None, max_keys=None, spec=None, os_name=None, config=None):
|
|
6368
6576
|
"""
|
|
6369
6577
|
:param marker:
|
|
@@ -6402,6 +6610,153 @@ class BccClient(bce_base_client.BceBaseClient):
|
|
|
6402
6610
|
|
|
6403
6611
|
return self._send_request(http_methods.GET, path, params=params, config=config)
|
|
6404
6612
|
|
|
6613
|
+
def create_reserved_instances(self, reserved_instance_name=None, scope=None, zone_name=None, spec=None,
|
|
6614
|
+
offering_type=None, instance_count=None, reserved_instance_count=None,
|
|
6615
|
+
reserved_instance_time=None, reserved_instance_time_unit=None,
|
|
6616
|
+
auto_renew_time_unit=None, auto_renew_time=None, auto_renew=None,
|
|
6617
|
+
effective_time=None, ehc_cluster_id=None, ticket_id=None,
|
|
6618
|
+
tags=None, client_token=None, config=None):
|
|
6619
|
+
|
|
6620
|
+
"""
|
|
6621
|
+
Create reserved instances.
|
|
6622
|
+
|
|
6623
|
+
:param reserved_instance_name:
|
|
6624
|
+
The name of the reserved instance.
|
|
6625
|
+
:type reserved_instance_name: string
|
|
6626
|
+
|
|
6627
|
+
:param scope:
|
|
6628
|
+
The scope.
|
|
6629
|
+
:type scope: string
|
|
6630
|
+
|
|
6631
|
+
:param zone_name:
|
|
6632
|
+
The name of the availability zone.
|
|
6633
|
+
:type zone_name: string
|
|
6634
|
+
|
|
6635
|
+
:param spec:
|
|
6636
|
+
The instance specification.
|
|
6637
|
+
:type spec: string
|
|
6638
|
+
|
|
6639
|
+
:param offering_type:
|
|
6640
|
+
The offering type.
|
|
6641
|
+
:type offering_type: string
|
|
6642
|
+
|
|
6643
|
+
:param instance_count:
|
|
6644
|
+
The number of instances.
|
|
6645
|
+
:type instance_count: int
|
|
6646
|
+
|
|
6647
|
+
:param reserved_instance_count:
|
|
6648
|
+
The number of reserved instances.
|
|
6649
|
+
:type reserved_instance_count: int
|
|
6650
|
+
|
|
6651
|
+
:param reserved_instance_time:
|
|
6652
|
+
The duration of the reserved instance.
|
|
6653
|
+
:type reserved_instance_time: int
|
|
6654
|
+
|
|
6655
|
+
:param reserved_instance_time_unit:
|
|
6656
|
+
The time unit of the reserved instance.
|
|
6657
|
+
:type reserved_instance_time_unit: string
|
|
6658
|
+
|
|
6659
|
+
:param auto_renew_time_unit:
|
|
6660
|
+
The time unit for automatic renewal.
|
|
6661
|
+
:type auto_renew_time_unit: string
|
|
6662
|
+
|
|
6663
|
+
:param auto_renew_time:
|
|
6664
|
+
The duration for automatic renewal.
|
|
6665
|
+
:type auto_renew_time: int
|
|
6666
|
+
|
|
6667
|
+
:param auto_renew:
|
|
6668
|
+
Whether to enable automatic renewal, defaults to False.
|
|
6669
|
+
:type auto_renew: bool
|
|
6670
|
+
|
|
6671
|
+
:param effective_time:
|
|
6672
|
+
The effective time.
|
|
6673
|
+
It is immediately effective by default.
|
|
6674
|
+
:type effective_time: string
|
|
6675
|
+
|
|
6676
|
+
:param ehc_cluster_id:
|
|
6677
|
+
The EHC cluster ID.
|
|
6678
|
+
:type ehc_cluster_id: string
|
|
6679
|
+
|
|
6680
|
+
:param ticket_id:
|
|
6681
|
+
The ticket ID.
|
|
6682
|
+
:type ticket_id: string
|
|
6683
|
+
|
|
6684
|
+
:param tags:
|
|
6685
|
+
The optional list of tag to be bonded.
|
|
6686
|
+
:type tags: list<bcc_model.TagModel>
|
|
6687
|
+
|
|
6688
|
+
:return:
|
|
6689
|
+
:rtype: baidubce.bce_response.BceResponse
|
|
6690
|
+
"""
|
|
6691
|
+
|
|
6692
|
+
path = b'/instance/reserved/create' # 请替换为实际的请求路径
|
|
6693
|
+
params = {}
|
|
6694
|
+
if client_token is not None:
|
|
6695
|
+
params['clientToken'] = client_token
|
|
6696
|
+
|
|
6697
|
+
body = {}
|
|
6698
|
+
|
|
6699
|
+
if reserved_instance_name is not None:
|
|
6700
|
+
body['reservedInstanceName'] = reserved_instance_name
|
|
6701
|
+
if scope is not None:
|
|
6702
|
+
body['scope'] = scope
|
|
6703
|
+
if zone_name is not None:
|
|
6704
|
+
body['zoneName'] = zone_name
|
|
6705
|
+
if spec is not None:
|
|
6706
|
+
body['spec'] = spec
|
|
6707
|
+
if offering_type is not None:
|
|
6708
|
+
body['offeringType'] = offering_type
|
|
6709
|
+
if instance_count is not None:
|
|
6710
|
+
body['instanceCount'] = instance_count
|
|
6711
|
+
if reserved_instance_count is not None:
|
|
6712
|
+
body['reservedInstanceCount'] = reserved_instance_count
|
|
6713
|
+
if reserved_instance_time is not None:
|
|
6714
|
+
body['reservedInstanceTime'] = reserved_instance_time
|
|
6715
|
+
if reserved_instance_time_unit is not None:
|
|
6716
|
+
body['reservedInstanceTimeUnit'] = reserved_instance_time_unit
|
|
6717
|
+
if auto_renew_time_unit is not None:
|
|
6718
|
+
body['autoRenewTimeUnit'] = auto_renew_time_unit
|
|
6719
|
+
if auto_renew_time is not None:
|
|
6720
|
+
body['autoRenewTime'] = auto_renew_time
|
|
6721
|
+
if auto_renew is not False:
|
|
6722
|
+
body['autoRenew'] = str(auto_renew).lower()
|
|
6723
|
+
if effective_time is not None:
|
|
6724
|
+
body['effectiveTime'] = effective_time
|
|
6725
|
+
if ehc_cluster_id is not None:
|
|
6726
|
+
body['ehcClusterId'] = ehc_cluster_id
|
|
6727
|
+
if ticket_id is not None:
|
|
6728
|
+
body['ticketId'] = ticket_id
|
|
6729
|
+
if tags is not None:
|
|
6730
|
+
tag_list = [tag.__dict__ for tag in tags]
|
|
6731
|
+
body['tags'] = tag_list
|
|
6732
|
+
|
|
6733
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body), params=params, config=config)
|
|
6734
|
+
|
|
6735
|
+
def modify_reserved_instances(self, reserved_instances=None, client_token=None, config=None):
|
|
6736
|
+
|
|
6737
|
+
"""
|
|
6738
|
+
Modify the information of reserved instances.
|
|
6739
|
+
|
|
6740
|
+
:param reserved_instances:
|
|
6741
|
+
A list of dictionaries containing the information of reserved instances to be updated.
|
|
6742
|
+
:type reserved_instances: list<bcc_model.ModifyReservedInstanceModel>
|
|
6743
|
+
|
|
6744
|
+
:return:
|
|
6745
|
+
:rtype: baidubce.bce_response.BceResponse
|
|
6746
|
+
"""
|
|
6747
|
+
path = b'/instance/reserved/modify'
|
|
6748
|
+
params = {}
|
|
6749
|
+
if client_token is not None:
|
|
6750
|
+
params['clientToken'] = client_token
|
|
6751
|
+
|
|
6752
|
+
body = {}
|
|
6753
|
+
|
|
6754
|
+
if reserved_instances is not None:
|
|
6755
|
+
reserved_instances_list = [reserved_instance.__dict__ for reserved_instance in reserved_instances]
|
|
6756
|
+
body['reservedInstances'] = reserved_instances_list
|
|
6757
|
+
|
|
6758
|
+
return self._send_request(http_methods.PUT, path, body=json.dumps(body), params=params, config=config)
|
|
6759
|
+
|
|
6405
6760
|
|
|
6406
6761
|
def generate_client_token_by_uuid():
|
|
6407
6762
|
"""
|
|
@@ -170,6 +170,18 @@ class AutoSnapshotPolicyModel(object):
|
|
|
170
170
|
self.retentionDays = retentionDays
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
class ModifyReservedInstanceModel(object):
|
|
174
|
+
"""
|
|
175
|
+
ModifyReservedInstanceModel
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
def __init__(self, reservedInstanceId=None, zoneName=None, reservedInstanceName=None, ehcClusterId=None):
|
|
179
|
+
self.reservedInstanceId = reservedInstanceId
|
|
180
|
+
self.zoneName = zoneName
|
|
181
|
+
self.reservedInstanceName = reservedInstanceName
|
|
182
|
+
self.ehcClusterId = ehcClusterId
|
|
183
|
+
|
|
184
|
+
|
|
173
185
|
class FileSystemModel(object):
|
|
174
186
|
"""
|
|
175
187
|
This class define file system.
|
|
File without changes
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides a client class for CA.
|
|
3
|
+
"""
|
|
4
|
+
import copy
|
|
5
|
+
import json
|
|
6
|
+
import uuid
|
|
7
|
+
|
|
8
|
+
from baidubce import bce_base_client, compat
|
|
9
|
+
from baidubce.auth import bce_v1_signer
|
|
10
|
+
from baidubce.http import handler, bce_http_client, http_methods
|
|
11
|
+
from baidubce.services.ca import ca_handler
|
|
12
|
+
from baidubce.utils import required
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CaClient(bce_base_client.BceBaseClient):
|
|
16
|
+
"""
|
|
17
|
+
CA base sdk client
|
|
18
|
+
"""
|
|
19
|
+
version = b'/v1'
|
|
20
|
+
|
|
21
|
+
content_type_header_key = b"content-type"
|
|
22
|
+
content_type_header_value = b"application/json;charset=UTF-8"
|
|
23
|
+
request_id_header_key = b"x-bce-request-id"
|
|
24
|
+
|
|
25
|
+
def __init__(self, config=None):
|
|
26
|
+
bce_base_client.BceBaseClient.__init__(self, config)
|
|
27
|
+
|
|
28
|
+
def _merge_config(self, config=None):
|
|
29
|
+
if config is None:
|
|
30
|
+
return self.config
|
|
31
|
+
else:
|
|
32
|
+
new_config = copy.copy(self.config)
|
|
33
|
+
new_config.merge_non_none_values(config)
|
|
34
|
+
return new_config
|
|
35
|
+
|
|
36
|
+
def _send_request(self, http_method, path,
|
|
37
|
+
body=None, headers=None, params=None, config=None, body_parser=None):
|
|
38
|
+
config = self._merge_config(config)
|
|
39
|
+
if body_parser is None:
|
|
40
|
+
body_parser = handler.parse_json
|
|
41
|
+
if headers is None:
|
|
42
|
+
headers = {}
|
|
43
|
+
if self.content_type_header_key not in headers:
|
|
44
|
+
headers[self.content_type_header_key] = self.content_type_header_value
|
|
45
|
+
if self.request_id_header_key not in headers:
|
|
46
|
+
headers[self.request_id_header_key] = uuid.uuid4()
|
|
47
|
+
|
|
48
|
+
return bce_http_client.send_request(
|
|
49
|
+
config, bce_v1_signer.sign, [ca_handler.parse_error, body_parser],
|
|
50
|
+
http_method, CaClient.version + path, body, headers, params)
|
|
51
|
+
|
|
52
|
+
def batch_get_agent(self, instance_list=None):
|
|
53
|
+
"""
|
|
54
|
+
Batch get agent info
|
|
55
|
+
|
|
56
|
+
:param instance_list:
|
|
57
|
+
Instance List
|
|
58
|
+
:type instance: dict
|
|
59
|
+
"""
|
|
60
|
+
path = b'/ca/agent/batch'
|
|
61
|
+
body = {
|
|
62
|
+
"hosts": instance_list
|
|
63
|
+
}
|
|
64
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body))
|
|
65
|
+
|
|
66
|
+
def create_action(self, execution=None, user_id=None, action=None, targets=None,
|
|
67
|
+
parameters=None, target_selector=None, target_selector_type=None):
|
|
68
|
+
"""
|
|
69
|
+
create execution
|
|
70
|
+
:param execution:
|
|
71
|
+
execution info
|
|
72
|
+
:type execution: string
|
|
73
|
+
|
|
74
|
+
:param user_id:
|
|
75
|
+
user_id
|
|
76
|
+
:type user_id: string
|
|
77
|
+
|
|
78
|
+
:param action:
|
|
79
|
+
action info
|
|
80
|
+
:type action: dict
|
|
81
|
+
|
|
82
|
+
:param targets:
|
|
83
|
+
targets info
|
|
84
|
+
:type targets:list
|
|
85
|
+
|
|
86
|
+
:param parameters:
|
|
87
|
+
parameters info
|
|
88
|
+
:type parameters:dict
|
|
89
|
+
|
|
90
|
+
:param target_selector:
|
|
91
|
+
target_selector info
|
|
92
|
+
:type target_selector:dict
|
|
93
|
+
|
|
94
|
+
:param target_selector_type:
|
|
95
|
+
target_selector_type info
|
|
96
|
+
:type target_selector_type:string
|
|
97
|
+
|
|
98
|
+
"""
|
|
99
|
+
path = b'/ca/action'
|
|
100
|
+
body = {
|
|
101
|
+
"execution": execution,
|
|
102
|
+
"action": action,
|
|
103
|
+
"targets": targets,
|
|
104
|
+
"userId": user_id,
|
|
105
|
+
"parameters": parameters,
|
|
106
|
+
"targetSelector": target_selector,
|
|
107
|
+
"targetSelectorType": target_selector_type
|
|
108
|
+
}
|
|
109
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body))
|
|
110
|
+
|
|
111
|
+
def delete_action(self, id):
|
|
112
|
+
"""
|
|
113
|
+
Delete action
|
|
114
|
+
:param id: The ID of the execution to be deleted
|
|
115
|
+
:type id: str
|
|
116
|
+
"""
|
|
117
|
+
id = compat.convert_to_bytes(id)
|
|
118
|
+
path = b'/ca/action/%s' % id
|
|
119
|
+
return self._send_request(http_methods.DELETE, path)
|
|
120
|
+
|
|
121
|
+
def get_action(self, id, user_id):
|
|
122
|
+
"""
|
|
123
|
+
Query id
|
|
124
|
+
:param id: The ID of the execution to be queried
|
|
125
|
+
:type id: str
|
|
126
|
+
|
|
127
|
+
Query user_id
|
|
128
|
+
:param user_id: user_id
|
|
129
|
+
:type user_id: str
|
|
130
|
+
|
|
131
|
+
"""
|
|
132
|
+
path = b'/ca/action'
|
|
133
|
+
params = {
|
|
134
|
+
"userId": user_id,
|
|
135
|
+
"id": id
|
|
136
|
+
}
|
|
137
|
+
return self._send_request(http_methods.GET, path, params=params)
|
|
138
|
+
|
|
139
|
+
def update_action(self, action=None, execution=None):
|
|
140
|
+
"""
|
|
141
|
+
:param action:
|
|
142
|
+
action info
|
|
143
|
+
:type action: dict
|
|
144
|
+
|
|
145
|
+
:param execution
|
|
146
|
+
execution info
|
|
147
|
+
:type execution: string
|
|
148
|
+
"""
|
|
149
|
+
path = b'/ca/action'
|
|
150
|
+
body = {
|
|
151
|
+
"action": action,
|
|
152
|
+
"execution": execution,
|
|
153
|
+
}
|
|
154
|
+
return self._send_request(http_methods.PUT, path, body=json.dumps(body))
|
|
155
|
+
|
|
156
|
+
def action_list(self, action=None, page_no=None, page_size=None, sort=None, ascending=None, user_id=None):
|
|
157
|
+
"""
|
|
158
|
+
:param action:
|
|
159
|
+
action info
|
|
160
|
+
:type action: dict
|
|
161
|
+
|
|
162
|
+
:param page_no:
|
|
163
|
+
page number
|
|
164
|
+
:type page_no: int
|
|
165
|
+
|
|
166
|
+
:param page_size:
|
|
167
|
+
page number
|
|
168
|
+
:type page_size: int
|
|
169
|
+
|
|
170
|
+
:param sort:
|
|
171
|
+
sort order
|
|
172
|
+
:type sort: str
|
|
173
|
+
|
|
174
|
+
:param ascending:
|
|
175
|
+
ascending order
|
|
176
|
+
:type ascending: bool
|
|
177
|
+
|
|
178
|
+
:param user_id:
|
|
179
|
+
:type user_id: str
|
|
180
|
+
"""
|
|
181
|
+
path = b'/ca/action/list'
|
|
182
|
+
body = {
|
|
183
|
+
"action": action,
|
|
184
|
+
"pageNo": page_no,
|
|
185
|
+
"pageSize": page_size,
|
|
186
|
+
"sort": sort,
|
|
187
|
+
"ascending": ascending,
|
|
188
|
+
"userId": user_id
|
|
189
|
+
}
|
|
190
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body))
|
|
191
|
+
|
|
192
|
+
def action_run(self, action=None, parameters=None, user_id=None,
|
|
193
|
+
target_selector_type=None, targets=None, target_selector=None):
|
|
194
|
+
"""
|
|
195
|
+
:param action:
|
|
196
|
+
action info
|
|
197
|
+
:type action: dict
|
|
198
|
+
|
|
199
|
+
:param parameters:
|
|
200
|
+
:param target_selector_type:map
|
|
201
|
+
|
|
202
|
+
:param user_id:
|
|
203
|
+
:type user_id: str
|
|
204
|
+
|
|
205
|
+
target selector type
|
|
206
|
+
:type target_selector_type: str
|
|
207
|
+
|
|
208
|
+
:param targets:
|
|
209
|
+
:type targets: list
|
|
210
|
+
|
|
211
|
+
:param target_selector:
|
|
212
|
+
:type target_selector: dict
|
|
213
|
+
"""
|
|
214
|
+
path = b'/ca/actionRun'
|
|
215
|
+
body = {
|
|
216
|
+
"action": action,
|
|
217
|
+
"parameters": parameters,
|
|
218
|
+
"targetSelectorType": target_selector_type,
|
|
219
|
+
"targets": targets,
|
|
220
|
+
"targetSelector": target_selector,
|
|
221
|
+
"userId": user_id,
|
|
222
|
+
"execution": "RUN"
|
|
223
|
+
}
|
|
224
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body))
|
|
225
|
+
|
|
226
|
+
def get_action_run(self, id=None, user_id=None):
|
|
227
|
+
"""
|
|
228
|
+
Query id
|
|
229
|
+
:param id: The ID of the execution to be queried
|
|
230
|
+
:type id: str
|
|
231
|
+
|
|
232
|
+
user_id
|
|
233
|
+
:user_id id: str
|
|
234
|
+
"""
|
|
235
|
+
params = {
|
|
236
|
+
"userId": user_id,
|
|
237
|
+
"id": id
|
|
238
|
+
}
|
|
239
|
+
path = b'/ca/actionRun'
|
|
240
|
+
return self._send_request(http_methods.GET, path, params=params)
|
|
241
|
+
|
|
242
|
+
def action_run_list(self, action=None, page_no=None, page_size=None, sort=None, ascending=None, user_id=None,
|
|
243
|
+
start_time=None, end_time=None, keyword=None, keyword_type=None, run_id=None, is_inited=False):
|
|
244
|
+
"""
|
|
245
|
+
:param action:
|
|
246
|
+
action info
|
|
247
|
+
:type action: dict
|
|
248
|
+
|
|
249
|
+
:param page_no:
|
|
250
|
+
page number
|
|
251
|
+
:type page_no: int
|
|
252
|
+
|
|
253
|
+
:param page_size:
|
|
254
|
+
page number
|
|
255
|
+
:type page_size: int
|
|
256
|
+
|
|
257
|
+
:param sort:
|
|
258
|
+
sort order
|
|
259
|
+
:type sort: str
|
|
260
|
+
|
|
261
|
+
:param ascending:
|
|
262
|
+
ascending order
|
|
263
|
+
:type ascending: bool
|
|
264
|
+
|
|
265
|
+
:param user_id:
|
|
266
|
+
:type user_id: str
|
|
267
|
+
|
|
268
|
+
:param start_time:
|
|
269
|
+
start time
|
|
270
|
+
:type start_time:
|
|
271
|
+
|
|
272
|
+
:param end_time:
|
|
273
|
+
end time
|
|
274
|
+
:type end_time:
|
|
275
|
+
|
|
276
|
+
:param keyword:
|
|
277
|
+
keyword type
|
|
278
|
+
:type keyword: str
|
|
279
|
+
|
|
280
|
+
:param keyword_type:
|
|
281
|
+
keyword type
|
|
282
|
+
:type keyword_type: str
|
|
283
|
+
|
|
284
|
+
:param run_id:
|
|
285
|
+
run id
|
|
286
|
+
:type run_id: str
|
|
287
|
+
|
|
288
|
+
:param is_inited:
|
|
289
|
+
is inited or not inited
|
|
290
|
+
:type is_inited: bool
|
|
291
|
+
"""
|
|
292
|
+
body = {
|
|
293
|
+
"action": action,
|
|
294
|
+
"pageNo": page_no,
|
|
295
|
+
"pageSize": page_size,
|
|
296
|
+
"sort": sort,
|
|
297
|
+
"ascending": ascending,
|
|
298
|
+
"userId": user_id,
|
|
299
|
+
"startTime": start_time,
|
|
300
|
+
"endTime": end_time,
|
|
301
|
+
"keyword": keyword,
|
|
302
|
+
"keyword_type": keyword_type,
|
|
303
|
+
"runId": run_id,
|
|
304
|
+
"isInited": is_inited
|
|
305
|
+
}
|
|
306
|
+
path = b'/ca/actionRun/list'
|
|
307
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body))
|
|
308
|
+
|
|
309
|
+
def action_log(self, run_id=None, child_id=None, cursor=None):
|
|
310
|
+
"""
|
|
311
|
+
:param run_id:
|
|
312
|
+
:type run_id: str
|
|
313
|
+
|
|
314
|
+
:param child_id:
|
|
315
|
+
:type child_id: str
|
|
316
|
+
|
|
317
|
+
:param cursor:
|
|
318
|
+
:type cursor: int
|
|
319
|
+
"""
|
|
320
|
+
body = {
|
|
321
|
+
"runId": run_id,
|
|
322
|
+
"childId": child_id,
|
|
323
|
+
"cursor": cursor
|
|
324
|
+
}
|
|
325
|
+
path = b'/ca/log'
|
|
326
|
+
return self._send_request(http_methods.POST, path, body=json.dumps(body))
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Copyright 2014 Baidu, Inc.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
|
4
|
+
# except in compliance with the License. You may obtain a copy of the License at
|
|
5
|
+
#
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
#
|
|
8
|
+
# Unless required by applicable law or agreed to in writing, software distributed under the
|
|
9
|
+
# License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
10
|
+
# either express or implied. See the License for the specific language governing permissions
|
|
11
|
+
# and limitations under the License.
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
This module provides general http handler functions for processing http responses from CA services.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import http.client
|
|
18
|
+
import json
|
|
19
|
+
from baidubce import compat, utils
|
|
20
|
+
from baidubce.exception import BceClientError
|
|
21
|
+
from baidubce.exception import BceServerError
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def parse_json_list(http_response, response):
|
|
25
|
+
"""If the body is not empty, convert it to a python object and set autoscaling the value of
|
|
26
|
+
response.body. http_response is always closed if no error occurs.
|
|
27
|
+
|
|
28
|
+
:param http_response: the http_response object returned by HTTPConnection.getresponse()
|
|
29
|
+
:type http_response: http.HTTPResponse
|
|
30
|
+
|
|
31
|
+
:param response: general response object which will be returned to the caller
|
|
32
|
+
:type response: baidubce.BceResponse
|
|
33
|
+
|
|
34
|
+
:return: always true
|
|
35
|
+
:rtype bool
|
|
36
|
+
"""
|
|
37
|
+
body = http_response.read()
|
|
38
|
+
if body:
|
|
39
|
+
body = compat.convert_to_string(body)
|
|
40
|
+
response.__dict__["result"] = json.loads(body, object_hook=utils.dict_to_python_object)
|
|
41
|
+
response.__dict__["raw_data"] = body
|
|
42
|
+
http_response.close()
|
|
43
|
+
return True
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def parse_error(http_response, response):
|
|
47
|
+
"""If the body is not empty, convert it to a python object and set autoscaling the value of
|
|
48
|
+
response.body. http_response is always closed if no error occurs.
|
|
49
|
+
|
|
50
|
+
:param http_response: the http_response object returned by HTTPConnection.getresponse()
|
|
51
|
+
:type http_response: http.HTTPResponse
|
|
52
|
+
|
|
53
|
+
:param response: general response object which will be returned to the caller
|
|
54
|
+
:type response: baidubce.BceResponse
|
|
55
|
+
|
|
56
|
+
:return: false if http status code is 2xx, raise an error otherwise
|
|
57
|
+
:rtype bool
|
|
58
|
+
|
|
59
|
+
:raise baidubce.exception.BceClientError: if http status code is NOT 2xx
|
|
60
|
+
"""
|
|
61
|
+
if http_response.status // 100 == http.client.OK // 100:
|
|
62
|
+
return False
|
|
63
|
+
if http_response.status // 100 == http.client.CONTINUE // 100:
|
|
64
|
+
raise BceClientError(b'Can not handle 1xx http status code')
|
|
65
|
+
body = http_response.read()
|
|
66
|
+
if not body:
|
|
67
|
+
bse = BceServerError(http_response.reason, request_id=response.metadata.bce_request_id)
|
|
68
|
+
bse.status_code = http_response.status
|
|
69
|
+
raise bse
|
|
70
|
+
|
|
71
|
+
error_dict = json.loads(compat.convert_to_string(body))
|
|
72
|
+
message = str(error_dict)
|
|
73
|
+
if 'message' in error_dict and error_dict['message'] is not None:
|
|
74
|
+
message = error_dict['message']
|
|
75
|
+
code = "Exception"
|
|
76
|
+
if 'code' in error_dict and error_dict['code'] is not None:
|
|
77
|
+
code = error_dict['code']
|
|
78
|
+
request_id = response.metadata.bce_request_id
|
|
79
|
+
if 'request_id' in error_dict and error_dict['request_id'] is not None:
|
|
80
|
+
request_id = error_dict['request_id']
|
|
81
|
+
|
|
82
|
+
bse = BceServerError(message, code=code, request_id=request_id)
|
|
83
|
+
bse.status_code = http_response.status
|
|
84
|
+
raise bse
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides a model class for CA.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
class Instance(dict):
|
|
6
|
+
"""
|
|
7
|
+
This class defines the Tag object.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
def __init__(self, instance_id):
|
|
11
|
+
"""
|
|
12
|
+
:param instance_id: Instance Id
|
|
13
|
+
:type instance_id: str
|
|
14
|
+
"""
|
|
15
|
+
super(Instance, self).__init__()
|
|
16
|
+
self["instanceId"] = instance_id
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Command(dict):
|
|
20
|
+
"""
|
|
21
|
+
This class defines the Command object.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, type, content, scope, enable_parameter, parameters, user, work_dir):
|
|
25
|
+
"""
|
|
26
|
+
:param type: Command type
|
|
27
|
+
:type type: str
|
|
28
|
+
:param content: Command content
|
|
29
|
+
:type content: str
|
|
30
|
+
:param scope: Command scope
|
|
31
|
+
:type scope: str
|
|
32
|
+
:param enable_parameter: Enable parameter flag
|
|
33
|
+
:type enable_parameter: bool
|
|
34
|
+
:param user: User
|
|
35
|
+
:type user: str
|
|
36
|
+
:param work_dir: Working directory
|
|
37
|
+
:type work_dir: str
|
|
38
|
+
"""
|
|
39
|
+
super(Command, self).__init__()
|
|
40
|
+
self["type"] = type
|
|
41
|
+
self["content"] = content
|
|
42
|
+
self["scope"] = scope
|
|
43
|
+
self["enableParameter"] = enable_parameter
|
|
44
|
+
self["parameters"] = parameters
|
|
45
|
+
self["user"] = user
|
|
46
|
+
self["workDir"] = work_dir
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Action(dict):
|
|
50
|
+
"""
|
|
51
|
+
This class defines the Action object.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def __init__(self, ref=None, id=None, type=None, name=None, timeout_second=None, command=None):
|
|
55
|
+
"""
|
|
56
|
+
:param ref: Action ref
|
|
57
|
+
:ref type: str
|
|
58
|
+
:param ref: Action id
|
|
59
|
+
:id type: str
|
|
60
|
+
:param type: Action type
|
|
61
|
+
:type type: str
|
|
62
|
+
:param name: Action name
|
|
63
|
+
:type name: str
|
|
64
|
+
:param timeout_second: Timeout in seconds
|
|
65
|
+
:type timeout_second: int
|
|
66
|
+
:param command: Command object
|
|
67
|
+
:type command: Command
|
|
68
|
+
"""
|
|
69
|
+
super(Action, self).__init__()
|
|
70
|
+
self["ref"] = ref
|
|
71
|
+
self["id"] = id
|
|
72
|
+
self["type"] = type
|
|
73
|
+
self["name"] = name
|
|
74
|
+
self["timeoutSecond"] = timeout_second
|
|
75
|
+
self["command"] = command
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class Target(dict):
|
|
79
|
+
"""
|
|
80
|
+
This class defines the Target object.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
def __init__(self, instance_type, instance_id):
|
|
84
|
+
"""
|
|
85
|
+
:param instance_type: Instance type
|
|
86
|
+
:type instance_type: str
|
|
87
|
+
:param instance_id: Instance Id
|
|
88
|
+
:type instance_id: str
|
|
89
|
+
"""
|
|
90
|
+
super(Target, self).__init__()
|
|
91
|
+
self["instanceType"] = instance_type
|
|
92
|
+
self["instanceId"] = instance_id
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class TargetSelector(dict):
|
|
96
|
+
"""
|
|
97
|
+
This class defines the Target object.
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
def __init__(self, instance_type, tags):
|
|
101
|
+
"""
|
|
102
|
+
:param instance_type: Instance type
|
|
103
|
+
:type instance_type: str
|
|
104
|
+
:param tags: tags
|
|
105
|
+
:type tags: list
|
|
106
|
+
"""
|
|
107
|
+
super(TargetSelector, self).__init__()
|
|
108
|
+
self["instanceType"] = instance_type
|
|
109
|
+
self["tags"] = tags
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class Execution(dict):
|
|
113
|
+
"""
|
|
114
|
+
This class defines the Execution object.
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
def __init__(self, execution, action, targets):
|
|
118
|
+
"""
|
|
119
|
+
:param execution: Execution type
|
|
120
|
+
:type execution: str
|
|
121
|
+
:param action: Action object
|
|
122
|
+
:type action: Action
|
|
123
|
+
:param targets: List of Target objects
|
|
124
|
+
:type targets: list
|
|
125
|
+
"""
|
|
126
|
+
super(Execution, self).__init__()
|
|
127
|
+
self["execution"] = execution
|
|
128
|
+
self["action"] = action
|
|
129
|
+
self["targets"] = targets
|
|
@@ -549,12 +549,15 @@ class SmsClient(BceBaseClient):
|
|
|
549
549
|
headers, params)
|
|
550
550
|
|
|
551
551
|
@required(type=str, phone=str)
|
|
552
|
-
def create_mobile_black(self, type, phone, sms_type=None, signature_id_str=None, config=None):
|
|
552
|
+
def create_mobile_black(self, type, phone, country_type, sms_type=None, signature_id_str=None, config=None):
|
|
553
553
|
"""
|
|
554
554
|
|
|
555
555
|
:param type: The value of type could be MerchantBlack or SignatureBlack
|
|
556
556
|
:type type: str
|
|
557
557
|
|
|
558
|
+
:param country_type: The value of countryType could be DOMESTIC or INTERNATIONAL
|
|
559
|
+
:type country_type: str
|
|
560
|
+
|
|
558
561
|
:param sms_type: Mobile of black, Support multiple mobile phone numbers, up to 200 maximum, separated by comma.
|
|
559
562
|
:type sms_type: str
|
|
560
563
|
|
|
@@ -570,7 +573,8 @@ class SmsClient(BceBaseClient):
|
|
|
570
573
|
"""
|
|
571
574
|
data = {
|
|
572
575
|
"type": type,
|
|
573
|
-
"phone": phone
|
|
576
|
+
"phone": phone,
|
|
577
|
+
"countryType": country_type
|
|
574
578
|
}
|
|
575
579
|
if sms_type:
|
|
576
580
|
data["smsType"] = sms_type
|
|
@@ -581,13 +585,16 @@ class SmsClient(BceBaseClient):
|
|
|
581
585
|
return self._send_request(http_methods.POST, function_name="blacklist", body=json.dumps(data),
|
|
582
586
|
config=config, api_version=2)
|
|
583
587
|
|
|
584
|
-
def get_mobile_black(self, phone=None,
|
|
585
|
-
page_no=None, page_size=None, config=None):
|
|
588
|
+
def get_mobile_black(self, phone=None, country_type=None, sms_type=None, signature_id_str=None, start_time=None,
|
|
589
|
+
end_time=None, page_no=None, page_size=None, config=None):
|
|
586
590
|
"""
|
|
587
591
|
Get mobile black
|
|
588
592
|
:param phone: Support multiple mobile phone numbers, up to 200 maximum, separated by comma.
|
|
589
593
|
:type phone: str
|
|
590
594
|
|
|
595
|
+
:param country_type: The value of countryType could be DOMESTIC or INTERNATIONAL
|
|
596
|
+
:type country_type: str
|
|
597
|
+
|
|
591
598
|
:param sms_type: smsType
|
|
592
599
|
:type sms_type: str
|
|
593
600
|
|
|
@@ -630,6 +637,9 @@ class SmsClient(BceBaseClient):
|
|
|
630
637
|
if phone:
|
|
631
638
|
req_params["phone"] = phone
|
|
632
639
|
|
|
640
|
+
if country_type:
|
|
641
|
+
req_params["countryType"] = country_type
|
|
642
|
+
|
|
633
643
|
if sms_type:
|
|
634
644
|
req_params["smsType"] = sms_type
|
|
635
645
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
baidubce/__init__.py,sha256
|
|
1
|
+
baidubce/__init__.py,sha256=4jhnanAX6CmYn6fEzwsN-t6UmwhG_b83UzLxHo7yyhc,813
|
|
2
2
|
baidubce/bce_base_client.py,sha256=7gjkRy_YlTTb6TXHYHyZRYMjdVO7FTtHMdwXx8bPgsE,3428
|
|
3
3
|
baidubce/bce_client_configuration.py,sha256=Wzuu9JR11hcHxgcKQIP63qIChEzVrT9ZA_fyqIfqqP4,3055
|
|
4
4
|
baidubce/bce_response.py,sha256=V5a3bgRj04cM3Ml3s1OByLyZZSGDUy9PL52JSugmCgM,1655
|
|
@@ -27,8 +27,8 @@ baidubce/services/bbc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
|
27
27
|
baidubce/services/bbc/bbc_client.py,sha256=OSDBnJK3b1TFLQJ8YALK-qEkzolFE1-J81mZy5512OE,37967
|
|
28
28
|
baidubce/services/bbc/bbc_model.py,sha256=Dy80LZ4ro_iS3UejJ_CL9kI7OyMSBoDitTE4J1XAC_g,1790
|
|
29
29
|
baidubce/services/bcc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
baidubce/services/bcc/bcc_client.py,sha256=
|
|
31
|
-
baidubce/services/bcc/bcc_model.py,sha256=
|
|
30
|
+
baidubce/services/bcc/bcc_client.py,sha256=JTsQfoE1LYvsuFwHBh_MG1pM6ZSLJQbmg5NBqDFHjVM,255608
|
|
31
|
+
baidubce/services/bcc/bcc_model.py,sha256=QKXqundXCjCjv7Q5Bl9NfHRgDzBxPxYOBuXoQ6yPG4A,6307
|
|
32
32
|
baidubce/services/bcc/fpga_card_type.py,sha256=n6goqnapIgAC9_sciA_2he5HFqPRbRv109qitO7qpd8,948
|
|
33
33
|
baidubce/services/bcc/gpu_card_type.py,sha256=HEfMzne-UC5F295JPrPUu7V9F5g-hbXF2TNBontEFes,1054
|
|
34
34
|
baidubce/services/bcm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -53,6 +53,10 @@ baidubce/services/bts/__init__.py,sha256=714yrJr3fupwooCvp7LBsBwS151wRo7OltVUFCk
|
|
|
53
53
|
baidubce/services/bts/bts_client.py,sha256=8J8BFllo3DEgFYloeliUxpGZHAuTQrKpnTEDkJdAwj4,21916
|
|
54
54
|
baidubce/services/bts/model.py,sha256=venQTHnF4Yqg5TKF8uFcUrJ8TIqhkVBoJNKY54DERwg,11520
|
|
55
55
|
baidubce/services/bts/util.py,sha256=0HbqDbALL2-KTlNlnt7N7XOlG1mnhv6VLkajScDSYZY,1521
|
|
56
|
+
baidubce/services/ca/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
|
+
baidubce/services/ca/ca_client.py,sha256=GIAmcaN-fY7uvh60McBRNFueVg5L1v--MMHAYu5SOBE,8838
|
|
58
|
+
baidubce/services/ca/ca_handler.py,sha256=DOqyHfUmN_INDo9ptb5YdSKRpN-Pnf0ErFR_zenanxc,3326
|
|
59
|
+
baidubce/services/ca/ca_model.py,sha256=gu52IMYiW_QjX4Z45nTT78kANwEw5T6FBuiDsIzZkTM,3389
|
|
56
60
|
baidubce/services/cdn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
61
|
baidubce/services/cdn/cdn_client.py,sha256=8PnvEumExNPgIzGlz1hVhTVLqlYvvInqAlJhBPhgWvE,59017
|
|
58
62
|
baidubce/services/cdn/cdn_stats_param.py,sha256=8ikq5ACllMhC1ArIm3xgH-jAK3MkFLaYYF0T1BMPdeo,1252
|
|
@@ -150,7 +154,7 @@ baidubce/services/scs/model.py,sha256=LApCKftzzifOHyor1rQPaPdIE9LyuN7DRWQyVwwrxz
|
|
|
150
154
|
baidubce/services/scs/scs_client.py,sha256=_b4YZ85kVrmoy8iMjUnOVJ05KVFzy2YhvKxpsdDsWjg,27357
|
|
151
155
|
baidubce/services/sms/__init__.py,sha256=_Z3YtctK4-2S9JzTrNtZ35Gg1hKVhcJp1YgoREkGStg,676
|
|
152
156
|
baidubce/services/sms/model.py,sha256=3nRxL2j0KAIpF6gc9nsAHcCHNPEyn5Nlxi8sw1nZUxc,6592
|
|
153
|
-
baidubce/services/sms/sms_client.py,sha256=
|
|
157
|
+
baidubce/services/sms/sms_client.py,sha256=Dgdrlz8fQDp5CRTOyoZc8Kc8Hak4Pn090ZRV_pNqKJQ,31516
|
|
154
158
|
baidubce/services/sts/__init__.py,sha256=EZmfLCCKOijC7YePDGTzWy9Qzn9OVh5et5klAffza_g,669
|
|
155
159
|
baidubce/services/sts/sts_client.py,sha256=kyJZPQTx48aCeeQqNZsSgd3TqSNk0hgMILG_HuF-BGs,3687
|
|
156
160
|
baidubce/services/subnet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -173,7 +177,7 @@ baidubce/services/vpc/vpc_client.py,sha256=6HD-TIxmNPujzIVc37Z9OOp_JUOoITUPzTwjm
|
|
|
173
177
|
baidubce/services/vpn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
174
178
|
baidubce/services/vpn/vpn_client.py,sha256=VGmPmnl7Il_NcbGMAgASmVK_1IF9HQ8PJ-WLij-7Axc,28554
|
|
175
179
|
baidubce/services/vpn/vpn_model.py,sha256=r9V2At9ll9cZTOryGflS9tH9DlHdeelKYuGXvTNyTgg,3364
|
|
176
|
-
bce_python_sdk-0.9.
|
|
177
|
-
bce_python_sdk-0.9.
|
|
178
|
-
bce_python_sdk-0.9.
|
|
179
|
-
bce_python_sdk-0.9.
|
|
180
|
+
bce_python_sdk-0.9.19.dist-info/METADATA,sha256=3Jizo3jDTSrtJaFKbzUDqpViWZJGoBrZ584Rmj7QA28,319
|
|
181
|
+
bce_python_sdk-0.9.19.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
182
|
+
bce_python_sdk-0.9.19.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
|
|
183
|
+
bce_python_sdk-0.9.19.dist-info/RECORD,,
|
|
File without changes
|