o
    Á¿i  ã                   @   s<   d dl mZmZmZ G dd„ deƒZG dd„ deeeƒZdS )é    )ÚActionAPIResourceÚSearchableAPIResourceÚListableAPIResourcec                       s8   e Zd ZdZdZe‡ fdd„ƒZe‡ fdd„ƒZ‡  ZS )ÚHostz)
    A wrapper around Host HTTP API.
    Úhostc                    s   t t| ƒjdd|fi |¤ŽS )aì  
        Mute a host.

        :param host_name: hostname
        :type host_name: string

        :param end: timestamp to end muting
        :type end: POSIX timestamp

        :param override: if true and the host is already muted, will override         existing end on the host
        :type override: bool

        :param message: message to associate with the muting of this host
        :type message: string

        :returns: Dictionary representing the API's JSON response

        ÚPOSTÚmute©Úsuperr   Ú_trigger_class_action)ÚclsÚ	host_nameÚbody©Ú	__class__© úE/home/ubuntu/.local/lib/python3.10/site-packages/datadog/api/hosts.pyr      s   z	Host.mutec                    s   t t| ƒ dd|¡S )z¨
        Unmute a host.

        :param host_name: hostname
        :type host_name: string

        :returns: Dictionary representing the API's JSON response

        r   Úunmuter	   )r   r   r   r   r   r   %   s   zHost.unmute)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_resource_nameÚclassmethodr   r   Ú__classcell__r   r   r   r   r      s    r   c                       sH   e Zd ZdZdZe‡ fdd„ƒZe‡ fdd„ƒZe‡ fdd„ƒZ‡  Z	S )	ÚHostsz*
    A wrapper around Hosts HTTP API.
    Úhostsc                    s   t t| ƒjdi |¤ŽS )aQ  
        Search among hosts live within the past 2 hours. Max 100
        results at a time.

        :param filter: query to filter search results
        :type filter: string

        :param sort_field: "status", "apps", "cpu", "iowait", or "load"
        :type sort_field: string

        :param sort_dir: "asc" or "desc"
        :type sort_dir: string

        :param start: host result to start at
        :type start: integer

        :param count: number of host results to return
        :type count: integer

        :returns: Dictionary representing the API's JSOn response

        Nr   )r
   r   Ú_search©r   Úparamsr   r   r   Úsearch:   s   zHosts.searchc                    s   t t| ƒjdi |¤ŽS )zþ
        Get total number of hosts active and up.

        :param from_: Number of seconds since UNIX epoch from which you want to search your hosts.
        :type from_: integer

        :returns: Dictionary representing the API's JSON response
        ÚGETÚtotalsN)r!   r"   )r
   r   r   r   r   r   r   r"   T   s   
zHosts.totalsc                    sH   dD ]}||v rt || tƒrd || ¡||< qtt| ƒjdi |¤ŽS )aŽ  
        Get all hosts.

        :param filter: query to filter search results
        :type filter: string

        :param sort_field: field to sort by
        :type sort_field: string

        :param sort_dir: Direction of sort. Options include asc and desc.
        :type sort_dir: string

        :param start: Specify the starting point for the host search results.
            For example, if you set count to 100 and the first 100 results have already been returned,
            you can set start to 101 to get the next 100 results.
        :type start: integer

        :param count: number of hosts to return. Max 1000.
        :type count: integer

        :param from_: Number of seconds since UNIX epoch from which you want to search your hosts.
        :type from_: integer

        :param include_muted_hosts_data: Include data from muted hosts.
        :type include_muted_hosts_data: boolean

        :param include_hosts_metadata: Include metadata from the hosts
            (agent_version, machine, platform, processor, etc.).
        :type include_hosts_metadata: boolean

        :returns: Dictionary representing the API's JSON response
        )Úfilterú,Nr   )Ú
isinstanceÚlistÚjoinr
   r   Úget_all)r   r   Úparamr   r   r   r(   `   s
   #€zHosts.get_all)
r   r   r   r   r   r   r    r"   r(   r   r   r   r   r   r   3   s    r   N)Údatadog.api.resourcesr   r   r   r   r   r   r   r   r   Ú<module>   s   ,