tccli 3.0.1256.1__py2.py3-none-any.whl → 3.0.1258.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 (45) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/services/__init__.py +3 -0
  3. tccli/services/asr/v20190614/api.json +1 -1
  4. tccli/services/bi/v20220105/api.json +389 -300
  5. tccli/services/bi/v20220105/examples.json +27 -33
  6. tccli/services/cdwdoris/v20211228/api.json +220 -170
  7. tccli/services/cdwdoris/v20211228/examples.json +36 -36
  8. tccli/services/cfg/v20210820/api.json +29 -0
  9. tccli/services/cmq/v20190304/api.json +59 -59
  10. tccli/services/cmq/v20190304/examples.json +3 -3
  11. tccli/services/cwp/cwp_client.py +0 -106
  12. tccli/services/cwp/v20180228/api.json +0 -405
  13. tccli/services/cwp/v20180228/examples.json +0 -16
  14. tccli/services/dbbrain/v20210527/api.json +9 -0
  15. tccli/services/dlc/v20210125/api.json +265 -216
  16. tccli/services/dlc/v20210125/examples.json +46 -52
  17. tccli/services/essbasic/essbasic_client.py +53 -0
  18. tccli/services/essbasic/v20210526/api.json +118 -0
  19. tccli/services/essbasic/v20210526/examples.json +8 -0
  20. tccli/services/hunyuan/v20230901/api.json +11 -1
  21. tccli/services/lke/v20231130/api.json +821 -10
  22. tccli/services/lke/v20231130/examples.json +10 -16
  23. tccli/services/ocr/ocr_client.py +361 -308
  24. tccli/services/ocr/v20181119/api.json +176 -0
  25. tccli/services/ocr/v20181119/examples.json +8 -0
  26. tccli/services/rum/v20210622/api.json +241 -135
  27. tccli/services/rum/v20210622/examples.json +31 -31
  28. tccli/services/scf/v20180416/api.json +2 -2
  29. tccli/services/ssl/ssl_client.py +61 -8
  30. tccli/services/ssl/v20191205/api.json +44 -0
  31. tccli/services/ssl/v20191205/examples.json +8 -0
  32. tccli/services/tccatalog/__init__.py +4 -0
  33. tccli/services/tccatalog/tccatalog_client.py +366 -0
  34. tccli/services/tccatalog/v20241024/api.json +525 -0
  35. tccli/services/tccatalog/v20241024/examples.json +37 -0
  36. tccli/services/tdmq/v20200217/api.json +3 -3
  37. tccli/services/tdmq/v20200217/examples.json +3 -3
  38. tccli/services/teo/teo_client.py +326 -8
  39. tccli/services/teo/v20220901/api.json +3104 -294
  40. tccli/services/teo/v20220901/examples.json +69 -3
  41. {tccli-3.0.1256.1.dist-info → tccli-3.0.1258.1.dist-info}/METADATA +2 -2
  42. {tccli-3.0.1256.1.dist-info → tccli-3.0.1258.1.dist-info}/RECORD +45 -41
  43. {tccli-3.0.1256.1.dist-info → tccli-3.0.1258.1.dist-info}/WHEEL +0 -0
  44. {tccli-3.0.1256.1.dist-info → tccli-3.0.1258.1.dist-info}/entry_points.txt +0 -0
  45. {tccli-3.0.1256.1.dist-info → tccli-3.0.1258.1.dist-info}/license_files/LICENSE +0 -0
