o
    i
                     @   sP   d dl mZ d dlmZmZmZmZ G dd deeZG dd deeeeZdS )    )urlparse)CreateableAPIResourceActionAPIResourceGetableAPIResourceListableAPIResourcec                       8   e Zd ZdZdZe fddZe fddZ  ZS )Graphz*
    A wrapper around Graph HTTP API.
    zgraph/snapshotc                    s   t t| jdddi|S )a  
        Take a snapshot of a graph, returning the full url to the snapshot.

        :param metric_query: metric query
        :type metric_query: string query

        :param start: query start timestamp
        :type start: POSIX timestamp

        :param end: query end timestamp
        :type end: POSIX timestamp

        :param event_query: a query that will add event bands to the graph
        :type event_query: string query

        :returns: Dictionary representing the API's JSON response
        methodGETN )superr   create)clsparams	__class__r   F/home/ubuntu/.local/lib/python3.10/site-packages/datadog/api/graphs.pyr      s   zGraph.createc                    s>   t |j}|dd dd }d|}tt| d|S )a  
        Returns the status code of snapshot. Can be used to know when the
        snapshot is ready for download.

        :param snapshot_url: snapshot URL to check
        :type snapshot_url: string url

        :returns: Dictionary representing the API's JSON response
        z/snapshot/view/   z.pngr   zgraph/snapshot_status/{0}r
   )r   pathsplitformatr   r   _trigger_action)r   snapshot_url	snap_pathsnapshot_status_urlr   r   r   status$   s   

zGraph.status)	__name__
__module____qualname____doc___resource_nameclassmethodr   r   __classcell__r   r   r   r   r      s    r   c                       r   )Embedz*
    A wrapper around Embed HTTP API.
    zgraph/embedc                       t t| jd|ddS )z
        Enable a specified embed.

        :param embed_id: embed token
        :type embed_id: string embed token

        :returns: Dictionary representing the API's JSON response
        r
   enableidaction_namer   r#   _trigger_class_actionr   embed_idr   r   r   r%   >      
zEmbed.enablec                    r$   )z
        Revoke a specified embed.

        :param embed_id: embed token
        :type embed_id: string embed token

        :returns: Dictionary representing the API's JSON response
        r
   revoker&   r)   r+   r   r   r   r.   J   r-   zEmbed.revoke)	r   r   r   r   r    r!   r%   r.   r"   r   r   r   r   r#   7   s    r#   N)	datadog.util.compatr   datadog.api.resourcesr   r   r   r   r   r#   r   r   r   r   <module>   s   /