/usr/lib/python2.6/site-packages/cinderclient/openstack/common/apiclient
NameSizeModeActions
auth.py70380644editdlrm
auth.pyc87270644editdlrm
base.py159280644editdlrm
base.pyc200660644editdlrm
client.py127320644editdlrm
client.pyc127530644editdlrm
exceptions.py119130644editdlrm
exceptions.pyc197950644editdlrm
fake_client.py58520644editdlrm
fake_client.pyc61740644editdlrm
__init__.py00644editdlrm
__init__.pyc1800644editdlrm
Edit: /usr/lib/python2.6/site-packages/cinderclient/openstack/common/apiclient/client.pyc (12753B)
Ñò =vVc @s»dZddkZddkZyddkZWnej oddkZnXddkZddklZddk l Z ei e ƒZ defd„ƒYZdefd„ƒYZdS( sC OpenStack Client interface. Handles the REST calls and responses. iÿÿÿÿN(t exceptions(t importutilst HTTPClientc BsžeZdZdZdddeddededdd„ Zd„Zd„Z d„Z d„Z d„Z d „Z ed „ƒZd „Zd „Zd „ZRS(sËThis client handles sending HTTP requests to OpenStack servers. Features: - share authentication information between several clients to different services (e.g., for compute and image clients); - reissue authentication request for expired tokens; - encode/decode JSON bodies; - raise exceptions on HTTP errors; - pluggable authentication; - store authentication information in a keyring; - store time spent for requests; - register clients for particular services, so one can use `http_client.identity` or `http_client.compute`; - log requests and responses in a format that is easy to copy-and-paste into terminal and send the same request with curl. s'cinderclient.openstack.common.apiclientt publicURLc Cs™||_||_||_||_||_||_||_| |_| |_| p|i |_ g|_ ||_ | p t i ƒ|_d|_dS(N(t auth_plugint endpoint_typet region_namet original_ipttimeouttverifytcertt keyring_savertdebugt user_agentttimesttimingstrequeststSessionthttptNonet cached_token( tselfRRRRR R RRR R R R((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyt__init__As           cCs¤|ipdSdd|d|g}x7|dD]+}d||d|f}|i|ƒq1Wtiddi|ƒƒd|jotid |dƒndS( Nscurl -is-X '%s's'%s'theaderss -H '%s: %s'sREQ: %st tdatas REQ BODY: %s (R tappendt_loggertjoin(Rtmethodturltkwargst string_partstelementtheader((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyt _http_log_reqds    cCsM|ipdStid|i|iƒ|iotid|iƒndS(NsRESP: [%s] %s sRESP BODY: %s (R Rt status_codeRt_content_consumedttext(Rtresp((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyt_http_log_respvs   cCsd|idƒdj o)d|dd>> def test_clients(): ... from keystoneclient.auth import keystone ... from openstack.common.apiclient import client ... auth = keystone.KeystoneAuthPlugin( ... username="user", password="pass", tenant_name="tenant", ... auth_url="http://auth:5000/v2.0") ... openstack_client = client.HTTPClient(auth) ... # create nova client ... from novaclient.v1_1 import client ... client.Client(openstack_client) ... # create keystone client ... from keystoneclient.v2_0 import client ... client.Client(openstack_client) ... # use them ... openstack_client.identity.tenants.list() ... openstack_client.compute.servers.list() N(R;thasattrtsetattr(Rtbase_client_instanceR;((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyt add_clients cCs2|ii|ƒ|io|ii|ƒndS(N(RR@R tsave(R((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyR@#s N(t__name__t __module__t__doc__R RRAR=RR#R(R-R.R/R3t staticmethodR:RJRNR@(((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyR-s.     ) A t BaseClientcBszeZdZd Zd Zd Zd d„Zd„Zd„Z d„Z d„Z d„Z d„Z d„Zed „ƒZRS( s¼Top-level object to access the OpenStack API. This client uses :class:`HTTPClient` to send requests. :class:`HTTPClient` will handle a bunch of issues such as authentication. cCs`||_|i|ƒ|o?x<|D]0}|io t||i|i|ƒƒq$q$WndS(N(t http_clientRNt manager_classRLtname(RRUt extensionst extension((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyR5s    cKs|ii||||S(N(RURJ(RRRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyRJ@s cKs|id||S(NtHEAD(RJ(RRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pytheadDscKs|id||S(NtGET(RJ(RRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyR*GscKs|id||S(NtPOST(RJ(RRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pytpostJscKs|id||S(NtPUT(RJ(RRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pytputMscKs|id||S(NtDELETE(RJ(RRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pytdeletePscKs|id||S(NtPATCH(RJ(RRR((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pytpatchSscCsny|t|ƒ}WnJttfj o8d||di|iƒƒf}ti|ƒ‚nXti|ƒS(s@Returns the client class for the requested API version :param api_name: the name of the API, e.g. 'compute', 'image', etc :param version: the requested API version :param version_map: a dict of client classes keyed by version :rtype: a client class for the requested API version s2Invalid %s client version '%s'. must be one of: %ss, ( tstrR,t ValueErrorRtkeysRtUnsupportedVersionRt import_class(tapi_nametversiont version_mapt client_pathtmsg((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyt get_classVs N(RPRQRRRR;RR<RRJR[R*R^R`RbRdRSRo(((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyRT*s       (RRtloggingR2t simplejsonR)t ImportErrorRt'cinderclient.openstack.common.apiclientRtcinderclient.openstack.commonRt getLoggerRPRtobjectRRT(((s[/tmp/pip-build-cD3xZi/python-cinderclient/cinderclient/openstack/common/apiclient/client.pyts   ý