o
    .&ßa-  ã                   @   s@   d dl Z d dlmZ d dlmZ d dlmZ G dd„ deƒZdS )é    N)Úpartial)Úurlopen)ÚBasicCommandc                   @   s4   e Zd ZdZdZddddœddddœgZd	d
„ ZdS )ÚGetGameSessionLogCommandzget-game-session-logz2Download a compressed log file for a game session.zgame-session-idTzThe game session ID)ÚnameÚrequiredÚ	help_textzsave-asz5The filename to which the file should be saved (.zip)c           	      C   s´   | j jd|j|j|jd�}|j|jd�}|d }t|ƒ}tj	 
d|j ¡ t|jdƒ�}tt|jdƒdƒD ]}| 
|¡ q5W d   ƒ n1 sGw   Y  tj	 
d	|j|jf ¡ d
S )NÚgamelift)Úregion_nameÚendpoint_urlÚverify)ÚGameSessionIdÚPreSignedUrlz/Downloading log archive for game session %s...Úwbi   ó    z>Successfully downloaded log archive for game session %s to %s
r   )Ú_sessionÚcreate_clientÚregionr   Ú
verify_sslÚget_game_session_log_urlÚgame_session_idr   ÚsysÚstdoutÚwriteÚopenÚsave_asÚiterr   Úread)	ÚselfÚargsÚparsed_globalsÚclientÚresponseÚurlÚcontentsÚfÚchunk© r'   úG/usr/lib/python3/dist-packages/awscli/customizations/gamelift/getlog.pyÚ	_run_main   s4   ýÿÿÿÿÿ
ÿÿz"GetGameSessionLogCommand._run_mainN)Ú__name__Ú
__module__Ú__qualname__ÚNAMEÚDESCRIPTIONÚ	ARG_TABLEr)   r'   r'   r'   r(   r      s    ÿÿýr   )r   Ú	functoolsr   Úawscli.compatr   Úawscli.customizations.commandsr   r   r'   r'   r'   r(   Ú<module>   s
   