tccli 3.0.1229.1__py2.py3-none-any.whl → 3.0.1231.1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/services/aiart/aiart_client.py +110 -4
  3. tccli/services/aiart/v20221229/api.json +197 -10
  4. tccli/services/aiart/v20221229/examples.json +16 -0
  5. tccli/services/batch/v20170312/api.json +19 -14
  6. tccli/services/cam/cam_client.py +53 -0
  7. tccli/services/cam/v20190116/api.json +125 -52
  8. tccli/services/cam/v20190116/examples.json +12 -4
  9. tccli/services/cfg/v20210820/api.json +9 -0
  10. tccli/services/cfw/v20190904/api.json +1 -1
  11. tccli/services/cloudaudit/v20190319/api.json +39 -39
  12. tccli/services/cloudaudit/v20190319/examples.json +5 -5
  13. tccli/services/cvm/v20170312/api.json +53 -55
  14. tccli/services/cvm/v20170312/examples.json +3 -3
  15. tccli/services/cwp/v20180228/api.json +1 -1
  16. tccli/services/cynosdb/cynosdb_client.py +110 -57
  17. tccli/services/cynosdb/v20190107/api.json +166 -18
  18. tccli/services/cynosdb/v20190107/examples.json +14 -0
  19. tccli/services/dbbrain/v20210527/api.json +3 -1
  20. tccli/services/emr/emr_client.py +110 -4
  21. tccli/services/emr/v20190103/api.json +645 -0
  22. tccli/services/emr/v20190103/examples.json +16 -0
  23. tccli/services/es/v20180416/api.json +106 -8
  24. tccli/services/essbasic/v20210526/api.json +2 -2
  25. tccli/services/iotexplorer/v20190423/api.json +10 -0
  26. tccli/services/ivld/v20210903/api.json +25 -25
  27. tccli/services/ivld/v20210903/examples.json +1 -1
  28. tccli/services/lcic/v20220817/api.json +2 -2
  29. tccli/services/lke/v20231130/api.json +4 -4
  30. tccli/services/memcached/v20190318/api.json +20 -20
  31. tccli/services/mps/v20190612/api.json +65 -1
  32. tccli/services/mqtt/mqtt_client.py +283 -71
  33. tccli/services/mqtt/v20240516/api.json +312 -0
  34. tccli/services/mqtt/v20240516/examples.json +32 -0
  35. tccli/services/ocr/v20181119/api.json +251 -28
  36. tccli/services/ocr/v20181119/examples.json +1 -1
  37. tccli/services/postgres/v20170312/api.json +232 -228
  38. tccli/services/postgres/v20170312/examples.json +38 -38
  39. tccli/services/redis/v20180412/examples.json +2 -2
  40. tccli/services/ssl/v20191205/api.json +4 -4
  41. tccli/services/ssl/v20191205/examples.json +1 -1
  42. tccli/services/sts/v20180813/api.json +9 -9
  43. tccli/services/tdmq/v20200217/api.json +2 -2
  44. tccli/services/trtc/v20190722/api.json +4 -8
  45. tccli/services/tse/tse_client.py +228 -16
  46. tccli/services/tse/v20201207/api.json +476 -0
  47. tccli/services/tse/v20201207/examples.json +32 -0
  48. tccli/services/vclm/v20240523/api.json +3 -3
  49. tccli/services/vdb/v20230616/api.json +3 -3
  50. tccli/services/vdb/v20230616/examples.json +1 -1
  51. tccli/services/vod/v20180717/api.json +17 -17
  52. tccli/services/vpc/v20170312/api.json +510 -34
  53. tccli/services/vpc/v20170312/examples.json +68 -12
  54. tccli/services/vpc/vpc_client.py +475 -104
  55. {tccli-3.0.1229.1.dist-info → tccli-3.0.1231.1.dist-info}/METADATA +2 -2
  56. {tccli-3.0.1229.1.dist-info → tccli-3.0.1231.1.dist-info}/RECORD +59 -59
  57. {tccli-3.0.1229.1.dist-info → tccli-3.0.1231.1.dist-info}/WHEEL +0 -0
  58. {tccli-3.0.1229.1.dist-info → tccli-3.0.1231.1.dist-info}/entry_points.txt +0 -0
  59. {tccli-3.0.1229.1.dist-info → tccli-3.0.1231.1.dist-info}/license_files/LICENSE +0 -0
