
    :gc                         d Z ddlmZ ddlZddlZddlmZ ddlZddlZddl	m
Z
 ddlZddlZddlZddlZddlmZ ddlmZ ddlZddlmZ dd	lmZ  G d
 de      Zy)z
    Kubernetes

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: release-1.32
    Generated by: https://openapi-generator.tech
    )absolute_importN)parse)
ThreadPool)quote)Configuration)rest)ApiValueErrorc            	          e Zd ZdZeeeej                  fej                  z   Z
eej                  reneeeeej                   ej                  edZdZ	 	 ddZd Zd Zd Zed        Zed	        Zej6                  d
        Zd Z	 	 	 	 	 ddZd Zd Zd Z 	 	 	 	 	 ddZ!	 	 	 d dZ"d Z#d!dZ$d Z%d Z&d Z'd Z(d Z)d Z*d Z+d Z,d Z-y)"	ApiClientay  Generic API client for OpenAPI client library builds.

    OpenAPI generic API client. This client handles the client-
    server communication, and is invariant across implementations. Specifics of
    the methods and models for each application are generated from the OpenAPI
    templates.

    NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech
    Do not edit the class manually.

    :param configuration: .Configuration object for this client
    :param header_name: a header to pass when making calls to the API.
    :param header_value: a header value to pass when making calls to
        the API.
    :param cookie: a cookie to include in the header when making calls
        to the API
    :param pool_threads: The number of threads to use for async requests
        to the API. More threads means more concurrent API requests.
    )intlongfloatstrbooldatedatetimeobjectNc                     |t        j                         }|| _        || _        t	        j
                  |      | _        i | _        ||| j                  |<   || _        d| _	        |j                  | _
        y )NzOpenAPI-Generator/32.0.0/python)r   get_default_copyconfigurationpool_threadsr   RESTClientObjectrest_clientdefault_headerscookie
user_agentclient_side_validation)selfr   header_nameheader_valuer   r   s         Q/var/www/openai/venv/lib/python3.12/site-packages/kubernetes/client/api_client.py__init__zApiClient.__init__D   ss     )::<M*(00?!"0<D  -;&3&J&J#    c                     | S N r   s    r!   	__enter__zApiClient.__enter__T   s    r#   c                 $    | j                          y r%   )close)r   exc_type	exc_value	tracebacks       r!   __exit__zApiClient.__exit__W   s    

r#   c                     | j                   rl| j                   j                          | j                   j                          d | _         t        t        d      r t	        j
                  | j                         y y y )N
unregister)_poolr*   joinhasattratexitr0   r'   s    r!   r*   zApiClient.closeZ   sT    ::JJJJOODJv|,!!$**- -	 r#   c                     | j                   9t        j                  | j                         t	        | j
                        | _         | j                   S )zrCreate thread pool on first request
         avoids instantiating unused threadpool for blocking clients.
        )r1   r4   registerr*   r   r   r'   s    r!   poolzApiClient.poolb   s:    
 ::OODJJ'#D$5$56DJzzr#   c                      | j                   d   S )zUser agent for this API client
