o
    i                     @   sD   d dl Z d dlmZ d dlmZ d dlmZmZ G dd deZ	dS )    N)pretty_json)api)report_errorsreport_warningsc                   @   s0   e Zd Zedd Zedd Zedd ZdS )
HostClientc                 C   s   |j ddd}|jddd}d|_|j dd	d}|jd
dd |jddd d |jddd d |jdddd |j| jd |j ddd}|jd
dd |j| jd d S )NhostzMute, unmute hosts)helpVerbsverb)titledestTmutezMute a host	host_namezhost to mutez--endzHPOSIX timestamp, if omitted, host will be muted until explicitly unmuted)r   defaultz	--messagez0string to associate with the muting of this hostz
--overridezZtrue/false, if true and the host is already muted, will overwrite existing end on the host
store_true)r   action)funcunmutezUnmute a host)
add_parseradd_subparsersrequiredadd_argumentset_defaults_mute_unmute)cls
subparsersparserverb_parsersmute_parserunmute_parser r!   I/home/ubuntu/.local/lib/python3.10/site-packages/datadog/dogshell/host.pysetup_parser   s$   zHostClient.setup_parserc                 C   sd   |j t_|j}tjj|j|j|j|j	d}t
| t| |dkr)tt| d S tt| d S )N)endmessageoverridepretty)timeoutr   _timeoutformatHostr   r   r$   r%   r&   r   r   printr   jsondumpsr   argsr*   resr!   r!   r"   r   '   s   zHostClient._mutec                 C   sV   |j t_|j}tj|j}t| t| |dkr"t	t
| d S t	t| d S )Nr'   )r(   r   r)   r*   r+   r   r   r   r   r,   r   r-   r.   r/   r!   r!   r"   r   3   s   zHostClient._unmuteN)__name__
__module____qualname__classmethodr#   r   r   r!   r!   r!   r"   r      s    

r   )
r-   datadog.util.formatr   datadogr   datadog.dogshell.commonr   r   objectr   r!   r!   r!   r"   <module>   s
   