MCPcopy Create free account
hub / github.com/aws/aws-cli / AWSCLIEntryPoint

Class AWSCLIEntryPoint

awscli/clidriver.py:235–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233
234
235class AWSCLIEntryPoint:
236 def __init__(self, driver=None):
237 self._error_handler = construct_entry_point_handlers_chain()
238 self._driver = driver
239
240 def main(self, args):
241 try:
242 rc = self._do_main(args)
243 except BaseException as e:
244 LOG.debug("Exception caught in AWSCLIEntryPoint", exc_info=True)
245 return self._error_handler.handle_exception(
246 e,
247 stdout=get_stdout_text_writer(),
248 stderr=get_stderr_text_writer(),
249 )
250
251 HISTORY_RECORDER.record('CLI_RC', rc, 'CLI')
252 return rc
253
254 def _add_autoprompt_to_user_agent(self, driver, prompt_mode):
255 add_metadata_component_to_user_agent_extra(
256 driver.session,
257 "prompt",
258 prompt_mode,
259 )
260
261 def _run_driver(self, driver, args, prompt_mode):
262 self._add_autoprompt_to_user_agent(driver, prompt_mode)
263 return driver.main(args)
264
265 def _do_main(self, args):
266 driver = self._driver
267 if driver is None:
268 driver = create_clidriver(args)
269 auto_prompt_mode = resolve_auto_prompt_mode(args, driver.session)
270 if auto_prompt_mode == 'on':
271 from awscli.autoprompt.core import AutoPromptDriver
272
273 autoprompt_driver = AutoPromptDriver(driver)
274 args = autoprompt_driver.prompt_for_args(args)
275 rc = self._run_driver(driver, args, prompt_mode='on')
276 elif auto_prompt_mode == 'on-partial':
277 from awscli.autoprompt.core import AutoPromptDriver
278
279 autoprompt_driver = AutoPromptDriver(driver)
280 autoprompt_driver.inject_silence_param_error_msg_handler(driver)
281 rc = self._run_driver(driver, args, prompt_mode='off')
282 if rc == PARAM_VALIDATION_ERROR_RC:
283 args = autoprompt_driver.prompt_for_args(args)
284 driver = create_clidriver(args)
285 rc = self._run_driver(driver, args, prompt_mode='partial')
286 else:
287 rc = self._run_driver(driver, args, prompt_mode='off')
288 return rc
289
290
291class CLIDriver:

Callers 15

_do_runMethod · 0.90
setUpMethod · 0.90
test_isoMethod · 0.90
test_noneMethod · 0.90
test_defaultMethod · 0.90
init_clidriverMethod · 0.90

Calls

no outgoing calls