o .&a@sddlZddlZddlZddlmZddlmZddlmZm Z e e Z dZ ddZdd ZGd d d eZGd d d e ZdS)N) check_call)ignore_user_entered_signals)ServiceOperationCLIOperationCaller)z#SessionManagerPlugin is not found. z3Please refer to SessionManager Documentation here: z3http://docs.aws.amazon.com/console/systems-manager/z session-manager-plugin-not-foundcCs|dtdS)Nzbuilding-command-table.ssm)registeradd_custom_start_session)event_handlersr F/usr/lib/python3/dist-packages/awscli/customizations/sessionmanager.pyregister_ssm_sessionsr cKs*tdd||ddt|d|d<dS)Nz start-sessionssm StartSession)name parent_namesessionoperation_modeloperation_caller)StartSessionCommandget_service_modelrStartSessionCaller)r command_tablekwargsr r r r$srcseZdZfddZZS)rcstt|}d|j_|S)N)superrcreate_help_command_operation_model output_shape)self help_command __class__r r r1sz'StartSessionCommand.create_help_command)__name__ __module__ __qualname__r __classcell__r r rr r/src@seZdZddZdS)rc Cs|jj||j|j|jd}|jd i|}|d}|jj}|jjdur'|jjnd} |jj} z)t t dt ||d| t || gWdWdS1sOwYWdSt y} z!| jtjkrxtjddd |j|d tdtWYd} ~ dSd} ~ ww) N) region_name endpoint_urlverify SessionIdzsession-manager-pluginr rz#SessionManagerPlugin is not presentT)exc_info)r'r )_session create_clientregionr% verify_ssl start_sessionmetar$profilerrjsondumpsOSErrorerrnoENOENTloggerdebugterminate_session ValueErrorjoin ERROR_MESSAGE) r service_nameoperation_name parametersparsed_globalsclientresponse session_idr$ profile_namer%exr r r invoke:sJ      zStartSessionCaller.invokeN)r r!r"rEr r r r r9s r)loggingr1r4 subprocessr awscli.compatrawscli.clidriverrr getLoggerr r6r;r rrrr r r r s