o .&a @sPdZddlmZdZGdddeZddZdd Zd d ZGd d d eZ dS)z+Add S3 specific event streaming output arg.)CustomArgumentz(Filename where the records will be savedc@s eZdZdS)DocSectionNotFoundErrorN)__name__ __module__ __qualname__rr@/usr/lib/python3/dist-packages/awscli/customizations/s3events.pyrsrcCs|dt|dtdS)Nz3building-argument-table.s3api.select-object-contentz&doc-output.s3api.select-object-content)registeradd_event_stream_output_arg register_lastreplace_event_stream_docs)event_handlersrrrregister_event_stream_argsrcKs$tdtdd|jjd|d|d<dS)NoutfilestringTpayload)name help_text cli_type_namepositional_arg stream_keysession)S3SelectStreamOutputArgumentSTREAM_HELP_TEXT output_shape serialization)argument_tableoperation_modelrkwargsrrrr "s  r cKsZ|j}d}|dkr!z|}Wn tytd|w|dks |d|ddS)Nz====== Output ======z7Could not find the "output" section for the command: %sz====== Output ====== zdThis command generates no output. The selected object content is written to the specified outfile. )doc pop_write IndexErrorrwrite) help_commandrr currentrrrr +s   r cs0eZdZdZfddZddZddZZS)rTc s,tt|jdi|||_d|_||_dS)Nr)superr__init__ _stream_key _output_file_session)selfrrr __class__rrr'?s z%S3SelectStreamOutputArgument.__init__cCs||_|jd|jdS)Nz!after-call.s3.SelectObjectContent)r)r*r save_file)r+ parametersvaluerrr add_to_paramsGsz*S3SelectStreamOutputArgument.add_to_paramscKst|j|vrdS||j}t|jd}|D]}d|vr$||ddqWdn1s/wY||j=dS)NwbRecordsPayload)r(openr)r#)r+parsedr event_streamfpeventrrrr.Ls   z&S3SelectStreamOutputArgument.save_file)rrr_DOCUMENT_AS_REQUIREDr'r1r. __classcell__rrr,rr<s  rN) __doc__awscli.argumentsrr Exceptionrrr r rrrrrs