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

Class OpcodeResource

source code


Base class for opcode-based RAPI resources.

Instances of this class automatically gain handler functions through _MetaOpcodeResource for any method for which a $METHOD$_OPCODE variable is defined at class level. Subclasses can define a Get$Method$OpInput method to do their own opcode input processing (e.g. for static values). The $METHOD$_RENAME variable defines which values are renamed (see baserlib.FillOpcode). Still default behavior cannot be totally overriden. There are opcode params that are available to all opcodes, e.g. "depends". In case those params (currently only "depends") are found in the original request's body, they are added to the dictionary of parsed parameters and eventually passed to the opcode. If the parsed body is not represented as a dictionary object, the values are not added.

Nested Classes [hide private]
  __metaclass__
Meta class for RAPI resources.
Instance Methods [hide private]
 
_ForbiddenHandler(self, method_fn, forbidden_params, rename_dict)
Examines provided parameters for forbidden values.
source code
 
_GetDefaultData(self) source code
 
_GetRapiOpName(self)
Extracts the name of the RAPI operation from the class name
source code
 
_GetCommonStatic(self)
Return the static parameters common to all the RAPI calls
source code
 
_GetDepends(self) source code
 
_GenericHandler(self, opcode, rename, fn) source code

Inherited from ResourceBase: GetClient, SubmitJob, __init__, dryRun, getBodyParameter, useBulk, useForce, useLocking

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

Class Variables [hide private]
  DELETE_FORBIDDEN
Set this to disable listed parameters and optionally specific values from being set through the DELETE handler (see baserlib.InspectParams)
  DELETE_OPCODE
Set this to a class derived from opcodes.OpCode to automatically generate a DELETE handler submitting the opcode
  DELETE_RENAME
Set this to rename parameters in the DELETE handler (see baserlib.FillOpcode)
  GET_ALIASES
Set this to duplicate return values in GET results (see baserlib.GetHandler)
  GET_FORBIDDEN
Set this to disable listed parameters and optionally specific values from being set through the GET handler (see baserlib.InspectParams)
  GET_OPCODE
Set this to a class derived from opcodes.OpCode to automatically generate a GET handler submitting the opcode
  GET_RENAME
Set this to rename parameters in the GET handler (see baserlib.FillOpcode)
  POST_FORBIDDEN
Set this to disable listed parameters and optionally specific values from being set through the POST handler (see baserlib.InspectParams)
  POST_OPCODE
Set this to a class derived from opcodes.OpCode to automatically generate a POST handler submitting the opcode
  POST_RENAME
Set this to rename parameters in the POST handler (see baserlib.FillOpcode)
  PUT_FORBIDDEN
Set this to disable listed parameters and optionally specific values from being set through the PUT handler (see baserlib.InspectParams)
  PUT_OPCODE
Set this to a class derived from opcodes.OpCode to automatically generate a PUT handler submitting the opcode
  PUT_RENAME
Set this to rename parameters in the PUT handler (see baserlib.FillOpcode)

Inherited from ResourceBase: DELETE_ACCESS, GET_ACCESS, POST_ACCESS, PUT_ACCESS, request_body

Instance Variables [hide private]
  GetDeleteOpInput
Define this to override the default method for getting opcode parameters (see baserlib.OpcodeResource._GetDefaultData)
  GetGetOpInput
Define this to override the default method for getting opcode parameters (see baserlib.OpcodeResource._GetDefaultData)
  GetPostOpInput
Define this to override the default method for getting opcode parameters (see baserlib.OpcodeResource._GetDefaultData)
  GetPutOpInput
Define this to override the default method for getting opcode parameters (see baserlib.OpcodeResource._GetDefaultData)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_GetCommonStatic(self)

source code 

Return the static parameters common to all the RAPI calls

The reason is a parameter present in all the RAPI calls, and the reason trail has to be build for all of them, so the parameter is read here and used to build the reason trail, that is the actual parameter passed forward.