tccli 3.0.1216.1__py2.py3-none-any.whl → 3.0.1217.1__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tccli/__init__.py +1 -1
- tccli/argparser.py +1 -1
- tccli/command.py +2 -2
- tccli/credentials.py +25 -0
- tccli/main.py +6 -2
- tccli/plugins/sso/__init__.py +61 -0
- tccli/plugins/sso/configs.py +4 -0
- tccli/plugins/sso/configure.py +45 -0
- tccli/plugins/sso/login.py +144 -0
- tccli/plugins/sso/logout.py +21 -0
- tccli/plugins/sso/terminal.py +161 -0
- tccli/plugins/sso/texts.py +40 -0
- tccli/services/__init__.py +6 -0
- tccli/services/acp/v20220105/api.json +7 -7
- tccli/services/acp/v20220105/examples.json +2 -2
- tccli/services/aiart/v20221229/api.json +29 -29
- tccli/services/aiart/v20221229/examples.json +8 -8
- tccli/services/apigateway/v20180808/api.json +18 -17
- tccli/services/apigateway/v20180808/examples.json +12 -12
- tccli/services/apm/v20210622/api.json +98 -4
- tccli/services/asr/v20190614/api.json +18 -17
- tccli/services/asr/v20190614/examples.json +13 -13
- tccli/services/autoscaling/v20180419/api.json +371 -309
- tccli/services/autoscaling/v20180419/examples.json +17 -17
- tccli/services/batch/v20170312/api.json +7 -7
- tccli/services/bda/v20200324/api.json +39 -31
- tccli/services/bda/v20200324/examples.json +9 -9
- tccli/services/bh/__init__.py +4 -0
- tccli/services/bh/bh_client.py +3428 -0
- tccli/services/bh/v20230418/api.json +8180 -0
- tccli/services/bh/v20230418/examples.json +519 -0
- tccli/services/bi/v20220105/api.json +48 -0
- tccli/services/billing/v20180709/api.json +26 -24
- tccli/services/bsca/v20210811/api.json +1 -1
- tccli/services/btoe/v20210514/api.json +4 -4
- tccli/services/btoe/v20210514/examples.json +2 -2
- tccli/services/ca/v20230228/api.json +60 -0
- tccli/services/cam/v20190116/api.json +11 -11
- tccli/services/cat/v20180409/api.json +9 -0
- tccli/services/cbs/v20170312/api.json +200 -188
- tccli/services/cbs/v20170312/examples.json +4 -4
- tccli/services/ccc/v20200210/api.json +390 -323
- tccli/services/ccc/v20200210/examples.json +15 -15
- tccli/services/cdb/cdb_client.py +13 -13
- tccli/services/cdb/v20170320/api.json +295 -270
- tccli/services/cdb/v20170320/examples.json +38 -38
- tccli/services/cdc/v20201214/api.json +283 -270
- tccli/services/cdc/v20201214/examples.json +26 -26
- tccli/services/cds/v20180420/api.json +82 -76
- tccli/services/cds/v20180420/examples.json +1 -1
- tccli/services/cdwch/v20200915/api.json +1 -1
- tccli/services/cdwdoris/v20211228/api.json +42 -2
- tccli/services/cdz/v20221123/api.json +41 -5
- tccli/services/cfg/v20210820/api.json +31 -0
- tccli/services/cfs/v20190719/api.json +89 -1
- tccli/services/cfs/v20190719/examples.json +1 -1
- tccli/services/cfw/cfw_client.py +0 -53
- tccli/services/cfw/v20190904/api.json +1849 -1999
- tccli/services/cfw/v20190904/examples.json +157 -159
- tccli/services/ckafka/v20190819/api.json +104 -75
- tccli/services/clb/v20180317/api.json +48 -26
- tccli/services/clb/v20180317/examples.json +1 -1
- tccli/services/cloudapp/v20220530/api.json +5 -1
- tccli/services/cloudaudit/v20190319/api.json +58 -44
- tccli/services/cloudaudit/v20190319/examples.json +6 -6
- tccli/services/cloudstudio/v20230508/api.json +38 -37
- tccli/services/cloudstudio/v20230508/examples.json +4 -4
- tccli/services/cls/cls_client.py +216 -4
- tccli/services/cls/v20201016/api.json +536 -47
- tccli/services/cls/v20201016/examples.json +34 -2
- tccli/services/csip/v20221121/api.json +2562 -2382
- tccli/services/csip/v20221121/examples.json +108 -108
- tccli/services/cvm/v20170312/api.json +149 -112
- tccli/services/cvm/v20170312/examples.json +2 -2
- tccli/services/cwp/cwp_client.py +4 -110
- tccli/services/cwp/v20180228/api.json +6338 -6146
- tccli/services/cwp/v20180228/examples.json +342 -370
- tccli/services/cynosdb/v20190107/api.json +93 -81
- tccli/services/cynosdb/v20190107/examples.json +70 -70
- tccli/services/dasb/v20191018/api.json +796 -651
- tccli/services/dasb/v20191018/examples.json +101 -101
- tccli/services/dcdb/dcdb_client.py +114 -61
- tccli/services/dcdb/v20180411/api.json +141 -7
- tccli/services/dcdb/v20180411/examples.json +32 -0
- tccli/services/dlc/v20210125/api.json +21 -11
- tccli/services/dnspod/dnspod_client.py +417 -46
- tccli/services/dnspod/v20210323/api.json +751 -30
- tccli/services/dnspod/v20210323/examples.json +62 -0
- tccli/services/dts/v20211206/api.json +4 -4
- tccli/services/ecm/v20190719/api.json +2 -2
- tccli/services/emr/v20190103/api.json +339 -114
- tccli/services/emr/v20190103/examples.json +64 -82
- tccli/services/es/v20180416/api.json +29 -0
- tccli/services/es/v20180416/examples.json +1 -1
- tccli/services/ess/v20201111/api.json +49 -31
- tccli/services/ess/v20201111/examples.json +20 -8
- tccli/services/essbasic/v20210526/api.json +54 -49
- tccli/services/essbasic/v20210526/examples.json +36 -18
- tccli/services/facefusion/v20181201/api.json +47 -45
- tccli/services/facefusion/v20181201/examples.json +2 -2
- tccli/services/facefusion/v20220927/api.json +54 -48
- tccli/services/facefusion/v20220927/examples.json +5 -5
- tccli/services/faceid/v20180301/api.json +497 -496
- tccli/services/faceid/v20180301/examples.json +219 -101
- tccli/services/fmu/v20191213/api.json +59 -67
- tccli/services/fmu/v20191213/examples.json +22 -22
- tccli/services/ft/v20200304/api.json +53 -57
- tccli/services/ft/v20200304/examples.json +14 -14
- tccli/services/gme/v20180711/api.json +21 -11
- tccli/services/gme/v20180711/examples.json +1 -1
- tccli/services/hai/v20230812/api.json +116 -9
- tccli/services/hai/v20230812/examples.json +4 -4
- tccli/services/hunyuan/hunyuan_client.py +436 -12
- tccli/services/hunyuan/v20230901/api.json +1482 -118
- tccli/services/hunyuan/v20230901/examples.json +82 -18
- tccli/services/iai/v20180301/api.json +23 -19
- tccli/services/iai/v20180301/examples.json +2 -2
- tccli/services/iai/v20200303/api.json +530 -511
- tccli/services/iai/v20200303/examples.json +116 -86
- tccli/services/ig/__init__.py +4 -0
- tccli/services/ig/ig_client.py +195 -0
- tccli/services/ig/v20210518/api.json +83 -0
- tccli/services/ig/v20210518/examples.json +13 -0
- tccli/services/ioa/ioa_client.py +53 -0
- tccli/services/ioa/v20220601/api.json +662 -413
- tccli/services/ioa/v20220601/examples.json +24 -10
- tccli/services/iotexplorer/v20190423/api.json +33 -13
- tccli/services/iotexplorer/v20190423/examples.json +3 -3
- tccli/services/iotvideo/iotvideo_client.py +106 -0
- tccli/services/iotvideo/v20191126/api.json +256 -24
- tccli/services/iotvideo/v20191126/examples.json +19 -3
- tccli/services/iotvideo/v20201215/api.json +1 -1
- tccli/services/iotvideo/v20201215/examples.json +1 -1
- tccli/services/iotvideo/v20211125/api.json +1 -1
- tccli/services/iotvideo/v20211125/examples.json +2 -2
- tccli/services/iss/iss_client.py +69 -122
- tccli/services/iss/v20230517/api.json +10 -54
- tccli/services/iss/v20230517/examples.json +0 -14
- tccli/services/kms/v20190118/api.json +301 -268
- tccli/services/kms/v20190118/examples.json +45 -51
- tccli/services/lcic/lcic_client.py +159 -0
- tccli/services/lcic/v20220817/api.json +273 -1
- tccli/services/lcic/v20220817/examples.json +24 -0
- tccli/services/lighthouse/v20200324/api.json +56 -0
- tccli/services/live/live_client.py +159 -0
- tccli/services/live/v20180801/api.json +244 -0
- tccli/services/live/v20180801/examples.json +24 -0
- tccli/services/lke/v20231130/api.json +17 -17
- tccli/services/lke/v20231130/examples.json +19 -25
- tccli/services/mariadb/v20170312/api.json +7 -7
- tccli/services/market/v20191010/api.json +3 -3
- tccli/services/market/v20191010/examples.json +2 -2
- tccli/services/mmps/v20200710/api.json +47 -47
- tccli/services/mmps/v20200710/examples.json +3 -3
- tccli/services/mongodb/v20190725/api.json +4 -4
- tccli/services/monitor/v20180724/api.json +46 -19
- tccli/services/mps/v20190612/api.json +282 -5
- tccli/services/mps/v20190612/examples.json +25 -1
- tccli/services/mqtt/v20240516/api.json +2 -2
- tccli/services/mrs/v20200910/api.json +72 -34
- tccli/services/mrs/v20200910/examples.json +2 -2
- tccli/services/ms/v20180408/api.json +535 -506
- tccli/services/ms/v20180408/examples.json +25 -25
- tccli/services/oceanus/v20190422/api.json +130 -0
- tccli/services/ocr/ocr_client.py +232 -20
- tccli/services/ocr/v20181119/api.json +2265 -760
- tccli/services/ocr/v20181119/examples.json +200 -180
- tccli/services/omics/v20221128/api.json +614 -553
- tccli/services/omics/v20221128/examples.json +9 -9
- tccli/services/organization/v20210331/api.json +13 -4
- tccli/services/organization/v20210331/examples.json +2 -2
- tccli/services/partners/v20180321/api.json +244 -234
- tccli/services/partners/v20180321/examples.json +19 -19
- tccli/services/privatedns/privatedns_client.py +428 -4
- tccli/services/privatedns/v20201028/api.json +815 -11
- tccli/services/privatedns/v20201028/examples.json +64 -0
- tccli/services/pts/v20210728/api.json +18 -0
- tccli/services/pts/v20210728/examples.json +1 -1
- tccli/services/rce/rce_client.py +53 -0
- tccli/services/rce/v20201103/api.json +146 -0
- tccli/services/rce/v20201103/examples.json +8 -0
- tccli/services/redis/v20180412/api.json +42 -42
- tccli/services/redis/v20180412/examples.json +19 -19
- tccli/services/rum/v20210622/api.json +9 -0
- tccli/services/scf/v20180416/api.json +15 -15
- tccli/services/scf/v20180416/examples.json +1 -1
- tccli/services/smop/v20201203/api.json +46 -42
- tccli/services/smop/v20201203/examples.json +2 -2
- tccli/services/soe/v20180724/api.json +10 -10
- tccli/services/sqlserver/v20180328/api.json +21 -8
- tccli/services/sqlserver/v20180328/examples.json +5 -5
- tccli/services/ssl/v20191205/api.json +97 -4
- tccli/services/ssm/v20190923/api.json +292 -231
- tccli/services/ssm/v20190923/examples.json +42 -42
- tccli/services/tat/v20201028/api.json +97 -97
- tccli/services/tat/v20201028/examples.json +20 -26
- tccli/services/tchd/v20230306/api.json +5 -5
- tccli/services/tchd/v20230306/examples.json +3 -3
- tccli/services/tcr/v20190924/api.json +1 -1
- tccli/services/tcr/v20190924/examples.json +1 -1
- tccli/services/tcss/v20201101/api.json +1973 -1426
- tccli/services/tcss/v20201101/examples.json +346 -364
- tccli/services/tdmq/v20200217/api.json +539 -401
- tccli/services/tdmq/v20200217/examples.json +104 -104
- tccli/services/tds/v20220801/api.json +4 -4
- tccli/services/tem/v20210701/api.json +287 -271
- tccli/services/tem/v20210701/examples.json +59 -59
- tccli/services/teo/v20220901/api.json +37 -9
- tccli/services/teo/v20220901/examples.json +13 -7
- tccli/services/thpc/v20230321/api.json +5 -5
- tccli/services/tke/tke_client.py +217 -58
- tccli/services/tke/v20180525/api.json +36 -27
- tccli/services/tke/v20180525/examples.json +1 -1
- tccli/services/tke/v20220501/api.json +176 -0
- tccli/services/tke/v20220501/examples.json +24 -0
- tccli/services/tmt/v20180321/api.json +38 -8
- tccli/services/trp/v20210515/api.json +86 -74
- tccli/services/trp/v20210515/examples.json +65 -65
- tccli/services/trro/v20220325/api.json +72 -71
- tccli/services/trro/v20220325/examples.json +8 -8
- tccli/services/trtc/trtc_client.py +8 -61
- tccli/services/trtc/v20190722/api.json +72 -30
- tccli/services/trtc/v20190722/examples.json +3 -11
- tccli/services/tse/tse_client.py +110 -4
- tccli/services/tse/v20201207/api.json +122 -7
- tccli/services/tse/v20201207/examples.json +25 -9
- tccli/services/vclm/v20240523/api.json +225 -82
- tccli/services/vclm/v20240523/examples.json +13 -19
- tccli/services/vod/v20180717/api.json +431 -4
- tccli/services/vod/v20180717/examples.json +25 -5
- tccli/services/vod/v20240718/api.json +11 -11
- tccli/services/vod/v20240718/examples.json +4 -4
- tccli/services/vod/vod_client.py +53 -0
- tccli/services/vpc/v20170312/api.json +1090 -862
- tccli/services/vpc/v20170312/examples.json +74 -66
- tccli/services/vpc/vpc_client.py +61 -8
- tccli/services/waf/v20180125/api.json +2540 -2177
- tccli/services/waf/v20180125/examples.json +216 -284
- tccli/services/waf/waf_client.py +172 -119
- tccli/services/wav/v20210129/api.json +48 -48
- tccli/services/wav/v20210129/examples.json +4 -4
- tccli/services/wedata/v20210820/api.json +909 -25
- tccli/services/wedata/v20210820/examples.json +28 -4
- tccli/services/wedata/wedata_client.py +159 -0
- tccli/services/weilingwith/v20230427/api.json +6 -6
- tccli/services/weilingwith/v20230427/examples.json +3 -3
- tccli/sso.py +229 -0
- {tccli-3.0.1216.1.dist-info → tccli-3.0.1217.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1216.1.dist-info → tccli-3.0.1217.1.dist-info}/RECORD +252 -235
- {tccli-3.0.1216.1.dist-info → tccli-3.0.1217.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1216.1.dist-info → tccli-3.0.1217.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1216.1.dist-info → tccli-3.0.1217.1.dist-info}/license_files/LICENSE +0 -0
@@ -17,7 +17,7 @@ from tencentcloud.hunyuan.v20230901 import models as models_v20230901
|
|
17
17
|
from jmespath import search
|
18
18
|
import time
|
19
19
|
|
20
|
-
def
|
20
|
+
def doFilesList(args, parsed_globals):
|
21
21
|
g_param = parse_global_arg(parsed_globals)
|
22
22
|
|
23
23
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -46,11 +46,63 @@ def doQueryHunyuanImageChatJob(args, parsed_globals):
|
|
46
46
|
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
47
47
|
client._sdkVersion += ("_CLI_" + __version__)
|
48
48
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
-
model = models.
|
49
|
+
model = models.FilesListRequest()
|
50
50
|
model.from_json_string(json.dumps(args))
|
51
51
|
start_time = time.time()
|
52
52
|
while True:
|
53
|
-
rsp = client.
|
53
|
+
rsp = client.FilesList(model)
|
54
|
+
result = rsp.to_json_string()
|
55
|
+
try:
|
56
|
+
json_obj = json.loads(result)
|
57
|
+
except TypeError as e:
|
58
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
59
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
60
|
+
break
|
61
|
+
cur_time = time.time()
|
62
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
63
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
64
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
65
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
66
|
+
else:
|
67
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
68
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
69
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
70
|
+
|
71
|
+
|
72
|
+
def doGetThread(args, parsed_globals):
|
73
|
+
g_param = parse_global_arg(parsed_globals)
|
74
|
+
|
75
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
76
|
+
cred = credential.CVMRoleCredential()
|
77
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
78
|
+
cred = credential.STSAssumeRoleCredential(
|
79
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
80
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
81
|
+
)
|
82
|
+
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):
|
83
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
84
|
+
else:
|
85
|
+
cred = credential.Credential(
|
86
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
87
|
+
)
|
88
|
+
http_profile = HttpProfile(
|
89
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
90
|
+
reqMethod="POST",
|
91
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
92
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
93
|
+
)
|
94
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
95
|
+
if g_param[OptionsDefine.Language]:
|
96
|
+
profile.language = g_param[OptionsDefine.Language]
|
97
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
98
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
99
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
100
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
101
|
+
model = models.GetThreadRequest()
|
102
|
+
model.from_json_string(json.dumps(args))
|
103
|
+
start_time = time.time()
|
104
|
+
while True:
|
105
|
+
rsp = client.GetThread(model)
|
54
106
|
result = rsp.to_json_string()
|
55
107
|
try:
|
56
108
|
json_obj = json.loads(result)
|
@@ -121,6 +173,58 @@ def doSubmitHunyuanImageJob(args, parsed_globals):
|
|
121
173
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
122
174
|
|
123
175
|
|
176
|
+
def doCreateThread(args, parsed_globals):
|
177
|
+
g_param = parse_global_arg(parsed_globals)
|
178
|
+
|
179
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
180
|
+
cred = credential.CVMRoleCredential()
|
181
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
182
|
+
cred = credential.STSAssumeRoleCredential(
|
183
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
184
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
185
|
+
)
|
186
|
+
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):
|
187
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
188
|
+
else:
|
189
|
+
cred = credential.Credential(
|
190
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
191
|
+
)
|
192
|
+
http_profile = HttpProfile(
|
193
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
194
|
+
reqMethod="POST",
|
195
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
196
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
197
|
+
)
|
198
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
199
|
+
if g_param[OptionsDefine.Language]:
|
200
|
+
profile.language = g_param[OptionsDefine.Language]
|
201
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
202
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
203
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
204
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
205
|
+
model = models.CreateThreadRequest()
|
206
|
+
model.from_json_string(json.dumps(args))
|
207
|
+
start_time = time.time()
|
208
|
+
while True:
|
209
|
+
rsp = client.CreateThread(model)
|
210
|
+
result = rsp.to_json_string()
|
211
|
+
try:
|
212
|
+
json_obj = json.loads(result)
|
213
|
+
except TypeError as e:
|
214
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
215
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
216
|
+
break
|
217
|
+
cur_time = time.time()
|
218
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
219
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
220
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
221
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
222
|
+
else:
|
223
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
224
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
225
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
226
|
+
|
227
|
+
|
124
228
|
def doQueryHunyuanImageJob(args, parsed_globals):
|
125
229
|
g_param = parse_global_arg(parsed_globals)
|
126
230
|
|
@@ -173,6 +277,110 @@ def doQueryHunyuanImageJob(args, parsed_globals):
|
|
173
277
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
174
278
|
|
175
279
|
|
280
|
+
def doFilesDeletions(args, parsed_globals):
|
281
|
+
g_param = parse_global_arg(parsed_globals)
|
282
|
+
|
283
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
284
|
+
cred = credential.CVMRoleCredential()
|
285
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
286
|
+
cred = credential.STSAssumeRoleCredential(
|
287
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
288
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
289
|
+
)
|
290
|
+
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):
|
291
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
292
|
+
else:
|
293
|
+
cred = credential.Credential(
|
294
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
295
|
+
)
|
296
|
+
http_profile = HttpProfile(
|
297
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
298
|
+
reqMethod="POST",
|
299
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
300
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
301
|
+
)
|
302
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
303
|
+
if g_param[OptionsDefine.Language]:
|
304
|
+
profile.language = g_param[OptionsDefine.Language]
|
305
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
306
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
307
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
308
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
309
|
+
model = models.FilesDeletionsRequest()
|
310
|
+
model.from_json_string(json.dumps(args))
|
311
|
+
start_time = time.time()
|
312
|
+
while True:
|
313
|
+
rsp = client.FilesDeletions(model)
|
314
|
+
result = rsp.to_json_string()
|
315
|
+
try:
|
316
|
+
json_obj = json.loads(result)
|
317
|
+
except TypeError as e:
|
318
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
319
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
320
|
+
break
|
321
|
+
cur_time = time.time()
|
322
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
323
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
324
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
325
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
326
|
+
else:
|
327
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
328
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
329
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
330
|
+
|
331
|
+
|
332
|
+
def doFilesUploads(args, parsed_globals):
|
333
|
+
g_param = parse_global_arg(parsed_globals)
|
334
|
+
|
335
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
336
|
+
cred = credential.CVMRoleCredential()
|
337
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
338
|
+
cred = credential.STSAssumeRoleCredential(
|
339
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
340
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
341
|
+
)
|
342
|
+
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):
|
343
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
344
|
+
else:
|
345
|
+
cred = credential.Credential(
|
346
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
347
|
+
)
|
348
|
+
http_profile = HttpProfile(
|
349
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
350
|
+
reqMethod="POST",
|
351
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
352
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
353
|
+
)
|
354
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
355
|
+
if g_param[OptionsDefine.Language]:
|
356
|
+
profile.language = g_param[OptionsDefine.Language]
|
357
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
358
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
359
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
360
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
361
|
+
model = models.FilesUploadsRequest()
|
362
|
+
model.from_json_string(json.dumps(args))
|
363
|
+
start_time = time.time()
|
364
|
+
while True:
|
365
|
+
rsp = client.FilesUploads(model)
|
366
|
+
result = rsp.to_json_string()
|
367
|
+
try:
|
368
|
+
json_obj = json.loads(result)
|
369
|
+
except TypeError as e:
|
370
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
371
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
372
|
+
break
|
373
|
+
cur_time = time.time()
|
374
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
375
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
376
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
377
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
378
|
+
else:
|
379
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
380
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
381
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
382
|
+
|
383
|
+
|
176
384
|
def doGetTokenCount(args, parsed_globals):
|
177
385
|
g_param = parse_global_arg(parsed_globals)
|
178
386
|
|
@@ -277,6 +485,110 @@ def doSubmitHunyuanImageChatJob(args, parsed_globals):
|
|
277
485
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
278
486
|
|
279
487
|
|
488
|
+
def doRunThread(args, parsed_globals):
|
489
|
+
g_param = parse_global_arg(parsed_globals)
|
490
|
+
|
491
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
492
|
+
cred = credential.CVMRoleCredential()
|
493
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
494
|
+
cred = credential.STSAssumeRoleCredential(
|
495
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
496
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
497
|
+
)
|
498
|
+
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):
|
499
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
500
|
+
else:
|
501
|
+
cred = credential.Credential(
|
502
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
503
|
+
)
|
504
|
+
http_profile = HttpProfile(
|
505
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
506
|
+
reqMethod="POST",
|
507
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
508
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
509
|
+
)
|
510
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
511
|
+
if g_param[OptionsDefine.Language]:
|
512
|
+
profile.language = g_param[OptionsDefine.Language]
|
513
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
514
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
515
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
516
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
517
|
+
model = models.RunThreadRequest()
|
518
|
+
model.from_json_string(json.dumps(args))
|
519
|
+
start_time = time.time()
|
520
|
+
while True:
|
521
|
+
rsp = client.RunThread(model)
|
522
|
+
result = rsp.to_json_string()
|
523
|
+
try:
|
524
|
+
json_obj = json.loads(result)
|
525
|
+
except TypeError as e:
|
526
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
527
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
528
|
+
break
|
529
|
+
cur_time = time.time()
|
530
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
531
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
532
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
533
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
534
|
+
else:
|
535
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
536
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
537
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
538
|
+
|
539
|
+
|
540
|
+
def doGetThreadMessage(args, parsed_globals):
|
541
|
+
g_param = parse_global_arg(parsed_globals)
|
542
|
+
|
543
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
544
|
+
cred = credential.CVMRoleCredential()
|
545
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
546
|
+
cred = credential.STSAssumeRoleCredential(
|
547
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
548
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
549
|
+
)
|
550
|
+
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):
|
551
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
552
|
+
else:
|
553
|
+
cred = credential.Credential(
|
554
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
555
|
+
)
|
556
|
+
http_profile = HttpProfile(
|
557
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
558
|
+
reqMethod="POST",
|
559
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
560
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
561
|
+
)
|
562
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
563
|
+
if g_param[OptionsDefine.Language]:
|
564
|
+
profile.language = g_param[OptionsDefine.Language]
|
565
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
566
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
567
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
568
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
569
|
+
model = models.GetThreadMessageRequest()
|
570
|
+
model.from_json_string(json.dumps(args))
|
571
|
+
start_time = time.time()
|
572
|
+
while True:
|
573
|
+
rsp = client.GetThreadMessage(model)
|
574
|
+
result = rsp.to_json_string()
|
575
|
+
try:
|
576
|
+
json_obj = json.loads(result)
|
577
|
+
except TypeError as e:
|
578
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
579
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
580
|
+
break
|
581
|
+
cur_time = time.time()
|
582
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
583
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
584
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
585
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
586
|
+
else:
|
587
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
588
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
589
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
590
|
+
|
591
|
+
|
280
592
|
def doChatCompletions(args, parsed_globals):
|
281
593
|
g_param = parse_global_arg(parsed_globals)
|
282
594
|
|
@@ -329,7 +641,7 @@ def doChatCompletions(args, parsed_globals):
|
|
329
641
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
330
642
|
|
331
643
|
|
332
|
-
def
|
644
|
+
def doQueryHunyuanImageChatJob(args, parsed_globals):
|
333
645
|
g_param = parse_global_arg(parsed_globals)
|
334
646
|
|
335
647
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -358,11 +670,115 @@ def doGetEmbedding(args, parsed_globals):
|
|
358
670
|
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
359
671
|
client._sdkVersion += ("_CLI_" + __version__)
|
360
672
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
361
|
-
model = models.
|
673
|
+
model = models.QueryHunyuanImageChatJobRequest()
|
362
674
|
model.from_json_string(json.dumps(args))
|
363
675
|
start_time = time.time()
|
364
676
|
while True:
|
365
|
-
rsp = client.
|
677
|
+
rsp = client.QueryHunyuanImageChatJob(model)
|
678
|
+
result = rsp.to_json_string()
|
679
|
+
try:
|
680
|
+
json_obj = json.loads(result)
|
681
|
+
except TypeError as e:
|
682
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
683
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
684
|
+
break
|
685
|
+
cur_time = time.time()
|
686
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
687
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
688
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
689
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
690
|
+
else:
|
691
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
692
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
693
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
694
|
+
|
695
|
+
|
696
|
+
def doActivateService(args, parsed_globals):
|
697
|
+
g_param = parse_global_arg(parsed_globals)
|
698
|
+
|
699
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
700
|
+
cred = credential.CVMRoleCredential()
|
701
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
702
|
+
cred = credential.STSAssumeRoleCredential(
|
703
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
704
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
705
|
+
)
|
706
|
+
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):
|
707
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
708
|
+
else:
|
709
|
+
cred = credential.Credential(
|
710
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
711
|
+
)
|
712
|
+
http_profile = HttpProfile(
|
713
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
714
|
+
reqMethod="POST",
|
715
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
716
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
717
|
+
)
|
718
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
719
|
+
if g_param[OptionsDefine.Language]:
|
720
|
+
profile.language = g_param[OptionsDefine.Language]
|
721
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
722
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
723
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
724
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
725
|
+
model = models.ActivateServiceRequest()
|
726
|
+
model.from_json_string(json.dumps(args))
|
727
|
+
start_time = time.time()
|
728
|
+
while True:
|
729
|
+
rsp = client.ActivateService(model)
|
730
|
+
result = rsp.to_json_string()
|
731
|
+
try:
|
732
|
+
json_obj = json.loads(result)
|
733
|
+
except TypeError as e:
|
734
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
735
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
736
|
+
break
|
737
|
+
cur_time = time.time()
|
738
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
739
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
740
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
741
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
742
|
+
else:
|
743
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
744
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
745
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
746
|
+
|
747
|
+
|
748
|
+
def doGetThreadMessageList(args, parsed_globals):
|
749
|
+
g_param = parse_global_arg(parsed_globals)
|
750
|
+
|
751
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
752
|
+
cred = credential.CVMRoleCredential()
|
753
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
754
|
+
cred = credential.STSAssumeRoleCredential(
|
755
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
756
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
757
|
+
)
|
758
|
+
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):
|
759
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
760
|
+
else:
|
761
|
+
cred = credential.Credential(
|
762
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
763
|
+
)
|
764
|
+
http_profile = HttpProfile(
|
765
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
766
|
+
reqMethod="POST",
|
767
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
768
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
769
|
+
)
|
770
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
771
|
+
if g_param[OptionsDefine.Language]:
|
772
|
+
profile.language = g_param[OptionsDefine.Language]
|
773
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
774
|
+
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
775
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
776
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
777
|
+
model = models.GetThreadMessageListRequest()
|
778
|
+
model.from_json_string(json.dumps(args))
|
779
|
+
start_time = time.time()
|
780
|
+
while True:
|
781
|
+
rsp = client.GetThreadMessageList(model)
|
366
782
|
result = rsp.to_json_string()
|
367
783
|
try:
|
368
784
|
json_obj = json.loads(result)
|
@@ -485,7 +901,7 @@ def doTextToImageLite(args, parsed_globals):
|
|
485
901
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
486
902
|
|
487
903
|
|
488
|
-
def
|
904
|
+
def doGetEmbedding(args, parsed_globals):
|
489
905
|
g_param = parse_global_arg(parsed_globals)
|
490
906
|
|
491
907
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -514,11 +930,11 @@ def doActivateService(args, parsed_globals):
|
|
514
930
|
client = mod.HunyuanClient(cred, g_param[OptionsDefine.Region], profile)
|
515
931
|
client._sdkVersion += ("_CLI_" + __version__)
|
516
932
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
517
|
-
model = models.
|
933
|
+
model = models.GetEmbeddingRequest()
|
518
934
|
model.from_json_string(json.dumps(args))
|
519
935
|
start_time = time.time()
|
520
936
|
while True:
|
521
|
-
rsp = client.
|
937
|
+
rsp = client.GetEmbedding(model)
|
522
938
|
result = rsp.to_json_string()
|
523
939
|
try:
|
524
940
|
json_obj = json.loads(result)
|
@@ -548,16 +964,24 @@ MODELS_MAP = {
|
|
548
964
|
}
|
549
965
|
|
550
966
|
ACTION_MAP = {
|
551
|
-
"
|
967
|
+
"FilesList": doFilesList,
|
968
|
+
"GetThread": doGetThread,
|
552
969
|
"SubmitHunyuanImageJob": doSubmitHunyuanImageJob,
|
970
|
+
"CreateThread": doCreateThread,
|
553
971
|
"QueryHunyuanImageJob": doQueryHunyuanImageJob,
|
972
|
+
"FilesDeletions": doFilesDeletions,
|
973
|
+
"FilesUploads": doFilesUploads,
|
554
974
|
"GetTokenCount": doGetTokenCount,
|
555
975
|
"SubmitHunyuanImageChatJob": doSubmitHunyuanImageChatJob,
|
976
|
+
"RunThread": doRunThread,
|
977
|
+
"GetThreadMessage": doGetThreadMessage,
|
556
978
|
"ChatCompletions": doChatCompletions,
|
557
|
-
"
|
979
|
+
"QueryHunyuanImageChatJob": doQueryHunyuanImageChatJob,
|
980
|
+
"ActivateService": doActivateService,
|
981
|
+
"GetThreadMessageList": doGetThreadMessageList,
|
558
982
|
"SetPayMode": doSetPayMode,
|
559
983
|
"TextToImageLite": doTextToImageLite,
|
560
|
-
"
|
984
|
+
"GetEmbedding": doGetEmbedding,
|
561
985
|
|
562
986
|
}
|
563
987
|
|