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
@@ -0,0 +1,195 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
import six
|
5
|
+
import json
|
6
|
+
import tccli.options_define as OptionsDefine
|
7
|
+
import tccli.format_output as FormatOutput
|
8
|
+
from tccli import __version__
|
9
|
+
from tccli.utils import Utils
|
10
|
+
from tccli.exceptions import ConfigurationError, ClientError, ParamError
|
11
|
+
from tencentcloud.common import credential
|
12
|
+
from tencentcloud.common.profile.http_profile import HttpProfile
|
13
|
+
from tencentcloud.common.profile.client_profile import ClientProfile
|
14
|
+
from tencentcloud.ig.v20210518 import ig_client as ig_client_v20210518
|
15
|
+
from tencentcloud.ig.v20210518 import models as models_v20210518
|
16
|
+
|
17
|
+
from jmespath import search
|
18
|
+
import time
|
19
|
+
|
20
|
+
def doDescribeIgOrderList(args, parsed_globals):
|
21
|
+
g_param = parse_global_arg(parsed_globals)
|
22
|
+
|
23
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
24
|
+
cred = credential.CVMRoleCredential()
|
25
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
26
|
+
cred = credential.STSAssumeRoleCredential(
|
27
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
28
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
29
|
+
)
|
30
|
+
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):
|
31
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
32
|
+
else:
|
33
|
+
cred = credential.Credential(
|
34
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
35
|
+
)
|
36
|
+
http_profile = HttpProfile(
|
37
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
38
|
+
reqMethod="POST",
|
39
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
40
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
41
|
+
)
|
42
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
43
|
+
if g_param[OptionsDefine.Language]:
|
44
|
+
profile.language = g_param[OptionsDefine.Language]
|
45
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
46
|
+
client = mod.IgClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
+
model = models.DescribeIgOrderListRequest()
|
50
|
+
model.from_json_string(json.dumps(args))
|
51
|
+
start_time = time.time()
|
52
|
+
while True:
|
53
|
+
rsp = client.DescribeIgOrderList(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
|
+
CLIENT_MAP = {
|
73
|
+
"v20210518": ig_client_v20210518,
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
MODELS_MAP = {
|
78
|
+
"v20210518": models_v20210518,
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
ACTION_MAP = {
|
83
|
+
"DescribeIgOrderList": doDescribeIgOrderList,
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
AVAILABLE_VERSION_LIST = [
|
88
|
+
"v20210518",
|
89
|
+
|
90
|
+
]
|
91
|
+
|
92
|
+
|
93
|
+
def action_caller():
|
94
|
+
return ACTION_MAP
|
95
|
+
|
96
|
+
|
97
|
+
def parse_global_arg(parsed_globals):
|
98
|
+
g_param = parsed_globals
|
99
|
+
|
100
|
+
is_exist_profile = True
|
101
|
+
if not parsed_globals["profile"]:
|
102
|
+
is_exist_profile = False
|
103
|
+
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
104
|
+
|
105
|
+
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
106
|
+
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
107
|
+
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
108
|
+
|
109
|
+
conf = {}
|
110
|
+
cred = {}
|
111
|
+
|
112
|
+
if is_conf_exist:
|
113
|
+
conf = Utils.load_json_msg(conf_path)
|
114
|
+
if is_cred_exist:
|
115
|
+
cred = Utils.load_json_msg(cred_path)
|
116
|
+
|
117
|
+
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
118
|
+
raise ConfigurationError(
|
119
|
+
"file: %s or %s is not json format"
|
120
|
+
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
121
|
+
|
122
|
+
if OptionsDefine.Token not in cred:
|
123
|
+
cred[OptionsDefine.Token] = None
|
124
|
+
|
125
|
+
if not is_exist_profile:
|
126
|
+
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
127
|
+
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
128
|
+
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
129
|
+
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
130
|
+
|
131
|
+
if os.environ.get(OptionsDefine.ENV_REGION):
|
132
|
+
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
133
|
+
|
134
|
+
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
135
|
+
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
136
|
+
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
137
|
+
|
138
|
+
for param in g_param.keys():
|
139
|
+
if g_param[param] is None:
|
140
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
141
|
+
if param in cred:
|
142
|
+
g_param[param] = cred[param]
|
143
|
+
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
144
|
+
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
145
|
+
raise ConfigurationError("%s is invalid" % param)
|
146
|
+
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
147
|
+
if param in conf[OptionsDefine.SysParam]:
|
148
|
+
g_param[param] = conf[OptionsDefine.SysParam][param]
|
149
|
+
elif param != OptionsDefine.Language:
|
150
|
+
raise ConfigurationError("%s is invalid" % param)
|
151
|
+
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
152
|
+
if param.replace('_', '-') in cred:
|
153
|
+
g_param[param] = cred[param.replace('_', '-')]
|
154
|
+
|
155
|
+
try:
|
156
|
+
if g_param[OptionsDefine.ServiceVersion]:
|
157
|
+
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
158
|
+
else:
|
159
|
+
version = conf["ig"][OptionsDefine.Version]
|
160
|
+
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
161
|
+
|
162
|
+
if g_param[OptionsDefine.Endpoint] is None:
|
163
|
+
g_param[OptionsDefine.Endpoint] = conf["ig"][OptionsDefine.Endpoint]
|
164
|
+
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
165
|
+
except Exception as err:
|
166
|
+
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
167
|
+
|
168
|
+
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
169
|
+
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
170
|
+
|
171
|
+
if g_param[OptionsDefine.Waiter]:
|
172
|
+
param = eval(g_param[OptionsDefine.Waiter])
|
173
|
+
if 'expr' not in param:
|
174
|
+
raise Exception('`expr` in `--waiter` must be defined')
|
175
|
+
if 'to' not in param:
|
176
|
+
raise Exception('`to` in `--waiter` must be defined')
|
177
|
+
if 'timeout' not in param:
|
178
|
+
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
179
|
+
param['timeout'] = conf['waiter']['timeout']
|
180
|
+
else:
|
181
|
+
param['timeout'] = 180
|
182
|
+
if 'interval' not in param:
|
183
|
+
if 'waiter' in conf and 'interval' in conf['waiter']:
|
184
|
+
param['interval'] = conf['waiter']['interval']
|
185
|
+
else:
|
186
|
+
param['interval'] = 5
|
187
|
+
param['interval'] = min(param['interval'], param['timeout'])
|
188
|
+
g_param['OptionsDefine.WaiterInfo'] = param
|
189
|
+
|
190
|
+
if six.PY2:
|
191
|
+
for key, value in g_param.items():
|
192
|
+
if isinstance(value, six.text_type):
|
193
|
+
g_param[key] = value.encode('utf-8')
|
194
|
+
return g_param
|
195
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
{
|
2
|
+
"actions": {
|
3
|
+
"DescribeIgOrderList": {
|
4
|
+
"document": "查询智能导诊订单列表",
|
5
|
+
"input": "DescribeIgOrderListRequest",
|
6
|
+
"name": "查询智能导诊订单列表",
|
7
|
+
"output": "DescribeIgOrderListResponse",
|
8
|
+
"status": "online"
|
9
|
+
}
|
10
|
+
},
|
11
|
+
"metadata": {
|
12
|
+
"apiVersion": "2021-05-18",
|
13
|
+
"api_brief": "智能导诊服务,是腾讯基于医疗AI、自然语言处理技术,推出的以智能导诊为核心,包含智能问病、智能问药、医务咨询等十多种就医服务能力的AI产品,可应用于微信线上挂号、互联网医院、区域平台等场景中,解决了由于患者医药专业知识缺乏,院内咨询不便导致的医患资源错配的痛点,同时满足智慧医院服务评级的诉求。",
|
14
|
+
"serviceNameCN": "智能导诊",
|
15
|
+
"serviceShortName": "ig"
|
16
|
+
},
|
17
|
+
"objects": {
|
18
|
+
"DescribeIgOrderListRequest": {
|
19
|
+
"document": "DescribeIgOrderList请求参数结构体",
|
20
|
+
"members": [
|
21
|
+
{
|
22
|
+
"disabled": false,
|
23
|
+
"document": "页码",
|
24
|
+
"example": "1",
|
25
|
+
"member": "int64",
|
26
|
+
"name": "PageNumber",
|
27
|
+
"required": true,
|
28
|
+
"type": "int"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"disabled": false,
|
32
|
+
"document": "每页数目",
|
33
|
+
"example": "10",
|
34
|
+
"member": "int64",
|
35
|
+
"name": "PageSize",
|
36
|
+
"required": true,
|
37
|
+
"type": "int"
|
38
|
+
},
|
39
|
+
{
|
40
|
+
"disabled": false,
|
41
|
+
"document": "产品类型",
|
42
|
+
"example": "ig",
|
43
|
+
"member": "string",
|
44
|
+
"name": "ProductType",
|
45
|
+
"required": true,
|
46
|
+
"type": "string"
|
47
|
+
},
|
48
|
+
{
|
49
|
+
"disabled": false,
|
50
|
+
"document": "订单状态",
|
51
|
+
"example": "1",
|
52
|
+
"member": "int64",
|
53
|
+
"name": "OrderStatus",
|
54
|
+
"required": false,
|
55
|
+
"type": "int"
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"disabled": false,
|
59
|
+
"document": "搜索关键字",
|
60
|
+
"example": "20210512936000413352781",
|
61
|
+
"member": "string",
|
62
|
+
"name": "KeyWord",
|
63
|
+
"required": false,
|
64
|
+
"type": "string"
|
65
|
+
}
|
66
|
+
],
|
67
|
+
"type": "object"
|
68
|
+
},
|
69
|
+
"DescribeIgOrderListResponse": {
|
70
|
+
"document": "DescribeIgOrderList返回参数结构体",
|
71
|
+
"members": [
|
72
|
+
{
|
73
|
+
"document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
|
74
|
+
"member": "string",
|
75
|
+
"name": "RequestId",
|
76
|
+
"type": "string"
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"type": "object"
|
80
|
+
}
|
81
|
+
},
|
82
|
+
"version": "1.0"
|
83
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"actions": {
|
3
|
+
"DescribeIgOrderList": [
|
4
|
+
{
|
5
|
+
"document": "",
|
6
|
+
"input": "POST / HTTP/1.1\nHost: ig.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeIgOrderList\n<公共请求参数>\n\n{\n \"PageNumber\": 1,\n \"PageSize\": 10,\n \"ProductType\": \"ig\",\n \"KeyWord\": \"20210521001000429685321\",\n \"OrderStatus\": 1\n}",
|
7
|
+
"output": "{\n \"Response\": {\n \"RequestId\": \"bea70601-4f99-4462-86ef-cddaae67bca0\"\n }\n}",
|
8
|
+
"title": "查询智能导诊订单列表"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
},
|
12
|
+
"version": "1.0"
|
13
|
+
}
|
tccli/services/ioa/ioa_client.py
CHANGED
@@ -121,6 +121,58 @@ def doDescribeDevices(args, parsed_globals):
|
|
121
121
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
122
122
|
|
123
123
|
|
124
|
+
def doCreateDeviceVirtualGroup(args, parsed_globals):
|
125
|
+
g_param = parse_global_arg(parsed_globals)
|
126
|
+
|
127
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
128
|
+
cred = credential.CVMRoleCredential()
|
129
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
130
|
+
cred = credential.STSAssumeRoleCredential(
|
131
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
132
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
133
|
+
)
|
134
|
+
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):
|
135
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
136
|
+
else:
|
137
|
+
cred = credential.Credential(
|
138
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
139
|
+
)
|
140
|
+
http_profile = HttpProfile(
|
141
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
142
|
+
reqMethod="POST",
|
143
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
144
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
145
|
+
)
|
146
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
147
|
+
if g_param[OptionsDefine.Language]:
|
148
|
+
profile.language = g_param[OptionsDefine.Language]
|
149
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
150
|
+
client = mod.IoaClient(cred, g_param[OptionsDefine.Region], profile)
|
151
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
152
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
153
|
+
model = models.CreateDeviceVirtualGroupRequest()
|
154
|
+
model.from_json_string(json.dumps(args))
|
155
|
+
start_time = time.time()
|
156
|
+
while True:
|
157
|
+
rsp = client.CreateDeviceVirtualGroup(model)
|
158
|
+
result = rsp.to_json_string()
|
159
|
+
try:
|
160
|
+
json_obj = json.loads(result)
|
161
|
+
except TypeError as e:
|
162
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
163
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
164
|
+
break
|
165
|
+
cur_time = time.time()
|
166
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
167
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
168
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
169
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
170
|
+
else:
|
171
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
172
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
173
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
174
|
+
|
175
|
+
|
124
176
|
def doDescribeAccountGroups(args, parsed_globals):
|
125
177
|
g_param = parse_global_arg(parsed_globals)
|
126
178
|
|
@@ -238,6 +290,7 @@ MODELS_MAP = {
|
|
238
290
|
ACTION_MAP = {
|
239
291
|
"DescribeRootAccountGroup": doDescribeRootAccountGroup,
|
240
292
|
"DescribeDevices": doDescribeDevices,
|
293
|
+
"CreateDeviceVirtualGroup": doCreateDeviceVirtualGroup,
|
241
294
|
"DescribeAccountGroups": doDescribeAccountGroups,
|
242
295
|
"DescribeLocalAccounts": doDescribeLocalAccounts,
|
243
296
|
|