
    ?g                        d dl Z d dlZd dlZd dlm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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!e      Z G d" d#e      Zy)$    N)ApiExceptionc                 B   t        j                         \  }}}dj                  t        j                  |            }	 t        t        t        t        t        t        t        t        t        t        t        t         dj#                  | j$                  t&              | |      S )z
    Returns the proper Exception class for the given kubernetes.client.rest.ApiException object
    https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#success-codes
    
)i  i  i  i  i  i  i  i  i  i  i  i  )sysexc_infojoin	traceback	format_tbBadRequestErrorUnauthorizedErrorForbiddenErrorNotFoundErrorMethodNotAllowedErrorConflictError	GoneErrorUnprocessibleEntityErrorTooManyRequestsErrorInternalServerErrorServiceUnavailableErrorServerTimeoutErrorgetstatusDynamicApiError)e_exc_tracebacktbs       R/var/www/openai/venv/lib/python3.12/site-packages/kubernetes/dynamic/exceptions.pyapi_exceptionr      s}    
 ,,.Aq-	9&&}5	6B%"%! $ 
c!((O$Q, ,    c                   $    e Zd ZdZddZd Zd Zy)r   z* Generic API Error for the dynamic client Nc                     |j                   | _         |j                  | _        |j                  | _        |j                  | _        || _        y N)r   reasonbodyheadersoriginal_traceback)selfr   r   s      r   __init__zDynamicApiError.__init__/   s6    hhhhFF	yy"$r    c                    t        | j                        dj                  | j                        g}| j                  r*|j                  dj                  | j                               | j                  r*|j                  dj                  | j                               | j                  r*|j                  dj                  | j                               dj                  |      S )Nz
Reason: {}zHTTP response headers: {}zHTTP response body: {}zOriginal traceback: 
{}r   )	strr   formatr$   r&   appendr%   r'   r   )r(   error_messages     r   __str__zDynamicApiError.__str__6   s    T[[)<+>+>t{{+KL<<  !<!C!CDLL!QR99  !9!@!@!KL""  !;!B!B4CZCZ![\yy''r    c                 6   | j                   rh| j                  rP| j                  j                  d      dk(  r2t        j                  | j                         j                  d      }|r|S | j                   S dj                  | j                  | j                        S )NzContent-Typezapplication/jsonmessagez{} Reason: {})r%   r&   r   jsonloadsr,   r   r$   )r(   r1   s     r   summaryzDynamicApiError.summaryC   sq    99|| 0 0 @DV V**TYY/33I>"N99"))$++t{{CCr    r#   )__name__
__module____qualname____doc__r)   r/   r4    r    r   r   r   -   s    4%(	Dr    r   c                       e Zd ZdZy)ResourceNotFoundErrorz* Resource was not found in available APIs Nr5   r6   r7   r8   r9   r    r   r;   r;   N   s    4r    r;   c                       e Zd ZdZy)ResourceNotUniqueErrorz1 Parameters given matched multiple API resources Nr<   r9   r    r   r>   r>   P   s    ;r    r>   c                       e Zd ZdZy)KubernetesValidateMissingz& kubernetes-validate is not installed Nr<   r9   r    r   r@   r@   S   s    0r    r@   c                       e Zd ZdZy)r   z 400: StatusBadRequest Nr<   r9   r    r   r   r   W   s    !r    r   c                       e Zd ZdZy)r   z 401: StatusUnauthorized Nr<   r9   r    r   r   r   Y   s    #r    r   c                       e Zd ZdZy)r   z 403: StatusForbidden Nr<   r9   r    r   r   r   [   s     r    r   c                       e Zd ZdZy)r   z 404: StatusNotFound Nr<   r9   r    r   r   r   ]       r    r   c                       e Zd ZdZy)r   z 405: StatusMethodNotAllowed Nr<   r9   r    r   r   r   _   s    'r    r   c                       e Zd ZdZy)r   z 409: StatusConflict Nr<   r9   r    r   r   r   a   rE   r    r   c                       e Zd ZdZy)r   z 410: StatusGone Nr<   r9   r    r   r   r   c   s    r    r   c                       e Zd ZdZy)r   z  422: StatusUnprocessibleEntity Nr<   r9   r    r   r   r   e   s    *r    r   c                       e Zd ZdZy)r   z 429: StatusTooManyRequests Nr<   r9   r    r   r   r   g   s    &r    r   c                       e Zd ZdZy)r   z 500: StatusInternalServer Nr<   r9   r    r   r   r   i   s    %r    r   c                       e Zd ZdZy)r   z 503: StatusServiceUnavailable Nr<   r9   r    r   r   r   k   s    )r    r   c                       e Zd ZdZy)r   z 504: StatusServerTimeout Nr<   r9   r    r   r   r   m   s    $r    r   )r2   r   r	   kubernetes.client.restr   r   r   	Exceptionr;   r>   r@   r   r   r   r   r   r   r   r   r   r   r   r   r9   r    r   <module>rP      s     
  /,.Dl DB5I 5<Y <1	 1"o "$ $!_ ! O  (O ( O   + +'? '&/ &*o *% %r    