Package ganeti :: Package rapi :: Module connector
[hide private]
[frames] | no frames]

Module connector

source code

Remote API connection map.

Classes [hide private]
  Mapper
Map resource to method.
  UriPattern
Functions [hide private]
 
_ConvertPattern(value)
Converts URI pattern into a regular expression group.
source code
 
_CompileHandlerPath(*args)
Compiles path for RAPI resource into regular expression.
source code
dict
GetHandlers(node_name_pattern, instance_name_pattern, group_name_pattern, network_name_pattern, job_id_pattern, disk_pattern, query_res_pattern, translate=None)
Returns all supported resources and their handlers.
source code
Variables [hide private]
  _NAME_PATTERN = r"[\w\._-]+"
  _DISK_PATTERN = r"\d+"
  CONNECTOR = {}

Imports: re, urlparse, constants, http, utils, rlib2


Function Details [hide private]

_ConvertPattern(value)

source code 

Converts URI pattern into a regular expression group.

Used by _CompileHandlerPath.

_CompileHandlerPath(*args)

source code 

Compiles path for RAPI resource into regular expression.

Returns:
Compiled regular expression object

GetHandlers(node_name_pattern, instance_name_pattern, group_name_pattern, network_name_pattern, job_id_pattern, disk_pattern, query_res_pattern, translate=None)

source code 

Returns all supported resources and their handlers.

node_name_pattern and the other *_pattern parameters are wrapped in UriPattern and, if used in a URI, passed to the function specified using translate. translate receives 1..N parameters which are either plain strings or instances of UriPattern and returns a dictionary key suitable for the caller of GetHandlers. The default implementation in _CompileHandlerPath returns a compiled regular expression in which each pattern is a group.

Returns: dict