User-Agentr   r'   s    r!   r   zApiClient.user_agentl   s     ##L11r#   c                 "    || j                   d<   y )Nr9   r:   r   values     r!   r   zApiClient.user_agentq   s    -2\*r#   c                 "    || j                   |<   y r%   r:   )r   r   r    s      r!   set_default_headerzApiClient.set_default_headeru   s    ,8[)r#   c           
         | j                   }|xs i }|j                  | j                         | j                  r| j                  |d<   |r,| j	                  |      }t        | j                  ||            }|r`| j	                  |      }| j                  ||      }|D ]8  \  }}|j                  d|z  t        t        |      |j                              }: |r#| j	                  |      }| j                  ||      }|s|rI|r|ng }| j	                  |      }| j                  ||      }|j                  | j                  |             | j                  |||
       |r| j	                  |      }|| j                   j                  |z   }n||z   }| j                  ||||||||      }|| _        |}|r|	r| j#                  ||	      }nd }|r|S ||j$                  |j'                         fS )NCookiez{%s})safe)query_paramsheaderspost_paramsbody_preload_content_request_timeout)r   updater   r   sanitize_for_serializationdictparameters_to_tuplesreplacer   r   safe_chars_for_path_paramextendfiles_parametersupdate_params_for_authhostrequestlast_responsedeserializestatus
getheaders)r   resource_pathmethodpath_paramsrC   header_paramsrF   rE   filesresponse_typeauth_settings_return_http_data_onlycollection_formatsrG   rH   _hostconfigkvurlresponse_datareturn_datas                         r!   
__call_apizApiClient.__call_apix   s$    ## &+T112;;&*kkM(# ;;MJM !:!:=;M"O PM 99+FK33K4FHK#1 - 5 5QJ#a&v'G'GH! $ ::<HL44\5GIL %)4+"K99+FK33K4FHKt44U;< 	##M<O 2248D =$$))M9C -'C ClM#$--	 % / +#"..}mL"! !5!5!,,.0 0r#   c           	          |yt        | j                        r|S t        |t              r|D cg c]  } j                  |       c}S t        |t              rt	         fd|D              S t        |t
        j
                  t
        j                  f      r|j                         S t        |t              r|}nUt        j                  |j                        D ci c]+  \  }}t        ||      |j                  |   t        ||      - }}}t        j                  |      D ci c]  \  }}| j                  |       c}}S c c}w c c}}w c c}}w )a  Builds a JSON POST object.

        If obj is None, return None.
        If obj is str, int, long, float, bool, return directly.
        If obj is datetime.datetime, datetime.date
            convert to string in iso8601 format.
        If obj is list, sanitize each element in the list.
        If obj is dict, return the dict.
        If obj is OpenAPI model, return the properties dict.

        :param obj: The data to serialize.
        :return: The serialized form of data.
        Nc              3   @   K   | ]  }j                  |        y wr%   )rJ   ).0sub_objr   s     r!   	<genexpr>z7ApiClient.sanitize_for_serialization.<locals>.<genexpr>   s$      -(+W 88A(+s   )
isinstancePRIMITIVE_TYPESlistrJ   tupler   r   	isoformatrK   six	iteritemsopenapi_typesgetattrattribute_map)r   objrl   obj_dictattr_keyvals   `       r!   rJ   z$ApiClient.sanitize_for_serialization   sV    ;T112JT"#&(#& 33G<#&( (U# -(+- - -h//?@==?"c4 H (+}}S5F5F'G;'GGD!"3-9 ))$/d1CC'G  ;
 !$h 79 7HC T44S99 79 	9)( ;9s   E
0E*Ec                     |dk(  r| j                  |      S 	 t        j                  |j                        }| j                  ||      S # t        $ r |j                  }Y )w xY w)a  Deserializes response into an object.

        :param response: RESTResponse object to be deserialized.
        :param response_type: class literal for
            deserialized object, or string of class name.

        :return: deserialized object.
        file)_ApiClient__deserialize_filejsonloadsdata
