tccli 3.0.1367.1__py2.py3-none-any.whl → 3.0.1369.1__py2.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.
- tccli/__init__.py +1 -1
- tccli/services/batch/v20170312/api.json +34 -1
- tccli/services/batch/v20170312/examples.json +1 -1
- tccli/services/cdb/v20170320/api.json +6 -6
- tccli/services/cdb/v20170320/examples.json +1 -1
- tccli/services/cdn/v20180606/api.json +6 -1
- tccli/services/cdwch/v20200915/api.json +16 -7
- tccli/services/cfg/v20210820/api.json +9 -0
- tccli/services/clb/v20180317/api.json +11 -11
- tccli/services/cls/v20201016/api.json +20 -18
- tccli/services/cls/v20201016/examples.json +7 -7
- tccli/services/csip/csip_client.py +53 -0
- tccli/services/csip/v20221121/api.json +333 -3
- tccli/services/csip/v20221121/examples.json +8 -0
- tccli/services/emr/v20190103/api.json +9 -0
- tccli/services/emr/v20190103/examples.json +1 -1
- tccli/services/es/v20180416/api.json +132 -3
- tccli/services/faceid/v20180301/api.json +1 -1
- tccli/services/hunyuan/v20230901/api.json +4 -4
- tccli/services/iai/v20180301/api.json +1 -1
- tccli/services/iai/v20200303/api.json +1 -1
- tccli/services/lighthouse/v20200324/api.json +1 -1
- tccli/services/live/v20180801/api.json +1 -1
- tccli/services/mps/v20190612/api.json +15 -5
- tccli/services/mps/v20190612/examples.json +1 -1
- tccli/services/omics/v20221128/api.json +105 -6
- tccli/services/sqlserver/v20180328/api.json +20 -0
- tccli/services/ssl/v20191205/api.json +40 -0
- tccli/services/ssl/v20191205/examples.json +1 -1
- tccli/services/sts/v20180813/api.json +1 -1
- tccli/services/tdmq/v20200217/api.json +74 -5
- tccli/services/tdmq/v20200217/examples.json +1 -1
- tccli/services/teo/v20220901/api.json +85 -2
- tccli/services/thpc/thpc_client.py +330 -12
- tccli/services/thpc/v20230321/api.json +718 -0
- tccli/services/thpc/v20230321/examples.json +48 -0
- tccli/services/trocket/v20230308/api.json +49 -9
- tccli/services/trocket/v20230308/examples.json +1 -1
- tccli/services/tts/v20190823/api.json +1 -1
- tccli/services/vdb/v20230616/api.json +12 -3
- tccli/services/vod/v20180717/api.json +5 -5
- tccli/services/vrs/v20200824/api.json +1 -1
- tccli/services/wedata/v20210820/api.json +12 -12
- {tccli-3.0.1367.1.dist-info → tccli-3.0.1369.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1367.1.dist-info → tccli-3.0.1369.1.dist-info}/RECORD +48 -48
- {tccli-3.0.1367.1.dist-info → tccli-3.0.1369.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1367.1.dist-info → tccli-3.0.1369.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1367.1.dist-info → tccli-3.0.1369.1.dist-info}/license_files/LICENSE +0 -0
@@ -21,6 +21,58 @@ from tencentcloud.thpc.v20211109 import models as models_v20211109
|
|
21
21
|
from jmespath import search
|
22
22
|
import time
|
23
23
|
|
24
|
+
def doDescribeAutoScalingConfiguration(args, parsed_globals):
|
25
|
+
g_param = parse_global_arg(parsed_globals)
|
26
|
+
|
27
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
28
|
+
cred = credential.CVMRoleCredential()
|
29
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
30
|
+
cred = credential.STSAssumeRoleCredential(
|
31
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
32
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
33
|
+
)
|
34
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
35
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
36
|
+
else:
|
37
|
+
cred = credential.Credential(
|
38
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
39
|
+
)
|
40
|
+
http_profile = HttpProfile(
|
41
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
42
|
+
reqMethod="POST",
|
43
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
44
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
45
|
+
)
|
46
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
47
|
+
if g_param[OptionsDefine.Language]:
|
48
|
+
profile.language = g_param[OptionsDefine.Language]
|
49
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
50
|
+
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
51
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
52
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
53
|
+
model = models.DescribeAutoScalingConfigurationRequest()
|
54
|
+
model.from_json_string(json.dumps(args))
|
55
|
+
start_time = time.time()
|
56
|
+
while True:
|
57
|
+
rsp = client.DescribeAutoScalingConfiguration(model)
|
58
|
+
result = rsp.to_json_string()
|
59
|
+
try:
|
60
|
+
json_obj = json.loads(result)
|
61
|
+
except TypeError as e:
|
62
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
63
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
64
|
+
break
|
65
|
+
cur_time = time.time()
|
66
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
67
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
68
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
69
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
70
|
+
else:
|
71
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
72
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
73
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
74
|
+
|
75
|
+
|
24
76
|
def doDeleteNodes(args, parsed_globals):
|
25
77
|
g_param = parse_global_arg(parsed_globals)
|
26
78
|
|
@@ -437,7 +489,7 @@ def doDescribeNodes(args, parsed_globals):
|
|
437
489
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
438
490
|
|
439
491
|
|
440
|
-
def
|
492
|
+
def doDeleteCluster(args, parsed_globals):
|
441
493
|
g_param = parse_global_arg(parsed_globals)
|
442
494
|
|
443
495
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -466,11 +518,11 @@ def doAddClusterStorageOption(args, parsed_globals):
|
|
466
518
|
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
467
519
|
client._sdkVersion += ("_CLI_" + __version__)
|
468
520
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
469
|
-
model = models.
|
521
|
+
model = models.DeleteClusterRequest()
|
470
522
|
model.from_json_string(json.dumps(args))
|
471
523
|
start_time = time.time()
|
472
524
|
while True:
|
473
|
-
rsp = client.
|
525
|
+
rsp = client.DeleteCluster(model)
|
474
526
|
result = rsp.to_json_string()
|
475
527
|
try:
|
476
528
|
json_obj = json.loads(result)
|
@@ -593,6 +645,58 @@ def doDescribeWorkspaces(args, parsed_globals):
|
|
593
645
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
594
646
|
|
595
647
|
|
648
|
+
def doTerminateJob(args, parsed_globals):
|
649
|
+
g_param = parse_global_arg(parsed_globals)
|
650
|
+
|
651
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
652
|
+
cred = credential.CVMRoleCredential()
|
653
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
654
|
+
cred = credential.STSAssumeRoleCredential(
|
655
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
656
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
657
|
+
)
|
658
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
659
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
660
|
+
else:
|
661
|
+
cred = credential.Credential(
|
662
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
663
|
+
)
|
664
|
+
http_profile = HttpProfile(
|
665
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
666
|
+
reqMethod="POST",
|
667
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
668
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
669
|
+
)
|
670
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
671
|
+
if g_param[OptionsDefine.Language]:
|
672
|
+
profile.language = g_param[OptionsDefine.Language]
|
673
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
674
|
+
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
675
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
676
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
677
|
+
model = models.TerminateJobRequest()
|
678
|
+
model.from_json_string(json.dumps(args))
|
679
|
+
start_time = time.time()
|
680
|
+
while True:
|
681
|
+
rsp = client.TerminateJob(model)
|
682
|
+
result = rsp.to_json_string()
|
683
|
+
try:
|
684
|
+
json_obj = json.loads(result)
|
685
|
+
except TypeError as e:
|
686
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
687
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
688
|
+
break
|
689
|
+
cur_time = time.time()
|
690
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
691
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
692
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
693
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
694
|
+
else:
|
695
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
696
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
697
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
698
|
+
|
699
|
+
|
596
700
|
def doDetachNodes(args, parsed_globals):
|
597
701
|
g_param = parse_global_arg(parsed_globals)
|
598
702
|
|
@@ -905,7 +1009,7 @@ def doAttachNodes(args, parsed_globals):
|
|
905
1009
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
906
1010
|
|
907
1011
|
|
908
|
-
def
|
1012
|
+
def doDescribeJobSubmitInfo(args, parsed_globals):
|
909
1013
|
g_param = parse_global_arg(parsed_globals)
|
910
1014
|
|
911
1015
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -934,11 +1038,11 @@ def doDescribeAutoScalingConfiguration(args, parsed_globals):
|
|
934
1038
|
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
935
1039
|
client._sdkVersion += ("_CLI_" + __version__)
|
936
1040
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
937
|
-
model = models.
|
1041
|
+
model = models.DescribeJobSubmitInfoRequest()
|
938
1042
|
model.from_json_string(json.dumps(args))
|
939
1043
|
start_time = time.time()
|
940
1044
|
while True:
|
941
|
-
rsp = client.
|
1045
|
+
rsp = client.DescribeJobSubmitInfo(model)
|
942
1046
|
result = rsp.to_json_string()
|
943
1047
|
try:
|
944
1048
|
json_obj = json.loads(result)
|
@@ -1009,6 +1113,58 @@ def doDescribeClusterActivities(args, parsed_globals):
|
|
1009
1113
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1010
1114
|
|
1011
1115
|
|
1116
|
+
def doSubmitJob(args, parsed_globals):
|
1117
|
+
g_param = parse_global_arg(parsed_globals)
|
1118
|
+
|
1119
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1120
|
+
cred = credential.CVMRoleCredential()
|
1121
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1122
|
+
cred = credential.STSAssumeRoleCredential(
|
1123
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1124
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1125
|
+
)
|
1126
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
1127
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1128
|
+
else:
|
1129
|
+
cred = credential.Credential(
|
1130
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1131
|
+
)
|
1132
|
+
http_profile = HttpProfile(
|
1133
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1134
|
+
reqMethod="POST",
|
1135
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1136
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1137
|
+
)
|
1138
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1139
|
+
if g_param[OptionsDefine.Language]:
|
1140
|
+
profile.language = g_param[OptionsDefine.Language]
|
1141
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1142
|
+
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
1143
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1144
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1145
|
+
model = models.SubmitJobRequest()
|
1146
|
+
model.from_json_string(json.dumps(args))
|
1147
|
+
start_time = time.time()
|
1148
|
+
while True:
|
1149
|
+
rsp = client.SubmitJob(model)
|
1150
|
+
result = rsp.to_json_string()
|
1151
|
+
try:
|
1152
|
+
json_obj = json.loads(result)
|
1153
|
+
except TypeError as e:
|
1154
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1155
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1156
|
+
break
|
1157
|
+
cur_time = time.time()
|
1158
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1159
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1160
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1161
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1162
|
+
else:
|
1163
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1164
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1165
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1166
|
+
|
1167
|
+
|
1012
1168
|
def doDescribeClusterStorageOption(args, parsed_globals):
|
1013
1169
|
g_param = parse_global_arg(parsed_globals)
|
1014
1170
|
|
@@ -1165,6 +1321,162 @@ def doModifyInitNodeScripts(args, parsed_globals):
|
|
1165
1321
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1166
1322
|
|
1167
1323
|
|
1324
|
+
def doAddClusterStorageOption(args, parsed_globals):
|
1325
|
+
g_param = parse_global_arg(parsed_globals)
|
1326
|
+
|
1327
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1328
|
+
cred = credential.CVMRoleCredential()
|
1329
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1330
|
+
cred = credential.STSAssumeRoleCredential(
|
1331
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1332
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1333
|
+
)
|
1334
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
1335
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1336
|
+
else:
|
1337
|
+
cred = credential.Credential(
|
1338
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1339
|
+
)
|
1340
|
+
http_profile = HttpProfile(
|
1341
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1342
|
+
reqMethod="POST",
|
1343
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1344
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1345
|
+
)
|
1346
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1347
|
+
if g_param[OptionsDefine.Language]:
|
1348
|
+
profile.language = g_param[OptionsDefine.Language]
|
1349
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1350
|
+
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
1351
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1352
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1353
|
+
model = models.AddClusterStorageOptionRequest()
|
1354
|
+
model.from_json_string(json.dumps(args))
|
1355
|
+
start_time = time.time()
|
1356
|
+
while True:
|
1357
|
+
rsp = client.AddClusterStorageOption(model)
|
1358
|
+
result = rsp.to_json_string()
|
1359
|
+
try:
|
1360
|
+
json_obj = json.loads(result)
|
1361
|
+
except TypeError as e:
|
1362
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1363
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1364
|
+
break
|
1365
|
+
cur_time = time.time()
|
1366
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1367
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1368
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1369
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1370
|
+
else:
|
1371
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1372
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1373
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1374
|
+
|
1375
|
+
|
1376
|
+
def doDescribeJobsOverview(args, parsed_globals):
|
1377
|
+
g_param = parse_global_arg(parsed_globals)
|
1378
|
+
|
1379
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1380
|
+
cred = credential.CVMRoleCredential()
|
1381
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1382
|
+
cred = credential.STSAssumeRoleCredential(
|
1383
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1384
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1385
|
+
)
|
1386
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
1387
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1388
|
+
else:
|
1389
|
+
cred = credential.Credential(
|
1390
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1391
|
+
)
|
1392
|
+
http_profile = HttpProfile(
|
1393
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1394
|
+
reqMethod="POST",
|
1395
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1396
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1397
|
+
)
|
1398
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1399
|
+
if g_param[OptionsDefine.Language]:
|
1400
|
+
profile.language = g_param[OptionsDefine.Language]
|
1401
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1402
|
+
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
1403
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1404
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1405
|
+
model = models.DescribeJobsOverviewRequest()
|
1406
|
+
model.from_json_string(json.dumps(args))
|
1407
|
+
start_time = time.time()
|
1408
|
+
while True:
|
1409
|
+
rsp = client.DescribeJobsOverview(model)
|
1410
|
+
result = rsp.to_json_string()
|
1411
|
+
try:
|
1412
|
+
json_obj = json.loads(result)
|
1413
|
+
except TypeError as e:
|
1414
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1415
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1416
|
+
break
|
1417
|
+
cur_time = time.time()
|
1418
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1419
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1420
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1421
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1422
|
+
else:
|
1423
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1424
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1425
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1426
|
+
|
1427
|
+
|
1428
|
+
def doDescribeJobs(args, parsed_globals):
|
1429
|
+
g_param = parse_global_arg(parsed_globals)
|
1430
|
+
|
1431
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1432
|
+
cred = credential.CVMRoleCredential()
|
1433
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1434
|
+
cred = credential.STSAssumeRoleCredential(
|
1435
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1436
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1437
|
+
)
|
1438
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
1439
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1440
|
+
else:
|
1441
|
+
cred = credential.Credential(
|
1442
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1443
|
+
)
|
1444
|
+
http_profile = HttpProfile(
|
1445
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1446
|
+
reqMethod="POST",
|
1447
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1448
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1449
|
+
)
|
1450
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1451
|
+
if g_param[OptionsDefine.Language]:
|
1452
|
+
profile.language = g_param[OptionsDefine.Language]
|
1453
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1454
|
+
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
1455
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1456
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1457
|
+
model = models.DescribeJobsRequest()
|
1458
|
+
model.from_json_string(json.dumps(args))
|
1459
|
+
start_time = time.time()
|
1460
|
+
while True:
|
1461
|
+
rsp = client.DescribeJobs(model)
|
1462
|
+
result = rsp.to_json_string()
|
1463
|
+
try:
|
1464
|
+
json_obj = json.loads(result)
|
1465
|
+
except TypeError as e:
|
1466
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1467
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1468
|
+
break
|
1469
|
+
cur_time = time.time()
|
1470
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1471
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1472
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1473
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1474
|
+
else:
|
1475
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1476
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1477
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1478
|
+
|
1479
|
+
|
1168
1480
|
def doModifyWorkspacesRenewFlag(args, parsed_globals):
|
1169
1481
|
g_param = parse_global_arg(parsed_globals)
|
1170
1482
|
|
@@ -1269,7 +1581,7 @@ def doDeleteQueue(args, parsed_globals):
|
|
1269
1581
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1270
1582
|
|
1271
1583
|
|
1272
|
-
def
|
1584
|
+
def doDeleteJob(args, parsed_globals):
|
1273
1585
|
g_param = parse_global_arg(parsed_globals)
|
1274
1586
|
|
1275
1587
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1298,11 +1610,11 @@ def doDeleteCluster(args, parsed_globals):
|
|
1298
1610
|
client = mod.ThpcClient(cred, g_param[OptionsDefine.Region], profile)
|
1299
1611
|
client._sdkVersion += ("_CLI_" + __version__)
|
1300
1612
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1301
|
-
model = models.
|
1613
|
+
model = models.DeleteJobRequest()
|
1302
1614
|
model.from_json_string(json.dumps(args))
|
1303
1615
|
start_time = time.time()
|
1304
1616
|
while True:
|
1305
|
-
rsp = client.
|
1617
|
+
rsp = client.DeleteJob(model)
|
1306
1618
|
result = rsp.to_json_string()
|
1307
1619
|
try:
|
1308
1620
|
json_obj = json.loads(result)
|
@@ -1336,6 +1648,7 @@ MODELS_MAP = {
|
|
1336
1648
|
}
|
1337
1649
|
|
1338
1650
|
ACTION_MAP = {
|
1651
|
+
"DescribeAutoScalingConfiguration": doDescribeAutoScalingConfiguration,
|
1339
1652
|
"DeleteNodes": doDeleteNodes,
|
1340
1653
|
"TerminateWorkspaces": doTerminateWorkspaces,
|
1341
1654
|
"ModifyWorkspacesAttribute": doModifyWorkspacesAttribute,
|
@@ -1344,23 +1657,28 @@ ACTION_MAP = {
|
|
1344
1657
|
"DescribeQueues": doDescribeQueues,
|
1345
1658
|
"AddNodes": doAddNodes,
|
1346
1659
|
"DescribeNodes": doDescribeNodes,
|
1347
|
-
"
|
1660
|
+
"DeleteCluster": doDeleteCluster,
|
1348
1661
|
"DeleteClusterStorageOption": doDeleteClusterStorageOption,
|
1349
1662
|
"DescribeWorkspaces": doDescribeWorkspaces,
|
1663
|
+
"TerminateJob": doTerminateJob,
|
1350
1664
|
"DetachNodes": doDetachNodes,
|
1351
1665
|
"DescribeClusters": doDescribeClusters,
|
1352
1666
|
"SetAutoScalingConfiguration": doSetAutoScalingConfiguration,
|
1353
1667
|
"AddQueue": doAddQueue,
|
1354
1668
|
"DescribeInitNodeScripts": doDescribeInitNodeScripts,
|
1355
1669
|
"AttachNodes": doAttachNodes,
|
1356
|
-
"
|
1670
|
+
"DescribeJobSubmitInfo": doDescribeJobSubmitInfo,
|
1357
1671
|
"DescribeClusterActivities": doDescribeClusterActivities,
|
1672
|
+
"SubmitJob": doSubmitJob,
|
1358
1673
|
"DescribeClusterStorageOption": doDescribeClusterStorageOption,
|
1359
1674
|
"BindAutoScalingGroup": doBindAutoScalingGroup,
|
1360
1675
|
"ModifyInitNodeScripts": doModifyInitNodeScripts,
|
1676
|
+
"AddClusterStorageOption": doAddClusterStorageOption,
|
1677
|
+
"DescribeJobsOverview": doDescribeJobsOverview,
|
1678
|
+
"DescribeJobs": doDescribeJobs,
|
1361
1679
|
"ModifyWorkspacesRenewFlag": doModifyWorkspacesRenewFlag,
|
1362
1680
|
"DeleteQueue": doDeleteQueue,
|
1363
|
-
"
|
1681
|
+
"DeleteJob": doDeleteJob,
|
1364
1682
|
|
1365
1683
|
}
|
1366
1684
|
|