File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/libcloud/common/__pycache__/gandi_live.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlmZ ddlmZmZ ddlmZ g d�Z dZ G dd � d e�ZG d d� de�ZG dd � d e�Z G dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� d�ZdS )z Gandi Live driver base classes � N)�httplib)�JsonResponse� ConnectionKey)� ProviderError) �API_HOST�GandiLiveBaseError�JsonParseError�ResourceNotFoundError�InvalidRequestError�ResourceConflictError�GandiLiveResponse�GandiLiveConnection�BaseGandiLiveDriverzdns.api.gandi.netc @ s e Zd ZdZdS )r z/ Exception class for Gandi Live driver N)�__name__� __module__�__qualname__�__doc__� r r �N/opt/saltstack/salt/lib/python3.10/site-packages/libcloud/common/gandi_live.pyr ( s r c @ � e Zd ZdS )r N�r r r r r r r r 0 � r c @ r )r Nr r r r r r ; r r c @ r )r Nr r r r r r M r r c @ r )r Nr r r r r r d r r c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) r z: A Base Gandi Live Response class to derive from. c C s dS )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 )�selfr r r �successm s zGandiLiveResponse.successc C s d}zt �| j�}W n ty | j}d}Y nw tjtjg}| j|v r.|r,t|| j��|S | jtj krDt |�dkrBd}t|| j��i S | jtjkrV| � ||�}t|| j��| jtjkrh| � ||�}t|| j��| jtjkrz| � ||�}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 Zvalid_http_codes�msg�messager r r � parse_bodyy s<