tccli-intl-en 3.0.1237.1__py2.py3-none-any.whl → 3.0.1282.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/services/__init__.py +17 -1
- tccli/services/advisor/advisor_client.py +8 -2
- tccli/services/aiart/aiart_client.py +4 -1
- tccli/services/ams/ams_client.py +16 -4
- tccli/services/antiddos/antiddos_client.py +280 -70
- tccli/services/apigateway/apigateway_client.py +372 -93
- tccli/services/apm/apm_client.py +52 -13
- tccli/services/asr/asr_client.py +8 -2
- tccli/services/autoscaling/autoscaling_client.py +232 -58
- tccli/services/autoscaling/v20180419/api.json +1 -1
- tccli/services/batch/batch_client.py +112 -28
- tccli/services/bi/bi_client.py +1242 -4
- tccli/services/bi/v20220105/api.json +5340 -107
- tccli/services/bi/v20220105/examples.json +196 -1
- tccli/services/billing/billing_client.py +168 -42
- tccli/services/cam/cam_client.py +324 -81
- tccli/services/captcha/captcha_client.py +4 -1
- tccli/services/car/car_client.py +132 -33
- tccli/services/cbs/cbs_client.py +152 -38
- tccli/services/ccc/ccc_client.py +732 -98
- tccli/services/ccc/v20200210/api.json +1727 -196
- tccli/services/ccc/v20200210/examples.json +64 -0
- tccli/services/cdb/cdb_client.py +532 -133
- tccli/services/cdc/cdc_client.py +80 -20
- tccli/services/cdc/v20201214/api.json +2 -2
- tccli/services/cdc/v20201214/examples.json +4 -4
- tccli/services/cdn/cdn_client.py +176 -44
- tccli/services/cdwdoris/cdwdoris_client.py +308 -77
- tccli/services/cdwpg/cdwpg_client.py +96 -24
- 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 +64 -16
- tccli/services/cfs/cfs_client.py +156 -39
- tccli/services/cfw/cfw_client.py +264 -66
- tccli/services/chdfs/chdfs_client.py +116 -29
- tccli/services/ciam/ciam_client.py +64 -16
- tccli/services/ckafka/ckafka_client.py +575 -77
- tccli/services/ckafka/v20190819/api.json +2749 -1470
- tccli/services/ckafka/v20190819/examples.json +209 -155
- tccli/services/clb/clb_client.py +332 -83
- tccli/services/clb/v20180317/api.json +29 -14
- tccli/services/cloudaudit/cloudaudit_client.py +72 -18
- tccli/services/cls/cls_client.py +348 -87
- tccli/services/cmq/cmq_client.py +12 -801
- tccli/services/cmq/v20190304/api.json +173 -1367
- tccli/services/cmq/v20190304/examples.json +0 -120
- tccli/services/config/config_client.py +24 -6
- tccli/services/controlcenter/controlcenter_client.py +4 -1
- tccli/services/csip/csip_client.py +136 -34
- tccli/services/ctsdb/ctsdb_client.py +8 -2
- tccli/services/cvm/cvm_client.py +627 -110
- tccli/services/cvm/v20170312/api.json +750 -340
- tccli/services/cvm/v20170312/examples.json +105 -59
- tccli/services/cwp/cwp_client.py +1860 -465
- tccli/services/cynosdb/cynosdb_client.py +1749 -439
- tccli/services/cynosdb/v20190107/api.json +11763 -7697
- tccli/services/cynosdb/v20190107/examples.json +132 -4
- tccli/services/dataintegration/dataintegration_client.py +4 -1
- tccli/services/dayu/dayu_client.py +412 -103
- tccli/services/dbbrain/dbbrain_client.py +168 -42
- tccli/services/dc/dc_client.py +72 -18
- tccli/services/dcdb/dcdb_client.py +248 -62
- tccli/services/dlc/dlc_client.py +756 -111
- tccli/services/dlc/v20210125/api.json +637 -13
- tccli/services/dlc/v20210125/examples.json +48 -0
- tccli/services/dms/dms_client.py +8 -2
- tccli/services/dnspod/dnspod_client.py +353 -74
- tccli/services/dnspod/v20210323/api.json +196 -0
- tccli/services/dnspod/v20210323/examples.json +24 -0
- tccli/services/domain/domain_client.py +96 -24
- tccli/services/dts/dts_client.py +332 -83
- tccli/services/eb/eb_client.py +104 -26
- tccli/services/ecdn/ecdn_client.py +60 -15
- tccli/services/ecm/ecm_client.py +496 -124
- tccli/services/eiam/eiam_client.py +160 -40
- tccli/services/emr/emr_client.py +2784 -115
- tccli/services/emr/v20190103/api.json +14647 -4756
- tccli/services/emr/v20190103/examples.json +408 -40
- tccli/services/es/es_client.py +84 -21
- tccli/services/facefusion/facefusion_client.py +12 -3
- tccli/services/faceid/faceid_client.py +76 -19
- tccli/services/faceid/v20180301/api.json +79 -14
- tccli/services/faceid/v20180301/examples.json +3 -3
- tccli/services/gaap/gaap_client.py +352 -88
- tccli/services/gme/gme_client.py +40 -10
- tccli/services/gpm/gpm_client.py +72 -18
- tccli/services/gse/gse_client.py +88 -22
- tccli/services/gwlb/gwlb_client.py +72 -18
- tccli/services/iai/iai_client.py +116 -29
- tccli/services/iap/iap_client.py +24 -6
- tccli/services/ims/ims_client.py +4 -1
- tccli/services/intlpartnersmgt/intlpartnersmgt_client.py +168 -42
- tccli/services/intlpartnersmgt/v20220928/api.json +11 -11
- tccli/services/iotcloud/iotcloud_client.py +80 -20
- tccli/services/ip/ip_client.py +24 -6
- tccli/services/kms/kms_client.py +272 -68
- tccli/services/lcic/lcic_client.py +212 -53
- tccli/services/lighthouse/lighthouse_client.py +296 -74
- tccli/services/lighthouse/v20200324/api.json +14 -14
- tccli/services/lighthouse/v20200324/examples.json +5 -5
- tccli/services/live/live_client.py +480 -120
- tccli/services/lke/lke_client.py +360 -90
- tccli/services/lke/v20231130/api.json +182 -39
- tccli/services/lkeap/__init__.py +4 -0
- tccli/services/lkeap/lkeap_client.py +546 -0
- tccli/services/lkeap/v20240522/api.json +855 -0
- tccli/services/lkeap/v20240522/examples.json +72 -0
- tccli/services/mariadb/mariadb_client.py +200 -50
- tccli/services/mdc/mdc_client.py +72 -18
- tccli/services/mdl/mdl_client.py +132 -33
- tccli/services/mdl/v20200326/api.json +186 -12
- tccli/services/mdl/v20200326/examples.json +16 -16
- tccli/services/mdp/mdp_client.py +680 -70
- 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 +340 -29
- tccli/services/mongodb/v20190725/api.json +811 -226
- tccli/services/mongodb/v20190725/examples.json +54 -22
- tccli/services/monitor/monitor_client.py +864 -152
- tccli/services/monitor/v20180724/api.json +657 -8
- tccli/services/monitor/v20180724/examples.json +152 -4
- tccli/services/mps/mps_client.py +592 -92
- tccli/services/mps/v20190612/api.json +2931 -399
- tccli/services/mps/v20190612/examples.json +64 -14
- tccli/services/msp/msp_client.py +28 -7
- tccli/services/ocr/ocr_client.py +212 -45
- tccli/services/ocr/v20181119/api.json +872 -112
- tccli/services/ocr/v20181119/examples.json +12 -4
- tccli/services/omics/omics_client.py +80 -20
- tccli/services/organization/organization_client.py +464 -116
- tccli/services/postgres/postgres_client.py +364 -91
- tccli/services/postgres/v20170312/api.json +134 -109
- tccli/services/postgres/v20170312/examples.json +14 -14
- tccli/services/privatedns/privatedns_client.py +124 -31
- tccli/services/pts/pts_client.py +192 -48
- 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 +4 -1
- tccli/services/redis/redis_client.py +592 -106
- tccli/services/redis/v20180412/api.json +636 -240
- tccli/services/redis/v20180412/examples.json +98 -56
- tccli/services/region/region_client.py +12 -3
- tccli/services/rum/rum_client.py +240 -60
- tccli/services/scf/scf_client.py +168 -42
- tccli/services/ses/ses_client.py +116 -29
- tccli/services/sms/sms_client.py +72 -18
- tccli/services/sqlserver/sqlserver_client.py +3772 -387
- tccli/services/sqlserver/v20180328/api.json +9760 -3380
- tccli/services/sqlserver/v20180328/examples.json +478 -18
- tccli/services/ssl/ssl_client.py +152 -38
- tccli/services/ssm/ssm_client.py +96 -24
- tccli/services/sts/sts_client.py +20 -5
- tccli/services/tag/tag_client.py +120 -30
- tccli/services/tat/tat_client.py +76 -19
- tccli/services/tbaas/tbaas_client.py +16 -4
- tccli/services/tcaplusdb/tcaplusdb_client.py +208 -52
- tccli/services/tcaplusdb/v20190823/api.json +836 -760
- tccli/services/tcaplusdb/v20190823/examples.json +3 -3
- tccli/services/tchd/tchd_client.py +4 -1
- tccli/services/tcmpp/tcmpp_client.py +416 -104
- tccli/services/tcr/tcr_client.py +304 -76
- tccli/services/tcsas/tcsas_client.py +236 -59
- tccli/services/tcsas/v20250106/api.json +155 -79
- tccli/services/tcsas/v20250106/examples.json +3 -3
- tccli/services/tcss/tcss_client.py +1320 -330
- tccli/services/tdid/tdid_client.py +192 -48
- tccli/services/tdmq/tdmq_client.py +376 -94
- tccli/services/tem/tem_client.py +224 -56
- tccli/services/teo/teo_client.py +1127 -245
- tccli/services/teo/v20220901/api.json +382 -58
- tccli/services/teo/v20220901/examples.json +24 -0
- 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 +204 -51
- tccli/services/tke/tke_client.py +552 -138
- tccli/services/tms/tms_client.py +4 -1
- tccli/services/tmt/tmt_client.py +4 -1
- tccli/services/trabbit/trabbit_client.py +116 -29
- tccli/services/trro/trro_client.py +76 -19
- tccli/services/trtc/trtc_client.py +420 -55
- tccli/services/trtc/v20190722/api.json +685 -23
- tccli/services/trtc/v20190722/examples.json +39 -7
- tccli/services/tts/tts_client.py +4 -1
- tccli/services/vclm/vclm_client.py +8 -2
- tccli/services/vm/vm_client.py +16 -4
- tccli/services/vod/v20180717/examples.json +1 -1
- tccli/services/vod/vod_client.py +716 -179
- tccli/services/vpc/v20170312/api.json +970 -75
- tccli/services/vpc/v20170312/examples.json +106 -10
- tccli/services/vpc/vpc_client.py +1876 -361
- tccli/services/waf/v20180125/api.json +1372 -194
- tccli/services/waf/v20180125/examples.json +89 -1
- tccli/services/waf/waf_client.py +1051 -147
- tccli/services/wedata/v20250806/api.json +13644 -0
- tccli/services/wedata/v20250806/examples.json +621 -0
- tccli/services/wedata/wedata_client.py +5830 -1026
- tccli/services/yunjing/yunjing_client.py +284 -71
- {tccli_intl_en-3.0.1237.1.dist-info → tccli_intl_en-3.0.1282.1.dist-info}/METADATA +4 -7
- {tccli_intl_en-3.0.1237.1.dist-info → tccli_intl_en-3.0.1282.1.dist-info}/RECORD +214 -192
- {tccli_intl_en-3.0.1237.1.dist-info → tccli_intl_en-3.0.1282.1.dist-info}/WHEEL +1 -1
- {tccli_intl_en-3.0.1237.1.dist-info → tccli_intl_en-3.0.1282.1.dist-info}/entry_points.txt +0 -1
- {tccli_intl_en-3.0.1237.1.dist-info → tccli_intl_en-3.0.1282.1.dist-info}/LICENSE +0 -0
- {tccli_intl_en-3.0.1237.1.dist-info → tccli_intl_en-3.0.1282.1.dist-info}/top_level.txt +0 -0
tccli/services/emr/emr_client.py
CHANGED
|
@@ -27,7 +27,10 @@ def doModifyResourcesTags(args, parsed_globals):
|
|
|
27
27
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
28
28
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
29
29
|
)
|
|
30
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
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):
|
|
31
34
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
32
35
|
else:
|
|
33
36
|
cred = credential.Credential(
|
|
@@ -79,7 +82,10 @@ def doInquiryPriceUpdateInstance(args, parsed_globals):
|
|
|
79
82
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
80
83
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
81
84
|
)
|
|
82
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
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):
|
|
83
89
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
84
90
|
else:
|
|
85
91
|
cred = credential.Credential(
|
|
@@ -131,7 +137,10 @@ def doCreateCluster(args, parsed_globals):
|
|
|
131
137
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
132
138
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
133
139
|
)
|
|
134
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
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):
|
|
135
144
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
136
145
|
else:
|
|
137
146
|
cred = credential.Credential(
|
|
@@ -173,6 +182,61 @@ def doCreateCluster(args, parsed_globals):
|
|
|
173
182
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
174
183
|
|
|
175
184
|
|
|
185
|
+
def doDescribeServiceConfGroupInfos(args, parsed_globals):
|
|
186
|
+
g_param = parse_global_arg(parsed_globals)
|
|
187
|
+
|
|
188
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
189
|
+
cred = credential.CVMRoleCredential()
|
|
190
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
191
|
+
cred = credential.STSAssumeRoleCredential(
|
|
192
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
193
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
194
|
+
)
|
|
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="HmacSHA256")
|
|
211
|
+
if g_param[OptionsDefine.Language]:
|
|
212
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
213
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
214
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
215
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
216
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
217
|
+
model = models.DescribeServiceConfGroupInfosRequest()
|
|
218
|
+
model.from_json_string(json.dumps(args))
|
|
219
|
+
start_time = time.time()
|
|
220
|
+
while True:
|
|
221
|
+
rsp = client.DescribeServiceConfGroupInfos(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
|
+
|
|
176
240
|
def doInquiryPriceRenewInstance(args, parsed_globals):
|
|
177
241
|
g_param = parse_global_arg(parsed_globals)
|
|
178
242
|
|
|
@@ -183,7 +247,2375 @@ def doInquiryPriceRenewInstance(args, parsed_globals):
|
|
|
183
247
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
184
248
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
185
249
|
)
|
|
186
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
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="HmacSHA256")
|
|
266
|
+
if g_param[OptionsDefine.Language]:
|
|
267
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
268
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
269
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
270
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
271
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
272
|
+
model = models.InquiryPriceRenewInstanceRequest()
|
|
273
|
+
model.from_json_string(json.dumps(args))
|
|
274
|
+
start_time = time.time()
|
|
275
|
+
while True:
|
|
276
|
+
rsp = client.InquiryPriceRenewInstance(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 doDescribeGroupsSTD(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="HmacSHA256")
|
|
321
|
+
if g_param[OptionsDefine.Language]:
|
|
322
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
323
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
324
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
325
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
326
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
327
|
+
model = models.DescribeGroupsSTDRequest()
|
|
328
|
+
model.from_json_string(json.dumps(args))
|
|
329
|
+
start_time = time.time()
|
|
330
|
+
while True:
|
|
331
|
+
rsp = client.DescribeGroupsSTD(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 doDescribeYarnQueue(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="HmacSHA256")
|
|
376
|
+
if g_param[OptionsDefine.Language]:
|
|
377
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
378
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
379
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
380
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
381
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
382
|
+
model = models.DescribeYarnQueueRequest()
|
|
383
|
+
model.from_json_string(json.dumps(args))
|
|
384
|
+
start_time = time.time()
|
|
385
|
+
while True:
|
|
386
|
+
rsp = client.DescribeYarnQueue(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 doModifyYarnQueueV2(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="HmacSHA256")
|
|
431
|
+
if g_param[OptionsDefine.Language]:
|
|
432
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
433
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
434
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
435
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
436
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
437
|
+
model = models.ModifyYarnQueueV2Request()
|
|
438
|
+
model.from_json_string(json.dumps(args))
|
|
439
|
+
start_time = time.time()
|
|
440
|
+
while True:
|
|
441
|
+
rsp = client.ModifyYarnQueueV2(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 doDeployYarnConf(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="HmacSHA256")
|
|
486
|
+
if g_param[OptionsDefine.Language]:
|
|
487
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
488
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
489
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
490
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
491
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
492
|
+
model = models.DeployYarnConfRequest()
|
|
493
|
+
model.from_json_string(json.dumps(args))
|
|
494
|
+
start_time = time.time()
|
|
495
|
+
while True:
|
|
496
|
+
rsp = client.DeployYarnConf(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 doDescribeClusterFlowStatusDetail(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="HmacSHA256")
|
|
541
|
+
if g_param[OptionsDefine.Language]:
|
|
542
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
543
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
544
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
545
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
546
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
547
|
+
model = models.DescribeClusterFlowStatusDetailRequest()
|
|
548
|
+
model.from_json_string(json.dumps(args))
|
|
549
|
+
start_time = time.time()
|
|
550
|
+
while True:
|
|
551
|
+
rsp = client.DescribeClusterFlowStatusDetail(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 doInquiryPriceScaleOutInstance(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="HmacSHA256")
|
|
596
|
+
if g_param[OptionsDefine.Language]:
|
|
597
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
598
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
599
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
600
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
601
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
602
|
+
model = models.InquiryPriceScaleOutInstanceRequest()
|
|
603
|
+
model.from_json_string(json.dumps(args))
|
|
604
|
+
start_time = time.time()
|
|
605
|
+
while True:
|
|
606
|
+
rsp = client.InquiryPriceScaleOutInstance(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 doDescribeAutoScaleRecords(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="HmacSHA256")
|
|
651
|
+
if g_param[OptionsDefine.Language]:
|
|
652
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
653
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
654
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
655
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
656
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
657
|
+
model = models.DescribeAutoScaleRecordsRequest()
|
|
658
|
+
model.from_json_string(json.dumps(args))
|
|
659
|
+
start_time = time.time()
|
|
660
|
+
while True:
|
|
661
|
+
rsp = client.DescribeAutoScaleRecords(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 doDescribeEmrOverviewMetrics(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="HmacSHA256")
|
|
706
|
+
if g_param[OptionsDefine.Language]:
|
|
707
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
708
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
709
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
710
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
711
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
712
|
+
model = models.DescribeEmrOverviewMetricsRequest()
|
|
713
|
+
model.from_json_string(json.dumps(args))
|
|
714
|
+
start_time = time.time()
|
|
715
|
+
while True:
|
|
716
|
+
rsp = client.DescribeEmrOverviewMetrics(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 doScaleOutInstance(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="HmacSHA256")
|
|
761
|
+
if g_param[OptionsDefine.Language]:
|
|
762
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
763
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
764
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
765
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
766
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
767
|
+
model = models.ScaleOutInstanceRequest()
|
|
768
|
+
model.from_json_string(json.dumps(args))
|
|
769
|
+
start_time = time.time()
|
|
770
|
+
while True:
|
|
771
|
+
rsp = client.ScaleOutInstance(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 doAttachDisks(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="HmacSHA256")
|
|
816
|
+
if g_param[OptionsDefine.Language]:
|
|
817
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
818
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
819
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
820
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
821
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
822
|
+
model = models.AttachDisksRequest()
|
|
823
|
+
model.from_json_string(json.dumps(args))
|
|
824
|
+
start_time = time.time()
|
|
825
|
+
while True:
|
|
826
|
+
rsp = client.AttachDisks(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 doSetNodeResourceConfigDefault(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="HmacSHA256")
|
|
871
|
+
if g_param[OptionsDefine.Language]:
|
|
872
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
873
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
874
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
875
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
876
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
877
|
+
model = models.SetNodeResourceConfigDefaultRequest()
|
|
878
|
+
model.from_json_string(json.dumps(args))
|
|
879
|
+
start_time = time.time()
|
|
880
|
+
while True:
|
|
881
|
+
rsp = client.SetNodeResourceConfigDefault(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 doDescribeStarRocksQueryInfo(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="HmacSHA256")
|
|
926
|
+
if g_param[OptionsDefine.Language]:
|
|
927
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
928
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
929
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
930
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
931
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
932
|
+
model = models.DescribeStarRocksQueryInfoRequest()
|
|
933
|
+
model.from_json_string(json.dumps(args))
|
|
934
|
+
start_time = time.time()
|
|
935
|
+
while True:
|
|
936
|
+
rsp = client.DescribeStarRocksQueryInfo(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 doModifySLInstanceBasic(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="HmacSHA256")
|
|
981
|
+
if g_param[OptionsDefine.Language]:
|
|
982
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
983
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
984
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
985
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
986
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
987
|
+
model = models.ModifySLInstanceBasicRequest()
|
|
988
|
+
model.from_json_string(json.dumps(args))
|
|
989
|
+
start_time = time.time()
|
|
990
|
+
while True:
|
|
991
|
+
rsp = client.ModifySLInstanceBasic(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 doAddMetricScaleStrategy(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="HmacSHA256")
|
|
1036
|
+
if g_param[OptionsDefine.Language]:
|
|
1037
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1038
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1039
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1040
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1041
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1042
|
+
model = models.AddMetricScaleStrategyRequest()
|
|
1043
|
+
model.from_json_string(json.dumps(args))
|
|
1044
|
+
start_time = time.time()
|
|
1045
|
+
while True:
|
|
1046
|
+
rsp = client.AddMetricScaleStrategy(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 doDescribeServiceNodeInfos(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):
|
|
1079
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1080
|
+
else:
|
|
1081
|
+
cred = credential.Credential(
|
|
1082
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1083
|
+
)
|
|
1084
|
+
http_profile = HttpProfile(
|
|
1085
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1086
|
+
reqMethod="POST",
|
|
1087
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1088
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1089
|
+
)
|
|
1090
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1091
|
+
if g_param[OptionsDefine.Language]:
|
|
1092
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1093
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1094
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1095
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1096
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1097
|
+
model = models.DescribeServiceNodeInfosRequest()
|
|
1098
|
+
model.from_json_string(json.dumps(args))
|
|
1099
|
+
start_time = time.time()
|
|
1100
|
+
while True:
|
|
1101
|
+
rsp = client.DescribeServiceNodeInfos(model)
|
|
1102
|
+
result = rsp.to_json_string()
|
|
1103
|
+
try:
|
|
1104
|
+
json_obj = json.loads(result)
|
|
1105
|
+
except TypeError as e:
|
|
1106
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1107
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1108
|
+
break
|
|
1109
|
+
cur_time = time.time()
|
|
1110
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1111
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1112
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1113
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1114
|
+
else:
|
|
1115
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1116
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1117
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
def doDescribeInstances(args, parsed_globals):
|
|
1121
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1122
|
+
|
|
1123
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1124
|
+
cred = credential.CVMRoleCredential()
|
|
1125
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1126
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1127
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1128
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1129
|
+
)
|
|
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):
|
|
1134
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1135
|
+
else:
|
|
1136
|
+
cred = credential.Credential(
|
|
1137
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1138
|
+
)
|
|
1139
|
+
http_profile = HttpProfile(
|
|
1140
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1141
|
+
reqMethod="POST",
|
|
1142
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1143
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1144
|
+
)
|
|
1145
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1146
|
+
if g_param[OptionsDefine.Language]:
|
|
1147
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1148
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1149
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1150
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1151
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1152
|
+
model = models.DescribeInstancesRequest()
|
|
1153
|
+
model.from_json_string(json.dumps(args))
|
|
1154
|
+
start_time = time.time()
|
|
1155
|
+
while True:
|
|
1156
|
+
rsp = client.DescribeInstances(model)
|
|
1157
|
+
result = rsp.to_json_string()
|
|
1158
|
+
try:
|
|
1159
|
+
json_obj = json.loads(result)
|
|
1160
|
+
except TypeError as e:
|
|
1161
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1162
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1163
|
+
break
|
|
1164
|
+
cur_time = time.time()
|
|
1165
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1166
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1167
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1168
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1169
|
+
else:
|
|
1170
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1171
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1172
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
def doModifyYarnDeploy(args, parsed_globals):
|
|
1176
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1177
|
+
|
|
1178
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1179
|
+
cred = credential.CVMRoleCredential()
|
|
1180
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1181
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1182
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1183
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1184
|
+
)
|
|
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):
|
|
1189
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1190
|
+
else:
|
|
1191
|
+
cred = credential.Credential(
|
|
1192
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1193
|
+
)
|
|
1194
|
+
http_profile = HttpProfile(
|
|
1195
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1196
|
+
reqMethod="POST",
|
|
1197
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1198
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1199
|
+
)
|
|
1200
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1201
|
+
if g_param[OptionsDefine.Language]:
|
|
1202
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1203
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1204
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1205
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1206
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1207
|
+
model = models.ModifyYarnDeployRequest()
|
|
1208
|
+
model.from_json_string(json.dumps(args))
|
|
1209
|
+
start_time = time.time()
|
|
1210
|
+
while True:
|
|
1211
|
+
rsp = client.ModifyYarnDeploy(model)
|
|
1212
|
+
result = rsp.to_json_string()
|
|
1213
|
+
try:
|
|
1214
|
+
json_obj = json.loads(result)
|
|
1215
|
+
except TypeError as e:
|
|
1216
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1217
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1218
|
+
break
|
|
1219
|
+
cur_time = time.time()
|
|
1220
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1221
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1222
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1223
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1224
|
+
else:
|
|
1225
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1226
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1227
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
def doTerminateTasks(args, parsed_globals):
|
|
1231
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1232
|
+
|
|
1233
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1234
|
+
cred = credential.CVMRoleCredential()
|
|
1235
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1236
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1237
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1238
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1239
|
+
)
|
|
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):
|
|
1244
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1245
|
+
else:
|
|
1246
|
+
cred = credential.Credential(
|
|
1247
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1248
|
+
)
|
|
1249
|
+
http_profile = HttpProfile(
|
|
1250
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1251
|
+
reqMethod="POST",
|
|
1252
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1253
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1254
|
+
)
|
|
1255
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1256
|
+
if g_param[OptionsDefine.Language]:
|
|
1257
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1258
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1259
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1260
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1261
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1262
|
+
model = models.TerminateTasksRequest()
|
|
1263
|
+
model.from_json_string(json.dumps(args))
|
|
1264
|
+
start_time = time.time()
|
|
1265
|
+
while True:
|
|
1266
|
+
rsp = client.TerminateTasks(model)
|
|
1267
|
+
result = rsp.to_json_string()
|
|
1268
|
+
try:
|
|
1269
|
+
json_obj = json.loads(result)
|
|
1270
|
+
except TypeError as e:
|
|
1271
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1272
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1273
|
+
break
|
|
1274
|
+
cur_time = time.time()
|
|
1275
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1276
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1277
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1278
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1279
|
+
else:
|
|
1280
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1281
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1282
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
def doDeleteGroupsSTD(args, parsed_globals):
|
|
1286
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1287
|
+
|
|
1288
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1289
|
+
cred = credential.CVMRoleCredential()
|
|
1290
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1291
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1292
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1293
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1294
|
+
)
|
|
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):
|
|
1299
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1300
|
+
else:
|
|
1301
|
+
cred = credential.Credential(
|
|
1302
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1303
|
+
)
|
|
1304
|
+
http_profile = HttpProfile(
|
|
1305
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1306
|
+
reqMethod="POST",
|
|
1307
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1308
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1309
|
+
)
|
|
1310
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1311
|
+
if g_param[OptionsDefine.Language]:
|
|
1312
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1313
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1314
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1315
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1316
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1317
|
+
model = models.DeleteGroupsSTDRequest()
|
|
1318
|
+
model.from_json_string(json.dumps(args))
|
|
1319
|
+
start_time = time.time()
|
|
1320
|
+
while True:
|
|
1321
|
+
rsp = client.DeleteGroupsSTD(model)
|
|
1322
|
+
result = rsp.to_json_string()
|
|
1323
|
+
try:
|
|
1324
|
+
json_obj = json.loads(result)
|
|
1325
|
+
except TypeError as e:
|
|
1326
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1327
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1328
|
+
break
|
|
1329
|
+
cur_time = time.time()
|
|
1330
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1331
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1332
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1333
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1334
|
+
else:
|
|
1335
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1336
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1337
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
def doTerminateClusterNodes(args, parsed_globals):
|
|
1341
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1342
|
+
|
|
1343
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1344
|
+
cred = credential.CVMRoleCredential()
|
|
1345
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1346
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1347
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1348
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1349
|
+
)
|
|
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):
|
|
1354
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1355
|
+
else:
|
|
1356
|
+
cred = credential.Credential(
|
|
1357
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1358
|
+
)
|
|
1359
|
+
http_profile = HttpProfile(
|
|
1360
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1361
|
+
reqMethod="POST",
|
|
1362
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1363
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1364
|
+
)
|
|
1365
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1366
|
+
if g_param[OptionsDefine.Language]:
|
|
1367
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1368
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1369
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1370
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1371
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1372
|
+
model = models.TerminateClusterNodesRequest()
|
|
1373
|
+
model.from_json_string(json.dumps(args))
|
|
1374
|
+
start_time = time.time()
|
|
1375
|
+
while True:
|
|
1376
|
+
rsp = client.TerminateClusterNodes(model)
|
|
1377
|
+
result = rsp.to_json_string()
|
|
1378
|
+
try:
|
|
1379
|
+
json_obj = json.loads(result)
|
|
1380
|
+
except TypeError as e:
|
|
1381
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1382
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1383
|
+
break
|
|
1384
|
+
cur_time = time.time()
|
|
1385
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1386
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1387
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1388
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1389
|
+
else:
|
|
1390
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1391
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1392
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
def doResetYarnConfig(args, parsed_globals):
|
|
1396
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1397
|
+
|
|
1398
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1399
|
+
cred = credential.CVMRoleCredential()
|
|
1400
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1401
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1402
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1403
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1404
|
+
)
|
|
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):
|
|
1409
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1410
|
+
else:
|
|
1411
|
+
cred = credential.Credential(
|
|
1412
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1413
|
+
)
|
|
1414
|
+
http_profile = HttpProfile(
|
|
1415
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1416
|
+
reqMethod="POST",
|
|
1417
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1418
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1419
|
+
)
|
|
1420
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1421
|
+
if g_param[OptionsDefine.Language]:
|
|
1422
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1423
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1424
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1425
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1426
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1427
|
+
model = models.ResetYarnConfigRequest()
|
|
1428
|
+
model.from_json_string(json.dumps(args))
|
|
1429
|
+
start_time = time.time()
|
|
1430
|
+
while True:
|
|
1431
|
+
rsp = client.ResetYarnConfig(model)
|
|
1432
|
+
result = rsp.to_json_string()
|
|
1433
|
+
try:
|
|
1434
|
+
json_obj = json.loads(result)
|
|
1435
|
+
except TypeError as e:
|
|
1436
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1437
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1438
|
+
break
|
|
1439
|
+
cur_time = time.time()
|
|
1440
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1441
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1442
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1443
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1444
|
+
else:
|
|
1445
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1446
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1447
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
def doDescribeUsersForUserManager(args, parsed_globals):
|
|
1451
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1452
|
+
|
|
1453
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1454
|
+
cred = credential.CVMRoleCredential()
|
|
1455
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1456
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1457
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1458
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1459
|
+
)
|
|
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):
|
|
1464
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1465
|
+
else:
|
|
1466
|
+
cred = credential.Credential(
|
|
1467
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1468
|
+
)
|
|
1469
|
+
http_profile = HttpProfile(
|
|
1470
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1471
|
+
reqMethod="POST",
|
|
1472
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1473
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1474
|
+
)
|
|
1475
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1476
|
+
if g_param[OptionsDefine.Language]:
|
|
1477
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1478
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1479
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1480
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1481
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1482
|
+
model = models.DescribeUsersForUserManagerRequest()
|
|
1483
|
+
model.from_json_string(json.dumps(args))
|
|
1484
|
+
start_time = time.time()
|
|
1485
|
+
while True:
|
|
1486
|
+
rsp = client.DescribeUsersForUserManager(model)
|
|
1487
|
+
result = rsp.to_json_string()
|
|
1488
|
+
try:
|
|
1489
|
+
json_obj = json.loads(result)
|
|
1490
|
+
except TypeError as e:
|
|
1491
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1492
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1493
|
+
break
|
|
1494
|
+
cur_time = time.time()
|
|
1495
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1496
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1497
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1498
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1499
|
+
else:
|
|
1500
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1501
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1502
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
def doModifyUserManagerPwd(args, parsed_globals):
|
|
1506
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1507
|
+
|
|
1508
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1509
|
+
cred = credential.CVMRoleCredential()
|
|
1510
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1511
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1512
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1513
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1514
|
+
)
|
|
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):
|
|
1519
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1520
|
+
else:
|
|
1521
|
+
cred = credential.Credential(
|
|
1522
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1523
|
+
)
|
|
1524
|
+
http_profile = HttpProfile(
|
|
1525
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1526
|
+
reqMethod="POST",
|
|
1527
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1528
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1529
|
+
)
|
|
1530
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1531
|
+
if g_param[OptionsDefine.Language]:
|
|
1532
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1533
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1534
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1535
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1536
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1537
|
+
model = models.ModifyUserManagerPwdRequest()
|
|
1538
|
+
model.from_json_string(json.dumps(args))
|
|
1539
|
+
start_time = time.time()
|
|
1540
|
+
while True:
|
|
1541
|
+
rsp = client.ModifyUserManagerPwd(model)
|
|
1542
|
+
result = rsp.to_json_string()
|
|
1543
|
+
try:
|
|
1544
|
+
json_obj = json.loads(result)
|
|
1545
|
+
except TypeError as e:
|
|
1546
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1547
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1548
|
+
break
|
|
1549
|
+
cur_time = time.time()
|
|
1550
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1551
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1552
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1553
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1554
|
+
else:
|
|
1555
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1556
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1557
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
def doConvertPreToPostCluster(args, parsed_globals):
|
|
1561
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1562
|
+
|
|
1563
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1564
|
+
cred = credential.CVMRoleCredential()
|
|
1565
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1566
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1567
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1568
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1569
|
+
)
|
|
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):
|
|
1574
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1575
|
+
else:
|
|
1576
|
+
cred = credential.Credential(
|
|
1577
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1578
|
+
)
|
|
1579
|
+
http_profile = HttpProfile(
|
|
1580
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1581
|
+
reqMethod="POST",
|
|
1582
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1583
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1584
|
+
)
|
|
1585
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1586
|
+
if g_param[OptionsDefine.Language]:
|
|
1587
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1588
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1589
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1590
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1591
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1592
|
+
model = models.ConvertPreToPostClusterRequest()
|
|
1593
|
+
model.from_json_string(json.dumps(args))
|
|
1594
|
+
start_time = time.time()
|
|
1595
|
+
while True:
|
|
1596
|
+
rsp = client.ConvertPreToPostCluster(model)
|
|
1597
|
+
result = rsp.to_json_string()
|
|
1598
|
+
try:
|
|
1599
|
+
json_obj = json.loads(result)
|
|
1600
|
+
except TypeError as e:
|
|
1601
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1602
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1603
|
+
break
|
|
1604
|
+
cur_time = time.time()
|
|
1605
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1606
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1607
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1608
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1609
|
+
else:
|
|
1610
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1611
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1612
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
def doCreateGroupsSTD(args, parsed_globals):
|
|
1616
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1617
|
+
|
|
1618
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1619
|
+
cred = credential.CVMRoleCredential()
|
|
1620
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1621
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1622
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1623
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1624
|
+
)
|
|
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):
|
|
1629
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1630
|
+
else:
|
|
1631
|
+
cred = credential.Credential(
|
|
1632
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1633
|
+
)
|
|
1634
|
+
http_profile = HttpProfile(
|
|
1635
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1636
|
+
reqMethod="POST",
|
|
1637
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1638
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1639
|
+
)
|
|
1640
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1641
|
+
if g_param[OptionsDefine.Language]:
|
|
1642
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1643
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1644
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1645
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1646
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1647
|
+
model = models.CreateGroupsSTDRequest()
|
|
1648
|
+
model.from_json_string(json.dumps(args))
|
|
1649
|
+
start_time = time.time()
|
|
1650
|
+
while True:
|
|
1651
|
+
rsp = client.CreateGroupsSTD(model)
|
|
1652
|
+
result = rsp.to_json_string()
|
|
1653
|
+
try:
|
|
1654
|
+
json_obj = json.loads(result)
|
|
1655
|
+
except TypeError as e:
|
|
1656
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1657
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1658
|
+
break
|
|
1659
|
+
cur_time = time.time()
|
|
1660
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1661
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1662
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1663
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1664
|
+
else:
|
|
1665
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1666
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1667
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1668
|
+
|
|
1669
|
+
|
|
1670
|
+
def doTerminateSLInstance(args, parsed_globals):
|
|
1671
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1672
|
+
|
|
1673
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1674
|
+
cred = credential.CVMRoleCredential()
|
|
1675
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1676
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1677
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1678
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1679
|
+
)
|
|
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):
|
|
1684
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1685
|
+
else:
|
|
1686
|
+
cred = credential.Credential(
|
|
1687
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1688
|
+
)
|
|
1689
|
+
http_profile = HttpProfile(
|
|
1690
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1691
|
+
reqMethod="POST",
|
|
1692
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1693
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1694
|
+
)
|
|
1695
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1696
|
+
if g_param[OptionsDefine.Language]:
|
|
1697
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1698
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1699
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1700
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1701
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1702
|
+
model = models.TerminateSLInstanceRequest()
|
|
1703
|
+
model.from_json_string(json.dumps(args))
|
|
1704
|
+
start_time = time.time()
|
|
1705
|
+
while True:
|
|
1706
|
+
rsp = client.TerminateSLInstance(model)
|
|
1707
|
+
result = rsp.to_json_string()
|
|
1708
|
+
try:
|
|
1709
|
+
json_obj = json.loads(result)
|
|
1710
|
+
except TypeError as e:
|
|
1711
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1712
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1713
|
+
break
|
|
1714
|
+
cur_time = time.time()
|
|
1715
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1716
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1717
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1718
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1719
|
+
else:
|
|
1720
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1721
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1722
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1723
|
+
|
|
1724
|
+
|
|
1725
|
+
def doAddUsersForUserManager(args, parsed_globals):
|
|
1726
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1727
|
+
|
|
1728
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1729
|
+
cred = credential.CVMRoleCredential()
|
|
1730
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1731
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1732
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1733
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1734
|
+
)
|
|
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):
|
|
1739
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1740
|
+
else:
|
|
1741
|
+
cred = credential.Credential(
|
|
1742
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1743
|
+
)
|
|
1744
|
+
http_profile = HttpProfile(
|
|
1745
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1746
|
+
reqMethod="POST",
|
|
1747
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1748
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1749
|
+
)
|
|
1750
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1751
|
+
if g_param[OptionsDefine.Language]:
|
|
1752
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1753
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1754
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1755
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1756
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1757
|
+
model = models.AddUsersForUserManagerRequest()
|
|
1758
|
+
model.from_json_string(json.dumps(args))
|
|
1759
|
+
start_time = time.time()
|
|
1760
|
+
while True:
|
|
1761
|
+
rsp = client.AddUsersForUserManager(model)
|
|
1762
|
+
result = rsp.to_json_string()
|
|
1763
|
+
try:
|
|
1764
|
+
json_obj = json.loads(result)
|
|
1765
|
+
except TypeError as e:
|
|
1766
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1767
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1768
|
+
break
|
|
1769
|
+
cur_time = time.time()
|
|
1770
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1771
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1772
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1773
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1774
|
+
else:
|
|
1775
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1776
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1777
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
def doDescribeSparkApplications(args, parsed_globals):
|
|
1781
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1782
|
+
|
|
1783
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1784
|
+
cred = credential.CVMRoleCredential()
|
|
1785
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1786
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1787
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1788
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1789
|
+
)
|
|
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):
|
|
1794
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1795
|
+
else:
|
|
1796
|
+
cred = credential.Credential(
|
|
1797
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1798
|
+
)
|
|
1799
|
+
http_profile = HttpProfile(
|
|
1800
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1801
|
+
reqMethod="POST",
|
|
1802
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1803
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1804
|
+
)
|
|
1805
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1806
|
+
if g_param[OptionsDefine.Language]:
|
|
1807
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1808
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1809
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1810
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1811
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1812
|
+
model = models.DescribeSparkApplicationsRequest()
|
|
1813
|
+
model.from_json_string(json.dumps(args))
|
|
1814
|
+
start_time = time.time()
|
|
1815
|
+
while True:
|
|
1816
|
+
rsp = client.DescribeSparkApplications(model)
|
|
1817
|
+
result = rsp.to_json_string()
|
|
1818
|
+
try:
|
|
1819
|
+
json_obj = json.loads(result)
|
|
1820
|
+
except TypeError as e:
|
|
1821
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1822
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1823
|
+
break
|
|
1824
|
+
cur_time = time.time()
|
|
1825
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1826
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1827
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1828
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1829
|
+
else:
|
|
1830
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1831
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1832
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1833
|
+
|
|
1834
|
+
|
|
1835
|
+
def doModifyUserGroup(args, parsed_globals):
|
|
1836
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1837
|
+
|
|
1838
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1839
|
+
cred = credential.CVMRoleCredential()
|
|
1840
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1841
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1842
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1843
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1844
|
+
)
|
|
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):
|
|
1849
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1850
|
+
else:
|
|
1851
|
+
cred = credential.Credential(
|
|
1852
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1853
|
+
)
|
|
1854
|
+
http_profile = HttpProfile(
|
|
1855
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1856
|
+
reqMethod="POST",
|
|
1857
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1858
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1859
|
+
)
|
|
1860
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1861
|
+
if g_param[OptionsDefine.Language]:
|
|
1862
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1863
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1864
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1865
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1866
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1867
|
+
model = models.ModifyUserGroupRequest()
|
|
1868
|
+
model.from_json_string(json.dumps(args))
|
|
1869
|
+
start_time = time.time()
|
|
1870
|
+
while True:
|
|
1871
|
+
rsp = client.ModifyUserGroup(model)
|
|
1872
|
+
result = rsp.to_json_string()
|
|
1873
|
+
try:
|
|
1874
|
+
json_obj = json.loads(result)
|
|
1875
|
+
except TypeError as e:
|
|
1876
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1877
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1878
|
+
break
|
|
1879
|
+
cur_time = time.time()
|
|
1880
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1881
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1882
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1883
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1884
|
+
else:
|
|
1885
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1886
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1887
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
def doCreateSLInstance(args, parsed_globals):
|
|
1891
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1892
|
+
|
|
1893
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1894
|
+
cred = credential.CVMRoleCredential()
|
|
1895
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1896
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1897
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1898
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1899
|
+
)
|
|
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):
|
|
1904
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1905
|
+
else:
|
|
1906
|
+
cred = credential.Credential(
|
|
1907
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1908
|
+
)
|
|
1909
|
+
http_profile = HttpProfile(
|
|
1910
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1911
|
+
reqMethod="POST",
|
|
1912
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1913
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1914
|
+
)
|
|
1915
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1916
|
+
if g_param[OptionsDefine.Language]:
|
|
1917
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1918
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1919
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1920
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1921
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1922
|
+
model = models.CreateSLInstanceRequest()
|
|
1923
|
+
model.from_json_string(json.dumps(args))
|
|
1924
|
+
start_time = time.time()
|
|
1925
|
+
while True:
|
|
1926
|
+
rsp = client.CreateSLInstance(model)
|
|
1927
|
+
result = rsp.to_json_string()
|
|
1928
|
+
try:
|
|
1929
|
+
json_obj = json.loads(result)
|
|
1930
|
+
except TypeError as e:
|
|
1931
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1932
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1933
|
+
break
|
|
1934
|
+
cur_time = time.time()
|
|
1935
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1936
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1937
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1938
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1939
|
+
else:
|
|
1940
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1941
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1942
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1943
|
+
|
|
1944
|
+
|
|
1945
|
+
def doDescribeSLInstanceList(args, parsed_globals):
|
|
1946
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1947
|
+
|
|
1948
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1949
|
+
cred = credential.CVMRoleCredential()
|
|
1950
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1951
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1952
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1953
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1954
|
+
)
|
|
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):
|
|
1959
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1960
|
+
else:
|
|
1961
|
+
cred = credential.Credential(
|
|
1962
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1963
|
+
)
|
|
1964
|
+
http_profile = HttpProfile(
|
|
1965
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1966
|
+
reqMethod="POST",
|
|
1967
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1968
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1969
|
+
)
|
|
1970
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1971
|
+
if g_param[OptionsDefine.Language]:
|
|
1972
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1973
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1974
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1975
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1976
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1977
|
+
model = models.DescribeSLInstanceListRequest()
|
|
1978
|
+
model.from_json_string(json.dumps(args))
|
|
1979
|
+
start_time = time.time()
|
|
1980
|
+
while True:
|
|
1981
|
+
rsp = client.DescribeSLInstanceList(model)
|
|
1982
|
+
result = rsp.to_json_string()
|
|
1983
|
+
try:
|
|
1984
|
+
json_obj = json.loads(result)
|
|
1985
|
+
except TypeError as e:
|
|
1986
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1987
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1988
|
+
break
|
|
1989
|
+
cur_time = time.time()
|
|
1990
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1991
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1992
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1993
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1994
|
+
else:
|
|
1995
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1996
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1997
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1998
|
+
|
|
1999
|
+
|
|
2000
|
+
def doAddNodeResourceConfig(args, parsed_globals):
|
|
2001
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2002
|
+
|
|
2003
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2004
|
+
cred = credential.CVMRoleCredential()
|
|
2005
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2006
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2007
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2008
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2009
|
+
)
|
|
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):
|
|
2014
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2015
|
+
else:
|
|
2016
|
+
cred = credential.Credential(
|
|
2017
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2018
|
+
)
|
|
2019
|
+
http_profile = HttpProfile(
|
|
2020
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2021
|
+
reqMethod="POST",
|
|
2022
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2023
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2024
|
+
)
|
|
2025
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2026
|
+
if g_param[OptionsDefine.Language]:
|
|
2027
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2028
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2029
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2030
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2031
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2032
|
+
model = models.AddNodeResourceConfigRequest()
|
|
2033
|
+
model.from_json_string(json.dumps(args))
|
|
2034
|
+
start_time = time.time()
|
|
2035
|
+
while True:
|
|
2036
|
+
rsp = client.AddNodeResourceConfig(model)
|
|
2037
|
+
result = rsp.to_json_string()
|
|
2038
|
+
try:
|
|
2039
|
+
json_obj = json.loads(result)
|
|
2040
|
+
except TypeError as e:
|
|
2041
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2042
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2043
|
+
break
|
|
2044
|
+
cur_time = time.time()
|
|
2045
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2046
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2047
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2048
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2049
|
+
else:
|
|
2050
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2051
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2052
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2053
|
+
|
|
2054
|
+
|
|
2055
|
+
def doModifyAutoScaleStrategy(args, parsed_globals):
|
|
2056
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2057
|
+
|
|
2058
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2059
|
+
cred = credential.CVMRoleCredential()
|
|
2060
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2061
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2062
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2063
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2064
|
+
)
|
|
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):
|
|
2069
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2070
|
+
else:
|
|
2071
|
+
cred = credential.Credential(
|
|
2072
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2073
|
+
)
|
|
2074
|
+
http_profile = HttpProfile(
|
|
2075
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2076
|
+
reqMethod="POST",
|
|
2077
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2078
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2079
|
+
)
|
|
2080
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2081
|
+
if g_param[OptionsDefine.Language]:
|
|
2082
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2083
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2084
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2085
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2086
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2087
|
+
model = models.ModifyAutoScaleStrategyRequest()
|
|
2088
|
+
model.from_json_string(json.dumps(args))
|
|
2089
|
+
start_time = time.time()
|
|
2090
|
+
while True:
|
|
2091
|
+
rsp = client.ModifyAutoScaleStrategy(model)
|
|
2092
|
+
result = rsp.to_json_string()
|
|
2093
|
+
try:
|
|
2094
|
+
json_obj = json.loads(result)
|
|
2095
|
+
except TypeError as e:
|
|
2096
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2097
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2098
|
+
break
|
|
2099
|
+
cur_time = time.time()
|
|
2100
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2101
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2102
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2103
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2104
|
+
else:
|
|
2105
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2106
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2107
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2108
|
+
|
|
2109
|
+
|
|
2110
|
+
def doDescribeKyuubiQueryInfo(args, parsed_globals):
|
|
2111
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2112
|
+
|
|
2113
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2114
|
+
cred = credential.CVMRoleCredential()
|
|
2115
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2116
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2117
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2118
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2119
|
+
)
|
|
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):
|
|
2124
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2125
|
+
else:
|
|
2126
|
+
cred = credential.Credential(
|
|
2127
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2128
|
+
)
|
|
2129
|
+
http_profile = HttpProfile(
|
|
2130
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2131
|
+
reqMethod="POST",
|
|
2132
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2133
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2134
|
+
)
|
|
2135
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2136
|
+
if g_param[OptionsDefine.Language]:
|
|
2137
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2138
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2139
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2140
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2141
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2142
|
+
model = models.DescribeKyuubiQueryInfoRequest()
|
|
2143
|
+
model.from_json_string(json.dumps(args))
|
|
2144
|
+
start_time = time.time()
|
|
2145
|
+
while True:
|
|
2146
|
+
rsp = client.DescribeKyuubiQueryInfo(model)
|
|
2147
|
+
result = rsp.to_json_string()
|
|
2148
|
+
try:
|
|
2149
|
+
json_obj = json.loads(result)
|
|
2150
|
+
except TypeError as e:
|
|
2151
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2152
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2153
|
+
break
|
|
2154
|
+
cur_time = time.time()
|
|
2155
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2156
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2157
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2158
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2159
|
+
else:
|
|
2160
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2161
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2162
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2163
|
+
|
|
2164
|
+
|
|
2165
|
+
def doDeleteAutoScaleStrategy(args, parsed_globals):
|
|
2166
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2167
|
+
|
|
2168
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2169
|
+
cred = credential.CVMRoleCredential()
|
|
2170
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2171
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2172
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2173
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2174
|
+
)
|
|
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):
|
|
2179
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2180
|
+
else:
|
|
2181
|
+
cred = credential.Credential(
|
|
2182
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2183
|
+
)
|
|
2184
|
+
http_profile = HttpProfile(
|
|
2185
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2186
|
+
reqMethod="POST",
|
|
2187
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2188
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2189
|
+
)
|
|
2190
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2191
|
+
if g_param[OptionsDefine.Language]:
|
|
2192
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2193
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2194
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2195
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2196
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2197
|
+
model = models.DeleteAutoScaleStrategyRequest()
|
|
2198
|
+
model.from_json_string(json.dumps(args))
|
|
2199
|
+
start_time = time.time()
|
|
2200
|
+
while True:
|
|
2201
|
+
rsp = client.DeleteAutoScaleStrategy(model)
|
|
2202
|
+
result = rsp.to_json_string()
|
|
2203
|
+
try:
|
|
2204
|
+
json_obj = json.loads(result)
|
|
2205
|
+
except TypeError as e:
|
|
2206
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2207
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2208
|
+
break
|
|
2209
|
+
cur_time = time.time()
|
|
2210
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2211
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2212
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2213
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2214
|
+
else:
|
|
2215
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2216
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2217
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
def doDescribeEmrApplicationStatics(args, parsed_globals):
|
|
2221
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2222
|
+
|
|
2223
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2224
|
+
cred = credential.CVMRoleCredential()
|
|
2225
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2226
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2227
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2228
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2229
|
+
)
|
|
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):
|
|
2234
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2235
|
+
else:
|
|
2236
|
+
cred = credential.Credential(
|
|
2237
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2238
|
+
)
|
|
2239
|
+
http_profile = HttpProfile(
|
|
2240
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2241
|
+
reqMethod="POST",
|
|
2242
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2243
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2244
|
+
)
|
|
2245
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2246
|
+
if g_param[OptionsDefine.Language]:
|
|
2247
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2248
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2249
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2250
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2251
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2252
|
+
model = models.DescribeEmrApplicationStaticsRequest()
|
|
2253
|
+
model.from_json_string(json.dumps(args))
|
|
2254
|
+
start_time = time.time()
|
|
2255
|
+
while True:
|
|
2256
|
+
rsp = client.DescribeEmrApplicationStatics(model)
|
|
2257
|
+
result = rsp.to_json_string()
|
|
2258
|
+
try:
|
|
2259
|
+
json_obj = json.loads(result)
|
|
2260
|
+
except TypeError as e:
|
|
2261
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2262
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2263
|
+
break
|
|
2264
|
+
cur_time = time.time()
|
|
2265
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2266
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2267
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2268
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2269
|
+
else:
|
|
2270
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2271
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2272
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
def doDescribeHDFSStorageInfo(args, parsed_globals):
|
|
2276
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2277
|
+
|
|
2278
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2279
|
+
cred = credential.CVMRoleCredential()
|
|
2280
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2281
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2282
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2283
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2284
|
+
)
|
|
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):
|
|
2289
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2290
|
+
else:
|
|
2291
|
+
cred = credential.Credential(
|
|
2292
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2293
|
+
)
|
|
2294
|
+
http_profile = HttpProfile(
|
|
2295
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2296
|
+
reqMethod="POST",
|
|
2297
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2298
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2299
|
+
)
|
|
2300
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2301
|
+
if g_param[OptionsDefine.Language]:
|
|
2302
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2303
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2304
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2305
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2306
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2307
|
+
model = models.DescribeHDFSStorageInfoRequest()
|
|
2308
|
+
model.from_json_string(json.dumps(args))
|
|
2309
|
+
start_time = time.time()
|
|
2310
|
+
while True:
|
|
2311
|
+
rsp = client.DescribeHDFSStorageInfo(model)
|
|
2312
|
+
result = rsp.to_json_string()
|
|
2313
|
+
try:
|
|
2314
|
+
json_obj = json.loads(result)
|
|
2315
|
+
except TypeError as e:
|
|
2316
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2317
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2318
|
+
break
|
|
2319
|
+
cur_time = time.time()
|
|
2320
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2321
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2322
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2323
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2324
|
+
else:
|
|
2325
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2326
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2327
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
def doCreateInstance(args, parsed_globals):
|
|
2331
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2332
|
+
|
|
2333
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2334
|
+
cred = credential.CVMRoleCredential()
|
|
2335
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2336
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2337
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2338
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2339
|
+
)
|
|
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):
|
|
2344
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2345
|
+
else:
|
|
2346
|
+
cred = credential.Credential(
|
|
2347
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2348
|
+
)
|
|
2349
|
+
http_profile = HttpProfile(
|
|
2350
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2351
|
+
reqMethod="POST",
|
|
2352
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2353
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2354
|
+
)
|
|
2355
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2356
|
+
if g_param[OptionsDefine.Language]:
|
|
2357
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2358
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2359
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2360
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2361
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2362
|
+
model = models.CreateInstanceRequest()
|
|
2363
|
+
model.from_json_string(json.dumps(args))
|
|
2364
|
+
start_time = time.time()
|
|
2365
|
+
while True:
|
|
2366
|
+
rsp = client.CreateInstance(model)
|
|
2367
|
+
result = rsp.to_json_string()
|
|
2368
|
+
try:
|
|
2369
|
+
json_obj = json.loads(result)
|
|
2370
|
+
except TypeError as e:
|
|
2371
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2372
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2373
|
+
break
|
|
2374
|
+
cur_time = time.time()
|
|
2375
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2376
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2377
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2378
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2379
|
+
else:
|
|
2380
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2381
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2382
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
def doModifyResourceScheduler(args, parsed_globals):
|
|
2386
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2387
|
+
|
|
2388
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2389
|
+
cred = credential.CVMRoleCredential()
|
|
2390
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2391
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2392
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2393
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2394
|
+
)
|
|
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):
|
|
2399
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2400
|
+
else:
|
|
2401
|
+
cred = credential.Credential(
|
|
2402
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2403
|
+
)
|
|
2404
|
+
http_profile = HttpProfile(
|
|
2405
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2406
|
+
reqMethod="POST",
|
|
2407
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2408
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2409
|
+
)
|
|
2410
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2411
|
+
if g_param[OptionsDefine.Language]:
|
|
2412
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2413
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2414
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2415
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2416
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2417
|
+
model = models.ModifyResourceSchedulerRequest()
|
|
2418
|
+
model.from_json_string(json.dumps(args))
|
|
2419
|
+
start_time = time.time()
|
|
2420
|
+
while True:
|
|
2421
|
+
rsp = client.ModifyResourceScheduler(model)
|
|
2422
|
+
result = rsp.to_json_string()
|
|
2423
|
+
try:
|
|
2424
|
+
json_obj = json.loads(result)
|
|
2425
|
+
except TypeError as e:
|
|
2426
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2427
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2428
|
+
break
|
|
2429
|
+
cur_time = time.time()
|
|
2430
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2431
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2432
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2433
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2434
|
+
else:
|
|
2435
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2436
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2437
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2438
|
+
|
|
2439
|
+
|
|
2440
|
+
def doDescribeHBaseTableOverview(args, parsed_globals):
|
|
2441
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2442
|
+
|
|
2443
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2444
|
+
cred = credential.CVMRoleCredential()
|
|
2445
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2446
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2447
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2448
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2449
|
+
)
|
|
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):
|
|
2454
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2455
|
+
else:
|
|
2456
|
+
cred = credential.Credential(
|
|
2457
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2458
|
+
)
|
|
2459
|
+
http_profile = HttpProfile(
|
|
2460
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2461
|
+
reqMethod="POST",
|
|
2462
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2463
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2464
|
+
)
|
|
2465
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2466
|
+
if g_param[OptionsDefine.Language]:
|
|
2467
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2468
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2469
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2470
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2471
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2472
|
+
model = models.DescribeHBaseTableOverviewRequest()
|
|
2473
|
+
model.from_json_string(json.dumps(args))
|
|
2474
|
+
start_time = time.time()
|
|
2475
|
+
while True:
|
|
2476
|
+
rsp = client.DescribeHBaseTableOverview(model)
|
|
2477
|
+
result = rsp.to_json_string()
|
|
2478
|
+
try:
|
|
2479
|
+
json_obj = json.loads(result)
|
|
2480
|
+
except TypeError as e:
|
|
2481
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2482
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2483
|
+
break
|
|
2484
|
+
cur_time = time.time()
|
|
2485
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2486
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2487
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2488
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2489
|
+
else:
|
|
2490
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2491
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2492
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2493
|
+
|
|
2494
|
+
|
|
2495
|
+
def doDescribeResourceScheduleDiffDetail(args, parsed_globals):
|
|
2496
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2497
|
+
|
|
2498
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2499
|
+
cred = credential.CVMRoleCredential()
|
|
2500
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2501
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2502
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2503
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2504
|
+
)
|
|
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):
|
|
2509
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2510
|
+
else:
|
|
2511
|
+
cred = credential.Credential(
|
|
2512
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2513
|
+
)
|
|
2514
|
+
http_profile = HttpProfile(
|
|
2515
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2516
|
+
reqMethod="POST",
|
|
2517
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2518
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2519
|
+
)
|
|
2520
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2521
|
+
if g_param[OptionsDefine.Language]:
|
|
2522
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2523
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2524
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2525
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2526
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2527
|
+
model = models.DescribeResourceScheduleDiffDetailRequest()
|
|
2528
|
+
model.from_json_string(json.dumps(args))
|
|
2529
|
+
start_time = time.time()
|
|
2530
|
+
while True:
|
|
2531
|
+
rsp = client.DescribeResourceScheduleDiffDetail(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 doDescribeSLInstance(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="HmacSHA256")
|
|
2576
|
+
if g_param[OptionsDefine.Language]:
|
|
2577
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2578
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2579
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2580
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2581
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2582
|
+
model = models.DescribeSLInstanceRequest()
|
|
2583
|
+
model.from_json_string(json.dumps(args))
|
|
2584
|
+
start_time = time.time()
|
|
2585
|
+
while True:
|
|
2586
|
+
rsp = client.DescribeSLInstance(model)
|
|
2587
|
+
result = rsp.to_json_string()
|
|
2588
|
+
try:
|
|
2589
|
+
json_obj = json.loads(result)
|
|
2590
|
+
except TypeError as e:
|
|
2591
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2592
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2593
|
+
break
|
|
2594
|
+
cur_time = time.time()
|
|
2595
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2596
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2597
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2598
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2599
|
+
else:
|
|
2600
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2601
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2602
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2603
|
+
|
|
2604
|
+
|
|
2605
|
+
def doDescribeSparkQueries(args, parsed_globals):
|
|
2606
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2607
|
+
|
|
2608
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2609
|
+
cred = credential.CVMRoleCredential()
|
|
2610
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2611
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2612
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2613
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2614
|
+
)
|
|
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):
|
|
187
2619
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
188
2620
|
else:
|
|
189
2621
|
cred = credential.Credential(
|
|
@@ -202,11 +2634,11 @@ def doInquiryPriceRenewInstance(args, parsed_globals):
|
|
|
202
2634
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
203
2635
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
204
2636
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
205
|
-
model = models.
|
|
2637
|
+
model = models.DescribeSparkQueriesRequest()
|
|
206
2638
|
model.from_json_string(json.dumps(args))
|
|
207
2639
|
start_time = time.time()
|
|
208
2640
|
while True:
|
|
209
|
-
rsp = client.
|
|
2641
|
+
rsp = client.DescribeSparkQueries(model)
|
|
210
2642
|
result = rsp.to_json_string()
|
|
211
2643
|
try:
|
|
212
2644
|
json_obj = json.loads(result)
|
|
@@ -225,7 +2657,7 @@ def doInquiryPriceRenewInstance(args, parsed_globals):
|
|
|
225
2657
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
226
2658
|
|
|
227
2659
|
|
|
228
|
-
def
|
|
2660
|
+
def doModifyAutoRenewFlag(args, parsed_globals):
|
|
229
2661
|
g_param = parse_global_arg(parsed_globals)
|
|
230
2662
|
|
|
231
2663
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -235,7 +2667,10 @@ def doInquiryPriceScaleOutInstance(args, parsed_globals):
|
|
|
235
2667
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
236
2668
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
237
2669
|
)
|
|
238
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
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):
|
|
239
2674
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
240
2675
|
else:
|
|
241
2676
|
cred = credential.Credential(
|
|
@@ -254,11 +2689,11 @@ def doInquiryPriceScaleOutInstance(args, parsed_globals):
|
|
|
254
2689
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
255
2690
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
256
2691
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
257
|
-
model = models.
|
|
2692
|
+
model = models.ModifyAutoRenewFlagRequest()
|
|
258
2693
|
model.from_json_string(json.dumps(args))
|
|
259
2694
|
start_time = time.time()
|
|
260
2695
|
while True:
|
|
261
|
-
rsp = client.
|
|
2696
|
+
rsp = client.ModifyAutoRenewFlag(model)
|
|
262
2697
|
result = rsp.to_json_string()
|
|
263
2698
|
try:
|
|
264
2699
|
json_obj = json.loads(result)
|
|
@@ -277,7 +2712,7 @@ def doInquiryPriceScaleOutInstance(args, parsed_globals):
|
|
|
277
2712
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
278
2713
|
|
|
279
2714
|
|
|
280
|
-
def
|
|
2715
|
+
def doModifyResource(args, parsed_globals):
|
|
281
2716
|
g_param = parse_global_arg(parsed_globals)
|
|
282
2717
|
|
|
283
2718
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -287,7 +2722,10 @@ def doDescribeAutoScaleRecords(args, parsed_globals):
|
|
|
287
2722
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
288
2723
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
289
2724
|
)
|
|
290
|
-
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):
|
|
291
2729
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
292
2730
|
else:
|
|
293
2731
|
cred = credential.Credential(
|
|
@@ -306,11 +2744,11 @@ def doDescribeAutoScaleRecords(args, parsed_globals):
|
|
|
306
2744
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
307
2745
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
308
2746
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
309
|
-
model = models.
|
|
2747
|
+
model = models.ModifyResourceRequest()
|
|
310
2748
|
model.from_json_string(json.dumps(args))
|
|
311
2749
|
start_time = time.time()
|
|
312
2750
|
while True:
|
|
313
|
-
rsp = client.
|
|
2751
|
+
rsp = client.ModifyResource(model)
|
|
314
2752
|
result = rsp.to_json_string()
|
|
315
2753
|
try:
|
|
316
2754
|
json_obj = json.loads(result)
|
|
@@ -329,7 +2767,7 @@ def doDescribeAutoScaleRecords(args, parsed_globals):
|
|
|
329
2767
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
330
2768
|
|
|
331
2769
|
|
|
332
|
-
def
|
|
2770
|
+
def doInquiryPriceCreateInstance(args, parsed_globals):
|
|
333
2771
|
g_param = parse_global_arg(parsed_globals)
|
|
334
2772
|
|
|
335
2773
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -339,7 +2777,10 @@ def doScaleOutInstance(args, parsed_globals):
|
|
|
339
2777
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
340
2778
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
341
2779
|
)
|
|
342
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2780
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2781
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2782
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2783
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
343
2784
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
344
2785
|
else:
|
|
345
2786
|
cred = credential.Credential(
|
|
@@ -358,11 +2799,11 @@ def doScaleOutInstance(args, parsed_globals):
|
|
|
358
2799
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
359
2800
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
360
2801
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
361
|
-
model = models.
|
|
2802
|
+
model = models.InquiryPriceCreateInstanceRequest()
|
|
362
2803
|
model.from_json_string(json.dumps(args))
|
|
363
2804
|
start_time = time.time()
|
|
364
2805
|
while True:
|
|
365
|
-
rsp = client.
|
|
2806
|
+
rsp = client.InquiryPriceCreateInstance(model)
|
|
366
2807
|
result = rsp.to_json_string()
|
|
367
2808
|
try:
|
|
368
2809
|
json_obj = json.loads(result)
|
|
@@ -381,7 +2822,7 @@ def doScaleOutInstance(args, parsed_globals):
|
|
|
381
2822
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
382
2823
|
|
|
383
2824
|
|
|
384
|
-
def
|
|
2825
|
+
def doDescribeResourceSchedule(args, parsed_globals):
|
|
385
2826
|
g_param = parse_global_arg(parsed_globals)
|
|
386
2827
|
|
|
387
2828
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -391,7 +2832,10 @@ def doModifyUserManagerPwd(args, parsed_globals):
|
|
|
391
2832
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
392
2833
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
393
2834
|
)
|
|
394
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2835
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2836
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2837
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2838
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
395
2839
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
396
2840
|
else:
|
|
397
2841
|
cred = credential.Credential(
|
|
@@ -410,11 +2854,11 @@ def doModifyUserManagerPwd(args, parsed_globals):
|
|
|
410
2854
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
411
2855
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
412
2856
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
413
|
-
model = models.
|
|
2857
|
+
model = models.DescribeResourceScheduleRequest()
|
|
414
2858
|
model.from_json_string(json.dumps(args))
|
|
415
2859
|
start_time = time.time()
|
|
416
2860
|
while True:
|
|
417
|
-
rsp = client.
|
|
2861
|
+
rsp = client.DescribeResourceSchedule(model)
|
|
418
2862
|
result = rsp.to_json_string()
|
|
419
2863
|
try:
|
|
420
2864
|
json_obj = json.loads(result)
|
|
@@ -433,7 +2877,7 @@ def doModifyUserManagerPwd(args, parsed_globals):
|
|
|
433
2877
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
434
2878
|
|
|
435
2879
|
|
|
436
|
-
def
|
|
2880
|
+
def doResizeDataDisks(args, parsed_globals):
|
|
437
2881
|
g_param = parse_global_arg(parsed_globals)
|
|
438
2882
|
|
|
439
2883
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -443,7 +2887,10 @@ def doModifySLInstanceBasic(args, parsed_globals):
|
|
|
443
2887
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
444
2888
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
445
2889
|
)
|
|
446
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2890
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2891
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2892
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2893
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
447
2894
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
448
2895
|
else:
|
|
449
2896
|
cred = credential.Credential(
|
|
@@ -462,11 +2909,11 @@ def doModifySLInstanceBasic(args, parsed_globals):
|
|
|
462
2909
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
463
2910
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
464
2911
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
465
|
-
model = models.
|
|
2912
|
+
model = models.ResizeDataDisksRequest()
|
|
466
2913
|
model.from_json_string(json.dumps(args))
|
|
467
2914
|
start_time = time.time()
|
|
468
2915
|
while True:
|
|
469
|
-
rsp = client.
|
|
2916
|
+
rsp = client.ResizeDataDisks(model)
|
|
470
2917
|
result = rsp.to_json_string()
|
|
471
2918
|
try:
|
|
472
2919
|
json_obj = json.loads(result)
|
|
@@ -485,7 +2932,7 @@ def doModifySLInstanceBasic(args, parsed_globals):
|
|
|
485
2932
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
486
2933
|
|
|
487
2934
|
|
|
488
|
-
def
|
|
2935
|
+
def doModifyResourceScheduleConfig(args, parsed_globals):
|
|
489
2936
|
g_param = parse_global_arg(parsed_globals)
|
|
490
2937
|
|
|
491
2938
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -495,7 +2942,10 @@ def doDescribeInstances(args, parsed_globals):
|
|
|
495
2942
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
496
2943
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
497
2944
|
)
|
|
498
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
2945
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
2946
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
2947
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
2948
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
499
2949
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
500
2950
|
else:
|
|
501
2951
|
cred = credential.Credential(
|
|
@@ -514,11 +2964,11 @@ def doDescribeInstances(args, parsed_globals):
|
|
|
514
2964
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
515
2965
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
516
2966
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
517
|
-
model = models.
|
|
2967
|
+
model = models.ModifyResourceScheduleConfigRequest()
|
|
518
2968
|
model.from_json_string(json.dumps(args))
|
|
519
2969
|
start_time = time.time()
|
|
520
2970
|
while True:
|
|
521
|
-
rsp = client.
|
|
2971
|
+
rsp = client.ModifyResourceScheduleConfig(model)
|
|
522
2972
|
result = rsp.to_json_string()
|
|
523
2973
|
try:
|
|
524
2974
|
json_obj = json.loads(result)
|
|
@@ -537,7 +2987,7 @@ def doDescribeInstances(args, parsed_globals):
|
|
|
537
2987
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
538
2988
|
|
|
539
2989
|
|
|
540
|
-
def
|
|
2990
|
+
def doDescribeHiveQueries(args, parsed_globals):
|
|
541
2991
|
g_param = parse_global_arg(parsed_globals)
|
|
542
2992
|
|
|
543
2993
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -547,7 +2997,10 @@ def doTerminateClusterNodes(args, parsed_globals):
|
|
|
547
2997
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
548
2998
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
549
2999
|
)
|
|
550
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3000
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3001
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3002
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3003
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
551
3004
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
552
3005
|
else:
|
|
553
3006
|
cred = credential.Credential(
|
|
@@ -566,11 +3019,11 @@ def doTerminateClusterNodes(args, parsed_globals):
|
|
|
566
3019
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
567
3020
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
568
3021
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
569
|
-
model = models.
|
|
3022
|
+
model = models.DescribeHiveQueriesRequest()
|
|
570
3023
|
model.from_json_string(json.dumps(args))
|
|
571
3024
|
start_time = time.time()
|
|
572
3025
|
while True:
|
|
573
|
-
rsp = client.
|
|
3026
|
+
rsp = client.DescribeHiveQueries(model)
|
|
574
3027
|
result = rsp.to_json_string()
|
|
575
3028
|
try:
|
|
576
3029
|
json_obj = json.loads(result)
|
|
@@ -589,7 +3042,7 @@ def doTerminateClusterNodes(args, parsed_globals):
|
|
|
589
3042
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
590
3043
|
|
|
591
3044
|
|
|
592
|
-
def
|
|
3045
|
+
def doStartStopServiceOrMonitor(args, parsed_globals):
|
|
593
3046
|
g_param = parse_global_arg(parsed_globals)
|
|
594
3047
|
|
|
595
3048
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -599,7 +3052,10 @@ def doDescribeUsersForUserManager(args, parsed_globals):
|
|
|
599
3052
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
600
3053
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
601
3054
|
)
|
|
602
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3055
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3056
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3057
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3058
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
603
3059
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
604
3060
|
else:
|
|
605
3061
|
cred = credential.Credential(
|
|
@@ -618,11 +3074,11 @@ def doDescribeUsersForUserManager(args, parsed_globals):
|
|
|
618
3074
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
619
3075
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
620
3076
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
621
|
-
model = models.
|
|
3077
|
+
model = models.StartStopServiceOrMonitorRequest()
|
|
622
3078
|
model.from_json_string(json.dumps(args))
|
|
623
3079
|
start_time = time.time()
|
|
624
3080
|
while True:
|
|
625
|
-
rsp = client.
|
|
3081
|
+
rsp = client.StartStopServiceOrMonitor(model)
|
|
626
3082
|
result = rsp.to_json_string()
|
|
627
3083
|
try:
|
|
628
3084
|
json_obj = json.loads(result)
|
|
@@ -641,7 +3097,7 @@ def doDescribeUsersForUserManager(args, parsed_globals):
|
|
|
641
3097
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
642
3098
|
|
|
643
3099
|
|
|
644
|
-
def
|
|
3100
|
+
def doDescribeYarnScheduleHistory(args, parsed_globals):
|
|
645
3101
|
g_param = parse_global_arg(parsed_globals)
|
|
646
3102
|
|
|
647
3103
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -651,7 +3107,10 @@ def doTerminateSLInstance(args, parsed_globals):
|
|
|
651
3107
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
652
3108
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
653
3109
|
)
|
|
654
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3110
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3111
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3112
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3113
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
655
3114
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
656
3115
|
else:
|
|
657
3116
|
cred = credential.Credential(
|
|
@@ -670,11 +3129,11 @@ def doTerminateSLInstance(args, parsed_globals):
|
|
|
670
3129
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
671
3130
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
672
3131
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
673
|
-
model = models.
|
|
3132
|
+
model = models.DescribeYarnScheduleHistoryRequest()
|
|
674
3133
|
model.from_json_string(json.dumps(args))
|
|
675
3134
|
start_time = time.time()
|
|
676
3135
|
while True:
|
|
677
|
-
rsp = client.
|
|
3136
|
+
rsp = client.DescribeYarnScheduleHistory(model)
|
|
678
3137
|
result = rsp.to_json_string()
|
|
679
3138
|
try:
|
|
680
3139
|
json_obj = json.loads(result)
|
|
@@ -693,7 +3152,7 @@ def doTerminateSLInstance(args, parsed_globals):
|
|
|
693
3152
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
694
3153
|
|
|
695
3154
|
|
|
696
|
-
def
|
|
3155
|
+
def doModifyGlobalConfig(args, parsed_globals):
|
|
697
3156
|
g_param = parse_global_arg(parsed_globals)
|
|
698
3157
|
|
|
699
3158
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -703,7 +3162,10 @@ def doAddUsersForUserManager(args, parsed_globals):
|
|
|
703
3162
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
704
3163
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
705
3164
|
)
|
|
706
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3165
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3166
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3167
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3168
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
707
3169
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
708
3170
|
else:
|
|
709
3171
|
cred = credential.Credential(
|
|
@@ -722,11 +3184,11 @@ def doAddUsersForUserManager(args, parsed_globals):
|
|
|
722
3184
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
723
3185
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
724
3186
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
725
|
-
model = models.
|
|
3187
|
+
model = models.ModifyGlobalConfigRequest()
|
|
726
3188
|
model.from_json_string(json.dumps(args))
|
|
727
3189
|
start_time = time.time()
|
|
728
3190
|
while True:
|
|
729
|
-
rsp = client.
|
|
3191
|
+
rsp = client.ModifyGlobalConfig(model)
|
|
730
3192
|
result = rsp.to_json_string()
|
|
731
3193
|
try:
|
|
732
3194
|
json_obj = json.loads(result)
|
|
@@ -745,7 +3207,7 @@ def doAddUsersForUserManager(args, parsed_globals):
|
|
|
745
3207
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
746
3208
|
|
|
747
3209
|
|
|
748
|
-
def
|
|
3210
|
+
def doTerminateInstance(args, parsed_globals):
|
|
749
3211
|
g_param = parse_global_arg(parsed_globals)
|
|
750
3212
|
|
|
751
3213
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -755,7 +3217,10 @@ def doCreateSLInstance(args, parsed_globals):
|
|
|
755
3217
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
756
3218
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
757
3219
|
)
|
|
758
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3220
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3221
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3222
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3223
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
759
3224
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
760
3225
|
else:
|
|
761
3226
|
cred = credential.Credential(
|
|
@@ -774,11 +3239,11 @@ def doCreateSLInstance(args, parsed_globals):
|
|
|
774
3239
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
775
3240
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
776
3241
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
777
|
-
model = models.
|
|
3242
|
+
model = models.TerminateInstanceRequest()
|
|
778
3243
|
model.from_json_string(json.dumps(args))
|
|
779
3244
|
start_time = time.time()
|
|
780
3245
|
while True:
|
|
781
|
-
rsp = client.
|
|
3246
|
+
rsp = client.TerminateInstance(model)
|
|
782
3247
|
result = rsp.to_json_string()
|
|
783
3248
|
try:
|
|
784
3249
|
json_obj = json.loads(result)
|
|
@@ -797,7 +3262,7 @@ def doCreateSLInstance(args, parsed_globals):
|
|
|
797
3262
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
798
3263
|
|
|
799
3264
|
|
|
800
|
-
def
|
|
3265
|
+
def doModifySLInstance(args, parsed_globals):
|
|
801
3266
|
g_param = parse_global_arg(parsed_globals)
|
|
802
3267
|
|
|
803
3268
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -807,7 +3272,10 @@ def doDescribeSLInstanceList(args, parsed_globals):
|
|
|
807
3272
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
808
3273
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
809
3274
|
)
|
|
810
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3275
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3276
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3277
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3278
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
811
3279
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
812
3280
|
else:
|
|
813
3281
|
cred = credential.Credential(
|
|
@@ -826,11 +3294,11 @@ def doDescribeSLInstanceList(args, parsed_globals):
|
|
|
826
3294
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
827
3295
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
828
3296
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
829
|
-
model = models.
|
|
3297
|
+
model = models.ModifySLInstanceRequest()
|
|
830
3298
|
model.from_json_string(json.dumps(args))
|
|
831
3299
|
start_time = time.time()
|
|
832
3300
|
while True:
|
|
833
|
-
rsp = client.
|
|
3301
|
+
rsp = client.ModifySLInstance(model)
|
|
834
3302
|
result = rsp.to_json_string()
|
|
835
3303
|
try:
|
|
836
3304
|
json_obj = json.loads(result)
|
|
@@ -849,7 +3317,7 @@ def doDescribeSLInstanceList(args, parsed_globals):
|
|
|
849
3317
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
850
3318
|
|
|
851
3319
|
|
|
852
|
-
def
|
|
3320
|
+
def doDescribeNodeDataDisks(args, parsed_globals):
|
|
853
3321
|
g_param = parse_global_arg(parsed_globals)
|
|
854
3322
|
|
|
855
3323
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -859,7 +3327,10 @@ def doDescribeEmrApplicationStatics(args, parsed_globals):
|
|
|
859
3327
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
860
3328
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
861
3329
|
)
|
|
862
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3330
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3331
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3332
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3333
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
863
3334
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
864
3335
|
else:
|
|
865
3336
|
cred = credential.Credential(
|
|
@@ -878,11 +3349,11 @@ def doDescribeEmrApplicationStatics(args, parsed_globals):
|
|
|
878
3349
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
879
3350
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
880
3351
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
881
|
-
model = models.
|
|
3352
|
+
model = models.DescribeNodeDataDisksRequest()
|
|
882
3353
|
model.from_json_string(json.dumps(args))
|
|
883
3354
|
start_time = time.time()
|
|
884
3355
|
while True:
|
|
885
|
-
rsp = client.
|
|
3356
|
+
rsp = client.DescribeNodeDataDisks(model)
|
|
886
3357
|
result = rsp.to_json_string()
|
|
887
3358
|
try:
|
|
888
3359
|
json_obj = json.loads(result)
|
|
@@ -901,7 +3372,7 @@ def doDescribeEmrApplicationStatics(args, parsed_globals):
|
|
|
901
3372
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
902
3373
|
|
|
903
3374
|
|
|
904
|
-
def
|
|
3375
|
+
def doDescribeNodeResourceConfigFast(args, parsed_globals):
|
|
905
3376
|
g_param = parse_global_arg(parsed_globals)
|
|
906
3377
|
|
|
907
3378
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -911,7 +3382,10 @@ def doModifyResourceScheduler(args, parsed_globals):
|
|
|
911
3382
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
912
3383
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
913
3384
|
)
|
|
914
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3385
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3386
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3387
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3388
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
915
3389
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
916
3390
|
else:
|
|
917
3391
|
cred = credential.Credential(
|
|
@@ -930,11 +3404,11 @@ def doModifyResourceScheduler(args, parsed_globals):
|
|
|
930
3404
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
931
3405
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
932
3406
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
933
|
-
model = models.
|
|
3407
|
+
model = models.DescribeNodeResourceConfigFastRequest()
|
|
934
3408
|
model.from_json_string(json.dumps(args))
|
|
935
3409
|
start_time = time.time()
|
|
936
3410
|
while True:
|
|
937
|
-
rsp = client.
|
|
3411
|
+
rsp = client.DescribeNodeResourceConfigFast(model)
|
|
938
3412
|
result = rsp.to_json_string()
|
|
939
3413
|
try:
|
|
940
3414
|
json_obj = json.loads(result)
|
|
@@ -953,7 +3427,7 @@ def doModifyResourceScheduler(args, parsed_globals):
|
|
|
953
3427
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
954
3428
|
|
|
955
3429
|
|
|
956
|
-
def
|
|
3430
|
+
def doDescribeAutoScaleStrategies(args, parsed_globals):
|
|
957
3431
|
g_param = parse_global_arg(parsed_globals)
|
|
958
3432
|
|
|
959
3433
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -963,7 +3437,10 @@ def doDescribeSLInstance(args, parsed_globals):
|
|
|
963
3437
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
964
3438
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
965
3439
|
)
|
|
966
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3440
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3441
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3442
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3443
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
967
3444
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
968
3445
|
else:
|
|
969
3446
|
cred = credential.Credential(
|
|
@@ -982,11 +3459,11 @@ def doDescribeSLInstance(args, parsed_globals):
|
|
|
982
3459
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
983
3460
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
984
3461
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
985
|
-
model = models.
|
|
3462
|
+
model = models.DescribeAutoScaleStrategiesRequest()
|
|
986
3463
|
model.from_json_string(json.dumps(args))
|
|
987
3464
|
start_time = time.time()
|
|
988
3465
|
while True:
|
|
989
|
-
rsp = client.
|
|
3466
|
+
rsp = client.DescribeAutoScaleStrategies(model)
|
|
990
3467
|
result = rsp.to_json_string()
|
|
991
3468
|
try:
|
|
992
3469
|
json_obj = json.loads(result)
|
|
@@ -1005,7 +3482,7 @@ def doDescribeSLInstance(args, parsed_globals):
|
|
|
1005
3482
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1006
3483
|
|
|
1007
3484
|
|
|
1008
|
-
def
|
|
3485
|
+
def doDescribeGlobalConfig(args, parsed_globals):
|
|
1009
3486
|
g_param = parse_global_arg(parsed_globals)
|
|
1010
3487
|
|
|
1011
3488
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1015,7 +3492,10 @@ def doModifySLInstance(args, parsed_globals):
|
|
|
1015
3492
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1016
3493
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1017
3494
|
)
|
|
1018
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3495
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3496
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3497
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3498
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1019
3499
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1020
3500
|
else:
|
|
1021
3501
|
cred = credential.Credential(
|
|
@@ -1034,11 +3514,11 @@ def doModifySLInstance(args, parsed_globals):
|
|
|
1034
3514
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1035
3515
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1036
3516
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1037
|
-
model = models.
|
|
3517
|
+
model = models.DescribeGlobalConfigRequest()
|
|
1038
3518
|
model.from_json_string(json.dumps(args))
|
|
1039
3519
|
start_time = time.time()
|
|
1040
3520
|
while True:
|
|
1041
|
-
rsp = client.
|
|
3521
|
+
rsp = client.DescribeGlobalConfig(model)
|
|
1042
3522
|
result = rsp.to_json_string()
|
|
1043
3523
|
try:
|
|
1044
3524
|
json_obj = json.loads(result)
|
|
@@ -1057,7 +3537,7 @@ def doModifySLInstance(args, parsed_globals):
|
|
|
1057
3537
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1058
3538
|
|
|
1059
3539
|
|
|
1060
|
-
def
|
|
3540
|
+
def doDescribeAutoScaleGroupGlobalConf(args, parsed_globals):
|
|
1061
3541
|
g_param = parse_global_arg(parsed_globals)
|
|
1062
3542
|
|
|
1063
3543
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1067,7 +3547,10 @@ def doCreateInstance(args, parsed_globals):
|
|
|
1067
3547
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1068
3548
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1069
3549
|
)
|
|
1070
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3550
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3551
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3552
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3553
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1071
3554
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1072
3555
|
else:
|
|
1073
3556
|
cred = credential.Credential(
|
|
@@ -1086,11 +3569,11 @@ def doCreateInstance(args, parsed_globals):
|
|
|
1086
3569
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1087
3570
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1088
3571
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1089
|
-
model = models.
|
|
3572
|
+
model = models.DescribeAutoScaleGroupGlobalConfRequest()
|
|
1090
3573
|
model.from_json_string(json.dumps(args))
|
|
1091
3574
|
start_time = time.time()
|
|
1092
3575
|
while True:
|
|
1093
|
-
rsp = client.
|
|
3576
|
+
rsp = client.DescribeAutoScaleGroupGlobalConf(model)
|
|
1094
3577
|
result = rsp.to_json_string()
|
|
1095
3578
|
try:
|
|
1096
3579
|
json_obj = json.loads(result)
|
|
@@ -1109,7 +3592,7 @@ def doCreateInstance(args, parsed_globals):
|
|
|
1109
3592
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1110
3593
|
|
|
1111
3594
|
|
|
1112
|
-
def
|
|
3595
|
+
def doDescribeDAGInfo(args, parsed_globals):
|
|
1113
3596
|
g_param = parse_global_arg(parsed_globals)
|
|
1114
3597
|
|
|
1115
3598
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1119,7 +3602,10 @@ def doInquiryPriceCreateInstance(args, parsed_globals):
|
|
|
1119
3602
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1120
3603
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1121
3604
|
)
|
|
1122
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3605
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3606
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3607
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3608
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1123
3609
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1124
3610
|
else:
|
|
1125
3611
|
cred = credential.Credential(
|
|
@@ -1138,11 +3624,11 @@ def doInquiryPriceCreateInstance(args, parsed_globals):
|
|
|
1138
3624
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1139
3625
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1140
3626
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1141
|
-
model = models.
|
|
3627
|
+
model = models.DescribeDAGInfoRequest()
|
|
1142
3628
|
model.from_json_string(json.dumps(args))
|
|
1143
3629
|
start_time = time.time()
|
|
1144
3630
|
while True:
|
|
1145
|
-
rsp = client.
|
|
3631
|
+
rsp = client.DescribeDAGInfo(model)
|
|
1146
3632
|
result = rsp.to_json_string()
|
|
1147
3633
|
try:
|
|
1148
3634
|
json_obj = json.loads(result)
|
|
@@ -1161,7 +3647,7 @@ def doInquiryPriceCreateInstance(args, parsed_globals):
|
|
|
1161
3647
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1162
3648
|
|
|
1163
3649
|
|
|
1164
|
-
def
|
|
3650
|
+
def doDescribeClusterNodes(args, parsed_globals):
|
|
1165
3651
|
g_param = parse_global_arg(parsed_globals)
|
|
1166
3652
|
|
|
1167
3653
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1171,7 +3657,10 @@ def doDescribeResourceSchedule(args, parsed_globals):
|
|
|
1171
3657
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1172
3658
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1173
3659
|
)
|
|
1174
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3660
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3661
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3662
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3663
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1175
3664
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1176
3665
|
else:
|
|
1177
3666
|
cred = credential.Credential(
|
|
@@ -1190,11 +3679,11 @@ def doDescribeResourceSchedule(args, parsed_globals):
|
|
|
1190
3679
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1191
3680
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1192
3681
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1193
|
-
model = models.
|
|
3682
|
+
model = models.DescribeClusterNodesRequest()
|
|
1194
3683
|
model.from_json_string(json.dumps(args))
|
|
1195
3684
|
start_time = time.time()
|
|
1196
3685
|
while True:
|
|
1197
|
-
rsp = client.
|
|
3686
|
+
rsp = client.DescribeClusterNodes(model)
|
|
1198
3687
|
result = rsp.to_json_string()
|
|
1199
3688
|
try:
|
|
1200
3689
|
json_obj = json.loads(result)
|
|
@@ -1213,7 +3702,7 @@ def doDescribeResourceSchedule(args, parsed_globals):
|
|
|
1213
3702
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1214
3703
|
|
|
1215
3704
|
|
|
1216
|
-
def
|
|
3705
|
+
def doDescribeTrinoQueryInfo(args, parsed_globals):
|
|
1217
3706
|
g_param = parse_global_arg(parsed_globals)
|
|
1218
3707
|
|
|
1219
3708
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1223,7 +3712,10 @@ def doModifyResourceScheduleConfig(args, parsed_globals):
|
|
|
1223
3712
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1224
3713
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1225
3714
|
)
|
|
1226
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3715
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3716
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3717
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3718
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1227
3719
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1228
3720
|
else:
|
|
1229
3721
|
cred = credential.Credential(
|
|
@@ -1242,11 +3734,11 @@ def doModifyResourceScheduleConfig(args, parsed_globals):
|
|
|
1242
3734
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1243
3735
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1244
3736
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1245
|
-
model = models.
|
|
3737
|
+
model = models.DescribeTrinoQueryInfoRequest()
|
|
1246
3738
|
model.from_json_string(json.dumps(args))
|
|
1247
3739
|
start_time = time.time()
|
|
1248
3740
|
while True:
|
|
1249
|
-
rsp = client.
|
|
3741
|
+
rsp = client.DescribeTrinoQueryInfo(model)
|
|
1250
3742
|
result = rsp.to_json_string()
|
|
1251
3743
|
try:
|
|
1252
3744
|
json_obj = json.loads(result)
|
|
@@ -1265,7 +3757,7 @@ def doModifyResourceScheduleConfig(args, parsed_globals):
|
|
|
1265
3757
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1266
3758
|
|
|
1267
3759
|
|
|
1268
|
-
def
|
|
3760
|
+
def doDescribeInstancesList(args, parsed_globals):
|
|
1269
3761
|
g_param = parse_global_arg(parsed_globals)
|
|
1270
3762
|
|
|
1271
3763
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1275,7 +3767,10 @@ def doDescribeHiveQueries(args, parsed_globals):
|
|
|
1275
3767
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1276
3768
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1277
3769
|
)
|
|
1278
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3770
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3771
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3772
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3773
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1279
3774
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1280
3775
|
else:
|
|
1281
3776
|
cred = credential.Credential(
|
|
@@ -1294,11 +3789,11 @@ def doDescribeHiveQueries(args, parsed_globals):
|
|
|
1294
3789
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1295
3790
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1296
3791
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1297
|
-
model = models.
|
|
3792
|
+
model = models.DescribeInstancesListRequest()
|
|
1298
3793
|
model.from_json_string(json.dumps(args))
|
|
1299
3794
|
start_time = time.time()
|
|
1300
3795
|
while True:
|
|
1301
|
-
rsp = client.
|
|
3796
|
+
rsp = client.DescribeInstancesList(model)
|
|
1302
3797
|
result = rsp.to_json_string()
|
|
1303
3798
|
try:
|
|
1304
3799
|
json_obj = json.loads(result)
|
|
@@ -1317,7 +3812,7 @@ def doDescribeHiveQueries(args, parsed_globals):
|
|
|
1317
3812
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1318
3813
|
|
|
1319
3814
|
|
|
1320
|
-
def
|
|
3815
|
+
def doDescribeNodeSpec(args, parsed_globals):
|
|
1321
3816
|
g_param = parse_global_arg(parsed_globals)
|
|
1322
3817
|
|
|
1323
3818
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1327,7 +3822,10 @@ def doStartStopServiceOrMonitor(args, parsed_globals):
|
|
|
1327
3822
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1328
3823
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1329
3824
|
)
|
|
1330
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3825
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3826
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3827
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3828
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1331
3829
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1332
3830
|
else:
|
|
1333
3831
|
cred = credential.Credential(
|
|
@@ -1346,11 +3844,11 @@ def doStartStopServiceOrMonitor(args, parsed_globals):
|
|
|
1346
3844
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1347
3845
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1348
3846
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1349
|
-
model = models.
|
|
3847
|
+
model = models.DescribeNodeSpecRequest()
|
|
1350
3848
|
model.from_json_string(json.dumps(args))
|
|
1351
3849
|
start_time = time.time()
|
|
1352
3850
|
while True:
|
|
1353
|
-
rsp = client.
|
|
3851
|
+
rsp = client.DescribeNodeSpec(model)
|
|
1354
3852
|
result = rsp.to_json_string()
|
|
1355
3853
|
try:
|
|
1356
3854
|
json_obj = json.loads(result)
|
|
@@ -1369,7 +3867,7 @@ def doStartStopServiceOrMonitor(args, parsed_globals):
|
|
|
1369
3867
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1370
3868
|
|
|
1371
3869
|
|
|
1372
|
-
def
|
|
3870
|
+
def doDescribeInsightList(args, parsed_globals):
|
|
1373
3871
|
g_param = parse_global_arg(parsed_globals)
|
|
1374
3872
|
|
|
1375
3873
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1379,7 +3877,10 @@ def doTerminateTasks(args, parsed_globals):
|
|
|
1379
3877
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1380
3878
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1381
3879
|
)
|
|
1382
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3880
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3881
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3882
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3883
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1383
3884
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1384
3885
|
else:
|
|
1385
3886
|
cred = credential.Credential(
|
|
@@ -1398,11 +3899,11 @@ def doTerminateTasks(args, parsed_globals):
|
|
|
1398
3899
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1399
3900
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1400
3901
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1401
|
-
model = models.
|
|
3902
|
+
model = models.DescribeInsightListRequest()
|
|
1402
3903
|
model.from_json_string(json.dumps(args))
|
|
1403
3904
|
start_time = time.time()
|
|
1404
3905
|
while True:
|
|
1405
|
-
rsp = client.
|
|
3906
|
+
rsp = client.DescribeInsightList(model)
|
|
1406
3907
|
result = rsp.to_json_string()
|
|
1407
3908
|
try:
|
|
1408
3909
|
json_obj = json.loads(result)
|
|
@@ -1421,7 +3922,7 @@ def doTerminateTasks(args, parsed_globals):
|
|
|
1421
3922
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1422
3923
|
|
|
1423
3924
|
|
|
1424
|
-
def
|
|
3925
|
+
def doDeleteNodeResourceConfig(args, parsed_globals):
|
|
1425
3926
|
g_param = parse_global_arg(parsed_globals)
|
|
1426
3927
|
|
|
1427
3928
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1431,7 +3932,10 @@ def doTerminateInstance(args, parsed_globals):
|
|
|
1431
3932
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1432
3933
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1433
3934
|
)
|
|
1434
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3935
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3936
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3937
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3938
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1435
3939
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1436
3940
|
else:
|
|
1437
3941
|
cred = credential.Credential(
|
|
@@ -1450,11 +3954,11 @@ def doTerminateInstance(args, parsed_globals):
|
|
|
1450
3954
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1451
3955
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1452
3956
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1453
|
-
model = models.
|
|
3957
|
+
model = models.DeleteNodeResourceConfigRequest()
|
|
1454
3958
|
model.from_json_string(json.dumps(args))
|
|
1455
3959
|
start_time = time.time()
|
|
1456
3960
|
while True:
|
|
1457
|
-
rsp = client.
|
|
3961
|
+
rsp = client.DeleteNodeResourceConfig(model)
|
|
1458
3962
|
result = rsp.to_json_string()
|
|
1459
3963
|
try:
|
|
1460
3964
|
json_obj = json.loads(result)
|
|
@@ -1473,7 +3977,7 @@ def doTerminateInstance(args, parsed_globals):
|
|
|
1473
3977
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1474
3978
|
|
|
1475
3979
|
|
|
1476
|
-
def
|
|
3980
|
+
def doModifyInstanceBasic(args, parsed_globals):
|
|
1477
3981
|
g_param = parse_global_arg(parsed_globals)
|
|
1478
3982
|
|
|
1479
3983
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1483,7 +3987,10 @@ def doDescribeClusterNodes(args, parsed_globals):
|
|
|
1483
3987
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1484
3988
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1485
3989
|
)
|
|
1486
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
3990
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
3991
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
3992
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
3993
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1487
3994
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1488
3995
|
else:
|
|
1489
3996
|
cred = credential.Credential(
|
|
@@ -1502,11 +4009,11 @@ def doDescribeClusterNodes(args, parsed_globals):
|
|
|
1502
4009
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1503
4010
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1504
4011
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1505
|
-
model = models.
|
|
4012
|
+
model = models.ModifyInstanceBasicRequest()
|
|
1506
4013
|
model.from_json_string(json.dumps(args))
|
|
1507
4014
|
start_time = time.time()
|
|
1508
4015
|
while True:
|
|
1509
|
-
rsp = client.
|
|
4016
|
+
rsp = client.ModifyInstanceBasic(model)
|
|
1510
4017
|
result = rsp.to_json_string()
|
|
1511
4018
|
try:
|
|
1512
4019
|
json_obj = json.loads(result)
|
|
@@ -1525,7 +4032,7 @@ def doDescribeClusterNodes(args, parsed_globals):
|
|
|
1525
4032
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1526
4033
|
|
|
1527
4034
|
|
|
1528
|
-
def
|
|
4035
|
+
def doModifyUsersOfGroupSTD(args, parsed_globals):
|
|
1529
4036
|
g_param = parse_global_arg(parsed_globals)
|
|
1530
4037
|
|
|
1531
4038
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1535,7 +4042,10 @@ def doDescribeInstancesList(args, parsed_globals):
|
|
|
1535
4042
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1536
4043
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1537
4044
|
)
|
|
1538
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
4045
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
4046
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
4047
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
4048
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1539
4049
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1540
4050
|
else:
|
|
1541
4051
|
cred = credential.Credential(
|
|
@@ -1554,11 +4064,121 @@ def doDescribeInstancesList(args, parsed_globals):
|
|
|
1554
4064
|
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1555
4065
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1556
4066
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1557
|
-
model = models.
|
|
4067
|
+
model = models.ModifyUsersOfGroupSTDRequest()
|
|
1558
4068
|
model.from_json_string(json.dumps(args))
|
|
1559
4069
|
start_time = time.time()
|
|
1560
4070
|
while True:
|
|
1561
|
-
rsp = client.
|
|
4071
|
+
rsp = client.ModifyUsersOfGroupSTD(model)
|
|
4072
|
+
result = rsp.to_json_string()
|
|
4073
|
+
try:
|
|
4074
|
+
json_obj = json.loads(result)
|
|
4075
|
+
except TypeError as e:
|
|
4076
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
4077
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
4078
|
+
break
|
|
4079
|
+
cur_time = time.time()
|
|
4080
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
4081
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
4082
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
4083
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
4084
|
+
else:
|
|
4085
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
4086
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
4087
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4088
|
+
|
|
4089
|
+
|
|
4090
|
+
def doModifyInspectionSettings(args, parsed_globals):
|
|
4091
|
+
g_param = parse_global_arg(parsed_globals)
|
|
4092
|
+
|
|
4093
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
4094
|
+
cred = credential.CVMRoleCredential()
|
|
4095
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
4096
|
+
cred = credential.STSAssumeRoleCredential(
|
|
4097
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
4098
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
4099
|
+
)
|
|
4100
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
4101
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
4102
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
4103
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
4104
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
4105
|
+
else:
|
|
4106
|
+
cred = credential.Credential(
|
|
4107
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
4108
|
+
)
|
|
4109
|
+
http_profile = HttpProfile(
|
|
4110
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
4111
|
+
reqMethod="POST",
|
|
4112
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
4113
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
4114
|
+
)
|
|
4115
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
4116
|
+
if g_param[OptionsDefine.Language]:
|
|
4117
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
4118
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
4119
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
4120
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
4121
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
4122
|
+
model = models.ModifyInspectionSettingsRequest()
|
|
4123
|
+
model.from_json_string(json.dumps(args))
|
|
4124
|
+
start_time = time.time()
|
|
4125
|
+
while True:
|
|
4126
|
+
rsp = client.ModifyInspectionSettings(model)
|
|
4127
|
+
result = rsp.to_json_string()
|
|
4128
|
+
try:
|
|
4129
|
+
json_obj = json.loads(result)
|
|
4130
|
+
except TypeError as e:
|
|
4131
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
4132
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
4133
|
+
break
|
|
4134
|
+
cur_time = time.time()
|
|
4135
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
4136
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
4137
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
4138
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
4139
|
+
else:
|
|
4140
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
4141
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
4142
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4143
|
+
|
|
4144
|
+
|
|
4145
|
+
def doDescribeInspectionTaskResult(args, parsed_globals):
|
|
4146
|
+
g_param = parse_global_arg(parsed_globals)
|
|
4147
|
+
|
|
4148
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
4149
|
+
cred = credential.CVMRoleCredential()
|
|
4150
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
4151
|
+
cred = credential.STSAssumeRoleCredential(
|
|
4152
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
4153
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
4154
|
+
)
|
|
4155
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
4156
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
4157
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
4158
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
4159
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
4160
|
+
else:
|
|
4161
|
+
cred = credential.Credential(
|
|
4162
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
4163
|
+
)
|
|
4164
|
+
http_profile = HttpProfile(
|
|
4165
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
4166
|
+
reqMethod="POST",
|
|
4167
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
4168
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
4169
|
+
)
|
|
4170
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
4171
|
+
if g_param[OptionsDefine.Language]:
|
|
4172
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
4173
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
4174
|
+
client = mod.EmrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
4175
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
4176
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
4177
|
+
model = models.DescribeInspectionTaskResultRequest()
|
|
4178
|
+
model.from_json_string(json.dumps(args))
|
|
4179
|
+
start_time = time.time()
|
|
4180
|
+
while True:
|
|
4181
|
+
rsp = client.DescribeInspectionTaskResult(model)
|
|
1562
4182
|
result = rsp.to_json_string()
|
|
1563
4183
|
try:
|
|
1564
4184
|
json_obj = json.loads(result)
|
|
@@ -1587,7 +4207,10 @@ def doScaleOutCluster(args, parsed_globals):
|
|
|
1587
4207
|
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1588
4208
|
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1589
4209
|
)
|
|
1590
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION)
|
|
4210
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
4211
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
4212
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
4213
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
1591
4214
|
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1592
4215
|
else:
|
|
1593
4216
|
cred = credential.Credential(
|
|
@@ -1643,33 +4266,79 @@ ACTION_MAP = {
|
|
|
1643
4266
|
"ModifyResourcesTags": doModifyResourcesTags,
|
|
1644
4267
|
"InquiryPriceUpdateInstance": doInquiryPriceUpdateInstance,
|
|
1645
4268
|
"CreateCluster": doCreateCluster,
|
|
4269
|
+
"DescribeServiceConfGroupInfos": doDescribeServiceConfGroupInfos,
|
|
1646
4270
|
"InquiryPriceRenewInstance": doInquiryPriceRenewInstance,
|
|
4271
|
+
"DescribeGroupsSTD": doDescribeGroupsSTD,
|
|
4272
|
+
"DescribeYarnQueue": doDescribeYarnQueue,
|
|
4273
|
+
"ModifyYarnQueueV2": doModifyYarnQueueV2,
|
|
4274
|
+
"DeployYarnConf": doDeployYarnConf,
|
|
4275
|
+
"DescribeClusterFlowStatusDetail": doDescribeClusterFlowStatusDetail,
|
|
1647
4276
|
"InquiryPriceScaleOutInstance": doInquiryPriceScaleOutInstance,
|
|
1648
4277
|
"DescribeAutoScaleRecords": doDescribeAutoScaleRecords,
|
|
4278
|
+
"DescribeEmrOverviewMetrics": doDescribeEmrOverviewMetrics,
|
|
1649
4279
|
"ScaleOutInstance": doScaleOutInstance,
|
|
1650
|
-
"
|
|
4280
|
+
"AttachDisks": doAttachDisks,
|
|
4281
|
+
"SetNodeResourceConfigDefault": doSetNodeResourceConfigDefault,
|
|
4282
|
+
"DescribeStarRocksQueryInfo": doDescribeStarRocksQueryInfo,
|
|
1651
4283
|
"ModifySLInstanceBasic": doModifySLInstanceBasic,
|
|
4284
|
+
"AddMetricScaleStrategy": doAddMetricScaleStrategy,
|
|
4285
|
+
"DescribeServiceNodeInfos": doDescribeServiceNodeInfos,
|
|
1652
4286
|
"DescribeInstances": doDescribeInstances,
|
|
4287
|
+
"ModifyYarnDeploy": doModifyYarnDeploy,
|
|
4288
|
+
"TerminateTasks": doTerminateTasks,
|
|
4289
|
+
"DeleteGroupsSTD": doDeleteGroupsSTD,
|
|
1653
4290
|
"TerminateClusterNodes": doTerminateClusterNodes,
|
|
4291
|
+
"ResetYarnConfig": doResetYarnConfig,
|
|
1654
4292
|
"DescribeUsersForUserManager": doDescribeUsersForUserManager,
|
|
4293
|
+
"ModifyUserManagerPwd": doModifyUserManagerPwd,
|
|
4294
|
+
"ConvertPreToPostCluster": doConvertPreToPostCluster,
|
|
4295
|
+
"CreateGroupsSTD": doCreateGroupsSTD,
|
|
1655
4296
|
"TerminateSLInstance": doTerminateSLInstance,
|
|
1656
4297
|
"AddUsersForUserManager": doAddUsersForUserManager,
|
|
4298
|
+
"DescribeSparkApplications": doDescribeSparkApplications,
|
|
4299
|
+
"ModifyUserGroup": doModifyUserGroup,
|
|
1657
4300
|
"CreateSLInstance": doCreateSLInstance,
|
|
1658
4301
|
"DescribeSLInstanceList": doDescribeSLInstanceList,
|
|
4302
|
+
"AddNodeResourceConfig": doAddNodeResourceConfig,
|
|
4303
|
+
"ModifyAutoScaleStrategy": doModifyAutoScaleStrategy,
|
|
4304
|
+
"DescribeKyuubiQueryInfo": doDescribeKyuubiQueryInfo,
|
|
4305
|
+
"DeleteAutoScaleStrategy": doDeleteAutoScaleStrategy,
|
|
1659
4306
|
"DescribeEmrApplicationStatics": doDescribeEmrApplicationStatics,
|
|
4307
|
+
"DescribeHDFSStorageInfo": doDescribeHDFSStorageInfo,
|
|
4308
|
+
"CreateInstance": doCreateInstance,
|
|
1660
4309
|
"ModifyResourceScheduler": doModifyResourceScheduler,
|
|
4310
|
+
"DescribeHBaseTableOverview": doDescribeHBaseTableOverview,
|
|
4311
|
+
"DescribeResourceScheduleDiffDetail": doDescribeResourceScheduleDiffDetail,
|
|
1661
4312
|
"DescribeSLInstance": doDescribeSLInstance,
|
|
1662
|
-
"
|
|
1663
|
-
"
|
|
4313
|
+
"DescribeSparkQueries": doDescribeSparkQueries,
|
|
4314
|
+
"ModifyAutoRenewFlag": doModifyAutoRenewFlag,
|
|
4315
|
+
"ModifyResource": doModifyResource,
|
|
1664
4316
|
"InquiryPriceCreateInstance": doInquiryPriceCreateInstance,
|
|
1665
4317
|
"DescribeResourceSchedule": doDescribeResourceSchedule,
|
|
4318
|
+
"ResizeDataDisks": doResizeDataDisks,
|
|
1666
4319
|
"ModifyResourceScheduleConfig": doModifyResourceScheduleConfig,
|
|
1667
4320
|
"DescribeHiveQueries": doDescribeHiveQueries,
|
|
1668
4321
|
"StartStopServiceOrMonitor": doStartStopServiceOrMonitor,
|
|
1669
|
-
"
|
|
4322
|
+
"DescribeYarnScheduleHistory": doDescribeYarnScheduleHistory,
|
|
4323
|
+
"ModifyGlobalConfig": doModifyGlobalConfig,
|
|
1670
4324
|
"TerminateInstance": doTerminateInstance,
|
|
4325
|
+
"ModifySLInstance": doModifySLInstance,
|
|
4326
|
+
"DescribeNodeDataDisks": doDescribeNodeDataDisks,
|
|
4327
|
+
"DescribeNodeResourceConfigFast": doDescribeNodeResourceConfigFast,
|
|
4328
|
+
"DescribeAutoScaleStrategies": doDescribeAutoScaleStrategies,
|
|
4329
|
+
"DescribeGlobalConfig": doDescribeGlobalConfig,
|
|
4330
|
+
"DescribeAutoScaleGroupGlobalConf": doDescribeAutoScaleGroupGlobalConf,
|
|
4331
|
+
"DescribeDAGInfo": doDescribeDAGInfo,
|
|
1671
4332
|
"DescribeClusterNodes": doDescribeClusterNodes,
|
|
4333
|
+
"DescribeTrinoQueryInfo": doDescribeTrinoQueryInfo,
|
|
1672
4334
|
"DescribeInstancesList": doDescribeInstancesList,
|
|
4335
|
+
"DescribeNodeSpec": doDescribeNodeSpec,
|
|
4336
|
+
"DescribeInsightList": doDescribeInsightList,
|
|
4337
|
+
"DeleteNodeResourceConfig": doDeleteNodeResourceConfig,
|
|
4338
|
+
"ModifyInstanceBasic": doModifyInstanceBasic,
|
|
4339
|
+
"ModifyUsersOfGroupSTD": doModifyUsersOfGroupSTD,
|
|
4340
|
+
"ModifyInspectionSettings": doModifyInspectionSettings,
|
|
4341
|
+
"DescribeInspectionTaskResult": doDescribeInspectionTaskResult,
|
|
1673
4342
|
"ScaleOutCluster": doScaleOutCluster,
|
|
1674
4343
|
|
|
1675
4344
|
}
|