§
    ÎÑßj¥  ã                   ó$  — d Z ddlZddlmZ ddlmZmZ ddlmZ g d¢Z	dZ
 G d„ d	e¦  «        Z G d
„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ d¦  «        ZdS )z 
Gandi Live driver base classes
é    N)Úhttplib)ÚJsonResponseÚConnectionKey)ÚProviderError)	ÚAPI_HOSTÚGandiLiveBaseErrorÚJsonParseErrorÚResourceNotFoundErrorÚInvalidRequestErrorÚResourceConflictErrorÚGandiLiveResponseÚGandiLiveConnectionÚBaseGandiLiveDriverzdns.api.gandi.netc                   ó   — e Zd ZdZdS )r   z/
    Exception class for Gandi Live driver
    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úN/opt/saltstack/salt/lib/python3.11/site-packages/libcloud/common/gandi_live.pyr   r   (   s   € € € € € ðð ð 	€Dr   r   c                   ó   — e Zd ZdS )r	   N©r   r   r   r   r   r   r	   r	   0   ó   € € € € € Ø€Dr   r	   c                   ó   — e Zd ZdS )r
   Nr   r   r   r   r
   r
   ;   r   r   r
   c                   ó   — e Zd ZdS )r   Nr   r   r   r   r   r   M   r   r   r   c                   ó   — e Zd ZdS )r   Nr   r   r   r   r   r   d   r   r   r   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )r   z:
    A Base Gandi Live Response class to derive from.
    c                 ó   — dS )zÚ
        Determine if our request was successful.

        For the Gandi Live response class, tag all responses as successful and
        raise appropriate Exceptions from parse_body.

        :return: C{True}
        Tr   )Úselfs    r   ÚsuccesszGandiLiveResponse.successm   s	   € ð ˆtr   c                 ó:  — d}	 t          j        | j        ¦  «        }n# t          $ r | j        }d}Y nw xY wt          j        t          j        g}| j        |v r|rt          || j        ¦  «        ‚|S | j        t          j	        k    r,t          |¦  «        dk    rd}t          || j        ¦  «        ‚i S | j        t          j        k    r+|                      ||¦  «        }t          || j        ¦  «        ‚| j        t          j        k    r+|                      ||¦  «        }t!          || j        ¦  «        ‚| j        t          j        k    r+|                      ||¦  «        }t%          || j        ¦  «        ‚|                      ||¦  «        }t          || j        ¦  «        ‚)z‘
        Parse the JSON response body, or raise exceptions as appropriate.

        :return:  JSON dictionary
        :rtype:   ``dict``
        FTr   z'"No Content" response contained content)ÚjsonÚloadsÚbodyÚ	Exceptionr   ÚOKÚCREATEDÚstatusr	   Ú
NO_CONTENTÚlenr   Ú	NOT_FOUNDÚ
_get_errorr
   ÚBAD_REQUESTr   ÚCONFLICTr   )r    Ú
