tccli 3.0.1156.1__py2.py3-none-any.whl → 3.0.1158.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 (44) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/services/ams/v20201229/api.json +14 -14
  3. tccli/services/ams/v20201229/examples.json +1 -1
  4. tccli/services/cam/v20190116/api.json +10 -0
  5. tccli/services/ccc/v20200210/api.json +3 -3
  6. tccli/services/cdwch/v20200915/api.json +27 -0
  7. tccli/services/cdwdoris/v20211228/api.json +27 -0
  8. tccli/services/cfw/v20190904/api.json +34 -0
  9. tccli/services/cls/v20201016/api.json +3 -3
  10. tccli/services/cls/v20201016/examples.json +1 -1
  11. tccli/services/cynosdb/v20190107/api.json +1 -1
  12. tccli/services/dbbrain/v20210527/api.json +10 -1
  13. tccli/services/dts/v20211206/api.json +9 -0
  14. tccli/services/ess/v20201111/api.json +32 -14
  15. tccli/services/ess/v20201111/examples.json +8 -2
  16. tccli/services/essbasic/v20210526/api.json +1 -1
  17. tccli/services/hunyuan/v20230901/api.json +1 -1
  18. tccli/services/mongodb/mongodb_client.py +326 -8
  19. tccli/services/mongodb/v20190725/api.json +551 -0
  20. tccli/services/mongodb/v20190725/examples.json +48 -0
  21. tccli/services/monitor/v20180724/api.json +8 -8
  22. tccli/services/mps/v20190612/api.json +2 -2
  23. tccli/services/mps/v20190612/examples.json +2 -2
  24. tccli/services/ocr/v20181119/api.json +27 -0
  25. tccli/services/redis/v20180412/api.json +3 -3
  26. tccli/services/tem/v20210701/api.json +21 -3
  27. tccli/services/tem/v20210701/examples.json +1 -7
  28. tccli/services/thpc/thpc_client.py +110 -4
  29. tccli/services/thpc/v20230321/api.json +170 -35
  30. tccli/services/thpc/v20230321/examples.json +17 -1
  31. tccli/services/tke/v20220501/api.json +10 -0
  32. tccli/services/trtc/v20190722/api.json +3 -3
  33. tccli/services/trtc/v20190722/examples.json +2 -2
  34. tccli/services/vclm/v20240523/api.json +9 -0
  35. tccli/services/vpc/v20170312/api.json +76 -16
  36. tccli/services/vpc/v20170312/examples.json +3 -3
  37. tccli/services/waf/v20180125/api.json +13 -13
  38. tccli/services/wedata/v20210820/api.json +55 -7
  39. tccli/services/wedata/v20210820/examples.json +6 -0
  40. {tccli-3.0.1156.1.dist-info → tccli-3.0.1158.1.dist-info}/METADATA +2 -2
  41. {tccli-3.0.1156.1.dist-info → tccli-3.0.1158.1.dist-info}/RECORD +44 -44
  42. {tccli-3.0.1156.1.dist-info → tccli-3.0.1158.1.dist-info}/WHEEL +0 -0
  43. {tccli-3.0.1156.1.dist-info → tccli-3.0.1158.1.dist-info}/entry_points.txt +0 -0
  44. {tccli-3.0.1156.1.dist-info → tccli-3.0.1158.1.dist-info}/license_files/LICENSE +0 -0
@@ -123,6 +123,58 @@ def doDescribeDBInstanceNodeProperty(args, parsed_globals):
123
123
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
124
124
 
125
125
 
126
+ def doDescribeDBInstanceParamTpl(args, parsed_globals):
127
+ g_param = parse_global_arg(parsed_globals)
128
+
129
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
130
+ cred = credential.CVMRoleCredential()
131
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
132
+ cred = credential.STSAssumeRoleCredential(
133
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
134
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
135
+ )
136
+ 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):
137
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
138
+ else:
139
+ cred = credential.Credential(
140
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
141
+ )
142
+ http_profile = HttpProfile(
143
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
144
+ reqMethod="POST",
145
+ endpoint=g_param[OptionsDefine.Endpoint],
146
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
147
+ )
148
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
149
+ if g_param[OptionsDefine.Language]:
150
+ profile.language = g_param[OptionsDefine.Language]
151
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
152
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
153
+ client._sdkVersion += ("_CLI_" + __version__)
154
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
155
+ model = models.DescribeDBInstanceParamTplRequest()
156
+ model.from_json_string(json.dumps(args))
157
+ start_time = time.time()
158
+ while True:
159
+ rsp = client.DescribeDBInstanceParamTpl(model)
160
+ result = rsp.to_json_string()
161
+ try:
162
+ json_obj = json.loads(result)
163
+ except TypeError as e:
164
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
165
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
166
+ break
167
+ cur_time = time.time()
168
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
169
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
170
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
171
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
172
+ else:
173
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
174
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
175
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
176
+
177
+
126
178
  def doDescribeDBInstanceDeal(args, parsed_globals):