ValueError_ApiClient__deserialize)r   responser]   r   s       r!   rU   zApiClient.deserialize   sc     F"**844	!::hmm,D !!$66  	!==D	!s   A	 	A! A!c           	      z   |yt        |      t        k(  r|j                  d      rEt        j                  d|      j                  d      }|D cg c]  }| j                  ||       c}S |j                  d      r^t        j                  d|      j                  d      }t        j                  |      D ci c]  \  }}|| j                  ||       c}}S || j                  v r| j                  |   }n$t        t        j                  j                  |      }|| j                  v r| j                  ||      S |t         k(  r| j#                  |      S |t$        j&                  k(  r| j)                  |      S |t$        j$                  k(  r| j+                  |      S | j-                  ||      S c c}w c c}}w )zDeserializes dict, list, str into an object.

        :param data: dict, list or str.
        :param klass: class literal, or string of class name.

        :return: object.
        Nzlist[zlist\[(.*)\]   zdict(zdict\(([^,]*), (.*)\)   )typer   
startswithrematchgroupr   rs   rt   NATIVE_TYPES_MAPPINGrv   
kubernetesclientmodelsro   !_ApiClient__deserialize_primitiver   _ApiClient__deserialize_objectr   r   _ApiClient__deserialize_date _ApiClient__deserialize_datetime_ApiClient__deserialize_model)r   r   klasssub_klssub_datarc   rd   s          r!   __deserializezApiClient.__deserialize
  s    <;#(((?E:@@C(,.(,H **8W=(,. . (((#;UCII!L$'MM$$79$7DAq 4--a99$79 9 11111%8
 1 1 8 8%@D(((//e<<f_,,T22hmm#**400h'''..t44++D%88/.
9s   F2;F7c                     |s| j                  |||||||||	|
|||||      S | j                  j                  | j                   |||||||||	|
|||||f      S )a  Makes the HTTP request (synchronous) and returns deserialized data.

        To make an async_req request, set the async_req parameter.

        :param resource_path: Path to method endpoint.
        :param method: Method to call.
        :param path_params: Path parameters in the url.
        :param query_params: Query parameters in the url.
        :param header_params: Header parameters to be
            placed in the request header.
        :param body: Request body.
        :param post_params dict: Request post form parameters,
            for `application/x-www-form-urlencoded`, `multipart/form-data`.
        :param auth_settings list: Auth Settings names for the request.
        :param response: Response data type.
        :param files dict: key -> filename, value -> filepath,
            for `multipart/form-data`.
        :param async_req bool: execute request asynchronously
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param collection_formats: dict of collection formats for path, query,
            header, and post parameters.
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return:
            If async_req parameter is True,
            the request will be called asynchronously.
            The method will return the request thread.
            If parameter async_req is False or missing,
            then the method will return the response directly.
        )_ApiClient__call_apir7   apply_async)r   rX   rY   rZ   rC   r[   rF   rE   r\   r]   r^   	async_reqr_   r`   rG   rH   ra   s                    r!   call_apizApiClient.call_api1  s    T ??=&#.m#'e#0-#9;M#35EuN N yy$$T__}7={7C7Dd7BE7D7D7M7I7G7G7<7> ? 	?r#   c	           	      ,   |dk(  r | j                   j                  |||||      S |dk(  r | j                   j                  |||||      S |dk(  r | j                   j                  |||||      S |dk(  r"| j                   j	                  |||||||      S |dk(  r"| j                   j                  |||||||      S |d	k(  r"| j                   j                  |||||||      S |d
k(  r!| j                   j                  ||||||      S t        d      )z(Makes the HTTP request using RESTClient.GET)rC   rG   rH   rD   HEADOPTIONS)rC   rD   rG   rH   POST)rC   rD   rE   rG   rH   rF   PUTPATCHDELETE)rC   rD   rG   rH   rF   zQhttp method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`.)	r   r   r   r   r   r   r   r   r	   )	r   rY   re   rC   rD   rE   rF   rG   rH   s	            r!   rS   zApiClient.requestp  s    U?##''5A9I9I07	 ( 9 9
 v##((6B:J:J18	 ) : :
 y ##++C9E4;=M=M	 , O O
 v##((6B185@:J:J.2 ) 4 4 u_##''5A074?9I9I-1 ( 3 3 w##))#7C296A;K;K/3 * 5 5 x##**38D3:<L<L04 + 6 6  7 r#   c                 r   g }|i }t        |t              rt        j                  |      n|D ]  \  }|v ri|   }|dk(  r|j	                  fd|D               /|dk(  rd}n|dk(  rd}n
