Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
³EYc@s~dZddlZddlZddlmZddlZddlmZddlm	Z	ddl
mZddl
mZd„Z
d	efd
„ƒYZdefd„ƒYZejejƒd
efd„ƒYƒZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdeefd„ƒYZdeefd„ƒYZdeefd„ƒYZdS(sG
Base utilities to build API operation managers and objects on top of.
iÿÿÿÿN(tResponse(tparse(t
exceptions(tencodeutils(tstrutilscCsLy|jr|jSWntk
r'nXy|jSWntk
rG|SXdS(s³Return id if argument is a Resource.

    Abstracts the common pattern of allowing both an object or an object's ID
    (UUID) as a parameter when dealing with relationships.
    N(tuuidtAttributeErrortid(tobj((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytgetid&s	

t
HookableMixincBs2eZdZiZed„ƒZed„ƒZRS(s,Mixin so classes can register and run hooks.cCs7||jkrg|j|<n|j|j|ƒdS(sÂAdd a new hook of specified type.

        :param cls: class that registers hooks
        :param hook_type: hook type, e.g., '__pre_parse_args__'
        :param hook_func: hook function
        N(t
_hooks_maptappend(tclst	hook_typet	hook_func((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytadd_hook<scOs:|jj|ƒpg}x|D]}|||ŽqWdS(sRun all hooks of specified type.

        :param cls: class that registers hooks
        :param hook_type: hook type, e.g., '__pre_parse_args__'
        :param **args: args to be passed to every hook function
        :param **kwargs: kwargs to be passed to every hook function
        N(Rtget(R
Rtargstkwargst
hook_funcsR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt	run_hooksIs	
(t__name__t
__module__t__doc__RtclassmethodRR(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR
8s
tBaseManagercBsqeZdZd	Zd„Zd	d	d„Zd„Zd„Ze	d„Z
d	d	d„Zd	d	d„Zd„Z
RS(
s´Basic manager type providing common operations.

    Managers interact with a particular type of API (servers, flavors, images,
    etc.) and provide CRUD operations for them.
    cCs tt|ƒjƒ||_dS(s{Initializes BaseManager with `client`.

        :param client: instance of BaseClient descendant for HTTP requests
        N(tsuperRt__init__tclient(tselfR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR_scCsµ|r'|jj|d|ƒjƒ}n|jj|ƒjƒ}|dkrW|j}n||}y|d}Wnttfk
rˆnXg|D]!}|r|||dtƒ^qS(s·List the collection.

        :param url: a partial URL, e.g., '/servers'
        :param response_key: the key to be looked up in response dictionary,
            e.g., 'servers'
        :param obj_class: class for constructing the returned objects
            (self.resource_class will be used by default)
        :param json: data that will be encoded as JSON and passed in POST
            request (GET will be sent by default)
        tjsontvaluestloadedN(	RtpostRRtNonetresource_classtKeyErrort	TypeErrortTrue(Rturltresponse_keyt	obj_classRtbodytdatatres((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_listgs!
cCs2|jj|ƒjƒ}|j|||dtƒS(sÄGet an object from collection.

        :param url: a partial URL, e.g., '/servers'
        :param response_key: the key to be looked up in response dictionary,
            e.g., 'server'
        R!(RRRR$R'(RR(R)R+((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_get„scCs|jj|ƒ}|jdkS(seRetrieve request headers for an object.

        :param url: a partial URL, e.g., '/servers'
        iÌ(Rtheadtstatus_code(RR(tresp((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_headŽscCs@|jj|d|ƒjƒ}|r,||S|j|||ƒS(s¬Create an object.

        :param url: a partial URL, e.g., '/servers'
        :param json: data that will be encoded as JSON and passed in POST
            request (GET will be sent by default)
        :param response_key: the key to be looked up in response dictionary,
            e.g., 'servers'
        :param return_raw: flag to force returning raw JSON instead of
            Python object of self.resource_class
        R(RR"RR$(RR(RR)t
return_rawR+((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_post–scCsd|jj|d|ƒ}|jr`|jƒ}|dk	rM|j|||ƒS|j||ƒSndS(sDUpdate an object with PUT method.

        :param url: a partial URL, e.g., '/servers'
        :param json: data that will be encoded as JSON and passed in POST
            request (GET will be sent by default)
        :param response_key: the key to be looked up in response dictionary,
            e.g., 'servers'
        RN(RtputtcontentRR#R$(RR(RR)R2R+((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_put¦s		cCsR|jj|d|ƒjƒ}|dk	r>|j|||ƒS|j||ƒSdS(sFUpdate an object with PATCH method.

        :param url: a partial URL, e.g., '/servers'
        :param json: data that will be encoded as JSON and passed in POST
            request (GET will be sent by default)
        :param response_key: the key to be looked up in response dictionary,
            e.g., 'servers'
        RN(RtpatchRR#R$(RR(RR)R+((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_patch¸s	cCs|jj|ƒS(sYDelete an object.

        :param url: a partial URL, e.g., '/servers/my-server'
        (Rtdelete(RR(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_deleteÇsN(RRRR#R$RR.R/R3tFalseR5R8R:R<(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRWs		
	tManagerWithFindcBs2eZdZejd„ƒZd„Zd„ZRS(s5Manager with additional `find()`/`findall()` methods.cCsdS(N((R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytlistÓscKsv|j|}t|ƒ}|dkrOd|jj|f}tj|ƒ‚n#|dkrjtjƒ‚n|dSdS(s¨Find a single item with attributes matching ``**kwargs``.

        This isn't very efficient: it loads the entire list then filters on
        the Python side.
        isNo %s matching %s.iN(tfindalltlenR$RRtNotFoundt
NoUniqueMatch(RRtmatchestnum_matchestmsg((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytfind×scstg}|jƒ}x[|jƒD]M‰y0t‡fd†|DƒƒrT|jˆƒnWqtk
rkqqXqW|S(s¤Find all items with attributes matching ``**kwargs``.

        This isn't very efficient: it loads the entire list then filters on
        the Python side.
        c3s*|] \}}tˆ|ƒ|kVqdS(N(tgetattr(t.0tattrtvalue(R(sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pys	<genexpr>òs(titemsR?tallRR(RRtfoundtsearches((RsP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR@çs

(RRRtabctabstractmethodR?RGR@(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR>Ïs	tCrudManagercBs€eZdZdZdZdd„Zd„Zd„Zd„Z	d„Z
dd„Zdd„Zd„Z
d	„Zdd
„ZRS(sBase manager class for manipulating entities.

    Children of this class are expected to define a `collection_key` and `key`.

    - `collection_key`: Usually a plural noun by convention (e.g. `entities`);
      used to refer collections in both URL's (e.g.  `/v3/entities`) and JSON
      objects containing a list of member resources (e.g. `{'entities': [{},
      {}, {}]}`).
    - `key`: Usually a singular noun by convention (e.g. `entity`); used to
      refer to an individual member of the collection.

    cKs`|dk	r|nd}|d|j7}|jd|jƒ}|dk	r\|d|7}n|S(sBuilds a resource URL for the given kwargs.

        Given an example collection where `collection_key = 'entities'` and
        `key = 'entity'`, the following URL's could be generated.

        By default, the URL will represent a collection of entities, e.g.::

            /entities

        If kwargs contains an `entity_id`, then the URL will represent a
        specific member, e.g.::

            /entities/{entity_id}

        :param base_url: if provided, the generated URL will be appended to it
        ts/%ss%s_idN(R#tcollection_keyRtkey(Rtbase_urlRR(t	entity_id((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt	build_urlscCsvxo|jƒjƒD][\}}|dkr;|j|ƒqt|tƒr|j|ƒt|ƒ|d|<qqW|S(s Drop null values and handle ids.s%s_idN(tcopyRLR#tpopt
isinstancetResourceR	(RRRUtref((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt_filter_kwargs's
cKs8|j|ƒ}|j|j|i||j6|jƒS(N(R^R5RXRU(RR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytcreate2s

cKs+|j|ƒ}|j|j||jƒS(N(R^R/RXRU(RR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR9scKs%|j|ƒ}|j|j|ƒS(N(R^R3RX(RR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR0?scKs\|j|ƒ}|jdi|jd||d6|rJdtj|ƒndd6|jƒS(smList the collection.

        :param base_url: if provided, the generated URL will be appended to it
        s%(base_url)s%(query)sRVs?%sRStquery(R^R.RXRt	urlencodeRT(RRVR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR?Cs!cKs+|j|ƒ}|j|jd||ƒS(skUpdate an element.

        :param base_url: if provided, the generated URL will be appended to it
        RV(R^R8RX(RRVR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR6QscKsX|j|ƒ}|jƒ}|jd|jƒ|j|j|i||j6|jƒS(Ns%s_id(R^RYRZRUR:RX(RRtparams((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytupdateZs
cKs%|j|ƒ}|j|j|ƒS(N(R^R<RX(RR((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR;dscKsÅ|j|ƒ}|jdi|jd||d6|rJdtj|ƒndd6|jƒ}t|ƒ}|dkr¡d|jj|f}t	j
d|ƒ‚n |d	kr¹t	j‚n|dSd
S(s’Find a single item with attributes matching ``**kwargs``.

        :param base_url: if provided, the generated URL will be appended to it
        s%(base_url)s%(query)sRVs?%sRSR`isNo %s matching %s.i”iN(R^R.RXRRaRTRAR$RRRBRC(RRVRtrltnumRF((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRGjs!N(RRRR#RTRURXR^R_RR0R?R6RcR;RG(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRRûs						
	t	ExtensioncBs5eZdZdZdZd„Zd„Zd„ZRS(sExtension descriptor.t__pre_parse_args__t__post_parse_args__cCs3tt|ƒjƒ||_||_|jƒdS(N(RRfRtnametmodulet_parse_extension_module(RRiRj((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRˆs		cCs…d|_xu|jjjƒD]a\}}||jkrJ|j||ƒqyt|tƒrh||_nWqt	k
r|qXqWdS(N(
R#t
manager_classRjt__dict__RLtSUPPORTED_HOOKSRt
issubclassRR&(Rt	attr_namet
attr_value((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRkŽs	
cCsd|jS(Ns<Extension '%s'>(Ri(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt__repr__šs(s__pre_parse_args__s__post_parse_args__N(	RRRRnR#RlRRkRr(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRf‚s		tRequestIdMixincBs8eZdZd„Zed„ƒZd„Zd„ZRS(s=Wrapper class to expose x-openstack-request-id to the caller.cCs
g|_dS(N(tx_openstack_request_ids(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytsetup scCs|jS(N(Rt(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytrequest_ids£scCsQ|dkrdSt|tƒr@x+|D]}|j|ƒq&Wn
|j|ƒdS(slAdd request_ids as an attribute to the object

        :param resp: list, Response object or string
        N(R#R[R?t_append_request_id(RR2tresp_obj((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytappend_request_ids§s
cCsHt|tƒr4|jjdƒ}|jj|ƒn|jj|ƒdS(Nsx-openstack-request-id(R[RtheadersRRtR(RR2t
request_id((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRw·s(RRRRutpropertyRvRyRw(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRsžs
		R\cBs˜eZdZeZdZedd„Zd„Ze	d„ƒZ
d„Zd„Ze	d„ƒZ
d„Zd	„Zd
„Zd„Zd„Zd
„ZRS(sqBase class for OpenStack resources (tenant, user, etc.).

    This is pretty much just a bag for attributes.
    RicCsp||_||_|j|ƒ||_|rUt|dƒrU|jjdƒ|_n|jƒ|j	|ƒdS(s
Populate and bind to a manager.

        :param manager: BaseManager object
        :param info: dictionary representing resource attributes
        :param loaded: prevent lazy-loading if set to True
        :param resp: Response or list of Response objects
        RztEtagN(
tmanagert_infot_add_detailst_loadedthasattrRzRt	_checksumRuRy(RR~tinfoR!R2((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRËs		
	
csRtd„ˆjjƒDƒƒ}dj‡fd†|Dƒƒ}dˆjj|fS(Ncss1|]'}|ddkr|dkr|VqdS(it_R~RtN(smanagersx_openstack_request_ids((RItk((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pys	<genexpr>Ýss, c3s(|]}d|tˆ|ƒfVqdS(s%s=%sN(RH(RIR†(R(sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pys	<genexpr>áss<%s %s>(tsortedRmtkeystjoint	__class__R(RtreprkeysR„((RsP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRrÜs	cCs8|j|jkr4|jr4tjt||jƒƒSdS(sAHuman-readable ID which can be used for bash completion.
        N(t	NAME_ATTRRmtHUMAN_IDRtto_slugRHR#(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pythuman_idäscCs‚x{|jƒD]m\}}yt|||ƒWn=tk
rCq
n*tk
rlt|tj|ƒ|ƒnX||j|<q
WdS(N(RLtsetattrRtUnicodeEncodeErrorRtsafe_encodeR(RR„R†tv((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR€ìs

cCsy||jks||jkrP|jƒsA|jƒ|j|ƒSt|ƒ‚n%||jkrj|j|S|j|SdS(N(RmRt	is_loadedRt__getattr__R(RR†((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR•÷s

cCs
|jjS(N(R~tapi_version(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR–scCsU|jtƒt|jdƒs#dS|jj|jƒ}|rQ|j|jƒndS(NR(t
set_loadedR'R‚R~RRR€R(Rtnew((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyRs
cCs9t|tƒstSt||jƒs)tS|j|jkS(N(R[R\tNotImplementedRŠR=R(Rtother((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt__eq__s
cCs|j|ƒS(N(R›(RRš((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt__ne__scCs|jS(N(R(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR”scCs
||_dS(N(R(Rtval((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR— scCstj|jƒS(N(RYtdeepcopyR(R((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pytto_dict#sN(RRRR=RRŒR#RRrR|RR€R•R–RR›RœR”R—RŸ(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR\Âs			
	
				tListWithMetacBseZd„ZRS(cCs1tt|ƒj|ƒ|jƒ|j|ƒdS(N(RR RRuRy(RR R2((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR(s
(RRR(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR 'stDictWithMetacBseZd„ZRS(cCs1tt|ƒj|ƒ|jƒ|j|ƒdS(N(RR¡RRuRy(RR R2((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR/s
(RRR(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR¡.st
TupleWithMetacBseZd„Zd„ZRS(cCstt|ƒj||ƒS(N(RR¢t__new__(R
R R2((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR£6scCs|jƒ|j|ƒdS(N(RuRy(RR R2((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR9s
(RRR£R(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyR¢5s	(RRPRYtrequestsRtsixtsix.moves.urllibRtcinderclient.apiclientRt
oslo_utilsRRR	tobjectR
Rt
add_metaclasstABCMetaR>RRRfRsR\R?R tdictR¡ttupleR¢(((sP/home/tvault/.virtenv/lib/python2.7/site-packages/cinderclient/apiclient/base.pyt<module>s(	x+‡$e