@@ -17,7 +17,7 @@ from tencentcloud.mqtt.v20240516 import models as models_v20240516
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
- def doCreateTopic(args, parsed_globals):
20
+ def doModifyTopic(args, parsed_globals):
21
21
  g_param = parse_global_arg(parsed_globals)
22
22
 
23
23
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -46,11 +46,11 @@ def doCreateTopic(args, parsed_globals):
46
46
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
47
47
  client._sdkVersion += ("_CLI_" + __version__)
48
48
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
- model = models.CreateTopicRequest()
49
+ model = models.ModifyTopicRequest()
50
50
  model.from_json_string(json.dumps(args))
51
51
  start_time = time.time()
52
52
  while True:
53
- rsp = client.CreateTopic(model)
53
+ rsp = client.ModifyTopic(model)
54
54
  result = rsp.to_json_string()
55
55
  try:
56
56
  json_obj = json.loads(result)
@@ -69,7 +69,7 @@ def doCreateTopic(args, parsed_globals):
69
69
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
70
70
 
71
71
 
72
- def doActivateDeviceCertificate(args, parsed_globals):
72
+ def doDeactivateDeviceCertificate(args, parsed_globals):
73
73
  g_param = parse_global_arg(parsed_globals)
74
74
 
75
75
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -98,11 +98,11 @@ def doActivateDeviceCertificate(args, parsed_globals):
98
98
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
99
99
  client._sdkVersion += ("_CLI_" + __version__)
100
100
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
- model = models.ActivateDeviceCertificateRequest()
101
+ model = models.DeactivateDeviceCertificateRequest()
102
102
  model.from_json_string(json.dumps(args))
103
103
  start_time = time.time()
104
104
  while True:
105
- rsp = client.ActivateDeviceCertificate(model)
105
+ rsp = client.DeactivateDeviceCertificate(model)
106
106
  result = rsp.to_json_string()
107
107
  try:
108
108
  json_obj = json.loads(result)
@@ -121,7 +121,7 @@ def doActivateDeviceCertificate(args, parsed_globals):
121
121
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
122
122
 
123
123
 
124
- def doDescribeAuthorizationPolicies(args, parsed_globals):
124
+ def doDeleteAuthenticator(args, parsed_globals):
125
125
  g_param = parse_global_arg(parsed_globals)
126
126
 
127
127
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -150,11 +150,11 @@ def doDescribeAuthorizationPolicies(args, parsed_globals):
150
150
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
151
151
  client._sdkVersion += ("_CLI_" + __version__)
152
152
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
153
- model = models.DescribeAuthorizationPoliciesRequest()
153
+ model = models.DeleteAuthenticatorRequest()
154
154
  model.from_json_string(json.dumps(args))
155
155
  start_time = time.time()
156
156
  while True:
157
- rsp = client.DescribeAuthorizationPolicies(model)
157
+ rsp = client.DeleteAuthenticator(model)
158
158
  result = rsp.to_json_string()
159
159
  try:
160
160
  json_obj = json.loads(result)
@@ -173,7 +173,7 @@ def doDescribeAuthorizationPolicies(args, parsed_globals):
173
173
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
174
174
 
175
175
 
176
- def doDescribeTopicList(args, parsed_globals):
176
+ def doCreateJWTAuthenticator(args, parsed_globals):
177
177
  g_param = parse_global_arg(parsed_globals)
178
178
 
179
179
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -202,11 +202,11 @@ def doDescribeTopicList(args, parsed_globals):
202
202
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
203
203
  client._sdkVersion += ("_CLI_" + __version__)
