o
    €Ïä  ã                   @   sÜ  d Z G dd„ deƒZG dd„ deeƒZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZ	G dd„ de	ƒZ
G dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZe
eeeedœZG dd„ deƒZG dd„ deeƒZG dd„ deƒZG d d!„ d!eƒZG d"d#„ d#eƒZG d$d%„ d%eƒZG d&d'„ d'eƒZG d(d)„ d)eƒZG d*d+„ d+eƒZG d,d-„ d-eƒZG d.d/„ d/eƒZG d0d1„ d1eƒZG d2d3„ d3e	ƒZG d4d5„ d5e	ƒZG d6d7„ d7eƒZG d8d9„ d9eƒZd:S );z*Exceptions for generated client libraries.c                   @   ó   e Zd ZdZdS )ÚErrorzBase class for all exceptions.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   úD/tmp/google-cloud-sdk/lib/third_party/apitools/base/py/exceptions.pyr      ó    r   c                   @   r   )ÚTypecheckErrorz+An object of an incorrect type is provided.Nr   r   r   r   r	   r      r
   r   c                   @   r   )ÚNotFoundErrorz(A specified resource could not be found.Nr   r   r   r   r	   r      r
   r   c                   @   r   )Ú	UserErrorz,Base class for errors related to user input.Nr   r   r   r   r	   r   #   r
   r   c                   @   r   )ÚInvalidDataErrorz&Base class for any invalid data error.Nr   r   r   r   r	   r   (   r
   r   c                   @   r   )ÚCommunicationErrorz1Any communication error talking to an API server.Nr   r   r   r   r	   r   -   r
   r   c                       sP   e Zd ZdZ	d‡ fdd„	Zdd„ Zedd„ ƒZed	d
„ ƒZ	e
dd„ ƒZ‡  ZS )Ú	HttpErrorz-Error making a request. Soon to be HttpError.Nc                    s@   t  |||¡}tt | ƒ |¡ || _|| _|| _|| _|| _d S ©N)	r   Ú_build_messageÚsuperÚ__init__ÚresponseÚcontentÚurlÚmethod_configÚrequest)Úselfr   r   r   r   r   Úerror_message©Ú	__class__r   r	   r   6   s   
zHttpError.__init__c                 C   s   t  | j| j| j¡S r   )r   r   r   r   r   ©r   r   r   r	   Ú__str__@   s   zHttpError.__str__c                 C   s$   t |tƒr| dd¡}d|| |f S )NÚasciiÚreplacez6HttpError accessing <%s>: response: <%s>, content <%s>)Ú
isinstanceÚbytesÚdecode)r   r   r   r   r   r	   r   C   s
   
ÿzHttpError._build_messagec                 C   s   t | jd ƒS ©NÚstatus)Úintr   r   r   r   r	   Ústatus_codeJ   s   zHttpError.status_codec                 K   sR   zt |j d¡ƒ}t || ¡}W n ty   | }Y nw ||j|j|jfi |¤ŽS r%   )r'   ÚinfoÚgetÚ_HTTP_ERRORSÚ
ValueErrorr   Úrequest_url)ÚclsÚhttp_responseÚkwargsr(   Ú	error_clsr   r   r	   ÚFromResponseP   s   ÿ
ÿÿzHttpError.FromResponse)NN)r   r   r   r   r   r   Ústaticmethodr   Úpropertyr(   Úclassmethodr2   Ú__classcell__r   r   r   r	   r   2   s    ÿ


r   c                   @   r   )ÚHttpBadRequestErrorzHTTP 400 Bad Request.Nr   r   r   r   r	   r7   [   ó    r7   c                   @   r   )ÚHttpUnauthorizedErrorzHTTP 401 Unauthorized.Nr   r   r   r   r	   r9   _   r8   r9   c                   @   r   )ÚHttpForbiddenErrorzHTTP 403 Forbidden.Nr   r   r   r   r	   r:   c   r8   r:   c                   @   r   )ÚHttpNotFoundErrorzHTTP 404 Not Found.Nr   r   r   r   r	   r;   g   r8   r;   c                   @   r   )ÚHttpConflictErrorzHTTP 409 Conflict.Nr   r   r   r   r	   r<   k   r8   r<   )i  i‘  i“  i”  i™  c                   @   r   )ÚInvalidUserInputErrorzUser-provided input is invalid.Nr   r   r   r   r	   r=   x   r
   r=   c                   @   r   )ÚInvalidDataFromServerErrorz+Data received from the server is malformed.Nr   r   r   r   r	   r>   }   r
   r>   c                   @   r   )Ú
BatchErrorz3Error generated while constructing a batch request.Nr   r   r   r   r	   r?   ‚   r
   r?   c                   @   r   )ÚConfigurationErrorz$Base class for configuration errors.Nr   r   r   r   r	   r@   ‡   r
   r@   c                   @   r   )ÚGeneratedClientErrorz.The generated client configuration is invalid.Nr   r   r   r   r	   rA   Œ   r
   rA   c                   @   r   )ÚConfigurationValueErrorz@Some part of the user-specified client configuration is invalid.Nr   r   r   r   r	   rB   ‘   r
   rB   c                   @   r   )ÚResourceUnavailableErrorz'User requested an unavailable resource.Nr   r   r   r   r	   rC   –   r
   rC   c                   @   r   )ÚCredentialsErrorz&Errors related to invalid credentials.Nr   r   r   r   r	   rD   ›   r
   rD   c                   @   r   )ÚTransferErrorzErrors related to transfers.Nr   r   r   r   r	   rE       r
   rE   c                   @   r   )ÚTransferRetryErrorz&Retryable errors related to transfers.Nr   r   r   r   r	   rF   ¥   r
   rF   c                   @   r   )ÚTransferInvalidErrorzThe given transfer is invalid.Nr   r   r   r   r	   rG   ª   r
   rG   c                   @   r   )ÚRequestErrorzThe request was not successful.Nr   r   r   r   r	   rH   ¯   r
   rH   c                       s,   e Zd ZdZ‡ fdd„Zedd„ ƒZ‡  ZS )ÚRetryAfterErrorz,The response contained a retry-after header.c                    s*   t t| ƒj|||fi |¤Ž t|ƒ| _d S r   )r   rI   r   r'   Úretry_after)r   r   r   r   rJ   r0   r   r   r	   r   ¸   s   zRetryAfterError.__init__c                 K   s   | |j |j|j|jfi |¤ŽS r   )r)   r   r-   rJ   )r.   r/   r0   r   r   r	   r2   ¼   s
   
ÿþzRetryAfterError.FromResponse)r   r   r   r   r   r5   r2   r6   r   r   r   r	   rI   ´   s
    rI   c                   @   r   )ÚBadStatusCodeErrorz5The request completed but returned a bad status code.Nr   r   r   r   r	   rK   Ã   r
   rK   c                   @   r   )ÚNotYetImplementedErrorz*This functionality is not yet implemented.Nr   r   r   r   r	   rL   È   r
   rL   c                   @   r   )ÚStreamExhaustedz?Attempted to read more bytes from a stream than were available.Nr   r   r   r   r	   rM   Í   r
   rM   N) r   Ú	Exceptionr   Ú	TypeErrorr   r   r   r   r   r   r7   r9   r:   r;   r<   r+   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rK   rL   rM   r   r   r   r	   Ú<module>   sF   )û	