U!\c@s ddlZddlZddlZddlZddlmZmZmZddlm Z ej e Z defdYZdefdYZdefd YZd efd YZd efd YZdefdYZdefdYZdS(iN(tensure_unicodet ensure_bytesturlparse(t EXCEPTION_MAPtMonitorcBs8eZdddddgZdZdZdZRS(sbefore-parameter-buildsrequest-createdsresponse-receiveds after-callsafter-call-errorcCs||_||_dS(sAbstraction for monitoring clients API calls :param adapter: An adapter that takes event emitter events and produces monitor events :param publisher: A publisher for generated monitor events N(t_adaptert _publisher(tselftadaptert publisher((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyt__init__"s cCs+x$|jD]}|j||jq WdS(s(Register an event emitter to the monitorN(t_EVENTS_TO_REGISTERt register_lasttcapture(Rt event_emittertevent_to_register((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pytregister-scKsey2|jj||}|r1|jj|nWn,tk r`}tjd||dtnXdS(sCaptures an incoming event from the event emitter It will feed an event emitter event to the monitor's adaptor to create a monitor event and then publish that event to the monitor's publisher. s:Exception %s raised by client monitor in handling event %stexc_infoN(RtfeedRtpublisht ExceptiontloggertdebugtTrue(Rt event_nametpayloadt monitor_eventte((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyR 2s(t__name__t __module__R R RR (((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyRs  tMonitorEventAdaptercBszeZejdZdZdZdZdZdZdZ dZ dZ d Z d Z d ZRS( cCs ||_dS(sAdapts event emitter events to produce monitor events :type time: callable :param time: A callable that produces the current time N(t_time(Rttime((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyR CscCs|j||S(sFeed an event emitter event to generate a monitor event :type emitter_event_name: str :param emitter_event_name: The name of the event emitted :type emitter_payload: dict :param emitter_payload: The payload to associated to the event emitted :rtype: BaseMonitorEvent :returns: A monitor event based on the event emitter events fired (t _get_handler(Rtemitter_event_nametemitter_payload((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyRKscCs*t|d|jddjddS(Nt_handle_t.it-t_(tgetattrtsplittreplace(RR((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyR![scKs2td|jjd|jd|j|d\w+)/\d+/(?P[a-z0-9-]+)/tv4sAWS (?P\w+):ts3R+R,R-RgRFRSR<R;RHRIRKRLcCs|j|||_dS(sSerializes monitor events to CSM (Client Side Monitoring) format :type csm_client_id: str :param csm_client_id: The application identifier to associate to the serialized events N(t_validate_client_idt csm_client_id(RRq((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyR Os cCs5t||jkr1td||jfndS(NsTThe value provided for csm_client_id: %s exceeds the maximum length of %s characters(tlent_MAX_CLIENT_ID_LENGTHt ValueError(RRq((s7/tmp/pip-install-usGedi/botocore/botocore/monitoring.pyRpYscCs|j|}|j|}||d s    )Z6=