204
204
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
205
- model = models.DescribeTopicListRequest()
205
+ model = models.CreateJWTAuthenticatorRequest()
206
206
  model.from_json_string(json.dumps(args))
207
207
  start_time = time.time()
208
208
  while True:
209
- rsp = client.DescribeTopicList(model)
209
+ rsp = client.CreateJWTAuthenticator(model)
210
210
  result = rsp.to_json_string()
211
211
  try:
212
212
  json_obj = json.loads(result)
@@ -225,7 +225,7 @@ def doDescribeTopicList(args, parsed_globals):
225
225
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
226
226
 
227
227
 
228
- def doModifyTopic(args, parsed_globals):
228
+ def doActivateDeviceCertificate(args, parsed_globals):
229
229
  g_param = parse_global_arg(parsed_globals)
230
230
 
231
231
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -254,11 +254,11 @@ def doModifyTopic(args, parsed_globals):
254
254
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
255
255
  client._sdkVersion += ("_CLI_" + __version__)
256
256
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
257
- model = models.ModifyTopicRequest()
257
+ model = models.ActivateDeviceCertificateRequest()
258
258
  model.from_json_string(json.dumps(args))
259
259
  start_time = time.time()
260
260
  while True:
261
- rsp = client.ModifyTopic(model)
261
+ rsp = client.ActivateDeviceCertificate(model)
262
262
  result = rsp.to_json_string()
263
263
  try:
264
264
  json_obj = json.loads(result)
@@ -277,7 +277,7 @@ def doModifyTopic(args, parsed_globals):
277
277
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
278
278
 
279
279
 
280
- def doCreateAuthorizationPolicy(args, parsed_globals):
280
+ def doDescribeInstanceList(args, parsed_globals):
281
281
  g_param = parse_global_arg(parsed_globals)
282
282
 
283
283
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -306,11 +306,115 @@ def doCreateAuthorizationPolicy(args, parsed_globals):
306
306
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
307
307
  client._sdkVersion += ("_CLI_" + __version__)
308
308
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
309
- model = models.CreateAuthorizationPolicyRequest()
309
+ model = models.DescribeInstanceListRequest()
310
310
  model.from_json_string(json.dumps(args))
311
311
  start_time = time.time()
312
312
  while True:
313
- rsp = client.CreateAuthorizationPolicy(model)
313
+ rsp = client.DescribeInstanceList(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 doModifyJWTAuthenticator(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.MqttClient(cred, g_param[OptionsDefine.Region], profile)
359
+ client._sdkVersion += ("_CLI_" + __version__)
360
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
361
+ model = models.ModifyJWTAuthenticatorRequest()
362
+ model.from_json_string(json.dumps(args))
363
+ start_time = time.time()
364
+ while True:
365
+ rsp = client.ModifyJWTAuthenticator(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 doDescribeAuthorizationPolicies(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.MqttClient(cred, g_param[OptionsDefine.Region], profile)
411
+ client._sdkVersion += ("_CLI_" + __version__)
412
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
413
+ model = models.DescribeAuthorizationPoliciesRequest()
414
+ model.from_json_string(json.dumps(args))
415
+ start_time = time.time()
416
+ while True:
417
+ rsp = client.DescribeAuthorizationPolicies(model)
314
418
  result = rsp.to_json_string()
315
419
  try:
316
420
  json_obj = json.loads(result)
@@ -381,7 +485,7 @@ def doRegisterDeviceCertificate(args, parsed_globals):
381
485
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
382
486
 
383
487
 
384
- def doModifyAuthorizationPolicy(args, parsed_globals):
488
+ def doDescribeDeviceCertificates(args, parsed_globals):
385
489
  g_param = parse_global_arg(parsed_globals)
386
490
 
387
491
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -410,11 +514,11 @@ def doModifyAuthorizationPolicy(args, parsed_globals):
410
514
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
411
515
  client._sdkVersion += ("_CLI_" + __version__)
412
516
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
413
- model = models.ModifyAuthorizationPolicyRequest()
517
+ model = models.DescribeDeviceCertificatesRequest()
414
518
  model.from_json_string(json.dumps(args))
415
519
  start_time = time.time()
416
520
  while True:
417
- rsp = client.ModifyAuthorizationPolicy(model)
521
+ rsp = client.DescribeDeviceCertificates(model)
418
522
  result = rsp.to_json_string()
419
523
  try:
420
524
  json_obj = json.loads(result)
@@ -433,7 +537,7 @@ def doModifyAuthorizationPolicy(args, parsed_globals):
433
537
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
434
538
 
435
539
 
436
- def doCreateJWTAuthenticator(args, parsed_globals):
540
+ def doCreateTopic(args, parsed_globals):
437
541
  g_param = parse_global_arg(parsed_globals)
438
542
 
439
543
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -462,11 +566,11 @@ def doCreateJWTAuthenticator(args, parsed_globals):
462
566
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
463
567
  client._sdkVersion += ("_CLI_" + __version__)
464
568
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
465
- model = models.CreateJWTAuthenticatorRequest()
569
+ model = models.CreateTopicRequest()
466
570
  model.from_json_string(json.dumps(args))
467
571
  start_time = time.time()
468
572
  while True:
469
- rsp = client.CreateJWTAuthenticator(model)
573
+ rsp = client.CreateTopic(model)
470
574
  result = rsp.to_json_string()
471
575
  try:
472
576
  json_obj = json.loads(result)
@@ -485,7 +589,7 @@ def doCreateJWTAuthenticator(args, parsed_globals):
485
589
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
486
590
 
487
591
 
488
- def doDeleteAuthenticator(args, parsed_globals):
592
+ def doDeleteDeviceCertificate(args, parsed_globals):
489
593
  g_param = parse_global_arg(parsed_globals)
490
594
 
491
595
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -514,11 +618,11 @@ def doDeleteAuthenticator(args, parsed_globals):
514
618
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
515
619
  client._sdkVersion += ("_CLI_" + __version__)
516
620
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
517
- model = models.DeleteAuthenticatorRequest()
621
+ model = models.DeleteDeviceCertificateRequest()
518
622
  model.from_json_string(json.dumps(args))
519
623
  start_time = time.time()
520
624
  while True:
521
- rsp = client.DeleteAuthenticator(model)
625
+ rsp = client.DeleteDeviceCertificate(model)
522
626
  result = rsp.to_json_string()
523
627
  try:
524
628
  json_obj = json.loads(result)
@@ -537,7 +641,7 @@ def doDeleteAuthenticator(args, parsed_globals):
537
641
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
538
642
 
539
643
 
540
- def doDescribeAuthenticator(args, parsed_globals):
644
+ def doModifyJWKSAuthenticator(args, parsed_globals):
541
645
  g_param = parse_global_arg(parsed_globals)
542
646
 
543
647
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -566,11 +670,115 @@ def doDescribeAuthenticator(args, parsed_globals):
566
670
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
567
671
  client._sdkVersion += ("_CLI_" + __version__)
568
672
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
569
- model = models.DescribeAuthenticatorRequest()
673
+ model = models.ModifyJWKSAuthenticatorRequest()
570
674
  model.from_json_string(json.dumps(args))
571
675
  start_time = time.time()
572
676
  while True:
573
- rsp = client.DescribeAuthenticator(model)
677
+ rsp = client.ModifyJWKSAuthenticator(model)
678
+ result = rsp.to_json_string()
679
+ try:
680
+ json_obj = json.loads(result)
681
+ except TypeError as e:
682
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
683
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
684
+ break
685
+ cur_time = time.time()
686
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
687
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
688
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
689
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
690
+ else:
691
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
692
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
693
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
694
+
695
+
696
+ def doDescribeDeviceCertificate(args, parsed_globals):
697
+ g_param = parse_global_arg(parsed_globals)
698
+
699
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
700
+ cred = credential.CVMRoleCredential()
701
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
702
+ cred = credential.STSAssumeRoleCredential(
703
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
704
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
705
+ )
706
+ 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):
707
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
708
+ else:
709
+ cred = credential.Credential(
710
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
711
+ )
712
+ http_profile = HttpProfile(
713
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
714
+ reqMethod="POST",
715
+ endpoint=g_param[OptionsDefine.Endpoint],
716
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
717
+ )
718
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
719
+ if g_param[OptionsDefine.Language]:
720
+ profile.language = g_param[OptionsDefine.Language]
721
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
722
+ client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
723
+ client._sdkVersion += ("_CLI_" + __version__)
724
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
725
+ model = models.DescribeDeviceCertificateRequest()
726
+ model.from_json_string(json.dumps(args))
727
+ start_time = time.time()
728
+ while True:
729
+ rsp = client.DescribeDeviceCertificate(model)
730
+ result = rsp.to_json_string()
731
+ try:
732
+ json_obj = json.loads(result)
733
+ except TypeError as e:
734
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
735
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
736
+ break
737
+ cur_time = time.time()
738
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
739
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
740
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
741
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
742
+ else:
743
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
744
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
745
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
746
+
747
+
748
+ def doRevokedDeviceCertificate(args, parsed_globals):
749
+ g_param = parse_global_arg(parsed_globals)
750
+
751
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
752
+ cred = credential.CVMRoleCredential()
753
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
754
+ cred = credential.STSAssumeRoleCredential(
755
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
756
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
757
+ )
758
+ 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):
759
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
760
+ else:
761
+ cred = credential.Credential(
762
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
763
+ )
764
+ http_profile = HttpProfile(
765
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
766
+ reqMethod="POST",
767
+ endpoint=g_param[OptionsDefine.Endpoint],
768
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
769
+ )
770
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
771
+ if g_param[OptionsDefine.Language]:
772
+ profile.language = g_param[OptionsDefine.Language]
773
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
774
+ client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
775
+ client._sdkVersion += ("_CLI_" + __version__)
776
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
777
+ model = models.RevokedDeviceCertificateRequest()
778
+ model.from_json_string(json.dumps(args))
779
+ start_time = time.time()
780
+ while True:
781
+ rsp = client.RevokedDeviceCertificate(model)
574
782
  result = rsp.to_json_string()
575
783
  try:
576
784
  json_obj = json.loads(result)
@@ -641,7 +849,7 @@ def doDescribeInstance(args, parsed_globals):
641
849
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
642
850
 
643
851
 
644
- def doDeleteAuthorizationPolicy(args, parsed_globals):
852
+ def doDescribeTopicList(args, parsed_globals):
645
853
  g_param = parse_global_arg(parsed_globals)
646
854
 
647
855
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -670,11 +878,11 @@ def doDeleteAuthorizationPolicy(args, parsed_globals):
670
878
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
671
879
  client._sdkVersion += ("_CLI_" + __version__)
672
880
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
673
- model = models.DeleteAuthorizationPolicyRequest()
881
+ model = models.DescribeTopicListRequest()
674
882
  model.from_json_string(json.dumps(args))
675
883
  start_time = time.time()
676
884
  while True:
677
- rsp = client.DeleteAuthorizationPolicy(model)
885
+ rsp = client.DescribeTopicList(model)
678
886
  result = rsp.to_json_string()
679
887
  try:
680
888
  json_obj = json.loads(result)
@@ -693,7 +901,7 @@ def doDeleteAuthorizationPolicy(args, parsed_globals):
693
901
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
694
902
 
695
903
 
696
- def doUpdateAuthorizationPolicyPriority(args, parsed_globals):
904
+ def doCreateJWKSAuthenticator(args, parsed_globals):
697
905
  g_param = parse_global_arg(parsed_globals)
698
906
 
699
907
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -722,11 +930,11 @@ def doUpdateAuthorizationPolicyPriority(args, parsed_globals):
722
930
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
723
931
  client._sdkVersion += ("_CLI_" + __version__)
724
932
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
725
- model = models.UpdateAuthorizationPolicyPriorityRequest()
933
+ model = models.CreateJWKSAuthenticatorRequest()
726
934
  model.from_json_string(json.dumps(args))
727
935
  start_time = time.time()
728
936
  while True:
729
- rsp = client.UpdateAuthorizationPolicyPriority(model)
937
+ rsp = client.CreateJWKSAuthenticator(model)
730
938
  result = rsp.to_json_string()
731
939
  try:
732
940
  json_obj = json.loads(result)
@@ -745,7 +953,7 @@ def doUpdateAuthorizationPolicyPriority(args, parsed_globals):
745
953
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
746
954
 
747
955
 
748
- def doDescribeTopic(args, parsed_globals):
956
+ def doModifyAuthorizationPolicy(args, parsed_globals):
749
957
  g_param = parse_global_arg(parsed_globals)
750
958
 
751
959
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -774,11 +982,11 @@ def doDescribeTopic(args, parsed_globals):
774
982
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
775
983
  client._sdkVersion += ("_CLI_" + __version__)
776
984
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
777
- model = models.DescribeTopicRequest()
985
+ model = models.ModifyAuthorizationPolicyRequest()
778
986
  model.from_json_string(json.dumps(args))
779
987
  start_time = time.time()
780
988
  while True:
781
- rsp = client.DescribeTopic(model)
989
+ rsp = client.ModifyAuthorizationPolicy(model)
782
990
  result = rsp.to_json_string()
783
991
  try:
784
992
  json_obj = json.loads(result)
@@ -797,7 +1005,7 @@ def doDescribeTopic(args, parsed_globals):
797
1005
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
798
1006
 
799
1007
 
800
- def doDescribeInstanceList(args, parsed_globals):
1008
+ def doDeleteAuthorizationPolicy(args, parsed_globals):
801
1009
  g_param = parse_global_arg(parsed_globals)
802
1010
 
803
1011
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -826,11 +1034,11 @@ def doDescribeInstanceList(args, parsed_globals):
826
1034
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
827
1035
  client._sdkVersion += ("_CLI_" + __version__)
828
1036
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
829
- model = models.DescribeInstanceListRequest()
1037
+ model = models.DeleteAuthorizationPolicyRequest()
830
1038
  model.from_json_string(json.dumps(args))
831
1039
  start_time = time.time()
832
1040
  while True:
833
- rsp = client.DescribeInstanceList(model)
1041
+ rsp = client.DeleteAuthorizationPolicy(model)
834
1042
  result = rsp.to_json_string()
835
1043
  try:
836
1044
  json_obj = json.loads(result)
@@ -849,7 +1057,7 @@ def doDescribeInstanceList(args, parsed_globals):
849
1057
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
850
1058
 
851
1059
 
852
- def doCreateJWKSAuthenticator(args, parsed_globals):
1060
+ def doDescribeTopic(args, parsed_globals):
853
1061
  g_param = parse_global_arg(parsed_globals)
854
1062
 
855
1063
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -878,11 +1086,11 @@ def doCreateJWKSAuthenticator(args, parsed_globals):
878
1086
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
879
1087
  client._sdkVersion += ("_CLI_" + __version__)
880
1088
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
881
- model = models.CreateJWKSAuthenticatorRequest()
1089
+ model = models.DescribeTopicRequest()
882
1090
  model.from_json_string(json.dumps(args))
883
1091
  start_time = time.time()
884
1092
  while True:
885
- rsp = client.CreateJWKSAuthenticator(model)
1093
+ rsp = client.DescribeTopic(model)
886
1094
  result = rsp.to_json_string()
887
1095
  try:
888
1096
  json_obj = json.loads(result)
@@ -901,7 +1109,7 @@ def doCreateJWKSAuthenticator(args, parsed_globals):
901
1109
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
902
1110
 
903
1111
 
904
- def doModifyJWTAuthenticator(args, parsed_globals):
1112
+ def doDescribeAuthenticator(args, parsed_globals):
905
1113
  g_param = parse_global_arg(parsed_globals)
906
1114
 
907
1115
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -930,11 +1138,11 @@ def doModifyJWTAuthenticator(args, parsed_globals):
930
1138
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
931
1139
  client._sdkVersion += ("_CLI_" + __version__)
932
1140
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
933
- model = models.ModifyJWTAuthenticatorRequest()
1141
+ model = models.DescribeAuthenticatorRequest()
934
1142
  model.from_json_string(json.dumps(args))
935
1143
  start_time = time.time()
936
1144
  while True:
937
- rsp = client.ModifyJWTAuthenticator(model)
1145
+ rsp = client.DescribeAuthenticator(model)
938
1146
  result = rsp.to_json_string()
939
1147
  try:
940
1148
  json_obj = json.loads(result)
@@ -953,7 +1161,7 @@ def doModifyJWTAuthenticator(args, parsed_globals):
953
1161
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
954
1162
 
955
1163
 
956
- def doDeleteTopic(args, parsed_globals):
1164
+ def doUpdateAuthorizationPolicyPriority(args, parsed_globals):
957
1165
  g_param = parse_global_arg(parsed_globals)
958
1166
 
959
1167
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -982,11 +1190,11 @@ def doDeleteTopic(args, parsed_globals):
982
1190
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
983
1191
  client._sdkVersion += ("_CLI_" + __version__)
984
1192
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
985
- model = models.DeleteTopicRequest()
1193
+ model = models.UpdateAuthorizationPolicyPriorityRequest()
986
1194
  model.from_json_string(json.dumps(args))
987
1195
  start_time = time.time()
988
1196
  while True:
989
- rsp = client.DeleteTopic(model)
1197
+ rsp = client.UpdateAuthorizationPolicyPriority(model)
990
1198
  result = rsp.to_json_string()
991
1199
  try:
992
1200
  json_obj = json.loads(result)
@@ -1005,7 +1213,7 @@ def doDeleteTopic(args, parsed_globals):
1005
1213
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1006
1214
 
1007
1215
 
1008
- def doModifyJWKSAuthenticator(args, parsed_globals):
1216
+ def doDeleteTopic(args, parsed_globals):
1009
1217
  g_param = parse_global_arg(parsed_globals)
1010
1218
 
1011
1219
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -1034,11 +1242,11 @@ def doModifyJWKSAuthenticator(args, parsed_globals):
1034
1242
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
1035
1243
  client._sdkVersion += ("_CLI_" + __version__)
1036
1244
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
1037
- model = models.ModifyJWKSAuthenticatorRequest()
1245
+ model = models.DeleteTopicRequest()
1038
1246
  model.from_json_string(json.dumps(args))
1039
1247
  start_time = time.time()
1040
1248
  while True:
1041
- rsp = client.ModifyJWKSAuthenticator(model)
1249
+ rsp = client.DeleteTopic(model)
1042
1250
  result = rsp.to_json_string()
1043
1251
  try:
1044
1252
  json_obj = json.loads(result)
@@ -1057,7 +1265,7 @@ def doModifyJWKSAuthenticator(args, parsed_globals):
1057
1265
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1058
1266
 
1059
1267
 
1060
- def doDescribeDeviceCertificates(args, parsed_globals):
1268
+ def doCreateAuthorizationPolicy(args, parsed_globals):
1061
1269
  g_param = parse_global_arg(parsed_globals)
1062
1270
 
1063
1271
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -1086,11 +1294,11 @@ def doDescribeDeviceCertificates(args, parsed_globals):
1086
1294
  client = mod.MqttClient(cred, g_param[OptionsDefine.Region], profile)
1087
1295
  client._sdkVersion += ("_CLI_" + __version__)
1088
1296
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
1089
- model = models.DescribeDeviceCertificatesRequest()
1297
+ model = models.CreateAuthorizationPolicyRequest()
1090
1298
  model.from_json_string(json.dumps(args))
1091
1299
  start_time = time.time()
1092
1300
  while True:
1093
- rsp = client.DescribeDeviceCertificates(model)
1301
+ rsp = client.CreateAuthorizationPolicy(model)
1094
1302
  result = rsp.to_json_string()
1095
1303
  try:
1096
1304
  json_obj = json.loads(result)
@@ -1120,27 +1328,31 @@ MODELS_MAP = {
1120
1328
  }
1121
1329
 
1122
1330
  ACTION_MAP = {
1123
- "CreateTopic": doCreateTopic,
1331
+ "ModifyTopic": doModifyTopic,
1332
+ "DeactivateDeviceCertificate": doDeactivateDeviceCertificate,
1333
+ "DeleteAuthenticator": doDeleteAuthenticator,
1334
+ "CreateJWTAuthenticator": doCreateJWTAuthenticator,
1124
1335
  "ActivateDeviceCertificate": doActivateDeviceCertificate,
1336
+ "DescribeInstanceList": doDescribeInstanceList,
1337
+ "ModifyJWTAuthenticator": doModifyJWTAuthenticator,
1125
1338
  "DescribeAuthorizationPolicies": doDescribeAuthorizationPolicies,
1126
- "DescribeTopicList": doDescribeTopicList,
1127
- "ModifyTopic": doModifyTopic,
1128
- "CreateAuthorizationPolicy": doCreateAuthorizationPolicy,
1129
1339
  "RegisterDeviceCertificate": doRegisterDeviceCertificate,
1130
- "ModifyAuthorizationPolicy": doModifyAuthorizationPolicy,
1131
- "CreateJWTAuthenticator": doCreateJWTAuthenticator,
1132
- "DeleteAuthenticator": doDeleteAuthenticator,
1133
- "DescribeAuthenticator": doDescribeAuthenticator,
1340
+ "DescribeDeviceCertificates": doDescribeDeviceCertificates,
1341
+ "CreateTopic": doCreateTopic,
1342
+ "DeleteDeviceCertificate": doDeleteDeviceCertificate,
1343
+ "ModifyJWKSAuthenticator": doModifyJWKSAuthenticator,
1344
+ "DescribeDeviceCertificate": doDescribeDeviceCertificate,
1345
+ "RevokedDeviceCertificate": doRevokedDeviceCertificate,
1134
1346
  "DescribeInstance": doDescribeInstance,
1347
+ "DescribeTopicList": doDescribeTopicList,
1348
+ "CreateJWKSAuthenticator": doCreateJWKSAuthenticator,
1349
+ "ModifyAuthorizationPolicy": doModifyAuthorizationPolicy,
1135
1350
  "DeleteAuthorizationPolicy": doDeleteAuthorizationPolicy,
1136
- "UpdateAuthorizationPolicyPriority": doUpdateAuthorizationPolicyPriority,
1137
1351
  "DescribeTopic": doDescribeTopic,
1138
- "DescribeInstanceList": doDescribeInstanceList,
1139
- "CreateJWKSAuthenticator": doCreateJWKSAuthenticator,
1140
- "ModifyJWTAuthenticator": doModifyJWTAuthenticator,
1352
+ "DescribeAuthenticator": doDescribeAuthenticator,
1353
+ "UpdateAuthorizationPolicyPriority": doUpdateAuthorizationPolicyPriority,
1141
1354
  "DeleteTopic": doDeleteTopic,
1142
- "ModifyJWKSAuthenticator": doModifyJWKSAuthenticator,
1143
- "DescribeDeviceCertificates": doDescribeDeviceCertificates,
1355
+ "CreateAuthorizationPolicy": doCreateAuthorizationPolicy,
1144
1356
 
1145
1357
  }
1146
1358