tccli 3.0.1108.1__py2.py3-none-any.whl → 3.0.1110.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.
Files changed (57) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/examples/bi/v20220105/CreateEmbedToken.md +4 -2
  3. tccli/examples/cam/v20190116/CreateRole.md +1 -1
  4. tccli/examples/ccc/v20200210/CreateCompanyApply.md +10 -3
  5. tccli/examples/ccc/v20200210/DescribeCompanyList.md +2 -1
  6. tccli/examples/ccc/v20200210/ModifyCompanyApply.md +10 -3
  7. tccli/examples/emr/v20190103/DescribeEmrOverviewMetrics.md +40 -0
  8. tccli/examples/emr/v20190103/DescribeHBaseTableOverview.md +94 -0
  9. tccli/examples/ims/v20200713/ImageModeration.md +2 -2
  10. tccli/examples/ims/v20201229/ImageModeration.md +2 -2
  11. tccli/examples/vcg/v20240404/DescribeVideoStylizationJob.md +24 -0
  12. tccli/examples/vcg/v20240404/SubmitVideoStylizationJob.md +22 -0
  13. tccli/examples/vtc/v20240223/ConfirmVideoTranslateJob.md +33 -0
  14. tccli/examples/vtc/v20240223/DescribeVideoTranslateJob.md +70 -0
  15. tccli/examples/vtc/v20240223/SubmitVideoTranslateJob.md +49 -0
  16. tccli/services/__init__.py +6 -0
  17. tccli/services/autoscaling/v20180419/api.json +9 -8
  18. tccli/services/bi/v20220105/api.json +22 -3
  19. tccli/services/bi/v20220105/examples.json +2 -2
  20. tccli/services/cam/v20190116/api.json +71 -70
  21. tccli/services/cam/v20190116/examples.json +1 -1
  22. tccli/services/ccc/v20200210/api.json +99 -11
  23. tccli/services/ccc/v20200210/examples.json +3 -3
  24. tccli/services/cfw/v20190904/api.json +1 -1
  25. tccli/services/ckafka/v20190819/api.json +33 -13
  26. tccli/services/cls/v20201016/api.json +10 -10
  27. tccli/services/cvm/v20170312/api.json +33 -0
  28. tccli/services/dbbrain/v20210527/api.json +5 -5
  29. tccli/services/emr/emr_client.py +114 -8
  30. tccli/services/emr/v20190103/api.json +493 -0
  31. tccli/services/emr/v20190103/examples.json +16 -0
  32. tccli/services/hunyuan/v20230901/api.json +9 -0
  33. tccli/services/ims/v20200713/api.json +1 -1
  34. tccli/services/ims/v20200713/examples.json +1 -1
  35. tccli/services/ims/v20201229/api.json +1 -1
  36. tccli/services/ims/v20201229/examples.json +1 -1
  37. tccli/services/ms/v20180408/api.json +1 -1
  38. tccli/services/rce/rce_client.py +0 -53
  39. tccli/services/rce/v20201103/api.json +10 -34
  40. tccli/services/rce/v20201103/examples.json +0 -8
  41. tccli/services/tcss/v20201101/api.json +5 -5
  42. tccli/services/tdmq/v20200217/api.json +7 -7
  43. tccli/services/trtc/v20190722/api.json +20 -11
  44. tccli/services/vcg/__init__.py +4 -0
  45. tccli/services/vcg/v20240404/api.json +140 -0
  46. tccli/services/vcg/v20240404/examples.json +21 -0
  47. tccli/services/vcg/vcg_client.py +248 -0
  48. tccli/services/vod/v20180717/api.json +9 -0
  49. tccli/services/vtc/__init__.py +4 -0
  50. tccli/services/vtc/v20240223/api.json +425 -0
  51. tccli/services/vtc/v20240223/examples.json +41 -0
  52. tccli/services/vtc/vtc_client.py +301 -0
  53. {tccli-3.0.1108.1.dist-info → tccli-3.0.1110.1.dist-info}/METADATA +2 -2
  54. {tccli-3.0.1108.1.dist-info → tccli-3.0.1110.1.dist-info}/RECORD +57 -42
  55. {tccli-3.0.1108.1.dist-info → tccli-3.0.1110.1.dist-info}/WHEEL +0 -0
  56. {tccli-3.0.1108.1.dist-info → tccli-3.0.1110.1.dist-info}/entry_points.txt +0 -0
  57. {tccli-3.0.1108.1.dist-info → tccli-3.0.1110.1.dist-info}/license_files/LICENSE +0 -0
