tccli 3.0.1383.1__py2.py3-none-any.whl → 3.0.1385.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.
@@ -17,6 +17,58 @@ from tencentcloud.bi.v20220105 import models as models_v20220105
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
+ def doDescribePermissionRanksInfo(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.BiClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.DescribePermissionRanksInfoRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.DescribePermissionRanksInfo(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
+
20
72
  def doModifyDatasource(args, parsed_globals):
21
73
  g_param = parse_global_arg(parsed_globals)
22
74
 
@@ -173,6 +225,58 @@ def doCreateDatasource(args, parsed_globals):
173
225
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
174
226
 
175
227
 
228
+ def doCreatePermissionRanks(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.BiClient(cred, g_param[OptionsDefine.Region], profile)
255
+ client._sdkVersion += ("_CLI_" + __version__)
256
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
257
+ model = models.CreatePermissionRanksRequest()
258
+ model.from_json_string(json.dumps(args))
259
+ start_time = time.time()
260
+ while True:
261
+ rsp = client.CreatePermissionRanks(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
+
176
280
  def doDescribeProjectInfo(args, parsed_globals):
177
281
  g_param = parse_global_arg(parsed_globals)
178
282
 
@@ -225,7 +329,7 @@ def doDescribeProjectInfo(args, parsed_globals):
225
329
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
226
330
 
227
331
 
228
- def doCreateProject(args, parsed_globals):
332
+ def doApplyEmbedInterval(args, parsed_globals):
229
333
  g_param = parse_global_arg(parsed_globals)
230
334
 
231
335
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -254,11 +358,11 @@ def doCreateProject(args, parsed_globals):
254
358
  client = mod.BiClient(cred, g_param[OptionsDefine.Region], profile)
255
359
  client._sdkVersion += ("_CLI_" + __version__)
256
360
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
257
- model = models.CreateProjectRequest()
361
+ model = models.ApplyEmbedIntervalRequest()
258
362
  model.from_json_string(json.dumps(args))
259
363
  start_time = time.time()
260
364
  while True:
261
- rsp = client.CreateProject(model)
365
+ rsp = client.ApplyEmbedInterval(model)
262
366
  result = rsp.to_json_string()
263
367
  try:
264
368
  json_obj = json.loads(result)
@@ -277,7 +381,7 @@ def doCreateProject(args, parsed_globals):
277
381
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
278
382
 
279
383
 
280
- def doCreateDatasourceCloud(args, parsed_globals):
384
+ def doExportScreenPage(args, parsed_globals):
281
385
  g_param = parse_global_arg(parsed_globals)
282
386
 
283
387
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -306,11 +410,63 @@ def doCreateDatasourceCloud(args, parsed_globals):
306
410
  client = mod.BiClient(cred, g_param[OptionsDefine.Region], profile)
307
411
  client._sdkVersion += ("_CLI_" + __version__)
308
412
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
309
- model = models.CreateDatasourceCloudRequest()
413
+ model = models.ExportScreenPageRequest()
310
414
  model.from_json_string(json.dumps(args))
311
415
  start_time = time.time()
312
416
  while True:
313
- rsp = client.CreateDatasourceCloud(model)
417
+ rsp = client.ExportScreenPage(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 doDescribePermissionStatusInfo(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.BiClient(cred, g_param[OptionsDefine.Region], profile)
463
+ client._sdkVersion += ("_CLI_" + __version__)
464
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
465
+ model = models.DescribePermissionStatusInfoRequest()
466
+ model.from_json_string(json.dumps(args))
467
+ start_time = time.time()
468
+ while True:
469
+ rsp = client.DescribePermissionStatusInfo(model)
314
470
  result = rsp.to_json_string()
315
471
  try:
316
472
  json_obj = json.loads(result)
@@ -381,7 +537,7 @@ def doModifyUserRole(args, parsed_globals):
381
537
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
382
538
 
383
539
 
384
- def doExportScreenPage(args, parsed_globals):
540
+ def doCreateDatasourceCloud(args, parsed_globals):
385
541
  g_param = parse_global_arg(parsed_globals)
386
542
 
387
543
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -410,11 +566,11 @@ def doExportScreenPage(args, parsed_globals):
410
566
  client = mod.BiClient(cred, g_param[OptionsDefine.Region], profile)
411
567
  client._sdkVersion += ("_CLI_" + __version__)
412
568
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
413
- model = models.ExportScreenPageRequest()
569
+ model = models.CreateDatasourceCloudRequest()
414
570
  model.from_json_string(json.dumps(args))
415
571
  start_time = time.time()
416
572
  while True:
417
- rsp = client.ExportScreenPage(model)
573
+ rsp = client.CreateDatasourceCloud(model)
418
574
  result = rsp.to_json_string()
419
575
  try:
420
576
  json_obj = json.loads(result)
@@ -1057,7 +1213,7 @@ def doDeleteUserRoleProject(args, parsed_globals):
1057
1213
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1058
1214
 
1059
1215
 
1060
- def doApplyEmbedInterval(args, parsed_globals):
1216
+ def doCreateProject(args, parsed_globals):
1061
1217
  g_param = parse_global_arg(parsed_globals)
1062
1218
 
1063
1219
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -1086,11 +1242,63 @@ def doApplyEmbedInterval(args, parsed_globals):
1086
1242
  client = mod.BiClient(cred, g_param[OptionsDefine.Region], profile)
1087
1243
  client._sdkVersion += ("_CLI_" + __version__)
1088
1244
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
1089
- model = models.ApplyEmbedIntervalRequest()
1245
+ model = models.CreateProjectRequest()
1090
1246
  model.from_json_string(json.dumps(args))
1091
1247
  start_time = time.time()
1092
1248
  while True:
1093
- rsp = client.ApplyEmbedInterval(model)
1249
+ rsp = client.CreateProject(model)
1250
+ result = rsp.to_json_string()
1251
+ try:
1252
+ json_obj = json.loads(result)
1253
+ except TypeError as e:
1254
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1255
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1256
+ break
1257
+ cur_time = time.time()
1258
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1259
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1260
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1261
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1262
+ else:
1263
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1264
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1265
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1266
+
1267
+
1268
+ def doDescribePermissionRoleInfo(args, parsed_globals):
1269
+ g_param = parse_global_arg(parsed_globals)
1270
+
1271
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1272
+ cred = credential.CVMRoleCredential()
1273
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1274
+ cred = credential.STSAssumeRoleCredential(
1275
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1276
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1277
+ )
1278
+ 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):
1279
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1280
+ else:
1281
+ cred = credential.Credential(
1282
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1283
+ )
1284
+ http_profile = HttpProfile(
1285
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1286
+ reqMethod="POST",
1287
+ endpoint=g_param[OptionsDefine.Endpoint],
1288
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1289
+ )
1290
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1291
+ if g_param[OptionsDefine.Language]:
1292
+ profile.language = g_param[OptionsDefine.Language]
1293
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1294
+ client = mod.BiClient(cred, g_param[OptionsDefine.Region], profile)
1295
+ client._sdkVersion += ("_CLI_" + __version__)
1296
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1297
+ model = models.DescribePermissionRoleInfoRequest()
1298
+ model.from_json_string(json.dumps(args))
1299
+ start_time = time.time()
1300
+ while True:
1301
+ rsp = client.DescribePermissionRoleInfo(model)
1094
1302
  result = rsp.to_json_string()
1095
1303
  try:
1096
1304
  json_obj = json.loads(result)
@@ -1328,14 +1536,17 @@ MODELS_MAP = {
1328
1536
  }
1329
1537
 
1330
1538
  ACTION_MAP = {
1539
+ "DescribePermissionRanksInfo": doDescribePermissionRanksInfo,
1331
1540
  "ModifyDatasource": doModifyDatasource,
1332
1541
  "DescribeDatasourceList": doDescribeDatasourceList,
1333
1542
  "CreateDatasource": doCreateDatasource,
1543
+ "CreatePermissionRanks": doCreatePermissionRanks,
1334
1544
  "DescribeProjectInfo": doDescribeProjectInfo,
1335
- "CreateProject": doCreateProject,
1336
- "CreateDatasourceCloud": doCreateDatasourceCloud,
1337
- "ModifyUserRole": doModifyUserRole,
1545
+ "ApplyEmbedInterval": doApplyEmbedInterval,
1338
1546
  "ExportScreenPage": doExportScreenPage,
1547
+ "DescribePermissionStatusInfo": doDescribePermissionStatusInfo,
1548
+ "ModifyUserRole": doModifyUserRole,
1549
+ "CreateDatasourceCloud": doCreateDatasourceCloud,
1339
1550
  "CreateEmbedToken": doCreateEmbedToken,
1340
1551
  "CreateUserRole": doCreateUserRole,
1341
1552
  "DeleteDatasource": doDeleteDatasource,
@@ -1348,7 +1559,8 @@ ACTION_MAP = {
1348
1559
  "ClearEmbedToken": doClearEmbedToken,
1349
1560
  "CreateUserRoleProject": doCreateUserRoleProject,
1350
1561
  "DeleteUserRoleProject": doDeleteUserRoleProject,
1351
- "ApplyEmbedInterval": doApplyEmbedInterval,
1562
+ "CreateProject": doCreateProject,
1563
+ "DescribePermissionRoleInfo": doDescribePermissionRoleInfo,
1352
1564
  "DescribeUserProjectList": doDescribeUserProjectList,
1353
1565
  "DeleteProject": doDeleteProject,
1354
1566
  "ModifyUserRoleProject": doModifyUserRoleProject,