Package ganeti :: Package rapi :: Module baserlib :: Class ResourceBase
[hide private]
[frames] | no frames]

Class ResourceBase

source code


Generic class for resources.

Instance Methods [hide private]
 
__init__(self, items, queryargs, req, _client_cls=None)
Generic resource constructor.
source code
 
_GetRequestBody(self)
Returns the body data.
source code
 
_checkIntVariable(self, name, default=0)
Return the parsed value of an int argument.
source code
 
_checkStringVariable(self, name, default=None)
Return the parsed value of a string argument.
source code
 
getBodyParameter(self, name, *args)
Check and return the value for a given parameter.
source code
 
useLocking(self)
Check if the request specifies locking.
source code
 
useBulk(self)
Check if the request specifies bulk querying.
source code
 
useForce(self)
Check if the request specifies a forced operation.
source code
 
dryRun(self)
Check if the request specifies dry-run mode.
source code
 
GetClient(self)
Wrapper for luxi.Client with HTTP-specific error handling.
source code
string
SubmitJob(self, op, cl=None)
Generic wrapper for submit job, for better http compatibility.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  GET_ACCESS = []
  PUT_ACCESS = [rapi.RAPI_ACCESS_WRITE]
  POST_ACCESS = [rapi.RAPI_ACCESS_WRITE]
  DELETE_ACCESS = [rapi.RAPI_ACCESS_WRITE]
  request_body = property(fget= _GetRequestBody)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, items, queryargs, req, _client_cls=None)
(Constructor)

source code 

Generic resource constructor.

Parameters:
  • items - a list with variables encoded in the URL
  • queryargs - a dictionary with additional options from URL
  • req - Request context
  • _client_cls - luxi client class (unittests only)
Overrides: object.__init__

getBodyParameter(self, name, *args)

source code 

Check and return the value for a given parameter.

If a second parameter is not given, an error will be returned, otherwise this parameter specifies the default value.

Parameters:
  • name - the required parameter

SubmitJob(self, op, cl=None)

source code 

Generic wrapper for submit job, for better http compatibility.

Parameters:
  • op (list) - the list of opcodes for the job
  • cl (None or luxi.Client) - optional luxi client to use
Returns: string
the job ID