@@ -0,0 +1,301 @@
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.vtc.v20240223 import vtc_client as vtc_client_v20240223
15
+ from tencentcloud.vtc.v20240223 import models as models_v20240223
16
+
17
+ from jmespath import search
18
+ import time
19
+
20
+ def doSubmitVideoTranslateJob(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.VtcClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.SubmitVideoTranslateJobRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.SubmitVideoTranslateJob(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 doDescribeVideoTranslateJob(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.VtcClient(cred, g_param[OptionsDefine.Region], profile)
99
+ client._sdkVersion += ("_CLI_" + __version__)
100
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
+ model = models.DescribeVideoTranslateJobRequest()
102
+ model.from_json_string(json.dumps(args))
103
+ start_time = time.time()
104
+ while True:
105
+ rsp = client.DescribeVideoTranslateJob(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 doConfirmVideoTranslateJob(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.VtcClient(cred, g_param[OptionsDefine.Region], profile)
151
+ client._sdkVersion += ("_CLI_" + __version__)
152
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
153
+ model = models.ConfirmVideoTranslateJobRequest()
154
+ model.from_json_string(json.dumps(args))
155
+ start_time = time.time()
156
+ while True:
157
+ rsp = client.ConfirmVideoTranslateJob(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
+ CLIENT_MAP = {
177
+ "v20240223": vtc_client_v20240223,
178
+
179
+ }
180
+
181
+ MODELS_MAP = {
182
+ "v20240223": models_v20240223,
183
+
184
+ }
185
+
186
+ ACTION_MAP = {
187
+ "SubmitVideoTranslateJob": doSubmitVideoTranslateJob,
188
+ "DescribeVideoTranslateJob": doDescribeVideoTranslateJob,
189
+ "ConfirmVideoTranslateJob": doConfirmVideoTranslateJob,
190
+
191
+ }
192
+
193
+ AVAILABLE_VERSION_LIST = [
194
+ "v20240223",
195
+
196
+ ]
197
+
198
+
199
+ def action_caller():
200
+ return ACTION_MAP
201
+
202
+
203
+ def parse_global_arg(parsed_globals):
204
+ g_param = parsed_globals
205
+
206
+ is_exist_profile = True
207
+ if not parsed_globals["profile"]:
208
+ is_exist_profile = False
209
+ g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
210
+
211
+ configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
212
+ is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
213
+ is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
214
+
215
+ conf = {}
216
+ cred = {}
217
+
218
+ if is_conf_exist:
219
+ conf = Utils.load_json_msg(conf_path)
220
+ if is_cred_exist:
221
+ cred = Utils.load_json_msg(cred_path)
222
+
223
+ if not (isinstance(conf, dict) and isinstance(cred, dict)):
224
+ raise ConfigurationError(
225
+ "file: %s or %s is not json format"
226
+ % (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
227
+
228
+ if OptionsDefine.Token not in cred:
229
+ cred[OptionsDefine.Token] = None
230
+
231
+ if not is_exist_profile:
232
+ if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
233
+ cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
234
+ cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
235
+ cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
236
+
237
+ if os.environ.get(OptionsDefine.ENV_REGION):
238
+ conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
239
+
240
+ if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
241
+ cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
242
+ cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
243
+
244
+ for param in g_param.keys():
245
+ if g_param[param] is None:
246
+ if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
247
+ if param in cred:
248
+ g_param[param] = cred[param]
249
+ elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
250
+ or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
251
+ raise ConfigurationError("%s is invalid" % param)
252
+ elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
253
+ if param in conf[OptionsDefine.SysParam]:
254
+ g_param[param] = conf[OptionsDefine.SysParam][param]
255
+ elif param != OptionsDefine.Language:
256
+ raise ConfigurationError("%s is invalid" % param)
257
+ elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
258
+ if param.replace('_', '-') in cred:
259
+ g_param[param] = cred[param.replace('_', '-')]
260
+
261
+ try:
262
+ if g_param[OptionsDefine.ServiceVersion]:
263
+ g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
264
+ else:
265
+ version = conf["vtc"][OptionsDefine.Version]
266
+ g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
267
+
268
+ if g_param[OptionsDefine.Endpoint] is None:
269
+ g_param[OptionsDefine.Endpoint] = conf["vtc"][OptionsDefine.Endpoint]
270
+ g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
271
+ except Exception as err:
272
+ raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
273
+
274
+ if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
275
+ raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
276
+
277
+ if g_param[OptionsDefine.Waiter]:
278
+ param = eval(g_param[OptionsDefine.Waiter])
279
+ if 'expr' not in param:
280
+ raise Exception('`expr` in `--waiter` must be defined')
281
+ if 'to' not in param:
282
+ raise Exception('`to` in `--waiter` must be defined')
283
+ if 'timeout' not in param:
284
+ if 'waiter' in conf and 'timeout' in conf['waiter']:
285
+ param['timeout'] = conf['waiter']['timeout']
286
+ else:
287
+ param['timeout'] = 180
288
+ if 'interval' not in param:
289
+ if 'waiter' in conf and 'interval' in conf['waiter']:
290
+ param['interval'] = conf['waiter']['interval']
291
+ else:
292
+ param['interval'] = 5
293
+ param['interval'] = min(param['interval'], param['timeout'])
294
+ g_param['OptionsDefine.WaiterInfo'] = param
295
+
296
+ if six.PY2:
297
+ for key, value in g_param.items():
298
+ if isinstance(value, six.text_type):
299
+ g_param[key] = value.encode('utf-8')
300
+ return g_param
301
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tccli
3
- Version: 3.0.1108.1
3
+ Version: 3.0.1110.1
4
4
  Summary: Universal Command Line Environment for Tencent Cloud
5
5
  Project-URL: Bug Tracker, https://github.com/TencentCloud/tencentcloud-cli/issues
6
6
  Project-URL: Homepage, https://github.com/TencentCloud/tencentcloud-cli
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 2.7
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Requires-Dist: jmespath==0.10.0
15
15
  Requires-Dist: six==1.16.0
16
- Requires-Dist: tencentcloud-sdk-python>=3.0.1108
16
+ Requires-Dist: tencentcloud-sdk-python>=3.0.1110
17
17
  Description-Content-Type: text/markdown
18
18
 
19
19
  # 命令行工具简介