@@ -0,0 +1,366 @@
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.tccatalog.v20241024 import tccatalog_client as tccatalog_client_v20241024
15
+ from tencentcloud.tccatalog.v20241024 import models as models_v20241024
16
+
17
+ from jmespath import search
18
+ import time
19
+
20
+ def doDescribeTccCatalogs(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.DescribeTccCatalogsRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.DescribeTccCatalogs(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 doDescribeTccCatalog(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
99
+ client._sdkVersion += ("_CLI_" + __version__)
100
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
+ model = models.DescribeTccCatalogRequest()
102
+ model.from_json_string(json.dumps(args))
103
+ start_time = time.time()
104
+ while True:
105
+ rsp = client.DescribeTccCatalog(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 doBindTccVpcEndPointServiceWhiteList(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
151
+ client._sdkVersion += ("_CLI_" + __version__)
152
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
153
+ model = models.BindTccVpcEndPointServiceWhiteListRequest()
154
+ model.from_json_string(json.dumps(args))
155
+ start_time = time.time()
156
+ while True:
157
+ rsp = client.BindTccVpcEndPointServiceWhiteList(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 doAcceptTccVpcEndPointConnect(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
203
+ client._sdkVersion += ("_CLI_" + __version__)
204
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
205
+ model = models.AcceptTccVpcEndPointConnectRequest()
206
+ model.from_json_string(json.dumps(args))
207
+ start_time = time.time()
208
+ while True:
209
+ rsp = client.AcceptTccVpcEndPointConnect(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
+ CLIENT_MAP = {
229
+ "v20241024": tccatalog_client_v20241024,
230
+
231
+ }
232
+
233
+ MODELS_MAP = {
234
+ "v20241024": models_v20241024,
235
+
236
+ }
237
+
238
+ ACTION_MAP = {
239
+ "DescribeTccCatalogs": doDescribeTccCatalogs,
240
+ "DescribeTccCatalog": doDescribeTccCatalog,
241
+ "BindTccVpcEndPointServiceWhiteList": doBindTccVpcEndPointServiceWhiteList,
242
+ "AcceptTccVpcEndPointConnect": doAcceptTccVpcEndPointConnect,
243
+
244
+ }
245
+
246
+ AVAILABLE_VERSION_LIST = [
247
+ "v20241024",
248
+
249
+ ]
250
+
251
+
252
+ def action_caller():
253
+ return ACTION_MAP
254
+
255
+
256
+ def parse_global_arg(parsed_globals):
257
+ g_param = parsed_globals
258
+ cvm_role_flag = True
259
+ for param in parsed_globals.keys():
260
+ if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
261
+ OptionsDefine.RoleSessionName]:
262
+ if parsed_globals[param] is not None:
263
+ cvm_role_flag = False
264
+ break
265
+ is_exist_profile = True
266
+ if not parsed_globals["profile"]:
267
+ is_exist_profile = False
268
+ g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
269
+
270
+ configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
271
+ is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
272
+ is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
273
+
274
+ conf = {}
275
+ cred = {}
276
+
277
+ if is_conf_exist:
278
+ conf = Utils.load_json_msg(conf_path)
279
+ if is_cred_exist:
280
+ cred = Utils.load_json_msg(cred_path)
281
+
282
+ if not (isinstance(conf, dict) and isinstance(cred, dict)):
283
+ raise ConfigurationError(
284
+ "file: %s or %s is not json format"
285
+ % (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
286
+
287
+ if OptionsDefine.Token not in cred:
288
+ cred[OptionsDefine.Token] = None
289
+
290
+ if not is_exist_profile:
291
+ if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
292
+ cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
293
+ cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
294
+ cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
295
+ cvm_role_flag = False
296
+
297
+ if os.environ.get(OptionsDefine.ENV_REGION):
298
+ conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
299
+
300
+ if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
301
+ cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
302
+ cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
303
+ cvm_role_flag = False
304
+
305
+ if cvm_role_flag:
306
+ if "type" in cred and cred["type"] == "cvm-role":
307
+ g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
308
+
309
+ for param in g_param.keys():
310
+ if g_param[param] is None:
311
+ if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
312
+ if param in cred:
313
+ g_param[param] = cred[param]
314
+ elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
315
+ or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
316
+ raise ConfigurationError("%s is invalid" % param)
317
+ elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
318
+ if param in conf[OptionsDefine.SysParam]:
319
+ g_param[param] = conf[OptionsDefine.SysParam][param]
320
+ elif param != OptionsDefine.Language:
321
+ raise ConfigurationError("%s is invalid" % param)
322
+ elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
323
+ if param.replace('_', '-') in cred:
324
+ g_param[param] = cred[param.replace('_', '-')]
325
+
326
+ try:
327
+ if g_param[OptionsDefine.ServiceVersion]:
328
+ g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
329
+ else:
330
+ version = conf["tccatalog"][OptionsDefine.Version]
331
+ g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
332
+
333
+ if g_param[OptionsDefine.Endpoint] is None:
334
+ g_param[OptionsDefine.Endpoint] = conf["tccatalog"][OptionsDefine.Endpoint]
335
+ g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
336
+ except Exception as err:
337
+ raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
338
+
339
+ if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
340
+ raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
341
+
342
+ if g_param[OptionsDefine.Waiter]:
343
+ param = eval(g_param[OptionsDefine.Waiter])
344
+ if 'expr' not in param:
345
+ raise Exception('`expr` in `--waiter` must be defined')
346
+ if 'to' not in param:
347
+ raise Exception('`to` in `--waiter` must be defined')
348
+ if 'timeout' not in param:
349
+ if 'waiter' in conf and 'timeout' in conf['waiter']:
350
+ param['timeout'] = conf['waiter']['timeout']
351
+ else:
352
+ param['timeout'] = 180
353
+ if 'interval' not in param:
354
+ if 'waiter' in conf and 'interval' in conf['waiter']:
355
+ param['interval'] = conf['waiter']['interval']
356
+ else:
357
+ param['interval'] = 5
358
+ param['interval'] = min(param['interval'], param['timeout'])
359
+ g_param['OptionsDefine.WaiterInfo'] = param
360
+
361
+ if six.PY2:
362
+ for key, value in g_param.items():
363
+ if isinstance(value, six.text_type):
364
+ g_param[key] = value.encode('utf-8')
365
+ return g_param
366
+