o
    ÙKÕiœ	  ã                   @   sò   d dl Z d dlZd dlmZ d dlmZmZ d dlmZm	Z	 d dl
mZ d dlmZ d dlmZmZmZ d dlmZ G d	d
„ d
eƒZdd„ Zede	je	jeejdeede	jdd�ede	jdd�ede	jdg dd�ede	jddd�gd�gd�ZdS )é    N)ÚOrderedDict)ÚAnyÚOptional)Ú
exceptionsÚmessages)ÚAbstractProgress)Úcall_api)ÚProArgumentÚProArgumentGroupÚ
ProCommand)ÚHelpCategoryc                	   @   s.   e Zd Zdededee dee fdd„ZdS )ÚCLIAPIProgressÚtotal_stepsÚ
done_stepsÚprevious_step_messageÚcurrent_step_messagec                C   s8   t ƒ }||d< ||d< ||d< ||d< tt |¡ƒ d S )Nr   r   r   r   )r   ÚprintÚjsonÚdumps)Úselfr   r   r   r   Úd© r   ú2/usr/lib/python3/dist-packages/uaclient/cli/api.pyÚprogress   s   zCLIAPIProgress.progressN)Ú__name__Ú
__module__Ú__qualname__Úintr   Ústrr   r   r   r   r   r      s    ýüûúr   c                K   s€   | j r
| jr
t ¡ ‚| jr| jdkrtj ¡ stj ¡ | _| jr$t	ƒ }nd }t
| j| j | j||ƒ}t| ¡ ƒ |jdkr>dS dS )Nú-Úsuccessr   é   )ÚoptionsÚdatar   ÚCLIAPIOptionsXORDataÚsysÚstdinÚisattyÚreadÚshow_progressr   r   Úendpoint_pathr   Úto_jsonÚresult)ÚargsÚcfgÚkwargsr   r,   r   r   r   Ú
action_api   s   
ÿr0   ÚapiTr*   Úendpoint)ÚhelpÚmetavarz--show-progressÚ
store_true)r3   Úactionz--argsr"   Ú*)r3   ÚdestÚdefaultÚnargsz--datar#   Ú )r3   r8   r9   )Ú	arguments)r3   Údescriptionr6   Úhelp_categoryÚpreserve_descriptionÚargument_groups)r   r%   Úcollectionsr   Útypingr   r   Úuaclientr   r   Úuaclient.apir   Úuaclient.api.apir   Úuaclient.cli.commandsr	   r
   r   Úuaclient.cli.parserr   r   r0   ÚCLI_ROOT_APIÚCLI_API_DESCÚOTHERÚCLI_API_ENDPOINTÚCLI_API_SHOW_PROGRESSÚCLI_API_ARGSÚCLI_API_DATAÚapi_commandr   r   r   r   Ú<module>   s\    ýýûüîÿÿ
ù