tccli-intl-en 3.0.1241.1__py2.py3-none-any.whl → 3.1.16.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tccli/__init__.py +1 -1
- tccli/argument.py +1 -1
- tccli/services/__init__.py +29 -1
- tccli/services/advisor/advisor_client.py +10 -4
- tccli/services/ai3d/__init__.py +4 -0
- tccli/services/ai3d/ai3d_client.py +266 -0
- tccli/services/ai3d/v20250513/api.json +264 -0
- tccli/services/ai3d/v20250513/examples.json +20 -0
- tccli/services/aiart/aiart_client.py +5 -2
- tccli/services/ams/ams_client.py +20 -8
- tccli/services/antiddos/antiddos_client.py +350 -140
- tccli/services/apigateway/apigateway_client.py +465 -186
- tccli/services/apm/apm_client.py +835 -68
- tccli/services/apm/v20210622/api.json +3936 -1145
- tccli/services/apm/v20210622/examples.json +133 -23
- tccli/services/asr/asr_client.py +10 -4
- tccli/services/autoscaling/autoscaling_client.py +290 -116
- tccli/services/autoscaling/v20180419/api.json +78 -28
- tccli/services/batch/batch_client.py +140 -56
- tccli/services/bi/bi_client.py +1244 -6
- tccli/services/bi/v20220105/api.json +5340 -107
- tccli/services/bi/v20220105/examples.json +196 -1
- tccli/services/billing/billing_client.py +210 -84
- tccli/services/cam/cam_client.py +405 -162
- tccli/services/captcha/captcha_client.py +5 -2
- tccli/services/car/car_client.py +165 -66
- tccli/services/cbs/cbs_client.py +190 -76
- tccli/services/ccc/ccc_client.py +794 -160
- tccli/services/ccc/v20200210/api.json +1748 -217
- tccli/services/ccc/v20200210/examples.json +64 -0
- tccli/services/cdb/cdb_client.py +665 -266
- tccli/services/cdb/v20170320/api.json +334 -134
- tccli/services/cdb/v20170320/examples.json +3 -3
- tccli/services/cdc/cdc_client.py +100 -40
- tccli/services/cdc/v20201214/api.json +2 -2
- tccli/services/cdc/v20201214/examples.json +4 -4
- tccli/services/cdn/cdn_client.py +220 -88
- tccli/services/cdwdoris/cdwdoris_client.py +385 -154
- tccli/services/cdwpg/cdwpg_client.py +120 -48
- tccli/services/cdz/__init__.py +4 -0
- tccli/services/cdz/cdz_client.py +210 -0
- tccli/services/cdz/v20221123/api.json +233 -0
- tccli/services/cdz/v20221123/examples.json +12 -0
- tccli/services/cfg/cfg_client.py +80 -32
- tccli/services/cfs/cfs_client.py +195 -78
- tccli/services/cfw/cfw_client.py +330 -132
- tccli/services/chdfs/chdfs_client.py +145 -58
- tccli/services/ciam/ciam_client.py +80 -32
- tccli/services/ckafka/ckafka_client.py +1033 -255
- tccli/services/ckafka/v20190819/api.json +3378 -1681
- tccli/services/ckafka/v20190819/examples.json +254 -160
- tccli/services/clb/clb_client.py +1054 -469
- tccli/services/clb/v20180317/api.json +2273 -1020
- tccli/services/clb/v20180317/examples.json +184 -124
- tccli/services/cloudaudit/cloudaudit_client.py +90 -36
- tccli/services/cls/cls_client.py +434 -173
- tccli/services/cmq/cmq_client.py +14 -803
- tccli/services/cmq/v20190304/api.json +173 -1367
- tccli/services/cmq/v20190304/examples.json +0 -120
- tccli/services/config/config_client.py +30 -12
- tccli/services/controlcenter/controlcenter_client.py +229 -2
- tccli/services/controlcenter/v20230110/api.json +528 -5
- tccli/services/controlcenter/v20230110/examples.json +32 -0
- tccli/services/csip/csip_client.py +170 -68
- tccli/services/ctsdb/ctsdb_client.py +10 -4
- tccli/services/cvm/cvm_client.py +706 -189
- tccli/services/cvm/v20170312/api.json +851 -382
- tccli/services/cvm/v20170312/examples.json +173 -127
- tccli/services/cwp/cwp_client.py +2325 -930
- tccli/services/cynosdb/cynosdb_client.py +1887 -577
- tccli/services/cynosdb/v20190107/api.json +11763 -7697
- tccli/services/cynosdb/v20190107/examples.json +132 -4
- tccli/services/dataintegration/dataintegration_client.py +5 -2
- tccli/services/dayu/dayu_client.py +515 -206
- tccli/services/dbbrain/dbbrain_client.py +210 -84
- tccli/services/dc/dc_client.py +90 -36
- tccli/services/dcdb/dcdb_client.py +310 -124
- tccli/services/dlc/dlc_client.py +859 -214
- tccli/services/dlc/v20210125/api.json +637 -13
- tccli/services/dlc/v20210125/examples.json +48 -0
- tccli/services/dms/dms_client.py +10 -4
- tccli/services/dnspod/dnspod_client.py +302 -76
- tccli/services/dnspod/v20210323/api.json +153 -0
- tccli/services/dnspod/v20210323/examples.json +16 -0
- tccli/services/domain/domain_client.py +120 -48
- tccli/services/dts/dts_client.py +415 -166
- tccli/services/eb/eb_client.py +130 -52
- tccli/services/ecdn/ecdn_client.py +75 -30
- tccli/services/ecm/ecm_client.py +620 -248
- tccli/services/eiam/eiam_client.py +200 -80
- tccli/services/emr/emr_client.py +2815 -146
- tccli/services/emr/v20190103/api.json +14527 -4841
- tccli/services/emr/v20190103/examples.json +404 -36
- tccli/services/es/es_client.py +105 -42
- tccli/services/facefusion/facefusion_client.py +15 -6
- tccli/services/faceid/faceid_client.py +95 -38
- tccli/services/faceid/v20180301/api.json +107 -14
- tccli/services/faceid/v20180301/examples.json +3 -3
- tccli/services/gaap/gaap_client.py +440 -176
- tccli/services/gme/gme_client.py +50 -20
- tccli/services/gpm/gpm_client.py +90 -36
- tccli/services/gse/gse_client.py +110 -44
- tccli/services/gwlb/gwlb_client.py +90 -36
- tccli/services/hunyuan/__init__.py +4 -0
- tccli/services/hunyuan/hunyuan_client.py +266 -0
- tccli/services/hunyuan/v20230901/api.json +270 -0
- tccli/services/hunyuan/v20230901/examples.json +20 -0
- tccli/services/iai/iai_client.py +145 -58
- tccli/services/iap/iap_client.py +30 -12
- tccli/services/ims/ims_client.py +5 -2
- tccli/services/intlpartnersmgt/intlpartnersmgt_client.py +210 -84
- tccli/services/intlpartnersmgt/v20220928/api.json +11 -11
- tccli/services/iotcloud/iotcloud_client.py +100 -40
- tccli/services/ip/ip_client.py +30 -12
- tccli/services/kms/kms_client.py +340 -136
- tccli/services/kms/v20190118/api.json +80 -3
- tccli/services/kms/v20190118/examples.json +3 -3
- tccli/services/lcic/lcic_client.py +265 -106
- tccli/services/lighthouse/lighthouse_client.py +370 -148
- tccli/services/lighthouse/v20200324/api.json +14 -14
- tccli/services/lighthouse/v20200324/examples.json +5 -5
- tccli/services/live/live_client.py +600 -240
- tccli/services/lke/lke_client.py +450 -180
- tccli/services/lke/v20231130/api.json +182 -39
- tccli/services/lkeap/__init__.py +4 -0
- tccli/services/lkeap/lkeap_client.py +602 -0
- tccli/services/lkeap/v20240522/api.json +953 -0
- tccli/services/lkeap/v20240522/examples.json +92 -0
- tccli/services/mariadb/mariadb_client.py +250 -100
- tccli/services/mdc/mdc_client.py +90 -36
- tccli/services/mdl/mdl_client.py +357 -90
- tccli/services/mdl/v20200326/api.json +791 -24
- tccli/services/mdl/v20200326/examples.json +40 -16
- tccli/services/mdp/mdp_client.py +734 -124
- tccli/services/mdp/v20200527/api.json +748 -23
- tccli/services/mdp/v20200527/examples.json +143 -79
- tccli/services/message/__init__.py +4 -0
- tccli/services/message/message_client.py +210 -0
- tccli/services/message/v20181225/api.json +72 -0
- tccli/services/message/v20181225/examples.json +13 -0
- tccli/services/mongodb/mongodb_client.py +1404 -141
- tccli/services/mongodb/v20190725/api.json +2919 -677
- tccli/services/mongodb/v20190725/examples.json +190 -22
- tccli/services/monitor/monitor_client.py +1008 -296
- tccli/services/monitor/v20180724/api.json +660 -11
- tccli/services/monitor/v20180724/examples.json +152 -4
- tccli/services/mps/mps_client.py +1489 -429
- tccli/services/mps/v20190612/api.json +4750 -1077
- tccli/services/mps/v20190612/examples.json +182 -70
- tccli/services/msp/msp_client.py +35 -14
- tccli/services/ocr/ocr_client.py +417 -82
- tccli/services/ocr/v20181119/api.json +1486 -103
- tccli/services/ocr/v20181119/examples.json +42 -4
- tccli/services/omics/omics_client.py +100 -40
- tccli/services/organization/organization_client.py +580 -232
- tccli/services/postgres/postgres_client.py +455 -182
- tccli/services/privatedns/privatedns_client.py +155 -62
- tccli/services/pts/pts_client.py +240 -96
- tccli/services/quota/__init__.py +4 -0
- tccli/services/quota/quota_client.py +434 -0
- tccli/services/quota/v20241204/api.json +548 -0
- tccli/services/quota/v20241204/examples.json +51 -0
- tccli/services/rce/rce_client.py +5 -2
- tccli/services/redis/redis_client.py +545 -218
- tccli/services/redis/v20180412/api.json +225 -113
- tccli/services/redis/v20180412/examples.json +19 -19
- tccli/services/region/region_client.py +15 -6
- tccli/services/rum/rum_client.py +300 -120
- tccli/services/scf/scf_client.py +210 -84
- tccli/services/ses/ses_client.py +145 -58
- tccli/services/smh/__init__.py +4 -0
- tccli/services/smh/smh_client.py +714 -0
- tccli/services/smh/v20210712/api.json +1287 -0
- tccli/services/smh/v20210712/examples.json +85 -0
- tccli/services/sms/sms_client.py +90 -36
- tccli/services/sqlserver/sqlserver_client.py +3855 -470
- tccli/services/sqlserver/v20180328/api.json +9725 -3356
- tccli/services/sqlserver/v20180328/examples.json +470 -10
- tccli/services/ssl/ssl_client.py +190 -76
- tccli/services/ssm/ssm_client.py +120 -48
- tccli/services/sts/sts_client.py +25 -10
- tccli/services/tag/tag_client.py +150 -60
- tccli/services/tat/tat_client.py +95 -38
- tccli/services/tbaas/tbaas_client.py +20 -8
- tccli/services/tcaplusdb/tcaplusdb_client.py +260 -104
- tccli/services/tcaplusdb/v20190823/api.json +836 -760
- tccli/services/tcaplusdb/v20190823/examples.json +3 -3
- tccli/services/tchd/tchd_client.py +5 -2
- tccli/services/tcmpp/tcmpp_client.py +520 -208
- tccli/services/tcr/tcr_client.py +380 -152
- tccli/services/tcsas/tcsas_client.py +295 -118
- tccli/services/tcsas/v20250106/api.json +155 -79
- tccli/services/tcsas/v20250106/examples.json +3 -3
- tccli/services/tcss/tcss_client.py +1650 -660
- tccli/services/tdid/tdid_client.py +240 -96
- tccli/services/tdmq/tdmq_client.py +2876 -466
- tccli/services/tdmq/v20200217/api.json +11607 -3958
- tccli/services/tdmq/v20200217/examples.json +562 -264
- tccli/services/tem/tem_client.py +280 -112
- tccli/services/teo/teo_client.py +1590 -540
- tccli/services/teo/v20220901/api.json +703 -71
- tccli/services/teo/v20220901/examples.json +88 -22
- tccli/services/tione/__init__.py +4 -0
- tccli/services/tione/tione_client.py +210 -0
- tccli/services/tione/v20211111/api.json +3074 -0
- tccli/services/tione/v20211111/examples.json +12 -0
- tccli/services/tiw/tiw_client.py +255 -102
- tccli/services/tke/tke_client.py +690 -276
- tccli/services/tms/tms_client.py +5 -2
- tccli/services/tmt/tmt_client.py +5 -2
- tccli/services/trabbit/trabbit_client.py +145 -58
- tccli/services/trocket/__init__.py +4 -0
- tccli/services/trocket/trocket_client.py +2450 -0
- tccli/services/trocket/v20230308/api.json +6062 -0
- tccli/services/trocket/v20230308/examples.json +339 -0
- tccli/services/trro/trro_client.py +95 -38
- tccli/services/trtc/trtc_client.py +255 -102
- tccli/services/trtc/v20190722/api.json +135 -31
- tccli/services/trtc/v20190722/examples.json +7 -7
- tccli/services/tts/tts_client.py +5 -2
- tccli/services/vclm/vclm_client.py +10 -4
- tccli/services/vm/vm_client.py +20 -8
- tccli/services/vod/vod_client.py +895 -358
- tccli/services/vpc/v20170312/api.json +1032 -134
- tccli/services/vpc/v20170312/examples.json +119 -23
- tccli/services/vpc/vpc_client.py +2159 -644
- tccli/services/waf/v20180125/api.json +1372 -194
- tccli/services/waf/v20180125/examples.json +89 -1
- tccli/services/waf/waf_client.py +1149 -245
- tccli/services/wedata/v20250806/api.json +13644 -0
- tccli/services/wedata/v20250806/examples.json +621 -0
- tccli/services/wedata/wedata_client.py +6067 -1263
- tccli/services/yunjing/yunjing_client.py +355 -142
- {tccli_intl_en-3.0.1241.1.dist-info → tccli_intl_en-3.1.16.1.dist-info}/METADATA +4 -7
- {tccli_intl_en-3.0.1241.1.dist-info → tccli_intl_en-3.1.16.1.dist-info}/RECORD +239 -201
- {tccli_intl_en-3.0.1241.1.dist-info → tccli_intl_en-3.1.16.1.dist-info}/WHEEL +1 -1
- {tccli_intl_en-3.0.1241.1.dist-info → tccli_intl_en-3.1.16.1.dist-info}/entry_points.txt +0 -1
- {tccli_intl_en-3.0.1241.1.dist-info → tccli_intl_en-3.1.16.1.dist-info}/LICENSE +0 -0
- {tccli_intl_en-3.0.1241.1.dist-info → tccli_intl_en-3.1.16.1.dist-info}/top_level.txt +0 -0
|
@@ -17,6 +17,171 @@ from tencentcloud.mongodb.v20190725 import models as models_v20190725
|
|
|
17
17
|
from jmespath import search
|
|
18
18
|
import time
|
|
19
19
|
|
|
20
|
+
def doTerminateDBInstances(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) \
|
|
31
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
32
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
33
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
34
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
35
|
+
else:
|
|
36
|
+
cred = credential.Credential(
|
|
37
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
38
|
+
)
|
|
39
|
+
http_profile = HttpProfile(
|
|
40
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
41
|
+
reqMethod="POST",
|
|
42
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
43
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
44
|
+
)
|
|
45
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
46
|
+
if g_param[OptionsDefine.Language]:
|
|
47
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
48
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
49
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
50
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
51
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
52
|
+
model = models.TerminateDBInstancesRequest()
|
|
53
|
+
model.from_json_string(json.dumps(args))
|
|
54
|
+
start_time = time.time()
|
|
55
|
+
while True:
|
|
56
|
+
rsp = client.TerminateDBInstances(model)
|
|
57
|
+
result = rsp.to_json_string()
|
|
58
|
+
try:
|
|
59
|
+
json_obj = json.loads(result)
|
|
60
|
+
except TypeError as e:
|
|
61
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
62
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
63
|
+
break
|
|
64
|
+
cur_time = time.time()
|
|
65
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
66
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
67
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
68
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
69
|
+
else:
|
|
70
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
71
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
72
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def doCreateLogDownloadTask(args, parsed_globals):
|
|
76
|
+
g_param = parse_global_arg(parsed_globals)
|
|
77
|
+
|
|
78
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
79
|
+
cred = credential.CVMRoleCredential()
|
|
80
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
81
|
+
cred = credential.STSAssumeRoleCredential(
|
|
82
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
83
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
84
|
+
)
|
|
85
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
86
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
87
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
88
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
89
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
90
|
+
else:
|
|
91
|
+
cred = credential.Credential(
|
|
92
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
93
|
+
)
|
|
94
|
+
http_profile = HttpProfile(
|
|
95
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
96
|
+
reqMethod="POST",
|
|
97
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
98
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
99
|
+
)
|
|
100
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
101
|
+
if g_param[OptionsDefine.Language]:
|
|
102
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
103
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
104
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
105
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
106
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
107
|
+
model = models.CreateLogDownloadTaskRequest()
|
|
108
|
+
model.from_json_string(json.dumps(args))
|
|
109
|
+
start_time = time.time()
|
|
110
|
+
while True:
|
|
111
|
+
rsp = client.CreateLogDownloadTask(model)
|
|
112
|
+
result = rsp.to_json_string()
|
|
113
|
+
try:
|
|
114
|
+
json_obj = json.loads(result)
|
|
115
|
+
except TypeError as e:
|
|
116
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
117
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
118
|
+
break
|
|
119
|
+
cur_time = time.time()
|
|
120
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
121
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
122
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
123
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
124
|
+
else:
|
|
125
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
126
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
127
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def doDescribeDBInstanceNodeProperty(args, parsed_globals):
|
|
131
|
+
g_param = parse_global_arg(parsed_globals)
|
|
132
|
+
|
|
133
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
134
|
+
cred = credential.CVMRoleCredential()
|
|
135
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
136
|
+
cred = credential.STSAssumeRoleCredential(
|
|
137
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
138
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
139
|
+
)
|
|
140
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
141
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
142
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
143
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
144
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
145
|
+
else:
|
|
146
|
+
cred = credential.Credential(
|
|
147
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
148
|
+
)
|
|
149
|
+
http_profile = HttpProfile(
|
|
150
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
151
|
+
reqMethod="POST",
|
|
152
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
153
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
154
|
+
)
|
|
155
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
156
|
+
if g_param[OptionsDefine.Language]:
|
|
157
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
158
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
159
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
160
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
161
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
162
|
+
model = models.DescribeDBInstanceNodePropertyRequest()
|
|
163
|
+
model.from_json_string(json.dumps(args))
|
|
164
|
+
start_time = time.time()
|
|
165
|
+
while True:
|
|
166
|
+
rsp = client.DescribeDBInstanceNodeProperty(model)
|
|
167
|
+
result = rsp.to_json_string()
|
|
168
|
+
try:
|
|
169
|
+
json_obj = json.loads(result)
|
|
170
|
+
except TypeError as e:
|
|
171
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
172
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
173
|
+
break
|
|
174
|
+
cur_time = time.time()
|
|
175
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
176
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
177
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
178
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
179
|
+
else:
|
|
180
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
181
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
182
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
183
|
+
|
|
184
|
+
|
|
20
185
|
def doDescribeDBInstanceDeal(args, parsed_globals):
|
|
21
186
|
g_param = parse_global_arg(parsed_globals)
|
|
22
187
|
|
|
@@ -27,7 +192,890 @@ def doDescribeDBInstanceDeal(args, parsed_globals):
|
|
|
27
192
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
28
193
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
29
194
|
)
|
|
30
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
195
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
196
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
197
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
198
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
199
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
200
|
+
else:
|
|
201
|
+
cred = credential.Credential(
|
|
202
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
203
|
+
)
|
|
204
|
+
http_profile = HttpProfile(
|
|
205
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
206
|
+
reqMethod="POST",
|
|
207
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
208
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
209
|
+
)
|
|
210
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
211
|
+
if g_param[OptionsDefine.Language]:
|
|
212
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
213
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
214
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
215
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
216
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
217
|
+
model = models.DescribeDBInstanceDealRequest()
|
|
218
|
+
model.from_json_string(json.dumps(args))
|
|
219
|
+
start_time = time.time()
|
|
220
|
+
while True:
|
|
221
|
+
rsp = client.DescribeDBInstanceDeal(model)
|
|
222
|
+
result = rsp.to_json_string()
|
|
223
|
+
try:
|
|
224
|
+
json_obj = json.loads(result)
|
|
225
|
+
except TypeError as e:
|
|
226
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
227
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
228
|
+
break
|
|
229
|
+
cur_time = time.time()
|
|
230
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
231
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
232
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
233
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
234
|
+
else:
|
|
235
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
236
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
237
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def doDescribeCurrentOp(args, parsed_globals):
|
|
241
|
+
g_param = parse_global_arg(parsed_globals)
|
|
242
|
+
|
|
243
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
244
|
+
cred = credential.CVMRoleCredential()
|
|
245
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
246
|
+
cred = credential.STSAssumeRoleCredential(
|
|
247
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
248
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
249
|
+
)
|
|
250
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
251
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
252
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
253
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
254
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
255
|
+
else:
|
|
256
|
+
cred = credential.Credential(
|
|
257
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
258
|
+
)
|
|
259
|
+
http_profile = HttpProfile(
|
|
260
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
261
|
+
reqMethod="POST",
|
|
262
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
263
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
264
|
+
)
|
|
265
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
266
|
+
if g_param[OptionsDefine.Language]:
|
|
267
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
268
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
269
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
270
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
271
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
272
|
+
model = models.DescribeCurrentOpRequest()
|
|
273
|
+
model.from_json_string(json.dumps(args))
|
|
274
|
+
start_time = time.time()
|
|
275
|
+
while True:
|
|
276
|
+
rsp = client.DescribeCurrentOp(model)
|
|
277
|
+
result = rsp.to_json_string()
|
|
278
|
+
try:
|
|
279
|
+
json_obj = json.loads(result)
|
|
280
|
+
except TypeError as e:
|
|
281
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
282
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
283
|
+
break
|
|
284
|
+
cur_time = time.time()
|
|
285
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
286
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
287
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
288
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
289
|
+
else:
|
|
290
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
291
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
292
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def doDescribeDBBackups(args, parsed_globals):
|
|
296
|
+
g_param = parse_global_arg(parsed_globals)
|
|
297
|
+
|
|
298
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
299
|
+
cred = credential.CVMRoleCredential()
|
|
300
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
301
|
+
cred = credential.STSAssumeRoleCredential(
|
|
302
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
303
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
304
|
+
)
|
|
305
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
306
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
307
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
308
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
309
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
310
|
+
else:
|
|
311
|
+
cred = credential.Credential(
|
|
312
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
313
|
+
)
|
|
314
|
+
http_profile = HttpProfile(
|
|
315
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
316
|
+
reqMethod="POST",
|
|
317
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
318
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
319
|
+
)
|
|
320
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
321
|
+
if g_param[OptionsDefine.Language]:
|
|
322
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
323
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
324
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
325
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
326
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
327
|
+
model = models.DescribeDBBackupsRequest()
|
|
328
|
+
model.from_json_string(json.dumps(args))
|
|
329
|
+
start_time = time.time()
|
|
330
|
+
while True:
|
|
331
|
+
rsp = client.DescribeDBBackups(model)
|
|
332
|
+
result = rsp.to_json_string()
|
|
333
|
+
try:
|
|
334
|
+
json_obj = json.loads(result)
|
|
335
|
+
except TypeError as e:
|
|
336
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
337
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
338
|
+
break
|
|
339
|
+
cur_time = time.time()
|
|
340
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
341
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
342
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
343
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
344
|
+
else:
|
|
345
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
346
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
347
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
def doDescribeClientConnections(args, parsed_globals):
|
|
351
|
+
g_param = parse_global_arg(parsed_globals)
|
|
352
|
+
|
|
353
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
354
|
+
cred = credential.CVMRoleCredential()
|
|
355
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
356
|
+
cred = credential.STSAssumeRoleCredential(
|
|
357
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
358
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
359
|
+
)
|
|
360
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
361
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
362
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
363
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
364
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
365
|
+
else:
|
|
366
|
+
cred = credential.Credential(
|
|
367
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
368
|
+
)
|
|
369
|
+
http_profile = HttpProfile(
|
|
370
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
371
|
+
reqMethod="POST",
|
|
372
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
373
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
374
|
+
)
|
|
375
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
376
|
+
if g_param[OptionsDefine.Language]:
|
|
377
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
378
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
379
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
380
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
381
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
382
|
+
model = models.DescribeClientConnectionsRequest()
|
|
383
|
+
model.from_json_string(json.dumps(args))
|
|
384
|
+
start_time = time.time()
|
|
385
|
+
while True:
|
|
386
|
+
rsp = client.DescribeClientConnections(model)
|
|
387
|
+
result = rsp.to_json_string()
|
|
388
|
+
try:
|
|
389
|
+
json_obj = json.loads(result)
|
|
390
|
+
except TypeError as e:
|
|
391
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
392
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
393
|
+
break
|
|
394
|
+
cur_time = time.time()
|
|
395
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
396
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
397
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
398
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
399
|
+
else:
|
|
400
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
401
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
402
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
def doResetDBInstancePassword(args, parsed_globals):
|
|
406
|
+
g_param = parse_global_arg(parsed_globals)
|
|
407
|
+
|
|
408
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
409
|
+
cred = credential.CVMRoleCredential()
|
|
410
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
411
|
+
cred = credential.STSAssumeRoleCredential(
|
|
412
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
413
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
414
|
+
)
|
|
415
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
416
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
417
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
418
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
419
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
420
|
+
else:
|
|
421
|
+
cred = credential.Credential(
|
|
422
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
423
|
+
)
|
|
424
|
+
http_profile = HttpProfile(
|
|
425
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
426
|
+
reqMethod="POST",
|
|
427
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
428
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
429
|
+
)
|
|
430
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
431
|
+
if g_param[OptionsDefine.Language]:
|
|
432
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
433
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
434
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
435
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
436
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
437
|
+
model = models.ResetDBInstancePasswordRequest()
|
|
438
|
+
model.from_json_string(json.dumps(args))
|
|
439
|
+
start_time = time.time()
|
|
440
|
+
while True:
|
|
441
|
+
rsp = client.ResetDBInstancePassword(model)
|
|
442
|
+
result = rsp.to_json_string()
|
|
443
|
+
try:
|
|
444
|
+
json_obj = json.loads(result)
|
|
445
|
+
except TypeError as e:
|
|
446
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
447
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
448
|
+
break
|
|
449
|
+
cur_time = time.time()
|
|
450
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
451
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
452
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
453
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
454
|
+
else:
|
|
455
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
456
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
457
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def doDescribeSecurityGroup(args, parsed_globals):
|
|
461
|
+
g_param = parse_global_arg(parsed_globals)
|
|
462
|
+
|
|
463
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
464
|
+
cred = credential.CVMRoleCredential()
|
|
465
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
466
|
+
cred = credential.STSAssumeRoleCredential(
|
|
467
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
468
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
469
|
+
)
|
|
470
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
471
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
472
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
473
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
474
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
475
|
+
else:
|
|
476
|
+
cred = credential.Credential(
|
|
477
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
478
|
+
)
|
|
479
|
+
http_profile = HttpProfile(
|
|
480
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
481
|
+
reqMethod="POST",
|
|
482
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
483
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
484
|
+
)
|
|
485
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
486
|
+
if g_param[OptionsDefine.Language]:
|
|
487
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
488
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
489
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
490
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
491
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
492
|
+
model = models.DescribeSecurityGroupRequest()
|
|
493
|
+
model.from_json_string(json.dumps(args))
|
|
494
|
+
start_time = time.time()
|
|
495
|
+
while True:
|
|
496
|
+
rsp = client.DescribeSecurityGroup(model)
|
|
497
|
+
result = rsp.to_json_string()
|
|
498
|
+
try:
|
|
499
|
+
json_obj = json.loads(result)
|
|
500
|
+
except TypeError as e:
|
|
501
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
502
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
503
|
+
break
|
|
504
|
+
cur_time = time.time()
|
|
505
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
506
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
507
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
508
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
509
|
+
else:
|
|
510
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
511
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
512
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
def doSetAccountUserPrivilege(args, parsed_globals):
|
|
516
|
+
g_param = parse_global_arg(parsed_globals)
|
|
517
|
+
|
|
518
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
519
|
+
cred = credential.CVMRoleCredential()
|
|
520
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
521
|
+
cred = credential.STSAssumeRoleCredential(
|
|
522
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
523
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
524
|
+
)
|
|
525
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
526
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
527
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
528
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
529
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
530
|
+
else:
|
|
531
|
+
cred = credential.Credential(
|
|
532
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
533
|
+
)
|
|
534
|
+
http_profile = HttpProfile(
|
|
535
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
536
|
+
reqMethod="POST",
|
|
537
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
538
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
539
|
+
)
|
|
540
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
541
|
+
if g_param[OptionsDefine.Language]:
|
|
542
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
543
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
544
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
545
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
546
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
547
|
+
model = models.SetAccountUserPrivilegeRequest()
|
|
548
|
+
model.from_json_string(json.dumps(args))
|
|
549
|
+
start_time = time.time()
|
|
550
|
+
while True:
|
|
551
|
+
rsp = client.SetAccountUserPrivilege(model)
|
|
552
|
+
result = rsp.to_json_string()
|
|
553
|
+
try:
|
|
554
|
+
json_obj = json.loads(result)
|
|
555
|
+
except TypeError as e:
|
|
556
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
557
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
558
|
+
break
|
|
559
|
+
cur_time = time.time()
|
|
560
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
561
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
562
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
563
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
564
|
+
else:
|
|
565
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
566
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
567
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
def doFlushInstanceRouterConfig(args, parsed_globals):
|
|
571
|
+
g_param = parse_global_arg(parsed_globals)
|
|
572
|
+
|
|
573
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
574
|
+
cred = credential.CVMRoleCredential()
|
|
575
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
576
|
+
cred = credential.STSAssumeRoleCredential(
|
|
577
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
578
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
579
|
+
)
|
|
580
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
581
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
582
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
583
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
584
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
585
|
+
else:
|
|
586
|
+
cred = credential.Credential(
|
|
587
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
588
|
+
)
|
|
589
|
+
http_profile = HttpProfile(
|
|
590
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
591
|
+
reqMethod="POST",
|
|
592
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
593
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
594
|
+
)
|
|
595
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
596
|
+
if g_param[OptionsDefine.Language]:
|
|
597
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
598
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
599
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
600
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
601
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
602
|
+
model = models.FlushInstanceRouterConfigRequest()
|
|
603
|
+
model.from_json_string(json.dumps(args))
|
|
604
|
+
start_time = time.time()
|
|
605
|
+
while True:
|
|
606
|
+
rsp = client.FlushInstanceRouterConfig(model)
|
|
607
|
+
result = rsp.to_json_string()
|
|
608
|
+
try:
|
|
609
|
+
json_obj = json.loads(result)
|
|
610
|
+
except TypeError as e:
|
|
611
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
612
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
613
|
+
break
|
|
614
|
+
cur_time = time.time()
|
|
615
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
616
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
617
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
618
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
619
|
+
else:
|
|
620
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
621
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
622
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
def doDescribeDBInstanceNamespace(args, parsed_globals):
|
|
626
|
+
g_param = parse_global_arg(parsed_globals)
|
|
627
|
+
|
|
628
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
629
|
+
cred = credential.CVMRoleCredential()
|
|
630
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
631
|
+
cred = credential.STSAssumeRoleCredential(
|
|
632
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
633
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
634
|
+
)
|
|
635
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
636
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
637
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
638
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
639
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
640
|
+
else:
|
|
641
|
+
cred = credential.Credential(
|
|
642
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
643
|
+
)
|
|
644
|
+
http_profile = HttpProfile(
|
|
645
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
646
|
+
reqMethod="POST",
|
|
647
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
648
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
649
|
+
)
|
|
650
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
651
|
+
if g_param[OptionsDefine.Language]:
|
|
652
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
653
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
654
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
655
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
656
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
657
|
+
model = models.DescribeDBInstanceNamespaceRequest()
|
|
658
|
+
model.from_json_string(json.dumps(args))
|
|
659
|
+
start_time = time.time()
|
|
660
|
+
while True:
|
|
661
|
+
rsp = client.DescribeDBInstanceNamespace(model)
|
|
662
|
+
result = rsp.to_json_string()
|
|
663
|
+
try:
|
|
664
|
+
json_obj = json.loads(result)
|
|
665
|
+
except TypeError as e:
|
|
666
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
667
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
668
|
+
break
|
|
669
|
+
cur_time = time.time()
|
|
670
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
671
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
672
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
673
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
674
|
+
else:
|
|
675
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
676
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
677
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
def doDeleteLogDownloadTask(args, parsed_globals):
|
|
681
|
+
g_param = parse_global_arg(parsed_globals)
|
|
682
|
+
|
|
683
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
684
|
+
cred = credential.CVMRoleCredential()
|
|
685
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
686
|
+
cred = credential.STSAssumeRoleCredential(
|
|
687
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
688
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
689
|
+
)
|
|
690
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
691
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
692
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
693
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
694
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
695
|
+
else:
|
|
696
|
+
cred = credential.Credential(
|
|
697
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
698
|
+
)
|
|
699
|
+
http_profile = HttpProfile(
|
|
700
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
701
|
+
reqMethod="POST",
|
|
702
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
703
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
704
|
+
)
|
|
705
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
706
|
+
if g_param[OptionsDefine.Language]:
|
|
707
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
708
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
709
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
710
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
711
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
712
|
+
model = models.DeleteLogDownloadTaskRequest()
|
|
713
|
+
model.from_json_string(json.dumps(args))
|
|
714
|
+
start_time = time.time()
|
|
715
|
+
while True:
|
|
716
|
+
rsp = client.DeleteLogDownloadTask(model)
|
|
717
|
+
result = rsp.to_json_string()
|
|
718
|
+
try:
|
|
719
|
+
json_obj = json.loads(result)
|
|
720
|
+
except TypeError as e:
|
|
721
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
722
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
723
|
+
break
|
|
724
|
+
cur_time = time.time()
|
|
725
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
726
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
727
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
728
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
729
|
+
else:
|
|
730
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
731
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
732
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
def doDescribeDetailedSlowLogs(args, parsed_globals):
|
|
736
|
+
g_param = parse_global_arg(parsed_globals)
|
|
737
|
+
|
|
738
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
739
|
+
cred = credential.CVMRoleCredential()
|
|
740
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
741
|
+
cred = credential.STSAssumeRoleCredential(
|
|
742
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
743
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
744
|
+
)
|
|
745
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
746
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
747
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
748
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
749
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
750
|
+
else:
|
|
751
|
+
cred = credential.Credential(
|
|
752
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
753
|
+
)
|
|
754
|
+
http_profile = HttpProfile(
|
|
755
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
756
|
+
reqMethod="POST",
|
|
757
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
758
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
759
|
+
)
|
|
760
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
761
|
+
if g_param[OptionsDefine.Language]:
|
|
762
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
763
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
764
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
765
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
766
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
767
|
+
model = models.DescribeDetailedSlowLogsRequest()
|
|
768
|
+
model.from_json_string(json.dumps(args))
|
|
769
|
+
start_time = time.time()
|
|
770
|
+
while True:
|
|
771
|
+
rsp = client.DescribeDetailedSlowLogs(model)
|
|
772
|
+
result = rsp.to_json_string()
|
|
773
|
+
try:
|
|
774
|
+
json_obj = json.loads(result)
|
|
775
|
+
except TypeError as e:
|
|
776
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
777
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
778
|
+
break
|
|
779
|
+
cur_time = time.time()
|
|
780
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
781
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
782
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
783
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
784
|
+
else:
|
|
785
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
786
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
787
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
def doInstanceEnableSSL(args, parsed_globals):
|
|
791
|
+
g_param = parse_global_arg(parsed_globals)
|
|
792
|
+
|
|
793
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
794
|
+
cred = credential.CVMRoleCredential()
|
|
795
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
796
|
+
cred = credential.STSAssumeRoleCredential(
|
|
797
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
798
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
799
|
+
)
|
|
800
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
801
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
802
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
803
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
804
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
805
|
+
else:
|
|
806
|
+
cred = credential.Credential(
|
|
807
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
808
|
+
)
|
|
809
|
+
http_profile = HttpProfile(
|
|
810
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
811
|
+
reqMethod="POST",
|
|
812
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
813
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
814
|
+
)
|
|
815
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
816
|
+
if g_param[OptionsDefine.Language]:
|
|
817
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
818
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
819
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
820
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
821
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
822
|
+
model = models.InstanceEnableSSLRequest()
|
|
823
|
+
model.from_json_string(json.dumps(args))
|
|
824
|
+
start_time = time.time()
|
|
825
|
+
while True:
|
|
826
|
+
rsp = client.InstanceEnableSSL(model)
|
|
827
|
+
result = rsp.to_json_string()
|
|
828
|
+
try:
|
|
829
|
+
json_obj = json.loads(result)
|
|
830
|
+
except TypeError as e:
|
|
831
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
832
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
833
|
+
break
|
|
834
|
+
cur_time = time.time()
|
|
835
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
836
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
837
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
838
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
839
|
+
else:
|
|
840
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
841
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
842
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
def doInquirePriceModifyDBInstanceSpec(args, parsed_globals):
|
|
846
|
+
g_param = parse_global_arg(parsed_globals)
|
|
847
|
+
|
|
848
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
849
|
+
cred = credential.CVMRoleCredential()
|
|
850
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
851
|
+
cred = credential.STSAssumeRoleCredential(
|
|
852
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
853
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
854
|
+
)
|
|
855
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
856
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
857
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
858
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
859
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
860
|
+
else:
|
|
861
|
+
cred = credential.Credential(
|
|
862
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
863
|
+
)
|
|
864
|
+
http_profile = HttpProfile(
|
|
865
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
866
|
+
reqMethod="POST",
|
|
867
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
868
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
869
|
+
)
|
|
870
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
871
|
+
if g_param[OptionsDefine.Language]:
|
|
872
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
873
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
874
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
875
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
876
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
877
|
+
model = models.InquirePriceModifyDBInstanceSpecRequest()
|
|
878
|
+
model.from_json_string(json.dumps(args))
|
|
879
|
+
start_time = time.time()
|
|
880
|
+
while True:
|
|
881
|
+
rsp = client.InquirePriceModifyDBInstanceSpec(model)
|
|
882
|
+
result = rsp.to_json_string()
|
|
883
|
+
try:
|
|
884
|
+
json_obj = json.loads(result)
|
|
885
|
+
except TypeError as e:
|
|
886
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
887
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
888
|
+
break
|
|
889
|
+
cur_time = time.time()
|
|
890
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
891
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
892
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
893
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
894
|
+
else:
|
|
895
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
896
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
897
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
def doDescribeLogDownloadTasks(args, parsed_globals):
|
|
901
|
+
g_param = parse_global_arg(parsed_globals)
|
|
902
|
+
|
|
903
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
904
|
+
cred = credential.CVMRoleCredential()
|
|
905
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
906
|
+
cred = credential.STSAssumeRoleCredential(
|
|
907
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
908
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
909
|
+
)
|
|
910
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
911
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
912
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
913
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
914
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
915
|
+
else:
|
|
916
|
+
cred = credential.Credential(
|
|
917
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
918
|
+
)
|
|
919
|
+
http_profile = HttpProfile(
|
|
920
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
921
|
+
reqMethod="POST",
|
|
922
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
923
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
924
|
+
)
|
|
925
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
926
|
+
if g_param[OptionsDefine.Language]:
|
|
927
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
928
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
929
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
930
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
931
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
932
|
+
model = models.DescribeLogDownloadTasksRequest()
|
|
933
|
+
model.from_json_string(json.dumps(args))
|
|
934
|
+
start_time = time.time()
|
|
935
|
+
while True:
|
|
936
|
+
rsp = client.DescribeLogDownloadTasks(model)
|
|
937
|
+
result = rsp.to_json_string()
|
|
938
|
+
try:
|
|
939
|
+
json_obj = json.loads(result)
|
|
940
|
+
except TypeError as e:
|
|
941
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
942
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
943
|
+
break
|
|
944
|
+
cur_time = time.time()
|
|
945
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
946
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
947
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
948
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
949
|
+
else:
|
|
950
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
951
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
952
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
def doDescribeBackupRules(args, parsed_globals):
|
|
956
|
+
g_param = parse_global_arg(parsed_globals)
|
|
957
|
+
|
|
958
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
959
|
+
cred = credential.CVMRoleCredential()
|
|
960
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
961
|
+
cred = credential.STSAssumeRoleCredential(
|
|
962
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
963
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
964
|
+
)
|
|
965
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
966
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
967
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
968
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
969
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
970
|
+
else:
|
|
971
|
+
cred = credential.Credential(
|
|
972
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
973
|
+
)
|
|
974
|
+
http_profile = HttpProfile(
|
|
975
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
976
|
+
reqMethod="POST",
|
|
977
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
978
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
979
|
+
)
|
|
980
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
981
|
+
if g_param[OptionsDefine.Language]:
|
|
982
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
983
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
984
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
985
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
986
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
987
|
+
model = models.DescribeBackupRulesRequest()
|
|
988
|
+
model.from_json_string(json.dumps(args))
|
|
989
|
+
start_time = time.time()
|
|
990
|
+
while True:
|
|
991
|
+
rsp = client.DescribeBackupRules(model)
|
|
992
|
+
result = rsp.to_json_string()
|
|
993
|
+
try:
|
|
994
|
+
json_obj = json.loads(result)
|
|
995
|
+
except TypeError as e:
|
|
996
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
997
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
998
|
+
break
|
|
999
|
+
cur_time = time.time()
|
|
1000
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1001
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1002
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1003
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1004
|
+
else:
|
|
1005
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1006
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1007
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
def doRenameInstance(args, parsed_globals):
|
|
1011
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1012
|
+
|
|
1013
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1014
|
+
cred = credential.CVMRoleCredential()
|
|
1015
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1016
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1017
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1018
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1019
|
+
)
|
|
1020
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1021
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1022
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1023
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1024
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1025
|
+
else:
|
|
1026
|
+
cred = credential.Credential(
|
|
1027
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1028
|
+
)
|
|
1029
|
+
http_profile = HttpProfile(
|
|
1030
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1031
|
+
reqMethod="POST",
|
|
1032
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1033
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1034
|
+
)
|
|
1035
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1036
|
+
if g_param[OptionsDefine.Language]:
|
|
1037
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1038
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1039
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1040
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1041
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1042
|
+
model = models.RenameInstanceRequest()
|
|
1043
|
+
model.from_json_string(json.dumps(args))
|
|
1044
|
+
start_time = time.time()
|
|
1045
|
+
while True:
|
|
1046
|
+
rsp = client.RenameInstance(model)
|
|
1047
|
+
result = rsp.to_json_string()
|
|
1048
|
+
try:
|
|
1049
|
+
json_obj = json.loads(result)
|
|
1050
|
+
except TypeError as e:
|
|
1051
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1052
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1053
|
+
break
|
|
1054
|
+
cur_time = time.time()
|
|
1055
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1056
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1057
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1058
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1059
|
+
else:
|
|
1060
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1061
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1062
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
def doDescribeAsyncRequestInfo(args, parsed_globals):
|
|
1066
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1067
|
+
|
|
1068
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1069
|
+
cred = credential.CVMRoleCredential()
|
|
1070
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1071
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1072
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1073
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1074
|
+
)
|
|
1075
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1076
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1077
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1078
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
31
1079
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
32
1080
|
else:
|
|
33
1081
|
cred = credential.Credential(
|
|
@@ -39,18 +1087,18 @@ def doDescribeDBInstanceDeal(args, parsed_globals):
|
|
|
39
1087
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
40
1088
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
41
1089
|
)
|
|
42
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1090
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
43
1091
|
if g_param[OptionsDefine.Language]:
|
|
44
1092
|
profile.language = g_param[OptionsDefine.Language]
|
|
45
1093
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
46
1094
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
47
1095
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
48
1096
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
49
|
-
model = models.
|
|
1097
|
+
model = models.DescribeAsyncRequestInfoRequest()
|
|
50
1098
|
model.from_json_string(json.dumps(args))
|
|
51
1099
|
start_time = time.time()
|
|
52
1100
|
while True:
|
|
53
|
-
rsp = client.
|
|
1101
|
+
rsp = client.DescribeAsyncRequestInfo(model)
|
|
54
1102
|
result = rsp.to_json_string()
|
|
55
1103
|
try:
|
|
56
1104
|
json_obj = json.loads(result)
|
|
@@ -69,7 +1117,7 @@ def doDescribeDBInstanceDeal(args, parsed_globals):
|
|
|
69
1117
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
70
1118
|
|
|
71
1119
|
|
|
72
|
-
def
|
|
1120
|
+
def doCreateAccountUser(args, parsed_globals):
|
|
73
1121
|
g_param = parse_global_arg(parsed_globals)
|
|
74
1122
|
|
|
75
1123
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -79,7 +1127,10 @@ def doDescribeDBInstanceNamespace(args, parsed_globals):
|
|
|
79
1127
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
80
1128
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
81
1129
|
)
|
|
82
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1130
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1131
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1132
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1133
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
83
1134
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
84
1135
|
else:
|
|
85
1136
|
cred = credential.Credential(
|
|
@@ -91,18 +1142,18 @@ def doDescribeDBInstanceNamespace(args, parsed_globals):
|
|
|
91
1142
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
92
1143
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
93
1144
|
)
|
|
94
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1145
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
95
1146
|
if g_param[OptionsDefine.Language]:
|
|
96
1147
|
profile.language = g_param[OptionsDefine.Language]
|
|
97
1148
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
98
1149
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
99
1150
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
100
1151
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
101
|
-
model = models.
|
|
1152
|
+
model = models.CreateAccountUserRequest()
|
|
102
1153
|
model.from_json_string(json.dumps(args))
|
|
103
1154
|
start_time = time.time()
|
|
104
1155
|
while True:
|
|
105
|
-
rsp = client.
|
|
1156
|
+
rsp = client.CreateAccountUser(model)
|
|
106
1157
|
result = rsp.to_json_string()
|
|
107
1158
|
try:
|
|
108
1159
|
json_obj = json.loads(result)
|
|
@@ -121,7 +1172,7 @@ def doDescribeDBInstanceNamespace(args, parsed_globals):
|
|
|
121
1172
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
122
1173
|
|
|
123
1174
|
|
|
124
|
-
def
|
|
1175
|
+
def doCreateDBInstanceHour(args, parsed_globals):
|
|
125
1176
|
g_param = parse_global_arg(parsed_globals)
|
|
126
1177
|
|
|
127
1178
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -131,7 +1182,10 @@ def doDescribeClientConnections(args, parsed_globals):
|
|
|
131
1182
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
132
1183
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
133
1184
|
)
|
|
134
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1185
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1186
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1187
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1188
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
135
1189
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
136
1190
|
else:
|
|
137
1191
|
cred = credential.Credential(
|
|
@@ -143,18 +1197,18 @@ def doDescribeClientConnections(args, parsed_globals):
|
|
|
143
1197
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
144
1198
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
145
1199
|
)
|
|
146
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1200
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
147
1201
|
if g_param[OptionsDefine.Language]:
|
|
148
1202
|
profile.language = g_param[OptionsDefine.Language]
|
|
149
1203
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
150
1204
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
151
1205
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
152
1206
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
153
|
-
model = models.
|
|
1207
|
+
model = models.CreateDBInstanceHourRequest()
|
|
154
1208
|
model.from_json_string(json.dumps(args))
|
|
155
1209
|
start_time = time.time()
|
|
156
1210
|
while True:
|
|
157
|
-
rsp = client.
|
|
1211
|
+
rsp = client.CreateDBInstanceHour(model)
|
|
158
1212
|
result = rsp.to_json_string()
|
|
159
1213
|
try:
|
|
160
1214
|
json_obj = json.loads(result)
|
|
@@ -173,7 +1227,7 @@ def doDescribeClientConnections(args, parsed_globals):
|
|
|
173
1227
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
174
1228
|
|
|
175
1229
|
|
|
176
|
-
def
|
|
1230
|
+
def doIsolateDBInstance(args, parsed_globals):
|
|
177
1231
|
g_param = parse_global_arg(parsed_globals)
|
|
178
1232
|
|
|
179
1233
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -183,7 +1237,10 @@ def doResetDBInstancePassword(args, parsed_globals):
|
|
|
183
1237
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
184
1238
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
185
1239
|
)
|
|
186
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1240
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1241
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1242
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1243
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
187
1244
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
188
1245
|
else:
|
|
189
1246
|
cred = credential.Credential(
|
|
@@ -195,18 +1252,18 @@ def doResetDBInstancePassword(args, parsed_globals):
|
|
|
195
1252
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
196
1253
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
197
1254
|
)
|
|
198
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1255
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
199
1256
|
if g_param[OptionsDefine.Language]:
|
|
200
1257
|
profile.language = g_param[OptionsDefine.Language]
|
|
201
1258
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
202
1259
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
203
1260
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
204
1261
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
205
|
-
model = models.
|
|
1262
|
+
model = models.IsolateDBInstanceRequest()
|
|
206
1263
|
model.from_json_string(json.dumps(args))
|
|
207
1264
|
start_time = time.time()
|
|
208
1265
|
while True:
|
|
209
|
-
rsp = client.
|
|
1266
|
+
rsp = client.IsolateDBInstance(model)
|
|
210
1267
|
result = rsp.to_json_string()
|
|
211
1268
|
try:
|
|
212
1269
|
json_obj = json.loads(result)
|
|
@@ -225,7 +1282,7 @@ def doResetDBInstancePassword(args, parsed_globals):
|
|
|
225
1282
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
226
1283
|
|
|
227
1284
|
|
|
228
|
-
def
|
|
1285
|
+
def doKillOps(args, parsed_globals):
|
|
229
1286
|
g_param = parse_global_arg(parsed_globals)
|
|
230
1287
|
|
|
231
1288
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -235,7 +1292,10 @@ def doDescribeSecurityGroup(args, parsed_globals):
|
|
|
235
1292
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
236
1293
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
237
1294
|
)
|
|
238
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1295
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1296
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1297
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1298
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
239
1299
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
240
1300
|
else:
|
|
241
1301
|
cred = credential.Credential(
|
|
@@ -247,18 +1307,18 @@ def doDescribeSecurityGroup(args, parsed_globals):
|
|
|
247
1307
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
248
1308
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
249
1309
|
)
|
|
250
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1310
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
251
1311
|
if g_param[OptionsDefine.Language]:
|
|
252
1312
|
profile.language = g_param[OptionsDefine.Language]
|
|
253
1313
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
254
1314
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
255
1315
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
256
1316
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
257
|
-
model = models.
|
|
1317
|
+
model = models.KillOpsRequest()
|
|
258
1318
|
model.from_json_string(json.dumps(args))
|
|
259
1319
|
start_time = time.time()
|
|
260
1320
|
while True:
|
|
261
|
-
rsp = client.
|
|
1321
|
+
rsp = client.KillOps(model)
|
|
262
1322
|
result = rsp.to_json_string()
|
|
263
1323
|
try:
|
|
264
1324
|
json_obj = json.loads(result)
|
|
@@ -277,7 +1337,7 @@ def doDescribeSecurityGroup(args, parsed_globals):
|
|
|
277
1337
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
278
1338
|
|
|
279
1339
|
|
|
280
|
-
def
|
|
1340
|
+
def doCreateBackupDownloadTask(args, parsed_globals):
|
|
281
1341
|
g_param = parse_global_arg(parsed_globals)
|
|
282
1342
|
|
|
283
1343
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -287,7 +1347,10 @@ def doFlushInstanceRouterConfig(args, parsed_globals):
|
|
|
287
1347
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
288
1348
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
289
1349
|
)
|
|
290
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1350
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1351
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1352
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1353
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
291
1354
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
292
1355
|
else:
|
|
293
1356
|
cred = credential.Credential(
|
|
@@ -299,18 +1362,18 @@ def doFlushInstanceRouterConfig(args, parsed_globals):
|
|
|
299
1362
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
300
1363
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
301
1364
|
)
|
|
302
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1365
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
303
1366
|
if g_param[OptionsDefine.Language]:
|
|
304
1367
|
profile.language = g_param[OptionsDefine.Language]
|
|
305
1368
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
306
1369
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
307
1370
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
308
1371
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
309
|
-
model = models.
|
|
1372
|
+
model = models.CreateBackupDownloadTaskRequest()
|
|
310
1373
|
model.from_json_string(json.dumps(args))
|
|
311
1374
|
start_time = time.time()
|
|
312
1375
|
while True:
|
|
313
|
-
rsp = client.
|
|
1376
|
+
rsp = client.CreateBackupDownloadTask(model)
|
|
314
1377
|
result = rsp.to_json_string()
|
|
315
1378
|
try:
|
|
316
1379
|
json_obj = json.loads(result)
|
|
@@ -329,7 +1392,7 @@ def doFlushInstanceRouterConfig(args, parsed_globals):
|
|
|
329
1392
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
330
1393
|
|
|
331
1394
|
|
|
332
|
-
def
|
|
1395
|
+
def doCreateBackupDBInstance(args, parsed_globals):
|
|
333
1396
|
g_param = parse_global_arg(parsed_globals)
|
|
334
1397
|
|
|
335
1398
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -339,7 +1402,10 @@ def doDescribeDBBackups(args, parsed_globals):
|
|
|
339
1402
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
340
1403
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
341
1404
|
)
|
|
342
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1405
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1406
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1407
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1408
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
343
1409
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
344
1410
|
else:
|
|
345
1411
|
cred = credential.Credential(
|
|
@@ -351,18 +1417,18 @@ def doDescribeDBBackups(args, parsed_globals):
|
|
|
351
1417
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
352
1418
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
353
1419
|
)
|
|
354
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1420
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
355
1421
|
if g_param[OptionsDefine.Language]:
|
|
356
1422
|
profile.language = g_param[OptionsDefine.Language]
|
|
357
1423
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
358
1424
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
359
1425
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
360
1426
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
361
|
-
model = models.
|
|
1427
|
+
model = models.CreateBackupDBInstanceRequest()
|
|
362
1428
|
model.from_json_string(json.dumps(args))
|
|
363
1429
|
start_time = time.time()
|
|
364
1430
|
while True:
|
|
365
|
-
rsp = client.
|
|
1431
|
+
rsp = client.CreateBackupDBInstance(model)
|
|
366
1432
|
result = rsp.to_json_string()
|
|
367
1433
|
try:
|
|
368
1434
|
json_obj = json.loads(result)
|
|
@@ -381,7 +1447,7 @@ def doDescribeDBBackups(args, parsed_globals):
|
|
|
381
1447
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
382
1448
|
|
|
383
1449
|
|
|
384
|
-
def
|
|
1450
|
+
def doDescribeDBInstances(args, parsed_globals):
|
|
385
1451
|
g_param = parse_global_arg(parsed_globals)
|
|
386
1452
|
|
|
387
1453
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -391,7 +1457,10 @@ def doIsolateDBInstance(args, parsed_globals):
|
|
|
391
1457
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
392
1458
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
393
1459
|
)
|
|
394
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1460
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1461
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1462
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1463
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
395
1464
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
396
1465
|
else:
|
|
397
1466
|
cred = credential.Credential(
|
|
@@ -403,18 +1472,18 @@ def doIsolateDBInstance(args, parsed_globals):
|
|
|
403
1472
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
404
1473
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
405
1474
|
)
|
|
406
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1475
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
407
1476
|
if g_param[OptionsDefine.Language]:
|
|
408
1477
|
profile.language = g_param[OptionsDefine.Language]
|
|
409
1478
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
410
1479
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
411
1480
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
412
1481
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
413
|
-
model = models.
|
|
1482
|
+
model = models.DescribeDBInstancesRequest()
|
|
414
1483
|
model.from_json_string(json.dumps(args))
|
|
415
1484
|
start_time = time.time()
|
|
416
1485
|
while True:
|
|
417
|
-
rsp = client.
|
|
1486
|
+
rsp = client.DescribeDBInstances(model)
|
|
418
1487
|
result = rsp.to_json_string()
|
|
419
1488
|
try:
|
|
420
1489
|
json_obj = json.loads(result)
|
|
@@ -433,7 +1502,7 @@ def doIsolateDBInstance(args, parsed_globals):
|
|
|
433
1502
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
434
1503
|
|
|
435
1504
|
|
|
436
|
-
def
|
|
1505
|
+
def doOfflineIsolatedDBInstance(args, parsed_globals):
|
|
437
1506
|
g_param = parse_global_arg(parsed_globals)
|
|
438
1507
|
|
|
439
1508
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -443,7 +1512,10 @@ def doInquirePriceModifyDBInstanceSpec(args, parsed_globals):
|
|
|
443
1512
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
444
1513
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
445
1514
|
)
|
|
446
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1515
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1516
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1517
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1518
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
447
1519
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
448
1520
|
else:
|
|
449
1521
|
cred = credential.Credential(
|
|
@@ -455,18 +1527,18 @@ def doInquirePriceModifyDBInstanceSpec(args, parsed_globals):
|
|
|
455
1527
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
456
1528
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
457
1529
|
)
|
|
458
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1530
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
459
1531
|
if g_param[OptionsDefine.Language]:
|
|
460
1532
|
profile.language = g_param[OptionsDefine.Language]
|
|
461
1533
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
462
1534
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
463
1535
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
464
1536
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
465
|
-
model = models.
|
|
1537
|
+
model = models.OfflineIsolatedDBInstanceRequest()
|
|
466
1538
|
model.from_json_string(json.dumps(args))
|
|
467
1539
|
start_time = time.time()
|
|
468
1540
|
while True:
|
|
469
|
-
rsp = client.
|
|
1541
|
+
rsp = client.OfflineIsolatedDBInstance(model)
|
|
470
1542
|
result = rsp.to_json_string()
|
|
471
1543
|
try:
|
|
472
1544
|
json_obj = json.loads(result)
|
|
@@ -485,7 +1557,7 @@ def doInquirePriceModifyDBInstanceSpec(args, parsed_globals):
|
|
|
485
1557
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
486
1558
|
|
|
487
1559
|
|
|
488
|
-
def
|
|
1560
|
+
def doDescribeSlowLogPatterns(args, parsed_globals):
|
|
489
1561
|
g_param = parse_global_arg(parsed_globals)
|
|
490
1562
|
|
|
491
1563
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -495,7 +1567,10 @@ def doDescribeAsyncRequestInfo(args, parsed_globals):
|
|
|
495
1567
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
496
1568
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
497
1569
|
)
|
|
498
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1570
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1571
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1572
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1573
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
499
1574
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
500
1575
|
else:
|
|
501
1576
|
cred = credential.Credential(
|
|
@@ -507,18 +1582,18 @@ def doDescribeAsyncRequestInfo(args, parsed_globals):
|
|
|
507
1582
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
508
1583
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
509
1584
|
)
|
|
510
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1585
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
511
1586
|
if g_param[OptionsDefine.Language]:
|
|
512
1587
|
profile.language = g_param[OptionsDefine.Language]
|
|
513
1588
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
514
1589
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
515
1590
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
516
1591
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
517
|
-
model = models.
|
|
1592
|
+
model = models.DescribeSlowLogPatternsRequest()
|
|
518
1593
|
model.from_json_string(json.dumps(args))
|
|
519
1594
|
start_time = time.time()
|
|
520
1595
|
while True:
|
|
521
|
-
rsp = client.
|
|
1596
|
+
rsp = client.DescribeSlowLogPatterns(model)
|
|
522
1597
|
result = rsp.to_json_string()
|
|
523
1598
|
try:
|
|
524
1599
|
json_obj = json.loads(result)
|
|
@@ -537,7 +1612,7 @@ def doDescribeAsyncRequestInfo(args, parsed_globals):
|
|
|
537
1612
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
538
1613
|
|
|
539
1614
|
|
|
540
|
-
def
|
|
1615
|
+
def doDescribeSlowLogs(args, parsed_globals):
|
|
541
1616
|
g_param = parse_global_arg(parsed_globals)
|
|
542
1617
|
|
|
543
1618
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -547,7 +1622,10 @@ def doModifyDBInstanceNetworkAddress(args, parsed_globals):
|
|
|
547
1622
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
548
1623
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
549
1624
|
)
|
|
550
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1625
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1626
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1627
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1628
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
551
1629
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
552
1630
|
else:
|
|
553
1631
|
cred = credential.Credential(
|
|
@@ -559,18 +1637,18 @@ def doModifyDBInstanceNetworkAddress(args, parsed_globals):
|
|
|
559
1637
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
560
1638
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
561
1639
|
)
|
|
562
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1640
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
563
1641
|
if g_param[OptionsDefine.Language]:
|
|
564
1642
|
profile.language = g_param[OptionsDefine.Language]
|
|
565
1643
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
566
1644
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
567
1645
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
568
1646
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
569
|
-
model = models.
|
|
1647
|
+
model = models.DescribeSlowLogsRequest()
|
|
570
1648
|
model.from_json_string(json.dumps(args))
|
|
571
1649
|
start_time = time.time()
|
|
572
1650
|
while True:
|
|
573
|
-
rsp = client.
|
|
1651
|
+
rsp = client.DescribeSlowLogs(model)
|
|
574
1652
|
result = rsp.to_json_string()
|
|
575
1653
|
try:
|
|
576
1654
|
json_obj = json.loads(result)
|
|
@@ -589,7 +1667,7 @@ def doModifyDBInstanceNetworkAddress(args, parsed_globals):
|
|
|
589
1667
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
590
1668
|
|
|
591
1669
|
|
|
592
|
-
def
|
|
1670
|
+
def doDescribeMongodbLogs(args, parsed_globals):
|
|
593
1671
|
g_param = parse_global_arg(parsed_globals)
|
|
594
1672
|
|
|
595
1673
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -599,7 +1677,10 @@ def doCreateDBInstanceHour(args, parsed_globals):
|
|
|
599
1677
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
600
1678
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
601
1679
|
)
|
|
602
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1680
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1681
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1682
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1683
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
603
1684
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
604
1685
|
else:
|
|
605
1686
|
cred = credential.Credential(
|
|
@@ -611,18 +1692,18 @@ def doCreateDBInstanceHour(args, parsed_globals):
|
|
|
611
1692
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
612
1693
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
613
1694
|
)
|
|
614
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1695
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
615
1696
|
if g_param[OptionsDefine.Language]:
|
|
616
1697
|
profile.language = g_param[OptionsDefine.Language]
|
|
617
1698
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
618
1699
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
619
1700
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
620
1701
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
621
|
-
model = models.
|
|
1702
|
+
model = models.DescribeMongodbLogsRequest()
|
|
622
1703
|
model.from_json_string(json.dumps(args))
|
|
623
1704
|
start_time = time.time()
|
|
624
1705
|
while True:
|
|
625
|
-
rsp = client.
|
|
1706
|
+
rsp = client.DescribeMongodbLogs(model)
|
|
626
1707
|
result = rsp.to_json_string()
|
|
627
1708
|
try:
|
|
628
1709
|
json_obj = json.loads(result)
|
|
@@ -641,7 +1722,7 @@ def doCreateDBInstanceHour(args, parsed_globals):
|
|
|
641
1722
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
642
1723
|
|
|
643
1724
|
|
|
644
|
-
def
|
|
1725
|
+
def doCreateDBInstance(args, parsed_globals):
|
|
645
1726
|
g_param = parse_global_arg(parsed_globals)
|
|
646
1727
|
|
|
647
1728
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -651,7 +1732,10 @@ def doCreateBackupDownloadTask(args, parsed_globals):
|
|
|
651
1732
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
652
1733
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
653
1734
|
)
|
|
654
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1735
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1736
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1737
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1738
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
655
1739
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
656
1740
|
else:
|
|
657
1741
|
cred = credential.Credential(
|
|
@@ -663,18 +1747,18 @@ def doCreateBackupDownloadTask(args, parsed_globals):
|
|
|
663
1747
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
664
1748
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
665
1749
|
)
|
|
666
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1750
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
667
1751
|
if g_param[OptionsDefine.Language]:
|
|
668
1752
|
profile.language = g_param[OptionsDefine.Language]
|
|
669
1753
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
670
1754
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
671
1755
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
672
1756
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
673
|
-
model = models.
|
|
1757
|
+
model = models.CreateDBInstanceRequest()
|
|
674
1758
|
model.from_json_string(json.dumps(args))
|
|
675
1759
|
start_time = time.time()
|
|
676
1760
|
while True:
|
|
677
|
-
rsp = client.
|
|
1761
|
+
rsp = client.CreateDBInstance(model)
|
|
678
1762
|
result = rsp.to_json_string()
|
|
679
1763
|
try:
|
|
680
1764
|
json_obj = json.loads(result)
|
|
@@ -693,7 +1777,7 @@ def doCreateBackupDownloadTask(args, parsed_globals):
|
|
|
693
1777
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
694
1778
|
|
|
695
1779
|
|
|
696
|
-
def
|
|
1780
|
+
def doModifyDBInstanceSpec(args, parsed_globals):
|
|
697
1781
|
g_param = parse_global_arg(parsed_globals)
|
|
698
1782
|
|
|
699
1783
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -703,7 +1787,10 @@ def doDescribeDBInstances(args, parsed_globals):
|
|
|
703
1787
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
704
1788
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
705
1789
|
)
|
|
706
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1790
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1791
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1792
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1793
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
707
1794
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
708
1795
|
else:
|
|
709
1796
|
cred = credential.Credential(
|
|
@@ -715,18 +1802,18 @@ def doDescribeDBInstances(args, parsed_globals):
|
|
|
715
1802
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
716
1803
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
717
1804
|
)
|
|
718
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1805
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
719
1806
|
if g_param[OptionsDefine.Language]:
|
|
720
1807
|
profile.language = g_param[OptionsDefine.Language]
|
|
721
1808
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
722
1809
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
723
1810
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
724
1811
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
725
|
-
model = models.
|
|
1812
|
+
model = models.ModifyDBInstanceSpecRequest()
|
|
726
1813
|
model.from_json_string(json.dumps(args))
|
|
727
1814
|
start_time = time.time()
|
|
728
1815
|
while True:
|
|
729
|
-
rsp = client.
|
|
1816
|
+
rsp = client.ModifyDBInstanceSpec(model)
|
|
730
1817
|
result = rsp.to_json_string()
|
|
731
1818
|
try:
|
|
732
1819
|
json_obj = json.loads(result)
|
|
@@ -745,7 +1832,7 @@ def doDescribeDBInstances(args, parsed_globals):
|
|
|
745
1832
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
746
1833
|
|
|
747
1834
|
|
|
748
|
-
def
|
|
1835
|
+
def doDescribeInstanceParams(args, parsed_globals):
|
|
749
1836
|
g_param = parse_global_arg(parsed_globals)
|
|
750
1837
|
|
|
751
1838
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -755,7 +1842,10 @@ def doOfflineIsolatedDBInstance(args, parsed_globals):
|
|
|
755
1842
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
756
1843
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
757
1844
|
)
|
|
758
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1845
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1846
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1847
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1848
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
759
1849
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
760
1850
|
else:
|
|
761
1851
|
cred = credential.Credential(
|
|
@@ -767,18 +1857,18 @@ def doOfflineIsolatedDBInstance(args, parsed_globals):
|
|
|
767
1857
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
768
1858
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
769
1859
|
)
|
|
770
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1860
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
771
1861
|
if g_param[OptionsDefine.Language]:
|
|
772
1862
|
profile.language = g_param[OptionsDefine.Language]
|
|
773
1863
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
774
1864
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
775
1865
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
776
1866
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
777
|
-
model = models.
|
|
1867
|
+
model = models.DescribeInstanceParamsRequest()
|
|
778
1868
|
model.from_json_string(json.dumps(args))
|
|
779
1869
|
start_time = time.time()
|
|
780
1870
|
while True:
|
|
781
|
-
rsp = client.
|
|
1871
|
+
rsp = client.DescribeInstanceParams(model)
|
|
782
1872
|
result = rsp.to_json_string()
|
|
783
1873
|
try:
|
|
784
1874
|
json_obj = json.loads(result)
|
|
@@ -797,7 +1887,7 @@ def doOfflineIsolatedDBInstance(args, parsed_globals):
|
|
|
797
1887
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
798
1888
|
|
|
799
1889
|
|
|
800
|
-
def
|
|
1890
|
+
def doUpgradeDBInstanceKernelVersion(args, parsed_globals):
|
|
801
1891
|
g_param = parse_global_arg(parsed_globals)
|
|
802
1892
|
|
|
803
1893
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -807,7 +1897,10 @@ def doDescribeSlowLogPatterns(args, parsed_globals):
|
|
|
807
1897
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
808
1898
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
809
1899
|
)
|
|
810
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1900
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1901
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1902
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1903
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
811
1904
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
812
1905
|
else:
|
|
813
1906
|
cred = credential.Credential(
|
|
@@ -819,18 +1912,18 @@ def doDescribeSlowLogPatterns(args, parsed_globals):
|
|
|
819
1912
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
820
1913
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
821
1914
|
)
|
|
822
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1915
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
823
1916
|
if g_param[OptionsDefine.Language]:
|
|
824
1917
|
profile.language = g_param[OptionsDefine.Language]
|
|
825
1918
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
826
1919
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
827
1920
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
828
1921
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
829
|
-
model = models.
|
|
1922
|
+
model = models.UpgradeDBInstanceKernelVersionRequest()
|
|
830
1923
|
model.from_json_string(json.dumps(args))
|
|
831
1924
|
start_time = time.time()
|
|
832
1925
|
while True:
|
|
833
|
-
rsp = client.
|
|
1926
|
+
rsp = client.UpgradeDBInstanceKernelVersion(model)
|
|
834
1927
|
result = rsp.to_json_string()
|
|
835
1928
|
try:
|
|
836
1929
|
json_obj = json.loads(result)
|
|
@@ -849,7 +1942,7 @@ def doDescribeSlowLogPatterns(args, parsed_globals):
|
|
|
849
1942
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
850
1943
|
|
|
851
1944
|
|
|
852
|
-
def
|
|
1945
|
+
def doDescribeSpecInfo(args, parsed_globals):
|
|
853
1946
|
g_param = parse_global_arg(parsed_globals)
|
|
854
1947
|
|
|
855
1948
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -859,7 +1952,10 @@ def doDescribeSlowLogs(args, parsed_globals):
|
|
|
859
1952
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
860
1953
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
861
1954
|
)
|
|
862
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
1955
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
1956
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
1957
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
1958
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
863
1959
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
864
1960
|
else:
|
|
865
1961
|
cred = credential.Credential(
|
|
@@ -871,18 +1967,18 @@ def doDescribeSlowLogs(args, parsed_globals):
|
|
|
871
1967
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
872
1968
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
873
1969
|
)
|
|
874
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
1970
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
875
1971
|
if g_param[OptionsDefine.Language]:
|
|
876
1972
|
profile.language = g_param[OptionsDefine.Language]
|
|
877
1973
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
878
1974
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
879
1975
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
880
1976
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
881
|
-
model = models.
|
|
1977
|
+
model = models.DescribeSpecInfoRequest()
|
|
882
1978
|
model.from_json_string(json.dumps(args))
|
|
883
1979
|
start_time = time.time()
|
|
884
1980
|
while True:
|
|
885
|
-
rsp = client.
|
|
1981
|
+
rsp = client.DescribeSpecInfo(model)
|
|
886
1982
|
result = rsp.to_json_string()
|
|
887
1983
|
try:
|
|
888
1984
|
json_obj = json.loads(result)
|
|
@@ -901,7 +1997,7 @@ def doDescribeSlowLogs(args, parsed_globals):
|
|
|
901
1997
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
902
1998
|
|
|
903
1999
|
|
|
904
|
-
def
|
|
2000
|
+
def doDescribeBackupDownloadTask(args, parsed_globals):
|
|
905
2001
|
g_param = parse_global_arg(parsed_globals)
|
|
906
2002
|
|
|
907
2003
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -911,7 +2007,10 @@ def doCreateDBInstance(args, parsed_globals):
|
|
|
911
2007
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
912
2008
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
913
2009
|
)
|
|
914
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2010
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2011
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2012
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2013
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
915
2014
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
916
2015
|
else:
|
|
917
2016
|
cred = credential.Credential(
|
|
@@ -923,18 +2022,18 @@ def doCreateDBInstance(args, parsed_globals):
|
|
|
923
2022
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
924
2023
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
925
2024
|
)
|
|
926
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2025
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
927
2026
|
if g_param[OptionsDefine.Language]:
|
|
928
2027
|
profile.language = g_param[OptionsDefine.Language]
|
|
929
2028
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
930
2029
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
931
2030
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
932
2031
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
933
|
-
model = models.
|
|
2032
|
+
model = models.DescribeBackupDownloadTaskRequest()
|
|
934
2033
|
model.from_json_string(json.dumps(args))
|
|
935
2034
|
start_time = time.time()
|
|
936
2035
|
while True:
|
|
937
|
-
rsp = client.
|
|
2036
|
+
rsp = client.DescribeBackupDownloadTask(model)
|
|
938
2037
|
result = rsp.to_json_string()
|
|
939
2038
|
try:
|
|
940
2039
|
json_obj = json.loads(result)
|
|
@@ -953,7 +2052,7 @@ def doCreateDBInstance(args, parsed_globals):
|
|
|
953
2052
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
954
2053
|
|
|
955
2054
|
|
|
956
|
-
def
|
|
2055
|
+
def doInquirePriceCreateDBInstances(args, parsed_globals):
|
|
957
2056
|
g_param = parse_global_arg(parsed_globals)
|
|
958
2057
|
|
|
959
2058
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -963,7 +2062,10 @@ def doModifyDBInstanceSpec(args, parsed_globals):
|
|
|
963
2062
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
964
2063
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
965
2064
|
)
|
|
966
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2065
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2066
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2067
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2068
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
967
2069
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
968
2070
|
else:
|
|
969
2071
|
cred = credential.Credential(
|
|
@@ -975,18 +2077,18 @@ def doModifyDBInstanceSpec(args, parsed_globals):
|
|
|
975
2077
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
976
2078
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
977
2079
|
)
|
|
978
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2080
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
979
2081
|
if g_param[OptionsDefine.Language]:
|
|
980
2082
|
profile.language = g_param[OptionsDefine.Language]
|
|
981
2083
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
982
2084
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
983
2085
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
984
2086
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
985
|
-
model = models.
|
|
2087
|
+
model = models.InquirePriceCreateDBInstancesRequest()
|
|
986
2088
|
model.from_json_string(json.dumps(args))
|
|
987
2089
|
start_time = time.time()
|
|
988
2090
|
while True:
|
|
989
|
-
rsp = client.
|
|
2091
|
+
rsp = client.InquirePriceCreateDBInstances(model)
|
|
990
2092
|
result = rsp.to_json_string()
|
|
991
2093
|
try:
|
|
992
2094
|
json_obj = json.loads(result)
|
|
@@ -1005,7 +2107,7 @@ def doModifyDBInstanceSpec(args, parsed_globals):
|
|
|
1005
2107
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1006
2108
|
|
|
1007
2109
|
|
|
1008
|
-
def
|
|
2110
|
+
def doDescribeInstanceSSL(args, parsed_globals):
|
|
1009
2111
|
g_param = parse_global_arg(parsed_globals)
|
|
1010
2112
|
|
|
1011
2113
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1015,7 +2117,10 @@ def doDescribeInstanceParams(args, parsed_globals):
|
|
|
1015
2117
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1016
2118
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1017
2119
|
)
|
|
1018
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2120
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2121
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2122
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2123
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1019
2124
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1020
2125
|
else:
|
|
1021
2126
|
cred = credential.Credential(
|
|
@@ -1027,18 +2132,18 @@ def doDescribeInstanceParams(args, parsed_globals):
|
|
|
1027
2132
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1028
2133
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1029
2134
|
)
|
|
1030
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2135
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1031
2136
|
if g_param[OptionsDefine.Language]:
|
|
1032
2137
|
profile.language = g_param[OptionsDefine.Language]
|
|
1033
2138
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1034
2139
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1035
2140
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1036
2141
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1037
|
-
model = models.
|
|
2142
|
+
model = models.DescribeInstanceSSLRequest()
|
|
1038
2143
|
model.from_json_string(json.dumps(args))
|
|
1039
2144
|
start_time = time.time()
|
|
1040
2145
|
while True:
|
|
1041
|
-
rsp = client.
|
|
2146
|
+
rsp = client.DescribeInstanceSSL(model)
|
|
1042
2147
|
result = rsp.to_json_string()
|
|
1043
2148
|
try:
|
|
1044
2149
|
json_obj = json.loads(result)
|
|
@@ -1057,7 +2162,7 @@ def doDescribeInstanceParams(args, parsed_globals):
|
|
|
1057
2162
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1058
2163
|
|
|
1059
2164
|
|
|
1060
|
-
def
|
|
2165
|
+
def doSetDBInstanceDeletionProtection(args, parsed_globals):
|
|
1061
2166
|
g_param = parse_global_arg(parsed_globals)
|
|
1062
2167
|
|
|
1063
2168
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1067,7 +2172,10 @@ def doDescribeSpecInfo(args, parsed_globals):
|
|
|
1067
2172
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1068
2173
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1069
2174
|
)
|
|
1070
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2175
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2176
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2177
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2178
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1071
2179
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1072
2180
|
else:
|
|
1073
2181
|
cred = credential.Credential(
|
|
@@ -1079,18 +2187,18 @@ def doDescribeSpecInfo(args, parsed_globals):
|
|
|
1079
2187
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1080
2188
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1081
2189
|
)
|
|
1082
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2190
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1083
2191
|
if g_param[OptionsDefine.Language]:
|
|
1084
2192
|
profile.language = g_param[OptionsDefine.Language]
|
|
1085
2193
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1086
2194
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1087
2195
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1088
2196
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1089
|
-
model = models.
|
|
2197
|
+
model = models.SetDBInstanceDeletionProtectionRequest()
|
|
1090
2198
|
model.from_json_string(json.dumps(args))
|
|
1091
2199
|
start_time = time.time()
|
|
1092
2200
|
while True:
|
|
1093
|
-
rsp = client.
|
|
2201
|
+
rsp = client.SetDBInstanceDeletionProtection(model)
|
|
1094
2202
|
result = rsp.to_json_string()
|
|
1095
2203
|
try:
|
|
1096
2204
|
json_obj = json.loads(result)
|
|
@@ -1109,7 +2217,7 @@ def doDescribeSpecInfo(args, parsed_globals):
|
|
|
1109
2217
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1110
2218
|
|
|
1111
2219
|
|
|
1112
|
-
def
|
|
2220
|
+
def doAssignProject(args, parsed_globals):
|
|
1113
2221
|
g_param = parse_global_arg(parsed_globals)
|
|
1114
2222
|
|
|
1115
2223
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1119,7 +2227,10 @@ def doDescribeBackupDownloadTask(args, parsed_globals):
|
|
|
1119
2227
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1120
2228
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1121
2229
|
)
|
|
1122
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2230
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2231
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2232
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2233
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1123
2234
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1124
2235
|
else:
|
|
1125
2236
|
cred = credential.Credential(
|
|
@@ -1131,18 +2242,18 @@ def doDescribeBackupDownloadTask(args, parsed_globals):
|
|
|
1131
2242
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1132
2243
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1133
2244
|
)
|
|
1134
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2245
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1135
2246
|
if g_param[OptionsDefine.Language]:
|
|
1136
2247
|
profile.language = g_param[OptionsDefine.Language]
|
|
1137
2248
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1138
2249
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1139
2250
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1140
2251
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1141
|
-
model = models.
|
|
2252
|
+
model = models.AssignProjectRequest()
|
|
1142
2253
|
model.from_json_string(json.dumps(args))
|
|
1143
2254
|
start_time = time.time()
|
|
1144
2255
|
while True:
|
|
1145
|
-
rsp = client.
|
|
2256
|
+
rsp = client.AssignProject(model)
|
|
1146
2257
|
result = rsp.to_json_string()
|
|
1147
2258
|
try:
|
|
1148
2259
|
json_obj = json.loads(result)
|
|
@@ -1161,7 +2272,7 @@ def doDescribeBackupDownloadTask(args, parsed_globals):
|
|
|
1161
2272
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1162
2273
|
|
|
1163
2274
|
|
|
1164
|
-
def
|
|
2275
|
+
def doUpgradeDbInstanceVersion(args, parsed_globals):
|
|
1165
2276
|
g_param = parse_global_arg(parsed_globals)
|
|
1166
2277
|
|
|
1167
2278
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1171,7 +2282,10 @@ def doInquirePriceCreateDBInstances(args, parsed_globals):
|
|
|
1171
2282
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1172
2283
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1173
2284
|
)
|
|
1174
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2285
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2286
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2287
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2288
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1175
2289
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1176
2290
|
else:
|
|
1177
2291
|
cred = credential.Credential(
|
|
@@ -1183,18 +2297,18 @@ def doInquirePriceCreateDBInstances(args, parsed_globals):
|
|
|
1183
2297
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1184
2298
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1185
2299
|
)
|
|
1186
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2300
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1187
2301
|
if g_param[OptionsDefine.Language]:
|
|
1188
2302
|
profile.language = g_param[OptionsDefine.Language]
|
|
1189
2303
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1190
2304
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1191
2305
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1192
2306
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1193
|
-
model = models.
|
|
2307
|
+
model = models.UpgradeDbInstanceVersionRequest()
|
|
1194
2308
|
model.from_json_string(json.dumps(args))
|
|
1195
2309
|
start_time = time.time()
|
|
1196
2310
|
while True:
|
|
1197
|
-
rsp = client.
|
|
2311
|
+
rsp = client.UpgradeDbInstanceVersion(model)
|
|
1198
2312
|
result = rsp.to_json_string()
|
|
1199
2313
|
try:
|
|
1200
2314
|
json_obj = json.loads(result)
|
|
@@ -1213,7 +2327,7 @@ def doInquirePriceCreateDBInstances(args, parsed_globals):
|
|
|
1213
2327
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1214
2328
|
|
|
1215
2329
|
|
|
1216
|
-
def
|
|
2330
|
+
def doSetInstanceMaintenance(args, parsed_globals):
|
|
1217
2331
|
g_param = parse_global_arg(parsed_globals)
|
|
1218
2332
|
|
|
1219
2333
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1223,7 +2337,10 @@ def doAssignProject(args, parsed_globals):
|
|
|
1223
2337
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1224
2338
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1225
2339
|
)
|
|
1226
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2340
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2341
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2342
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2343
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1227
2344
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1228
2345
|
else:
|
|
1229
2346
|
cred = credential.Credential(
|
|
@@ -1235,18 +2352,18 @@ def doAssignProject(args, parsed_globals):
|
|
|
1235
2352
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1236
2353
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1237
2354
|
)
|
|
1238
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2355
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1239
2356
|
if g_param[OptionsDefine.Language]:
|
|
1240
2357
|
profile.language = g_param[OptionsDefine.Language]
|
|
1241
2358
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1242
2359
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1243
2360
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1244
2361
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1245
|
-
model = models.
|
|
2362
|
+
model = models.SetInstanceMaintenanceRequest()
|
|
1246
2363
|
model.from_json_string(json.dumps(args))
|
|
1247
2364
|
start_time = time.time()
|
|
1248
2365
|
while True:
|
|
1249
|
-
rsp = client.
|
|
2366
|
+
rsp = client.SetInstanceMaintenance(model)
|
|
1250
2367
|
result = rsp.to_json_string()
|
|
1251
2368
|
try:
|
|
1252
2369
|
json_obj = json.loads(result)
|
|
@@ -1265,7 +2382,7 @@ def doAssignProject(args, parsed_globals):
|
|
|
1265
2382
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1266
2383
|
|
|
1267
2384
|
|
|
1268
|
-
def
|
|
2385
|
+
def doModifyInstanceParams(args, parsed_globals):
|
|
1269
2386
|
g_param = parse_global_arg(parsed_globals)
|
|
1270
2387
|
|
|
1271
2388
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1275,7 +2392,10 @@ def doRenameInstance(args, parsed_globals):
|
|
|
1275
2392
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1276
2393
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1277
2394
|
)
|
|
1278
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2395
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2396
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2397
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2398
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1279
2399
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1280
2400
|
else:
|
|
1281
2401
|
cred = credential.Credential(
|
|
@@ -1287,18 +2407,18 @@ def doRenameInstance(args, parsed_globals):
|
|
|
1287
2407
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1288
2408
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1289
2409
|
)
|
|
1290
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2410
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1291
2411
|
if g_param[OptionsDefine.Language]:
|
|
1292
2412
|
profile.language = g_param[OptionsDefine.Language]
|
|
1293
2413
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1294
2414
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1295
2415
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1296
2416
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1297
|
-
model = models.
|
|
2417
|
+
model = models.ModifyInstanceParamsRequest()
|
|
1298
2418
|
model.from_json_string(json.dumps(args))
|
|
1299
2419
|
start_time = time.time()
|
|
1300
2420
|
while True:
|
|
1301
|
-
rsp = client.
|
|
2421
|
+
rsp = client.ModifyInstanceParams(model)
|
|
1302
2422
|
result = rsp.to_json_string()
|
|
1303
2423
|
try:
|
|
1304
2424
|
json_obj = json.loads(result)
|
|
@@ -1327,7 +2447,10 @@ def doRenewDBInstances(args, parsed_globals):
|
|
|
1327
2447
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1328
2448
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1329
2449
|
)
|
|
1330
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2450
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2451
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2452
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2453
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1331
2454
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1332
2455
|
else:
|
|
1333
2456
|
cred = credential.Credential(
|
|
@@ -1339,7 +2462,7 @@ def doRenewDBInstances(args, parsed_globals):
|
|
|
1339
2462
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1340
2463
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1341
2464
|
)
|
|
1342
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2465
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1343
2466
|
if g_param[OptionsDefine.Language]:
|
|
1344
2467
|
profile.language = g_param[OptionsDefine.Language]
|
|
1345
2468
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
@@ -1369,7 +2492,7 @@ def doRenewDBInstances(args, parsed_globals):
|
|
|
1369
2492
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1370
2493
|
|
|
1371
2494
|
|
|
1372
|
-
def
|
|
2495
|
+
def doEnableTransparentDataEncryption(args, parsed_globals):
|
|
1373
2496
|
g_param = parse_global_arg(parsed_globals)
|
|
1374
2497
|
|
|
1375
2498
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1379,7 +2502,10 @@ def doCreateBackupDBInstance(args, parsed_globals):
|
|
|
1379
2502
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1380
2503
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1381
2504
|
)
|
|
1382
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2505
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2506
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2507
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2508
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1383
2509
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1384
2510
|
else:
|
|
1385
2511
|
cred = credential.Credential(
|
|
@@ -1391,18 +2517,73 @@ def doCreateBackupDBInstance(args, parsed_globals):
|
|
|
1391
2517
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1392
2518
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1393
2519
|
)
|
|
1394
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2520
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1395
2521
|
if g_param[OptionsDefine.Language]:
|
|
1396
2522
|
profile.language = g_param[OptionsDefine.Language]
|
|
1397
2523
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1398
2524
|
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1399
2525
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1400
2526
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1401
|
-
model = models.
|
|
2527
|
+
model = models.EnableTransparentDataEncryptionRequest()
|
|
1402
2528
|
model.from_json_string(json.dumps(args))
|
|
1403
2529
|
start_time = time.time()
|
|
1404
2530
|
while True:
|
|
1405
|
-
rsp = client.
|
|
2531
|
+
rsp = client.EnableTransparentDataEncryption(model)
|
|
2532
|
+
result = rsp.to_json_string()
|
|
2533
|
+
try:
|
|
2534
|
+
json_obj = json.loads(result)
|
|
2535
|
+
except TypeError as e:
|
|
2536
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2537
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2538
|
+
break
|
|
2539
|
+
cur_time = time.time()
|
|
2540
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2541
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2542
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2543
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2544
|
+
else:
|
|
2545
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2546
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2547
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2548
|
+
|
|
2549
|
+
|
|
2550
|
+
def doModifyDBInstanceNetworkAddress(args, parsed_globals):
|
|
2551
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2552
|
+
|
|
2553
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2554
|
+
cred = credential.CVMRoleCredential()
|
|
2555
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2556
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2557
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2558
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2559
|
+
)
|
|
2560
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2561
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2562
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2563
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
2564
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2565
|
+
else:
|
|
2566
|
+
cred = credential.Credential(
|
|
2567
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2568
|
+
)
|
|
2569
|
+
http_profile = HttpProfile(
|
|
2570
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2571
|
+
reqMethod="POST",
|
|
2572
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2573
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2574
|
+
)
|
|
2575
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
2576
|
+
if g_param[OptionsDefine.Language]:
|
|
2577
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2578
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2579
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2580
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2581
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2582
|
+
model = models.ModifyDBInstanceNetworkAddressRequest()
|
|
2583
|
+
model.from_json_string(json.dumps(args))
|
|
2584
|
+
start_time = time.time()
|
|
2585
|
+
while True:
|
|
2586
|
+
rsp = client.ModifyDBInstanceNetworkAddress(model)
|
|
1406
2587
|
result = rsp.to_json_string()
|
|
1407
2588
|
try:
|
|
1408
2589
|
json_obj = json.loads(result)
|
|
@@ -1431,7 +2612,10 @@ def doInquirePriceRenewDBInstances(args, parsed_globals):
|
|
|
1431
2612
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1432
2613
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1433
2614
|
)
|
|
1434
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2615
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2616
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2617
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2618
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1435
2619
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1436
2620
|
else:
|
|
1437
2621
|
cred = credential.Credential(
|
|
@@ -1443,7 +2627,7 @@ def doInquirePriceRenewDBInstances(args, parsed_globals):
|
|
|
1443
2627
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1444
2628
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1445
2629
|
)
|
|
1446
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2630
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1447
2631
|
if g_param[OptionsDefine.Language]:
|
|
1448
2632
|
profile.language = g_param[OptionsDefine.Language]
|
|
1449
2633
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
@@ -1473,6 +2657,61 @@ def doInquirePriceRenewDBInstances(args, parsed_globals):
|
|
|
1473
2657
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1474
2658
|
|
|
1475
2659
|
|
|
2660
|
+
def doDeleteAccountUser(args, parsed_globals):
|
|
2661
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2662
|
+
|
|
2663
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2664
|
+
cred = credential.CVMRoleCredential()
|
|
2665
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2666
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2667
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2668
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2669
|
+
)
|
|
2670
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2671
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2672
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2673
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
2674
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2675
|
+
else:
|
|
2676
|
+
cred = credential.Credential(
|
|
2677
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2678
|
+
)
|
|
2679
|
+
http_profile = HttpProfile(
|
|
2680
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2681
|
+
reqMethod="POST",
|
|
2682
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2683
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2684
|
+
)
|
|
2685
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
2686
|
+
if g_param[OptionsDefine.Language]:
|
|
2687
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2688
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2689
|
+
client = mod.MongodbClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2690
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2691
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2692
|
+
model = models.DeleteAccountUserRequest()
|
|
2693
|
+
model.from_json_string(json.dumps(args))
|
|
2694
|
+
start_time = time.time()
|
|
2695
|
+
while True:
|
|
2696
|
+
rsp = client.DeleteAccountUser(model)
|
|
2697
|
+
result = rsp.to_json_string()
|
|
2698
|
+
try:
|
|
2699
|
+
json_obj = json.loads(result)
|
|
2700
|
+
except TypeError as e:
|
|
2701
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2702
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2703
|
+
break
|
|
2704
|
+
cur_time = time.time()
|
|
2705
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2706
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2707
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2708
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2709
|
+
else:
|
|
2710
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2711
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2712
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2713
|
+
|
|
2714
|
+
|
|
1476
2715
|
def doModifyDBInstanceSecurityGroup(args, parsed_globals):
|
|
1477
2716
|
g_param = parse_global_arg(parsed_globals)
|
|
1478
2717
|
|
|
@@ -1483,7 +2722,10 @@ def doModifyDBInstanceSecurityGroup(args, parsed_globals):
|
|
|
1483
2722
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1484
2723
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1485
2724
|
)
|
|
1486
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2725
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2726
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2727
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2728
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1487
2729
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1488
2730
|
else:
|
|
1489
2731
|
cred = credential.Credential(
|
|
@@ -1495,7 +2737,7 @@ def doModifyDBInstanceSecurityGroup(args, parsed_globals):
|
|
|
1495
2737
|
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1496
2738
|
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1497
2739
|
)
|
|
1498
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="
|
|
2740
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
1499
2741
|
if g_param[OptionsDefine.Language]:
|
|
1500
2742
|
profile.language = g_param[OptionsDefine.Language]
|
|
1501
2743
|
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
@@ -1536,34 +2778,55 @@ MODELS_MAP = {
|
|
|
1536
2778
|
}
|
|
1537
2779
|
|
|
1538
2780
|
ACTION_MAP = {
|
|
2781
|
+
"TerminateDBInstances": doTerminateDBInstances,
|
|
2782
|
+
"CreateLogDownloadTask": doCreateLogDownloadTask,
|
|
2783
|
+
"DescribeDBInstanceNodeProperty": doDescribeDBInstanceNodeProperty,
|
|
1539
2784
|
"DescribeDBInstanceDeal": doDescribeDBInstanceDeal,
|
|
1540
|
-
"
|
|
2785
|
+
"DescribeCurrentOp": doDescribeCurrentOp,
|
|
2786
|
+
"DescribeDBBackups": doDescribeDBBackups,
|
|
1541
2787
|
"DescribeClientConnections": doDescribeClientConnections,
|
|
1542
2788
|
"ResetDBInstancePassword": doResetDBInstancePassword,
|
|
1543
2789
|
"DescribeSecurityGroup": doDescribeSecurityGroup,
|
|
2790
|
+
"SetAccountUserPrivilege": doSetAccountUserPrivilege,
|
|
1544
2791
|
"FlushInstanceRouterConfig": doFlushInstanceRouterConfig,
|
|
1545
|
-
"
|
|
1546
|
-
"
|
|
2792
|
+
"DescribeDBInstanceNamespace": doDescribeDBInstanceNamespace,
|
|
2793
|
+
"DeleteLogDownloadTask": doDeleteLogDownloadTask,
|
|
2794
|
+
"DescribeDetailedSlowLogs": doDescribeDetailedSlowLogs,
|
|
2795
|
+
"InstanceEnableSSL": doInstanceEnableSSL,
|
|
1547
2796
|
"InquirePriceModifyDBInstanceSpec": doInquirePriceModifyDBInstanceSpec,
|
|
2797
|
+
"DescribeLogDownloadTasks": doDescribeLogDownloadTasks,
|
|
2798
|
+
"DescribeBackupRules": doDescribeBackupRules,
|
|
2799
|
+
"RenameInstance": doRenameInstance,
|
|
1548
2800
|
"DescribeAsyncRequestInfo": doDescribeAsyncRequestInfo,
|
|
1549
|
-
"
|
|
2801
|
+
"CreateAccountUser": doCreateAccountUser,
|
|
1550
2802
|
"CreateDBInstanceHour": doCreateDBInstanceHour,
|
|
2803
|
+
"IsolateDBInstance": doIsolateDBInstance,
|
|
2804
|
+
"KillOps": doKillOps,
|
|
1551
2805
|
"CreateBackupDownloadTask": doCreateBackupDownloadTask,
|
|
2806
|
+
"CreateBackupDBInstance": doCreateBackupDBInstance,
|
|
1552
2807
|
"DescribeDBInstances": doDescribeDBInstances,
|
|
1553
2808
|
"OfflineIsolatedDBInstance": doOfflineIsolatedDBInstance,
|
|
1554
2809
|
"DescribeSlowLogPatterns": doDescribeSlowLogPatterns,
|
|
1555
2810
|
"DescribeSlowLogs": doDescribeSlowLogs,
|
|
2811
|
+
"DescribeMongodbLogs": doDescribeMongodbLogs,
|
|
1556
2812
|
"CreateDBInstance": doCreateDBInstance,
|
|
1557
2813
|
"ModifyDBInstanceSpec": doModifyDBInstanceSpec,
|
|
1558
2814
|
"DescribeInstanceParams": doDescribeInstanceParams,
|
|
2815
|
+
"UpgradeDBInstanceKernelVersion": doUpgradeDBInstanceKernelVersion,
|
|
1559
2816
|
"DescribeSpecInfo": doDescribeSpecInfo,
|
|
1560
2817
|
"DescribeBackupDownloadTask": doDescribeBackupDownloadTask,
|
|
1561
2818
|
"InquirePriceCreateDBInstances": doInquirePriceCreateDBInstances,
|
|
2819
|
+
"DescribeInstanceSSL": doDescribeInstanceSSL,
|
|
2820
|
+
"SetDBInstanceDeletionProtection": doSetDBInstanceDeletionProtection,
|
|
1562
2821
|
"AssignProject": doAssignProject,
|
|
1563
|
-
"
|
|
2822
|
+
"UpgradeDbInstanceVersion": doUpgradeDbInstanceVersion,
|
|
2823
|
+
"SetInstanceMaintenance": doSetInstanceMaintenance,
|
|
2824
|
+
"ModifyInstanceParams": doModifyInstanceParams,
|
|
1564
2825
|
"RenewDBInstances": doRenewDBInstances,
|
|
1565
|
-
"
|
|
2826
|
+
"EnableTransparentDataEncryption": doEnableTransparentDataEncryption,
|
|
2827
|
+
"ModifyDBInstanceNetworkAddress": doModifyDBInstanceNetworkAddress,
|
|
1566
2828
|
"InquirePriceRenewDBInstances": doInquirePriceRenewDBInstances,
|
|
2829
|
+
"DeleteAccountUser": doDeleteAccountUser,
|
|
1567
2830
|
"ModifyDBInstanceSecurityGroup": doModifyDBInstanceSecurityGroup,
|
|
1568
2831
|
|
|
1569
2832
|
}
|