/usr/lib/python2.6/site-packages/openstackclient/api
Edit: /usr/lib/python2.6/site-packages/openstackclient/api/api.pyc (9571B)
Ñò
;vVc @ sr d Z d d k Z d d k l Z d d k l Z d d k l Z d e f d „ ƒ YZ
d e
f d „ ƒ YZ d S( s Base API LibraryiÿÿÿÿN( t
exceptions( t sessiont KeystoneSessionc B s) e Z d Z d d d „ Z d d „ Z RS( så Wrapper for the Keystone Session
Restore some requests.session.Session compatibility;
keystoneclient.session.Session.request() has the method and url
arguments swapped from the rest of the requests-using world.
c K s) t t | ƒ i ƒ | | _ | | _ d S( s? Base object that contains some common API objects and methods
:param Session session:
The default session to be used for making the HTTP API calls.
:param string endpoint:
The URL from the Service Catalog to be used as the base for API
requests on this API.
N( t superR t __init__R t endpoint( t selfR R t kwargs( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyR s c K s“ | p
| i } n | p t i ƒ } n | i oK | o. d i | i i d ƒ | i d ƒ g ƒ } q€ | i i d ƒ } n | i | | | S( s Perform call into session
All API calls are funneled through this method to provide a common
place to finalize the passed URL and other things.
:param string method:
The HTTP method name, i.e. ``GET``, ``PUT``, etc
:param string url:
The API-specific portion of the URL path
:param Session session:
HTTP client session
:param kwargs:
keyword arguments passed to requests.request().
:return: the requests.Response object
t /( R t ksc_sessiont SessionR t joint rstript lstript request( R t methodt urlR R ( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyt _request5 s
.N( t __name__t
__module__t __doc__t NoneR R ( ( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyR s t BaseAPIc B s€ e Z d Z d d d d „ Z d d d „ Z d d „ Z d d e d „ Z d d d d „ Z d „ Z
d „ Z d d d „ Z RS(
s Base APIc K s, t t | ƒ i d | d | ƒ | | _ d S( sš Base object that contains some common API objects and methods
:param Session session:
The default session to be used for making the HTTP API calls.
:param string service_type:
API name, i.e. ``identity`` or ``compute``
:param string endpoint:
The URL from the Service Catalog to be used as the base for API
requests on this API.
R R N( R R R t service_type( R R R R R ( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyR X s c K sX | p
d } n | i | | d | | } y | i ƒ SWn t i j
o | SXd S( sô Create a new resource
:param string url:
The API-specific portion of the URL path
:param Session session:
HTTP client session
:param string method:
HTTP method (default POST)
t POSTR N( R t jsont JSONDecodeError( R R R R t paramst ret( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyt createp s
c K s | i d | | S( s« Delete a resource
:param string url:
The API-specific portion of the URL path
:param Session session:
HTTP client session
t DELETE( R ( R R R R ( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyt deleteŠ s c K s– | o" d i | i d ƒ d g ƒ } n | o" | i d | d | d | ƒ} n | i d | d | ƒ} y | i ƒ SWn t i j
o | SXd S( s_ Return a list of resources
GET ${ENDPOINT}/${PATH}?${PARAMS}
path is often the object's plural resource type
:param string path:
The API-specific portion of the URL path
:param Session session:
HTTP client session
:param body: data that will be encoded as JSON and passed in POST
request (GET will be sent by default)
:param bool detailed:
Adds '/details' to path for some APIs to return extended attributes
:returns:
JSON-decoded response, could be a list or a dict-wrapped-list
R t detailsR R R t GETN( R R R R R ( R t pathR t bodyt detailedR R ( ( sG /tmp/pip-build-cD3xZi/python-openstackclient/openstackclient/api/api.pyt listš s "
c s$ | d j o
d } n ˆ d j o
ˆ ‰ n ‡ ‡ ‡ f d † } h | | 6} | | ƒ } t | ƒ t j o | St | ƒ d j o | d St | ƒ d j o&