o
    !d-                     @   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requiredZ	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 )NZgamelift)Zregion_nameendpoint_urlZverify)ZGameSessionIdZPreSignedUrlz/Downloading log archive for game session %s...wbi       z>Successfully downloaded log archive for game session %s to %s
r   )Z_sessionZcreate_clientZregionr   Z
verify_sslZget_game_session_log_urlZgame_session_idr   sysstdoutwriteopenZsave_asiterr   read)	selfargsZparsed_globalsZclientresponseurlcontentsfchunk r   Iusr/lib/python3.10/site-packages/awscli/customizations/gamelift/getlog.py	_run_main   s4   
z"GetGameSessionLogCommand._run_mainN)__name__
__module____qualname__NAMEZDESCRIPTIONZ	ARG_TABLEr   r   r   r   r   r      s    r   )r   	functoolsr   Zawscli.compatr   Zawscli.customizations.commandsr   r   r   r   r   r   <module>   s
   