127
179
  g_param = parse_global_arg(parsed_globals)
128
180
 
@@ -539,7 +591,7 @@ def doFlushInstanceRouterConfig(args, parsed_globals):
539
591
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
540
592
 
541
593
 
542
- def doSetAutoRenew(args, parsed_globals):
594
+ def doUpgradeDBInstance(args, parsed_globals):
543
595
  g_param = parse_global_arg(parsed_globals)
544
596
 
545
597
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -568,11 +620,11 @@ def doSetAutoRenew(args, parsed_globals):
568
620
  client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
569
621
  client._sdkVersion += ("_CLI_" + __version__)
570
622
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
571
- model = models.SetAutoRenewRequest()
623
+ model = models.UpgradeDBInstanceRequest()
572
624
  model.from_json_string(json.dumps(args))
573
625
  start_time = time.time()
574
626
  while True:
575
- rsp = client.SetAutoRenew(model)
627
+ rsp = client.UpgradeDBInstance(model)
576
628
  result = rsp.to_json_string()
577
629
  try:
578
630
  json_obj = json.loads(result)
@@ -643,6 +695,58 @@ def doDescribeDBBackups(args, parsed_globals):
643
695
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
644
696
 
645
697
 
698
+ def doSetAutoRenew(args, parsed_globals):
699
+ g_param = parse_global_arg(parsed_globals)
700
+
701
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
702
+ cred = credential.CVMRoleCredential()
703
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
704
+ cred = credential.STSAssumeRoleCredential(
705
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
706
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
707
+ )
708
+ 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):
709
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
710
+ else:
711
+ cred = credential.Credential(
712
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
713
+ )
714
+ http_profile = HttpProfile(
715
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
716
+ reqMethod="POST",
717
+ endpoint=g_param[OptionsDefine.Endpoint],
718
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
719
+ )
720
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
721
+ if g_param[OptionsDefine.Language]:
722
+ profile.language = g_param[OptionsDefine.Language]
723
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
724
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
725
+ client._sdkVersion += ("_CLI_" + __version__)
726
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
727
+ model = models.SetAutoRenewRequest()
728
+ model.from_json_string(json.dumps(args))
729
+ start_time = time.time()
730
+ while True:
731
+ rsp = client.SetAutoRenew(model)
732
+ result = rsp.to_json_string()
733
+ try:
734
+ json_obj = json.loads(result)
735
+ except TypeError as e:
736
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
737
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
738
+ break
739
+ cur_time = time.time()
740
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
741
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
742
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
743
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
744
+ else:
745
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
746
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
747
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
748
+
749
+
646
750
  def doIsolateDBInstance(args, parsed_globals):
647
751
  g_param = parse_global_arg(parsed_globals)
648
752
 
@@ -799,6 +903,58 @@ def doInquirePriceModifyDBInstanceSpec(args, parsed_globals):
799
903
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
800
904
 
801
905
 
906
+ def doRestartNodes(args, parsed_globals):
907
+ g_param = parse_global_arg(parsed_globals)
908
+
909
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
910
+ cred = credential.CVMRoleCredential()
911
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
912
+ cred = credential.STSAssumeRoleCredential(
913
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
914
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
915
+ )
916
+ 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):
917
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
918
+ else:
919
+ cred = credential.Credential(
920
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
921
+ )
922
+ http_profile = HttpProfile(
923
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
924
+ reqMethod="POST",
925
+ endpoint=g_param[OptionsDefine.Endpoint],
926
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
927
+ )
928
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
929
+ if g_param[OptionsDefine.Language]:
930
+ profile.language = g_param[OptionsDefine.Language]
931
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
932
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
933
+ client._sdkVersion += ("_CLI_" + __version__)
934
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
935
+ model = models.RestartNodesRequest()
936
+ model.from_json_string(json.dumps(args))
937
+ start_time = time.time()
938
+ while True:
939
+ rsp = client.RestartNodes(model)
940
+ result = rsp.to_json_string()
941
+ try:
942
+ json_obj = json.loads(result)
943
+ except TypeError as e:
944
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
945
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
946
+ break
947
+ cur_time = time.time()
948
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
949
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
950
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
951
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
952
+ else:
953
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
954
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
955
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
956
+
957
+
802
958
  def doDescribeBackupRules(args, parsed_globals):
803
959
  g_param = parse_global_arg(parsed_globals)
804
960
 
