tccli 3.0.1348.1__py2.py3-none-any.whl → 3.0.1350.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/__init__.py +0 -76
- tccli/services/ai3d/v20250513/api.json +1 -1
- tccli/services/aiart/v20221229/api.json +2 -2
- tccli/services/autoscaling/v20180419/api.json +11 -0
- tccli/services/batch/v20170312/api.json +44 -0
- tccli/services/cdb/v20170320/api.json +8 -8
- tccli/services/cdb/v20170320/examples.json +1 -1
- tccli/services/cdn/v20180606/api.json +5 -5
- tccli/services/cdwch/v20200915/api.json +11 -1
- tccli/services/cdwdoris/v20211228/api.json +145 -7
- tccli/services/cfg/v20210820/api.json +20 -0
- tccli/services/cfs/v20190719/api.json +10 -10
- tccli/services/cfw/cfw_client.py +53 -0
- tccli/services/cfw/v20190904/api.json +272 -0
- tccli/services/cfw/v20190904/examples.json +8 -0
- tccli/services/ckafka/ckafka_client.py +0 -53
- tccli/services/ckafka/v20190819/api.json +0 -215
- tccli/services/ckafka/v20190819/examples.json +0 -8
- tccli/services/csip/csip_client.py +833 -144
- tccli/services/csip/v20221121/api.json +3304 -1436
- tccli/services/csip/v20221121/examples.json +105 -7
- tccli/services/ctem/v20231128/api.json +20 -0
- tccli/services/cvm/v20170312/api.json +3 -3
- tccli/services/cwp/v20180228/api.json +9 -0
- tccli/services/cwp/v20180228/examples.json +6 -0
- tccli/services/dts/v20211206/api.json +21 -1
- tccli/services/emr/v20190103/api.json +219 -4
- tccli/services/es/v20250101/api.json +22 -0
- tccli/services/ess/v20201111/api.json +10 -1
- tccli/services/essbasic/v20210526/api.json +3 -3
- tccli/services/faceid/v20180301/api.json +3 -3
- tccli/services/gs/v20191118/api.json +38 -0
- tccli/services/igtm/igtm_client.py +159 -0
- tccli/services/igtm/v20231024/api.json +577 -0
- tccli/services/igtm/v20231024/examples.json +24 -0
- tccli/services/iotexplorer/v20190423/api.json +3 -3
- tccli/services/lcic/lcic_client.py +53 -0
- tccli/services/lcic/v20220817/api.json +53 -0
- tccli/services/lcic/v20220817/examples.json +8 -0
- tccli/services/live/live_client.py +224 -65
- tccli/services/live/v20180801/api.json +275 -1
- tccli/services/live/v20180801/examples.json +25 -1
- tccli/services/lke/v20231130/api.json +248 -2
- tccli/services/lke/v20231130/examples.json +1 -1
- tccli/services/lkeap/v20240522/api.json +1 -1
- tccli/services/mrs/v20200910/api.json +10 -0
- tccli/services/nlp/nlp_client.py +4 -322
- tccli/services/nlp/v20190408/api.json +0 -459
- tccli/services/nlp/v20190408/examples.json +0 -48
- tccli/services/ocr/v20181119/api.json +60 -5
- tccli/services/omics/v20221128/api.json +41 -3
- tccli/services/redis/v20180412/api.json +6 -6
- tccli/services/redis/v20180412/examples.json +1 -1
- tccli/services/ses/v20201002/api.json +100 -5
- tccli/services/tcb/v20180608/api.json +1 -1
- tccli/services/tcb/v20180608/examples.json +1 -1
- tccli/services/tdmq/v20200217/api.json +19 -0
- tccli/services/teo/teo_client.py +281 -16
- tccli/services/teo/v20220901/api.json +611 -6
- tccli/services/teo/v20220901/examples.json +48 -2
- tccli/services/tione/v20211111/api.json +16 -0
- tccli/services/tke/tke_client.py +57 -4
- tccli/services/tke/v20180525/api.json +24 -24
- tccli/services/tke/v20220501/api.json +52 -0
- tccli/services/tke/v20220501/examples.json +8 -0
- tccli/services/tmt/v20180321/api.json +4 -4
- tccli/services/tsf/v20180326/api.json +4 -4
- tccli/services/vclm/v20240523/api.json +2 -2
- tccli/services/vod/v20180717/api.json +5 -5
- tccli/services/vod/v20180717/examples.json +9 -9
- tccli/services/vpc/v20170312/api.json +1 -1
- tccli/services/vrs/v20200824/api.json +1 -1
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/RECORD +78 -180
- tccli/services/cis/__init__.py +0 -4
- tccli/services/cis/cis_client.py +0 -525
- tccli/services/cis/v20180408/api.json +0 -737
- tccli/services/cis/v20180408/examples.json +0 -93
- tccli/services/dataintegration/__init__.py +0 -4
- tccli/services/dataintegration/dataintegration_client.py +0 -207
- tccli/services/dataintegration/v20220613/api.json +0 -87
- tccli/services/dataintegration/v20220613/examples.json +0 -13
- tccli/services/dtf/__init__.py +0 -4
- tccli/services/dtf/dtf_client.py +0 -207
- tccli/services/dtf/v20200506/api.json +0 -274
- tccli/services/dtf/v20200506/examples.json +0 -13
- tccli/services/gpm/__init__.py +0 -4
- tccli/services/gpm/gpm_client.py +0 -1108
- tccli/services/gpm/v20200820/api.json +0 -1959
- tccli/services/gpm/v20200820/examples.json +0 -149
- tccli/services/gse/__init__.py +0 -4
- tccli/services/gse/gse_client.py +0 -4076
- tccli/services/gse/v20191112/api.json +0 -7095
- tccli/services/gse/v20191112/examples.json +0 -615
- tccli/services/iecp/__init__.py +0 -4
- tccli/services/iecp/iecp_client.py +0 -4500
- tccli/services/iecp/v20210914/api.json +0 -9770
- tccli/services/iecp/v20210914/examples.json +0 -691
- tccli/services/iir/__init__.py +0 -4
- tccli/services/iir/iir_client.py +0 -207
- tccli/services/iir/v20200417/api.json +0 -204
- tccli/services/iir/v20200417/examples.json +0 -13
- tccli/services/iottid/__init__.py +0 -4
- tccli/services/iottid/iottid_client.py +0 -631
- tccli/services/iottid/v20190411/api.json +0 -553
- tccli/services/iottid/v20190411/examples.json +0 -95
- tccli/services/mgobe/__init__.py +0 -4
- tccli/services/mgobe/mgobe_client.py +0 -530
- tccli/services/mgobe/v20190929/api.json +0 -52
- tccli/services/mgobe/v20190929/examples.json +0 -13
- tccli/services/mgobe/v20201014/api.json +0 -671
- tccli/services/mgobe/v20201014/examples.json +0 -61
- tccli/services/mvj/__init__.py +0 -4
- tccli/services/mvj/mvj_client.py +0 -207
- tccli/services/mvj/v20190926/api.json +0 -123
- tccli/services/mvj/v20190926/examples.json +0 -19
- tccli/services/pds/__init__.py +0 -4
- tccli/services/pds/pds_client.py +0 -260
- tccli/services/pds/v20210701/api.json +0 -193
- tccli/services/pds/v20210701/examples.json +0 -21
- tccli/services/smpn/__init__.py +0 -4
- tccli/services/smpn/smpn_client.py +0 -260
- tccli/services/smpn/v20190822/api.json +0 -191
- tccli/services/smpn/v20190822/examples.json +0 -21
- tccli/services/solar/__init__.py +0 -4
- tccli/services/solar/solar_client.py +0 -1055
- tccli/services/solar/v20181011/api.json +0 -1760
- tccli/services/solar/v20181011/examples.json +0 -125
- tccli/services/tan/__init__.py +0 -4
- tccli/services/tan/tan_client.py +0 -207
- tccli/services/tan/v20220420/api.json +0 -65
- tccli/services/tan/v20220420/examples.json +0 -19
- tccli/services/tav/__init__.py +0 -4
- tccli/services/tav/tav_client.py +0 -366
- tccli/services/tav/v20190118/api.json +0 -262
- tccli/services/tav/v20190118/examples.json +0 -37
- tccli/services/tbm/__init__.py +0 -4
- tccli/services/tbm/tbm_client.py +0 -631
- tccli/services/tbm/v20180129/api.json +0 -1037
- tccli/services/tbm/v20180129/examples.json +0 -77
- tccli/services/tcex/__init__.py +0 -4
- tccli/services/tcex/tcex_client.py +0 -260
- tccli/services/tcex/v20200727/api.json +0 -158
- tccli/services/tcex/v20200727/examples.json +0 -21
- tccli/services/tci/__init__.py +0 -4
- tccli/services/tci/tci_client.py +0 -2327
- tccli/services/tci/v20190318/api.json +0 -4958
- tccli/services/tci/v20190318/examples.json +0 -333
- tccli/services/tic/__init__.py +0 -4
- tccli/services/tic/tic_client.py +0 -843
- tccli/services/tic/v20201117/api.json +0 -1067
- tccli/services/tic/v20201117/examples.json +0 -121
- tccli/services/ticm/__init__.py +0 -4
- tccli/services/ticm/ticm_client.py +0 -313
- tccli/services/ticm/v20181127/api.json +0 -1391
- tccli/services/ticm/v20181127/examples.json +0 -53
- tccli/services/tics/__init__.py +0 -4
- tccli/services/tics/tics_client.py +0 -366
- tccli/services/tics/v20181115/api.json +0 -694
- tccli/services/tics/v20181115/examples.json +0 -37
- tccli/services/tiems/__init__.py +0 -4
- tccli/services/tiems/tiems_client.py +0 -1479
- tccli/services/tiems/v20190416/api.json +0 -3144
- tccli/services/tiems/v20190416/examples.json +0 -217
- tccli/services/trdp/__init__.py +0 -4
- tccli/services/trdp/trdp_client.py +0 -207
- tccli/services/trdp/v20220726/api.json +0 -843
- tccli/services/trdp/v20220726/examples.json +0 -13
- tccli/services/ump/__init__.py +0 -4
- tccli/services/ump/ump_client.py +0 -1055
- tccli/services/ump/v20200918/api.json +0 -2168
- tccli/services/ump/v20200918/examples.json +0 -141
- tccli/services/youmall/__init__.py +0 -4
- tccli/services/youmall/v20180228/api.json +0 -3572
- tccli/services/youmall/v20180228/examples.json +0 -313
- tccli/services/youmall/youmall_client.py +0 -1797
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/license_files/LICENSE +0 -0
tccli/services/tbm/tbm_client.py
DELETED
@@ -1,631 +0,0 @@
|
|
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.tbm.v20180129 import tbm_client as tbm_client_v20180129
|
15
|
-
from tencentcloud.tbm.v20180129 import models as models_v20180129
|
16
|
-
|
17
|
-
from jmespath import search
|
18
|
-
import time
|
19
|
-
|
20
|
-
def doDescribeUserPortrait(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.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
-
model = models.DescribeUserPortraitRequest()
|
50
|
-
model.from_json_string(json.dumps(args))
|
51
|
-
start_time = time.time()
|
52
|
-
while True:
|
53
|
-
rsp = client.DescribeUserPortrait(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 doDescribeBrandPosComments(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.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
99
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
100
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
101
|
-
model = models.DescribeBrandPosCommentsRequest()
|
102
|
-
model.from_json_string(json.dumps(args))
|
103
|
-
start_time = time.time()
|
104
|
-
while True:
|
105
|
-
rsp = client.DescribeBrandPosComments(model)
|
106
|
-
result = rsp.to_json_string()
|
107
|
-
try:
|
108
|
-
json_obj = json.loads(result)
|
109
|
-
except TypeError as e:
|
110
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
111
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
112
|
-
break
|
113
|
-
cur_time = time.time()
|
114
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
115
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
116
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
117
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
118
|
-
else:
|
119
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
120
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
121
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
122
|
-
|
123
|
-
|
124
|
-
def doDescribeBrandMediaReport(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.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
151
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
152
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
153
|
-
model = models.DescribeBrandMediaReportRequest()
|
154
|
-
model.from_json_string(json.dumps(args))
|
155
|
-
start_time = time.time()
|
156
|
-
while True:
|
157
|
-
rsp = client.DescribeBrandMediaReport(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
|
-
|
176
|
-
def doDescribeBrandNegComments(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.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
203
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
204
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
205
|
-
model = models.DescribeBrandNegCommentsRequest()
|
206
|
-
model.from_json_string(json.dumps(args))
|
207
|
-
start_time = time.time()
|
208
|
-
while True:
|
209
|
-
rsp = client.DescribeBrandNegComments(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
|
-
|
228
|
-
def doDescribeBrandSocialReport(args, parsed_globals):
|
229
|
-
g_param = parse_global_arg(parsed_globals)
|
230
|
-
|
231
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
232
|
-
cred = credential.CVMRoleCredential()
|
233
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
234
|
-
cred = credential.STSAssumeRoleCredential(
|
235
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
236
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
237
|
-
)
|
238
|
-
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):
|
239
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
240
|
-
else:
|
241
|
-
cred = credential.Credential(
|
242
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
243
|
-
)
|
244
|
-
http_profile = HttpProfile(
|
245
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
246
|
-
reqMethod="POST",
|
247
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
248
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
249
|
-
)
|
250
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
251
|
-
if g_param[OptionsDefine.Language]:
|
252
|
-
profile.language = g_param[OptionsDefine.Language]
|
253
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
254
|
-
client = mod.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
255
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
256
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
257
|
-
model = models.DescribeBrandSocialReportRequest()
|
258
|
-
model.from_json_string(json.dumps(args))
|
259
|
-
start_time = time.time()
|
260
|
-
while True:
|
261
|
-
rsp = client.DescribeBrandSocialReport(model)
|
262
|
-
result = rsp.to_json_string()
|
263
|
-
try:
|
264
|
-
json_obj = json.loads(result)
|
265
|
-
except TypeError as e:
|
266
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
267
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
268
|
-
break
|
269
|
-
cur_time = time.time()
|
270
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
271
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
272
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
273
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
274
|
-
else:
|
275
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
276
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
277
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
278
|
-
|
279
|
-
|
280
|
-
def doDescribeBrandSocialOpinion(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.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
307
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
308
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
309
|
-
model = models.DescribeBrandSocialOpinionRequest()
|
310
|
-
model.from_json_string(json.dumps(args))
|
311
|
-
start_time = time.time()
|
312
|
-
while True:
|
313
|
-
rsp = client.DescribeBrandSocialOpinion(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 doDescribeIndustryNews(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.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
359
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
360
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
361
|
-
model = models.DescribeIndustryNewsRequest()
|
362
|
-
model.from_json_string(json.dumps(args))
|
363
|
-
start_time = time.time()
|
364
|
-
while True:
|
365
|
-
rsp = client.DescribeIndustryNews(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
|
-
|
384
|
-
def doDescribeBrandCommentCount(args, parsed_globals):
|
385
|
-
g_param = parse_global_arg(parsed_globals)
|
386
|
-
|
387
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
388
|
-
cred = credential.CVMRoleCredential()
|
389
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
390
|
-
cred = credential.STSAssumeRoleCredential(
|
391
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
392
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
393
|
-
)
|
394
|
-
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):
|
395
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
396
|
-
else:
|
397
|
-
cred = credential.Credential(
|
398
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
399
|
-
)
|
400
|
-
http_profile = HttpProfile(
|
401
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
402
|
-
reqMethod="POST",
|
403
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
404
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
405
|
-
)
|
406
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
407
|
-
if g_param[OptionsDefine.Language]:
|
408
|
-
profile.language = g_param[OptionsDefine.Language]
|
409
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
410
|
-
client = mod.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
411
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
412
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
413
|
-
model = models.DescribeBrandCommentCountRequest()
|
414
|
-
model.from_json_string(json.dumps(args))
|
415
|
-
start_time = time.time()
|
416
|
-
while True:
|
417
|
-
rsp = client.DescribeBrandCommentCount(model)
|
418
|
-
result = rsp.to_json_string()
|
419
|
-
try:
|
420
|
-
json_obj = json.loads(result)
|
421
|
-
except TypeError as e:
|
422
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
423
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
424
|
-
break
|
425
|
-
cur_time = time.time()
|
426
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
427
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
428
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
429
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
430
|
-
else:
|
431
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
432
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
433
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
434
|
-
|
435
|
-
|
436
|
-
def doDescribeBrandExposure(args, parsed_globals):
|
437
|
-
g_param = parse_global_arg(parsed_globals)
|
438
|
-
|
439
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
440
|
-
cred = credential.CVMRoleCredential()
|
441
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
442
|
-
cred = credential.STSAssumeRoleCredential(
|
443
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
444
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
445
|
-
)
|
446
|
-
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):
|
447
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
448
|
-
else:
|
449
|
-
cred = credential.Credential(
|
450
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
451
|
-
)
|
452
|
-
http_profile = HttpProfile(
|
453
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
454
|
-
reqMethod="POST",
|
455
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
456
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
457
|
-
)
|
458
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
459
|
-
if g_param[OptionsDefine.Language]:
|
460
|
-
profile.language = g_param[OptionsDefine.Language]
|
461
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
462
|
-
client = mod.TbmClient(cred, g_param[OptionsDefine.Region], profile)
|
463
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
464
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
465
|
-
model = models.DescribeBrandExposureRequest()
|
466
|
-
model.from_json_string(json.dumps(args))
|
467
|
-
start_time = time.time()
|
468
|
-
while True:
|
469
|
-
rsp = client.DescribeBrandExposure(model)
|
470
|
-
result = rsp.to_json_string()
|
471
|
-
try:
|
472
|
-
json_obj = json.loads(result)
|
473
|
-
except TypeError as e:
|
474
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
475
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
476
|
-
break
|
477
|
-
cur_time = time.time()
|
478
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
479
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
480
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
481
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
482
|
-
else:
|
483
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
484
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
485
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
486
|
-
|
487
|
-
|
488
|
-
CLIENT_MAP = {
|
489
|
-
"v20180129": tbm_client_v20180129,
|
490
|
-
|
491
|
-
}
|
492
|
-
|
493
|
-
MODELS_MAP = {
|
494
|
-
"v20180129": models_v20180129,
|
495
|
-
|
496
|
-
}
|
497
|
-
|
498
|
-
ACTION_MAP = {
|
499
|
-
"DescribeUserPortrait": doDescribeUserPortrait,
|
500
|
-
"DescribeBrandPosComments": doDescribeBrandPosComments,
|
501
|
-
"DescribeBrandMediaReport": doDescribeBrandMediaReport,
|
502
|
-
"DescribeBrandNegComments": doDescribeBrandNegComments,
|
503
|
-
"DescribeBrandSocialReport": doDescribeBrandSocialReport,
|
504
|
-
"DescribeBrandSocialOpinion": doDescribeBrandSocialOpinion,
|
505
|
-
"DescribeIndustryNews": doDescribeIndustryNews,
|
506
|
-
"DescribeBrandCommentCount": doDescribeBrandCommentCount,
|
507
|
-
"DescribeBrandExposure": doDescribeBrandExposure,
|
508
|
-
|
509
|
-
}
|
510
|
-
|
511
|
-
AVAILABLE_VERSION_LIST = [
|
512
|
-
"v20180129",
|
513
|
-
|
514
|
-
]
|
515
|
-
|
516
|
-
|
517
|
-
def action_caller():
|
518
|
-
return ACTION_MAP
|
519
|
-
|
520
|
-
|
521
|
-
def parse_global_arg(parsed_globals):
|
522
|
-
g_param = parsed_globals
|
523
|
-
cvm_role_flag = True
|
524
|
-
for param in parsed_globals.keys():
|
525
|
-
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
|
526
|
-
OptionsDefine.RoleSessionName]:
|
527
|
-
if parsed_globals[param] is not None:
|
528
|
-
cvm_role_flag = False
|
529
|
-
break
|
530
|
-
is_exist_profile = True
|
531
|
-
if not parsed_globals["profile"]:
|
532
|
-
is_exist_profile = False
|
533
|
-
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
534
|
-
|
535
|
-
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
536
|
-
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
537
|
-
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
538
|
-
|
539
|
-
conf = {}
|
540
|
-
cred = {}
|
541
|
-
|
542
|
-
if is_conf_exist:
|
543
|
-
conf = Utils.load_json_msg(conf_path)
|
544
|
-
if is_cred_exist:
|
545
|
-
cred = Utils.load_json_msg(cred_path)
|
546
|
-
|
547
|
-
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
548
|
-
raise ConfigurationError(
|
549
|
-
"file: %s or %s is not json format"
|
550
|
-
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
551
|
-
|
552
|
-
if OptionsDefine.Token not in cred:
|
553
|
-
cred[OptionsDefine.Token] = None
|
554
|
-
|
555
|
-
if not is_exist_profile:
|
556
|
-
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
557
|
-
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
558
|
-
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
559
|
-
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
560
|
-
cvm_role_flag = False
|
561
|
-
|
562
|
-
if os.environ.get(OptionsDefine.ENV_REGION):
|
563
|
-
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
564
|
-
|
565
|
-
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
566
|
-
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
567
|
-
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
568
|
-
cvm_role_flag = False
|
569
|
-
|
570
|
-
if cvm_role_flag:
|
571
|
-
if "type" in cred and cred["type"] == "cvm-role":
|
572
|
-
g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
|
573
|
-
|
574
|
-
for param in g_param.keys():
|
575
|
-
if g_param[param] is None:
|
576
|
-
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
577
|
-
if param in cred:
|
578
|
-
g_param[param] = cred[param]
|
579
|
-
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
580
|
-
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
581
|
-
raise ConfigurationError("%s is invalid" % param)
|
582
|
-
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
583
|
-
if param in conf[OptionsDefine.SysParam]:
|
584
|
-
g_param[param] = conf[OptionsDefine.SysParam][param]
|
585
|
-
elif param != OptionsDefine.Language:
|
586
|
-
raise ConfigurationError("%s is invalid" % param)
|
587
|
-
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
588
|
-
if param.replace('_', '-') in cred:
|
589
|
-
g_param[param] = cred[param.replace('_', '-')]
|
590
|
-
|
591
|
-
try:
|
592
|
-
if g_param[OptionsDefine.ServiceVersion]:
|
593
|
-
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
594
|
-
else:
|
595
|
-
version = conf["tbm"][OptionsDefine.Version]
|
596
|
-
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
597
|
-
|
598
|
-
if g_param[OptionsDefine.Endpoint] is None:
|
599
|
-
g_param[OptionsDefine.Endpoint] = conf["tbm"][OptionsDefine.Endpoint]
|
600
|
-
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
601
|
-
except Exception as err:
|
602
|
-
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
603
|
-
|
604
|
-
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
605
|
-
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
606
|
-
|
607
|
-
if g_param[OptionsDefine.Waiter]:
|
608
|
-
param = eval(g_param[OptionsDefine.Waiter])
|
609
|
-
if 'expr' not in param:
|
610
|
-
raise Exception('`expr` in `--waiter` must be defined')
|
611
|
-
if 'to' not in param:
|
612
|
-
raise Exception('`to` in `--waiter` must be defined')
|
613
|
-
if 'timeout' not in param:
|
614
|
-
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
615
|
-
param['timeout'] = conf['waiter']['timeout']
|
616
|
-
else:
|
617
|
-
param['timeout'] = 180
|
618
|
-
if 'interval' not in param:
|
619
|
-
if 'waiter' in conf and 'interval' in conf['waiter']:
|
620
|
-
param['interval'] = conf['waiter']['interval']
|
621
|
-
else:
|
622
|
-
param['interval'] = 5
|
623
|
-
param['interval'] = min(param['interval'], param['timeout'])
|
624
|
-
g_param['OptionsDefine.WaiterInfo'] = param
|
625
|
-
|
626
|
-
if six.PY2:
|
627
|
-
for key, value in g_param.items():
|
628
|
-
if isinstance(value, six.text_type):
|
629
|
-
g_param[key] = value.encode('utf-8')
|
630
|
-
return g_param
|
631
|
-
|