tccli 3.0.1147.1__py2.py3-none-any.whl → 3.0.1148.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 (29) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/services/aiart/aiart_client.py +53 -0
  3. tccli/services/aiart/v20221229/api.json +80 -0
  4. tccli/services/aiart/v20221229/examples.json +8 -0
  5. tccli/services/asr/v20190614/api.json +6 -6
  6. tccli/services/clb/v20180317/api.json +1 -1
  7. tccli/services/dcdb/v20180411/api.json +2 -0
  8. tccli/services/dnspod/v20210323/api.json +9 -0
  9. tccli/services/lighthouse/v20200324/api.json +33 -31
  10. tccli/services/lighthouse/v20200324/examples.json +3 -3
  11. tccli/services/lke/lke_client.py +53 -0
  12. tccli/services/lke/v20231130/api.json +160 -1
  13. tccli/services/lke/v20231130/examples.json +8 -0
  14. tccli/services/mna/mna_client.py +485 -8
  15. tccli/services/mna/v20210119/api.json +743 -21
  16. tccli/services/mna/v20210119/examples.json +72 -0
  17. tccli/services/mps/v20190612/api.json +31 -10
  18. tccli/services/tdmq/v20200217/api.json +8 -8
  19. tccli/services/tdmq/v20200217/examples.json +1 -1
  20. tccli/services/tke/v20180525/api.json +3 -3
  21. tccli/services/tsf/tsf_client.py +110 -4
  22. tccli/services/tsf/v20180326/api.json +142 -0
  23. tccli/services/tsf/v20180326/examples.json +16 -0
  24. tccli/services/vpc/v20170312/api.json +1 -1
  25. {tccli-3.0.1147.1.dist-info → tccli-3.0.1148.1.dist-info}/METADATA +2 -2
  26. {tccli-3.0.1147.1.dist-info → tccli-3.0.1148.1.dist-info}/RECORD +29 -29
  27. {tccli-3.0.1147.1.dist-info → tccli-3.0.1148.1.dist-info}/WHEEL +0 -0
  28. {tccli-3.0.1147.1.dist-info → tccli-3.0.1148.1.dist-info}/entry_points.txt +0 -0
  29. {tccli-3.0.1147.1.dist-info → tccli-3.0.1148.1.dist-info}/license_files/LICENSE +0 -0