@@ -1007,6 +1163,58 @@ def doCreateAccountUser(args, parsed_globals):
1007
1163
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1008
1164
 
1009
1165
 
1166
+ def doModifyDBInstanceParamTpl(args, parsed_globals):
1167
+ g_param = parse_global_arg(parsed_globals)
1168
+
1169
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1170
+ cred = credential.CVMRoleCredential()
1171
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1172
+ cred = credential.STSAssumeRoleCredential(
1173
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1174
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1175
+ )
1176
+ 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):
1177
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1178
+ else:
1179
+ cred = credential.Credential(
1180
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1181
+ )
1182
+ http_profile = HttpProfile(
1183
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1184
+ reqMethod="POST",
1185
+ endpoint=g_param[OptionsDefine.Endpoint],
1186
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1187
+ )
1188
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1189
+ if g_param[OptionsDefine.Language]:
1190
+ profile.language = g_param[OptionsDefine.Language]
1191
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1192
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
1193
+ client._sdkVersion += ("_CLI_" + __version__)
1194
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1195
+ model = models.ModifyDBInstanceParamTplRequest()
1196
+ model.from_json_string(json.dumps(args))
1197
+ start_time = time.time()
1198
+ while True:
1199
+ rsp = client.ModifyDBInstanceParamTpl(model)
1200
+ result = rsp.to_json_string()
1201
+ try:
1202
+ json_obj = json.loads(result)
1203
+ except TypeError as e:
1204
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1205
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1206
+ break
1207
+ cur_time = time.time()
1208
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1209
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1210
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1211
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1212
+ else:
1213
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1214
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1215
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1216
+
1217
+
1010
1218
  def doCreateDBInstanceHour(args, parsed_globals):
1011
1219
  g_param = parse_global_arg(parsed_globals)
1012
1220
 
@@ -1059,6 +1267,110 @@ def doCreateDBInstanceHour(args, parsed_globals):
1059
1267
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1060
1268
 
1061
1269
 
1270
+ def doCreateDBInstanceParamTpl(args, parsed_globals):
1271
+ g_param = parse_global_arg(parsed_globals)
1272
+
1273
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1274
+ cred = credential.CVMRoleCredential()
1275
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1276
+ cred = credential.STSAssumeRoleCredential(
1277
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1278
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1279
+ )
1280
+ 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):
1281
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1282
+ else:
1283
+ cred = credential.Credential(
1284
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1285
+ )
1286
+ http_profile = HttpProfile(
1287
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1288
+ reqMethod="POST",
1289
+ endpoint=g_param[OptionsDefine.Endpoint],
1290
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1291
+ )
1292
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1293
+ if g_param[OptionsDefine.Language]:
1294
+ profile.language = g_param[OptionsDefine.Language]
1295
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1296
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
1297
+ client._sdkVersion += ("_CLI_" + __version__)
1298
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1299
+ model = models.CreateDBInstanceParamTplRequest()
1300
+ model.from_json_string(json.dumps(args))
1301
+ start_time = time.time()
1302
+ while True:
1303
+ rsp = client.CreateDBInstanceParamTpl(model)
1304
+ result = rsp.to_json_string()
1305
+ try:
1306
+ json_obj = json.loads(result)
1307
+ except TypeError as e:
1308
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1309
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1310
+ break
1311
+ cur_time = time.time()
1312
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1313
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1314
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1315
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1316
+ else:
1317
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1318
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1319
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1320
+
1321
+
1322
+ def doDropDBInstanceParamTpl(args, parsed_globals):
1323
+ g_param = parse_global_arg(parsed_globals)
1324
+
1325
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1326
+ cred = credential.CVMRoleCredential()
1327
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1328
+ cred = credential.STSAssumeRoleCredential(
1329
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1330
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1331
+ )
1332
+ 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):
1333
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1334
+ else:
1335
+ cred = credential.Credential(
1336
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1337
+ )
1338
+ http_profile = HttpProfile(
1339
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1340
+ reqMethod="POST",
1341
+ endpoint=g_param[OptionsDefine.Endpoint],
1342
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1343
+ )
1344
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1345
+ if g_param[OptionsDefine.Language]:
1346
+ profile.language = g_param[OptionsDefine.Language]
1347
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1348
+ client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
1349
+ client._sdkVersion += ("_CLI_" + __version__)
1350
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1351
+ model = models.DropDBInstanceParamTplRequest()
1352
+ model.from_json_string(json.dumps(args))
1353
+ start_time = time.time()
1354
+ while True:
1355
+ rsp = client.DropDBInstanceParamTpl(model)
1356
+ result = rsp.to_json_string()
1357
+ try:
1358
+ json_obj = json.loads(result)
1359
+ except TypeError as e:
1360
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1361
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1362
+ break
1363
+ cur_time = time.time()
1364
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1365
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1366
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1367
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1368
+ else:
1369
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1370
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1371
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1372
+
1373
+
1062
1374
  def doTerminateDBInstance(args, parsed_globals):