|dk(  rd}nd	}|j                  |j                  d
 |D              f       s|j                  |f        |S )a  Get parameters as list of tuples, formatting collections.

        :param params: Parameters as dict or list of two-tuples
        :param dict collection_formats: Parameter collection formats
        :return: Parameters as list of tuples, collections formatted
        multic              3   &   K   | ]  }|f 
 y wr%   r&   )rk   r=   rc   s     r!   rm   z1ApiClient.parameters_to_tuples.<locals>.<genexpr>  s     %@aUq%jas   ssv tsv	pipes|,c              3   2   K   | ]  }t        |        y wr%   )r   )rk   r=   s     r!   rm   z1ApiClient.parameters_to_tuples.<locals>.<genexpr>  s     *E1%3u:1s   )rn   rK   rs   rt   rO   appendr2   )r   paramsr`   
new_paramsrd   collection_format	delimiterrc   s          @r!   rL   zApiClient.parameters_to_tuples  s     
%!#-7-ECMM&)6QDAq&&$6q$9!$/%%%@a%@@(E1$'	*e3$(	*g5$'	$'	%%INN*E1*EEFH !!1a&)# R$ r#   c                    g }|rt        j                  |      D ]  \  }}|s	t        |      t        u r|n|g}|D ]  }t	        |d      5 }t
        j                  j                  |j                        }|j                         }	t        j                  |      d   xs d}
|j                  t        |t        ||	|
g      g             ddd         |S # 1 sw Y   xY w)zuBuilds form parameters.

        :param files: File parameters.
        :return: Form parameters with files.
        rbr   zapplication/octet-streamN)rs   rt   r   rp   openospathbasenamenameread	mimetypes
guess_typer   rq   )r   r\   r   rc   rd   
file_namesnffilenamefiledatamimetypes              r!   rP   zApiClient.files_parameters  s     e,1"&q'T/Qs
#Aa!#%77#3#3AFF#;#$668$-$8$8$B1$E %?$> !!1eXx,J&K"LMO ' $	 -  's   
A>CCc                 x    |sy|D cg c]  }|j                          }}d|v rydj                  |      S c c}w )zReturns `Accept` based on an array of accepts provided.

        :param accepts: List of headers.
        :return: Accept (e.g. application/json).
        Napplication/jsonz, )lowerr2   )r   acceptsxs      r!   select_header_acceptzApiClient.select_header_accept  sC     &-.g1779g.(%99W%% /s   7c                 h    |sy|D cg c]  }|j                          }}d|v sd|v ry|d   S c c}w )zReturns `Content-Type` based on an array of content_types provided.

        :param content_types: List of content-types.
        :return: Content-Type (e.g. application/json).
        r   z*/*r   )r   )r   content_typesr   s      r!   select_header_content_typez$ApiClient.select_header_content_type  sF     %,9:MqM:.%=2H% ## ;s   /c                    |sy|D ]  }| j                   j                         j                  |      }|s/|d   dk(  r	|d   |d<   @|d   dk(  r|d   ||d   <   T|d   dk(  r|j                  |d   |d   f       vt	        d	       y)
a  Updates header and query params based on authentication setting.

        :param headers: Header parameters dict to be updated.
        :param querys: Query parameters tuple list to be updated.
        :param auth_settings: Authentication setting identifiers list.
        Ninr   r=   rA   headerr|   queryz3Authentication token must be in `query` or `header`)r   r^   getr   r	   )r   rD   querysr^   authauth_settings         r!   rQ   z ApiClient.update_params_for_auth  s     !D--;;=AA$GL%1(4W(=GH%!$'833?3HGL/0!$'72MM<#6W8M"NO'M  "r#   c                    t        j                  | j                  j                        \  }}t	        j
                  |       t	        j                  |       |j                  d      }|rbt        j                  d|      j                  d      }t        j                  j                  t        j                  j                  |      |      }t        |d      5 }|j                  |j                          ddd       |S # 1 sw Y   |S xY w)zDeserializes body to file

        Saves response body into a file in a temporary folder,
        using the filename from the `Content-Disposition` header if provided.

        :param response:  RESTResponse.
        :return: file path.
        )dirzContent-Dispositionz filename=[\'"]?([^\'"\s]+)[\'"]?r   wbN)tempfilemkstempr   temp_folder_pathr   r*   remove	getheaderr   searchr   r   r2   dirnamer   writer   )r   r   fdr   content_dispositionr   r   s          r!   __deserialize_filezApiClient.__deserialize_file  s     ##(:(:(K(KLD

		$&001FGyy!D!466;eAh 77<< 5x@D$GGHMM"    s   C??D	c                 t    	  ||      S # t         $ r t        j                  |      cY S t        $ r |cY S w xY w)zDeserializes string to primitive type.

        :param data: str.
        :param klass: class literal.

        :return: int, long, float, str, bool.
        )UnicodeEncodeErrorrs   	text_type	TypeError)r   r   r   s      r!   __deserialize_primitivez!ApiClient.__deserialize_primitive1  s<    	;! 	'==&& 	K	s   
 7
77c                     |S )z<Return an original value.

        :return: object.
        r&   r<   s     r!   __deserialize_objectzApiClient.__deserialize_object@  s	    
 r#   c                     	 t        |      j                         S # t        $ r |cY S t        $ r' t	        j
                  ddj                  |            w xY w)zYDeserializes string to date.

        :param string: str.
        :return: date.
        r   z$Failed to parse `{0}` as date objectrV   reason)r   r   ImportErrorr   r   ApiExceptionformatr   strings     r!   __deserialize_datezApiClient.__deserialize_dateG  sZ    	=%%'' 	M 	##=DDVL 	s    A/Ac                     	 t        |      S # t        $ r |cY S t        $ r' t        j                  ddj                  |            w xY w)zDeserializes string to datetime.

        The string should be in iso8601 datetime format.

        :param string: str.
        :return: datetime.
        r   z(Failed to parse `{0}` as datetime objectr   )r   r   r   r   r   r   r   s     r!   __deserialize_datetimez ApiClient.__deserialize_datetimeW  sO    	=  	M 	##>VF^	 	s   
 A	/A	c                    |j                   st        |d      s|S i }||j                   vt        |t        t        f      r`t        j                  |j                         D ]>  \  }}|j                  |   |v s||j                  |      }| j                  ||      ||<   @  |di |}t        |d      r%|j                  |      }|r| j                  ||      }|S )zDeserializes list or dict to model.

        :param data: dict, list.
        :param klass: class literal.
        :return: model object.
        get_real_child_modelr&   )