json_errorr%   Úvalid_http_codesÚmsgÚmessages         r   Ú
parse_bodyzGandiLiveResponse.parse_bodyy   s’  € ð ˆ
ð	Ý”:˜dœiÑ(Ô(ˆDˆDøÝð 	ð 	ð 	ð ”9ˆDØˆJˆJˆJð	øøøõ ŒJÝŒOð
Ðð Œ;Ð*Ð*Ð*Øð Ý$ T¨4¬;Ñ7Ô7Ð7à�ØŒ[�GÔ.Ò.Ð.õ �4‰yŒy˜1Š}ˆ}Ø?�Ý(¨¨d¬kÑ:Ô:Ð:à�	ØŒ[�GÔ-Ò-Ð-Ø—o’o d¨JÑ7Ô7ˆGÝ'¨°´Ñ=Ô=Ð=ØŒ[�GÔ/Ò/Ð/Ø—o’o d¨JÑ7Ô7ˆGÝ% g¨t¬{Ñ;Ô;Ð;ØŒ[�GÔ,Ò,Ð,Ø—o’o d¨JÑ7Ô7ˆGÝ'¨°´Ñ=Ô=Ð=à—o’o d¨JÑ7Ô7ˆGÝ$ W¨d¬kÑ:Ô:Ð:s   „ ž4³4c                 ó"  — |sŠd|v r†d                      |d         |d         ¦  «        }d|v r_|d         d         }d                      ||                     d¦  «        |                     d¦  «        |                     d	¦  «        ¦  «        }n|}|S )
a5  
        Get the error code and message from a JSON response.

        Incorporate the first error if there are multiple errors.

        :param  body: The body of the JSON response dictionary
        :type   body: ``dict``

        :return:  String containing error message
        :rtype:   ``str``
        Úcausez{}: {}r3   Úerrorsr   z{} ({} in {}: {})ÚlocationÚnameÚdescription)ÚformatÚget)r    r%   r0   r3   Úerrs        r   r-   zGandiLiveResponse._get_errorÄ   s˜   € ð ð 	˜g¨˜o˜oØ—o’o d¨7¤m°T¸)´_ÑEÔEˆGØ˜4ÐÐØ˜8”n QÔ'�Ø-×4Ò4ØØ—G’G˜JÑ'Ô'Ø—G’G˜F‘O”OØ—G’G˜MÑ*Ô*ñ	ô �øð ˆGàˆr   N)r   r   r   r   r!   r4   r-   r   r   r   r   r   h   sL   € € € € € ðð ð
ð 
ð 
ð.;ð .;ð .;ðVð ð ð ð r   r   c                   ó&   — e Zd ZdZeZeZd„ Zd„ Z	dS )r   z4
    Connection class for the Gandi Live driver
    c                 ó$   — d|d<   | j         |d<   |S )z:
        Returns default headers as a dictionary.
        zapplication/jsonzContent-Typez	X-Api-Key)Úkey)r    Úheaderss     r   Úadd_default_headersz'GandiLiveConnection.add_default_headersè   s   € ð #5ˆ�ÑØ#œxˆ�ÑØˆr   c                 ó*   — t          j        |¦  «        S )zEncode data to JSON)r#   Údumps)r    Údatas     r   Úencode_datazGandiLiveConnection.encode_datað   s   € åŒz˜$ÑÔÐr   N)
r   r   r   r   r   ÚresponseClsr   ÚhostrB   rF   r   r   r   r   r   à   sH   € € € € € ðð ð $€KØ€Dðð ð ð ð  ð  ð  ð  r   r   c                   ó   — e Zd ZdZeZdZdS )r   z 
    Gandi Live base driver
    Ú	GandiLiveN)r   r   r   r   r   ÚconnectionClsr9   r   r   r   r   r   õ   s$   € € € € € ðð ð (€MØ€D€D€Dr   r   )r   r#   Úlibcloud.utils.py3r   Úlibcloud.common.baser   r   Úlibcloud.common.typesr   Ú__all__r   r   r	   r
   r   r   r   r   r   r   r   r   ú<module>rP      sÓ  ððð ð €€€à &Ð &Ð &Ð &Ð &Ð &Ø <Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø /Ð /Ð /Ð /Ð /Ð /ð
ð 
ð 
€ð €ð	ð 	ð 	ð 	ð 	˜ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	Ð'ñ 	ô 	ð 	ð	ð 	ð 	ð 	ð 	Ð.ñ 	ô 	ð 	ð$	ð 	ð 	ð 	ð 	Ð,ñ 	ô 	ð 	ð.	ð 	ð 	ð 	ð 	Ð.ñ 	ô 	ð 	ðuð uð uð uð u˜ñ uô uð uðp ð  ð  ð  ð  ˜-ñ  ô  ð  ð*ð ð ð ð ñ ô ð ð ð r   