1063
1375
  g_param = parse_global_arg(parsed_globals)
1064
1376
 
@@ -2203,7 +2515,7 @@ def doModifyInstanceParams(args, parsed_globals):
2203
2515
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2204
2516
 
2205
2517
 
2206
- def doUpgradeDBInstance(args, parsed_globals):
2518
+ def doDescribeDBInstanceParamTplDetail(args, parsed_globals):
2207
2519
  g_param = parse_global_arg(parsed_globals)
2208
2520
 
2209
2521
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -2232,11 +2544,11 @@ def doUpgradeDBInstance(args, parsed_globals):
2232
2544
  client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
2233
2545
  client._sdkVersion += ("_CLI_" + __version__)
2234
2546
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
2235
- model = models.UpgradeDBInstanceRequest()
2547
+ model = models.DescribeDBInstanceParamTplDetailRequest()
2236
2548
  model.from_json_string(json.dumps(args))
2237
2549
  start_time = time.time()
2238
2550
  while True:
2239
- rsp = client.UpgradeDBInstance(model)
2551
+ rsp = client.DescribeDBInstanceParamTplDetail(model)
2240
2552
  result = rsp.to_json_string()
2241
2553
  try:
2242
2554
  json_obj = json.loads(result)
@@ -2582,6 +2894,7 @@ MODELS_MAP = {
2582
2894
  ACTION_MAP = {
2583
2895
  "TerminateDBInstances": doTerminateDBInstances,
2584
2896
  "DescribeDBInstanceNodeProperty": doDescribeDBInstanceNodeProperty,
2897
+ "DescribeDBInstanceParamTpl": doDescribeDBInstanceParamTpl,
2585
2898
  "DescribeDBInstanceDeal": doDescribeDBInstanceDeal,
2586
2899
  "DescribeCurrentOp": doDescribeCurrentOp,
2587
2900
  "DescribeClientConnections": doDescribeClientConnections,
@@ -2590,16 +2903,21 @@ ACTION_MAP = {
2590
2903
  "SetPassword": doSetPassword,
2591
2904
  "SetAccountUserPrivilege": doSetAccountUserPrivilege,
2592
2905
  "FlushInstanceRouterConfig": doFlushInstanceRouterConfig,
2593
- "SetAutoRenew": doSetAutoRenew,
2906
+ "UpgradeDBInstance": doUpgradeDBInstance,
2594
2907
  "DescribeDBBackups": doDescribeDBBackups,
2908
+ "SetAutoRenew": doSetAutoRenew,
2595
2909
  "IsolateDBInstance": doIsolateDBInstance,
2596
2910
  "SetBackupRules": doSetBackupRules,
2597
2911
  "InquirePriceModifyDBInstanceSpec": doInquirePriceModifyDBInstanceSpec,
2912
+ "RestartNodes": doRestartNodes,
2598
2913
  "DescribeBackupRules": doDescribeBackupRules,
2599
2914
  "RenameInstance": doRenameInstance,
2600
2915
  "DescribeAsyncRequestInfo": doDescribeAsyncRequestInfo,
2601
2916
  "CreateAccountUser": doCreateAccountUser,
2917
+ "ModifyDBInstanceParamTpl": doModifyDBInstanceParamTpl,
2602
2918
  "CreateDBInstanceHour": doCreateDBInstanceHour,
2919
+ "CreateDBInstanceParamTpl": doCreateDBInstanceParamTpl,
2920
+ "DropDBInstanceParamTpl": doDropDBInstanceParamTpl,
2603
2921
  "TerminateDBInstance": doTerminateDBInstance,
2604
2922
  "RenewDBInstances": doRenewDBInstances,
2605
2923
  "CreateBackupDownloadTask": doCreateBackupDownloadTask,
@@ -2622,7 +2940,7 @@ ACTION_MAP = {
2622
2940
  "DescribeSlowLog": doDescribeSlowLog,
2623
2941
  "SetInstanceMaintenance": doSetInstanceMaintenance,
2624
2942
  "ModifyInstanceParams": doModifyInstanceParams,
2625
- "UpgradeDBInstance": doUpgradeDBInstance,
2943
+ "DescribeDBInstanceParamTplDetail": doDescribeDBInstanceParamTplDetail,
2626
2944
  "KillOps": doKillOps,
2627
2945
  "EnableTransparentDataEncryption": doEnableTransparentDataEncryption,
2628
2946
  "CreateBackupDBInstance": doCreateBackupDBInstance,