ru   r3   rn   rp   rK   rs   rt   rw   r   r   )	r   r   r   kwargsrz   	attr_typer=   instance
klass_names	            r!   __deserialize_modelzApiClient.__deserialize_modell  s     ""753I,KK##/4$.#&==1D1D#Ei&&t,4 !4!4T!:;E#'#5#5eY#GF4L $F
 ?6?834!66t<J--dJ?r#   )NNNNr   )NNNNNNNNNNTNN)NNNNNNNNNNNTNN)NNNNTNr%   ).__name__
__module____qualname____doc__r   r   bytesrs   r   integer_typesro   r   PY3r   r   r   r   r   r   r1   r"   r(   r.   r*   propertyr7   r   setterr?   r   rJ   rU   r   r   rS   rL   rP   r   r   rQ   r   r   r   r   r   r   r&   r#   r!   r   r   !   sL   * dE3==9C<M<MMOwwD%%	 EJN+,K .   2 2 3 39 6:JN:><@@DP0d(9T7,%9P EI48CGAEEI=?~ ?C>B!%9v<0& $ 00 *r#   r   )r  
__future__r   r4   r   dateutil.parserr   r   r   multiprocessing.poolr   r   r   r   rs   six.moves.urllib.parser   kubernetes.client.configurationr   kubernetes.client.modelsr   kubernetes.clientr   kubernetes.client.exceptionsr	   r   r   r&   r#   r!   <module>r     sL    '   !   + 	 	   ( 9  " 6f	 f	r#   