@@ -17,6 +17,58 @@ from tencentcloud.mna.v20210119 import models as models_v20210119
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
+ def doSetNotifyUrl(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.MnaClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.SetNotifyUrlRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.SetNotifyUrl(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 doGetDevicePayMode(args, parsed_globals):
21
73
  g_param = parse_global_arg(parsed_globals)
22
74
 
@@ -381,6 +433,58 @@ def doGetPublicKey(args, parsed_globals):
381
433
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
382
434
 
383
435
 
436
+ def doGroupAddDevice(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.MnaClient(cred, g_param[OptionsDefine.Region], profile)
463
+ client._sdkVersion += ("_CLI_" + __version__)
464
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
465
+ model = models.GroupAddDeviceRequest()
466
+ model.from_json_string(json.dumps(args))
467
+ start_time = time.time()
468
+ while True:
469
+ rsp = client.GroupAddDevice(model)
470
+ result = rsp.to_json_string()
471
+ try:
472
+ json_obj = json.loads(result)
473
+ except TypeError as e:
474
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
475
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
476
+ break
477
+ cur_time = time.time()
478
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
479
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
480
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
481
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
482
+ else:
483
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
484
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
485
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
486
+
487
+
384
488
  def doActivateHardware(args, parsed_globals):
385
489
  g_param = parse_global_arg(parsed_globals)
386
490
 
@@ -537,7 +641,7 @@ def doAddHardware(args, parsed_globals):
537
641
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
538
642
 
539
643
 
540
- def doGetDevice(args, parsed_globals):
644
+ def doGetFlowAlarmInfo(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,11 @@ def doGetDevice(args, parsed_globals):
566
670
  client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
567
671
  client._sdkVersion += ("_CLI_" + __version__)
568
672
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
569
- model = models.GetDeviceRequest()
673
+ model = models.GetFlowAlarmInfoRequest()
570
674
  model.from_json_string(json.dumps(args))
571
675
  start_time = time.time()
572
676
  while True:
573
- rsp = client.GetDevice(model)
677
+ rsp = client.GetFlowAlarmInfo(model)
574
678
  result = rsp.to_json_string()
575
679
  try:
576
680
  json_obj = json.loads(result)
@@ -641,6 +745,110 @@ def doCreateQos(args, parsed_globals):
641
745
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
642
746
 
643
747
 
748
+ def doDeleteGroup(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.MnaClient(cred, g_param[OptionsDefine.Region], profile)
775
+ client._sdkVersion += ("_CLI_" + __version__)
776
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
777
+ model = models.DeleteGroupRequest()
778
+ model.from_json_string(json.dumps(args))
779
+ start_time = time.time()
780
+ while True:
781
+ rsp = client.DeleteGroup(model)
782
+ result = rsp.to_json_string()
783
+ try:
784
+ json_obj = json.loads(result)
785
+ except TypeError as e:
786
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
787
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
788
+ break
789
+ cur_time = time.time()
790
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
791
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
792
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
793
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
794
+ else:
795
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
796
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
797
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
798
+
799
+
800
+ def doGetFlowStatisticByRegion(args, parsed_globals):
801
+ g_param = parse_global_arg(parsed_globals)
802
+
803
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
804
+ cred = credential.CVMRoleCredential()
805
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
806
+ cred = credential.STSAssumeRoleCredential(
807
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
808
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
809
+ )
810
+ 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):
811
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
812
+ else:
813
+ cred = credential.Credential(
814
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
815
+ )
816
+ http_profile = HttpProfile(
817
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
818
+ reqMethod="POST",
819
+ endpoint=g_param[OptionsDefine.Endpoint],
820
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
821
+ )
822
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
823
+ if g_param[OptionsDefine.Language]:
824
+ profile.language = g_param[OptionsDefine.Language]
825
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
826
+ client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
827
+ client._sdkVersion += ("_CLI_" + __version__)
828
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
829
+ model = models.GetFlowStatisticByRegionRequest()
830
+ model.from_json_string(json.dumps(args))
831
+ start_time = time.time()
832
+ while True:
833
+ rsp = client.GetFlowStatisticByRegion(model)
834
+ result = rsp.to_json_string()
835
+ try:
836
+ json_obj = json.loads(result)
837
+ except TypeError as e:
838
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
839
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
840
+ break
841
+ cur_time = time.time()
842
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
843
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
844
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
845
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
846
+ else:
847
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
848
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
849
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
850
+
851
+
644
852
  def doDeleteDevice(args, parsed_globals):
645
853
  g_param = parse_global_arg(parsed_globals)
646
854
 
@@ -849,6 +1057,58 @@ def doUpdateHardware(args, parsed_globals):
849
1057
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
850
1058
 
851
1059
 
1060
+ def doGetGroupDetail(args, parsed_globals):
1061
+ g_param = parse_global_arg(parsed_globals)
1062
+
1063
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1064
+ cred = credential.CVMRoleCredential()
1065
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1066
+ cred = credential.STSAssumeRoleCredential(
1067
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1068
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1069
+ )
1070
+ 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):
1071
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1072
+ else:
1073
+ cred = credential.Credential(
1074
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1075
+ )
1076
+ http_profile = HttpProfile(
1077
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1078
+ reqMethod="POST",
1079
+ endpoint=g_param[OptionsDefine.Endpoint],
1080
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1081
+ )
1082
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1083
+ if g_param[OptionsDefine.Language]:
1084
+ profile.language = g_param[OptionsDefine.Language]
1085
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1086
+ client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
1087
+ client._sdkVersion += ("_CLI_" + __version__)
1088
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1089
+ model = models.GetGroupDetailRequest()
1090
+ model.from_json_string(json.dumps(args))
1091
+ start_time = time.time()
1092
+ while True:
1093
+ rsp = client.GetGroupDetail(model)
1094
+ result = rsp.to_json_string()
1095
+ try:
1096
+ json_obj = json.loads(result)
1097
+ except TypeError as e:
1098
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1099
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1100
+ break
1101
+ cur_time = time.time()
1102
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1103
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1104
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1105
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1106
+ else:
1107
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1108
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1109
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1110
+
1111
+
852
1112
  def doGetVendorHardware(args, parsed_globals):
853
1113
  g_param = parse_global_arg(parsed_globals)
854
1114
 
@@ -1005,7 +1265,7 @@ def doDeleteQos(args, parsed_globals):
1005
1265
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1006
1266
 
1007
1267
 
1008
- def doGetFlowAlarmInfo(args, parsed_globals):
1268
+ def doGetDevice(args, parsed_globals):
1009
1269
  g_param = parse_global_arg(parsed_globals)
1010
1270
 
1011
1271
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -1034,11 +1294,63 @@ def doGetFlowAlarmInfo(args, parsed_globals):
1034
1294
  client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
1035
1295
  client._sdkVersion += ("_CLI_" + __version__)
1036
1296
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
1037
- model = models.GetFlowAlarmInfoRequest()
1297
+ model = models.GetDeviceRequest()
1038
1298
  model.from_json_string(json.dumps(args))
1039
1299
  start_time = time.time()
1040
1300
  while True:
1041
- rsp = client.GetFlowAlarmInfo(model)
1301
+ rsp = client.GetDevice(model)
1302
+ result = rsp.to_json_string()
1303
+ try:
1304
+ json_obj = json.loads(result)
1305
+ except TypeError as e:
1306
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1307
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1308
+ break
1309
+ cur_time = time.time()
1310
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1311
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1312
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1313
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1314
+ else:
1315
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1316
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1317
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1318
+
1319
+
1320
+ def doGroupDeleteDevice(args, parsed_globals):
1321
+ g_param = parse_global_arg(parsed_globals)
1322
+
1323
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1324
+ cred = credential.CVMRoleCredential()
1325
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1326
+ cred = credential.STSAssumeRoleCredential(
1327
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1328
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1329
+ )
1330
+ 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):
1331
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1332
+ else:
1333
+ cred = credential.Credential(
1334
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1335
+ )
1336
+ http_profile = HttpProfile(
1337
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1338
+ reqMethod="POST",
1339
+ endpoint=g_param[OptionsDefine.Endpoint],
1340
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1341
+ )
1342
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1343
+ if g_param[OptionsDefine.Language]:
1344
+ profile.language = g_param[OptionsDefine.Language]
1345
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1346
+ client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
1347
+ client._sdkVersion += ("_CLI_" + __version__)
1348
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1349
+ model = models.GroupDeleteDeviceRequest()
1350
+ model.from_json_string(json.dumps(args))
1351
+ start_time = time.time()
1352
+ while True:
1353
+ rsp = client.GroupDeleteDevice(model)
1042
1354
  result = rsp.to_json_string()
1043
1355
  try:
1044
1356
  json_obj = json.loads(result)
@@ -1317,6 +1629,162 @@ def doDescribeQos(args, parsed_globals):
1317
1629
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1318
1630
 
1319
1631
 
1632
+ def doGetGroupList(args, parsed_globals):
1633
+ g_param = parse_global_arg(parsed_globals)
1634
+
1635
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1636
+ cred = credential.CVMRoleCredential()
1637
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1638
+ cred = credential.STSAssumeRoleCredential(
1639
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1640
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1641
+ )
1642
+ 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):
1643
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1644
+ else:
1645
+ cred = credential.Credential(
1646
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1647
+ )
1648
+ http_profile = HttpProfile(
1649
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1650
+ reqMethod="POST",
1651
+ endpoint=g_param[OptionsDefine.Endpoint],
1652
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1653
+ )
1654
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1655
+ if g_param[OptionsDefine.Language]:
1656
+ profile.language = g_param[OptionsDefine.Language]
1657
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1658
+ client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
1659
+ client._sdkVersion += ("_CLI_" + __version__)
1660
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1661
+ model = models.GetGroupListRequest()
1662
+ model.from_json_string(json.dumps(args))
1663
+ start_time = time.time()
1664
+ while True:
1665
+ rsp = client.GetGroupList(model)
1666
+ result = rsp.to_json_string()
1667
+ try:
1668
+ json_obj = json.loads(result)
1669
+ except TypeError as e:
1670
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1671
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1672
+ break
1673
+ cur_time = time.time()
1674
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1675
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1676
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1677
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1678
+ else:
1679
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1680
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1681
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1682
+
1683
+
1684
+ def doUpdateGroup(args, parsed_globals):
1685
+ g_param = parse_global_arg(parsed_globals)
1686
+
1687
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1688
+ cred = credential.CVMRoleCredential()
1689
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1690
+ cred = credential.STSAssumeRoleCredential(
1691
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1692
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1693
+ )
1694
+ 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):
1695
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1696
+ else:
1697
+ cred = credential.Credential(
1698
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1699
+ )
1700
+ http_profile = HttpProfile(
1701
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1702
+ reqMethod="POST",
1703
+ endpoint=g_param[OptionsDefine.Endpoint],
1704
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1705
+ )
1706
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1707
+ if g_param[OptionsDefine.Language]:
1708
+ profile.language = g_param[OptionsDefine.Language]
1709
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1710
+ client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
1711
+ client._sdkVersion += ("_CLI_" + __version__)
1712
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1713
+ model = models.UpdateGroupRequest()
1714
+ model.from_json_string(json.dumps(args))
1715
+ start_time = time.time()
1716
+ while True:
1717
+ rsp = client.UpdateGroup(model)
1718
+ result = rsp.to_json_string()
1719
+ try:
1720
+ json_obj = json.loads(result)
1721
+ except TypeError as e:
1722
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1723
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1724
+ break
1725
+ cur_time = time.time()
1726
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1727
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1728
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1729
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1730
+ else:
1731
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1732
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1733
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1734
+
1735
+
1736
+ def doAddGroup(args, parsed_globals):
1737
+ g_param = parse_global_arg(parsed_globals)
1738
+
1739
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1740
+ cred = credential.CVMRoleCredential()
1741
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1742
+ cred = credential.STSAssumeRoleCredential(
1743
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1744
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1745
+ )
1746
+ 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):
1747
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1748
+ else:
1749
+ cred = credential.Credential(
1750
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1751
+ )
1752
+ http_profile = HttpProfile(
1753
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1754
+ reqMethod="POST",
1755
+ endpoint=g_param[OptionsDefine.Endpoint],
1756
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1757
+ )
1758
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1759
+ if g_param[OptionsDefine.Language]:
1760
+ profile.language = g_param[OptionsDefine.Language]
1761
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1762
+ client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
1763
+ client._sdkVersion += ("_CLI_" + __version__)
1764
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1765
+ model = models.AddGroupRequest()
1766
+ model.from_json_string(json.dumps(args))
1767
+ start_time = time.time()
1768
+ while True:
1769
+ rsp = client.AddGroup(model)
1770
+ result = rsp.to_json_string()
1771
+ try:
1772
+ json_obj = json.loads(result)
1773
+ except TypeError as e:
1774
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1775
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1776
+ break
1777
+ cur_time = time.time()
1778
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1779
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1780
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1781
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1782
+ else:
1783
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1784
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1785
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1786
+
1787
+
1320
1788
  CLIENT_MAP = {
1321
1789
  "v20210119": mna_client_v20210119,
1322
1790
 
@@ -1328,6 +1796,7 @@ MODELS_MAP = {
1328
1796
  }
1329
1797
 
1330
1798
  ACTION_MAP = {
1799
+ "SetNotifyUrl": doSetNotifyUrl,
1331
1800
  "GetDevicePayMode": doGetDevicePayMode,
1332
1801
  "ModifyPackageRenewFlag": doModifyPackageRenewFlag,
1333
1802
  "GetFlowStatistic": doGetFlowStatistic,
@@ -1335,24 +1804,32 @@ ACTION_MAP = {
1335
1804
  "GetMultiFlowStatistic": doGetMultiFlowStatistic,
1336
1805
  "GetDevices": doGetDevices,
1337
1806
  "GetPublicKey": doGetPublicKey,
1807
+ "GroupAddDevice": doGroupAddDevice,
1338
1808
  "ActivateHardware": doActivateHardware,
1339
1809
  "GetFlowPackages": doGetFlowPackages,
1340
1810
  "AddHardware": doAddHardware,
1341
- "GetDevice": doGetDevice,
1811
+ "GetFlowAlarmInfo": doGetFlowAlarmInfo,
1342
1812
  "CreateQos": doCreateQos,
1813
+ "DeleteGroup": doDeleteGroup,
1814
+ "GetFlowStatisticByRegion": doGetFlowStatisticByRegion,
1343
1815
  "DeleteDevice": doDeleteDevice,
1344
1816
  "UpdateDevice": doUpdateDevice,
1345
1817
  "GetNetMonitor": doGetNetMonitor,
1346
1818
  "UpdateHardware": doUpdateHardware,
1819
+ "GetGroupDetail": doGetGroupDetail,
1347
1820
  "GetVendorHardware": doGetVendorHardware,
1348
1821
  "CreateEncryptedKey": doCreateEncryptedKey,
1349
1822
  "DeleteQos": doDeleteQos,
1350
- "GetFlowAlarmInfo": doGetFlowAlarmInfo,
1823
+ "GetDevice": doGetDevice,
1824
+ "GroupDeleteDevice": doGroupDeleteDevice,
1351
1825
  "OrderFlowPackage": doOrderFlowPackage,
1352
1826
  "GetStatisticData": doGetStatisticData,
1353
1827
  "GetHardwareList": doGetHardwareList,
1354
1828
  "AddDevice": doAddDevice,
1355
1829
  "DescribeQos": doDescribeQos,
1830
+ "GetGroupList": doGetGroupList,
1831
+ "UpdateGroup": doUpdateGroup,
1832
+ "AddGroup": doAddGroup,
1356
1833
 
1357
1834
  }
1358
1835