3 fY4 @sdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl m Z y ddlZWnek redYnXejeZGd d d ejZGd d d eZGd ddeZdS)a Kubernetes First version Generated by: https://github.com/swagger-api/swagger-codegen Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. )absolute_importN)PY3) urlencode) configurationz'Swagger python client requires urllib3.c@s&eZdZddZddZdddZdS) RESTResponsecCs"||_|j|_|j|_|j|_dS)N)urllib3_responsestatusreasondata)selfresprG/Users/olari/OneDrive/sandbox/awsBlog2/lambda/kubernetes/client/rest.py__init__/szRESTResponse.__init__cCs |jjS)z? Returns a dictionary of the response headers. )r getheaders)r rrrr5szRESTResponse.getheadersNcCs|jj||S)z2 Returns a given response header. )r getheader)r namedefaultrrrr;szRESTResponse.getheader)N)__name__ __module__ __qualname__rrrrrrrr-src@sjeZdZdefddZdddZddd Zdd d Zdd d ZdddZ dddZ dddZ dddZ dS)RESTClientObjectcCs|jrtj}ntj}|jr"|j}ntj}|j}|j}|||||d}|j dk rZ|j |d<|j dk rn|j |d<|j dk rt j |j f||_nt jf||_dS)N) num_pools cert_reqsca_certs cert_filekey_filemaxsizeassert_hostname) verify_sslssl CERT_REQUIRED CERT_NONE ssl_ca_certcertifiwhererrconnection_pool_maxsizer http_proxy_urlurllib3proxy_from_url pool_manager PoolManager)r Z pools_sizeconfigrrrrkwargsrrrrDs,     zRESTClientObject.__init__NTc Cs|j}|d$kst|r$|r$td|p*i}|p2i}d } |rt|trJtfnttfrbtj|d } n,t|t rt |d krtj|d |d d} d|krd|d<yb|d%kr|r|dt |7}|ddkrt|t sd|d<d } |rt j|} |jj||| || |d} ntjd|dtjrRd } |r8t j|} |jj||| || |d} n|ddkr||jj|||d|| |d} nj|ddkr|d=|jj|||d|| |d} n:t|tr|} |jj||| || |d} nd} td | dn|jj||||| |d} WnJtjjk rL} z(djt| jt| } td | dWYd d } ~ XnX|r~t| } trp| jjd| _tjd | j| j t!d!d"krt| d#| S)&a :param method: http request method :param url: http request url :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` :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. GETHEADDELETEPOSTPUTPATCHOPTIONSz9body parameter cannot be used with post_params parameter.N)totalrr)connectreadz Content-Typezapplication/json?zapplication/json-patch+jsonz&application/strategic-merge-patch+json)bodypreload_contenttimeoutheadersjsonz!application/x-www-form-urlencodedF)fieldsencode_multipartr=r>r?zmultipart/form-dataTzwCannot prepare a request message for provided arguments. Please check that your arguments match declared content type.)r r )rAr=r>r?z{0} {1}utf8zresponse body: %s) http_resp)r0r1r2r3r4r5r6)r3r4r5r6r2)"upperAssertionError ValueError isinstancerintlongr*Timeouttuplelenrlistr@dumpsr,requestresearch IGNORECASEstr ApiException exceptionsSSLErrorformattyperrr decodeloggerdebugr range)r methodurl query_paramsr?r< post_params_preload_content_request_timeoutr>Z request_bodyrmsgerrrrRvs                  zRESTClientObject.requestcCs|jd|||||dS)Nr0)r?rdrerb)rR)r rar?rbrdrerrrr0s zRESTClientObject.GETcCs|jd|||||dS)Nr1)r?rdrerb)rR)r rar?rbrdrerrrr1s zRESTClientObject.HEADc Cs|jd|||||||dS)Nr6)r?rbrcrdrer<)rR)r rar?rbrcr<rdrerrrr6szRESTClientObject.OPTIONSc Cs|jd||||||dS)Nr2)r?rbrdrer<)rR)r rar?rbr<rdrerrrr2s zRESTClientObject.DELETEc Cs|jd|||||||dS)Nr3)r?rbrcrdrer<)rR)r rar?rbrcr<rdrerrrr3szRESTClientObject.POSTc Cs|jd|||||||dS)Nr4)r?rbrcrdrer<)rR)r rar?rbrcr<rdrerrrr4!szRESTClientObject.PUTc Cs|jd|||||||dS)Nr5)r?rbrcrdrer<)rR)r rar?rbrcr<rdrerrrr5+szRESTClientObject.PATCH)NNNNTN)NNTN)NNTN)NNNNTN)NNNTN)NNNNTN)NNNNTN)NNNNTN) rrrrrrRr0r1r6r2r3r4r5rrrrrBs$2 |      rc@seZdZdddZddZdS)rWNcCsD|r(|j|_|j|_|j|_|j|_n||_||_d|_d|_dS)N)r r r r<rr?)r r r rFrrrr8s zApiException.__init__cCs@dj|j|j}|jr&|dj|j7}|jr<|dj|j7}|S)z5 Custom error messages for exception z({0}) Reason: {1} zHTTP response headers: {0} zHTTP response body: {0} )rZr r r?r<)r error_messagerrr__str__Ds  zApiException.__str__)NNN)rrrrrjrrrrrW6s rW)__doc__ __future__rior@loggingrSr"r&sixrsix.moves.urllib.parserrr* ImportError getLoggerrr]IOBaserobjectr ExceptionrWrrrrs&      u