Package Products :: Package Zuul :: Package routers :: Module service :: Class ServiceRouter
[hide private]
[frames] | no frames]

Class ServiceRouter

source code

ZenUtils.Ext.DirectRouter --+    
                            |    
                   TreeRouter --+
                                |
                               ServiceRouter

A JSON/ExtDirect interface to operations on services

Instance Methods [hide private]
 
__init__(self, context, request) source code
 
_getFacade(self)
Abstract method for child classes to use to get their facade
source code
 
_canDeleteUid(self, uid)
We can not delete top level UID's.
source code
 
getClassNames(self, uid=None, query=None) source code
DirectResponse
addClass(self, contextUid, id, posQuery=None)
Add a new service class.
source code
DirectResponse
query(self, limit=None, start=None, sort=None, dir=None, params=None, page=None, history=False, uid=None, criteria=())
Retrieve a list of services based on a set of parameters.
source code
[dictionary]
getTree(self, id)
Returns the tree structure of an organizer hierarchy.
source code
[dictionary]
getOrganizerTree(self, id)
Returns the tree structure of an organizer hierarchy, only including organizers.
source code
DirectResponse
getInfo(self, uid, keys=None)
Get the properties of a service.
source code
DirectResponse
setInfo(self, **data)
Set attributes on a service.
source code
DirectResponse
getInstances(self, uid, start=0, params=None, limit=50, sort='name', page=None, dir='ASC')
Get a list of instances for a service UID.
source code
DirectResponse
moveServices(self, sourceUids, targetUid)
Move service(s) from one organizer to another.
source code
DirectResponse
getUnmonitoredStartModes(self, uid)
Get a list of unmonitored start modes for a Windows service.
source code
DirectResponse
getMonitoredStartModes(self, uid, query='')
Get a list of monitored start modes for a Windows service.
source code

Inherited from TreeRouter: addNode, asyncGetTree, deleteNode, gunzip_b64, gzip_b64, moveOrganizer, objectExists

Method Details [hide private]

_getFacade(self)

source code 

Abstract method for child classes to use to get their facade

Overrides: TreeRouter._getFacade
(inherited documentation)

_canDeleteUid(self, uid)

source code 

We can not delete top level UID's. For example:

  • '/zport/dmd/Processes' this will return False (we can NOT delete)
  • '/zport/dmd/Processes/Child' will return True (we can delete this)
Overrides: TreeRouter._canDeleteUid
(inherited documentation)

addClass(self, contextUid, id, posQuery=None)

source code 

Add a new service class.

Parameters:
  • contextUid (string) - Unique ID of the service ogranizer to add new class to
  • id (string) - ID of the new service
  • posQuery (dictionary) - Object defining a query where the returned position will lie
Returns: DirectResponse
Properties:
  • newIndex: (integer) Index of the newly added class in the query defined by posQuery
Decorators:
  • @require('Manage DMD')

query(self, limit=None, start=None, sort=None, dir=None, params=None, page=None, history=False, uid=None, criteria=())

source code 

Retrieve a list of services based on a set of parameters.

Parameters:
  • limit (integer) - (optional) Number of items to return; used in pagination (default: None)
  • start (integer) - (optional) Offset to return the results from; used in pagination (default: None)
  • sort (string) - (optional) Key on which to sort the return results (default: None)
  • dir (string) - (optional) Sort order; can be either 'ASC' or 'DESC' (default: None)
  • params (dictionary) - (optional) Key-value pair of filters for this search.
  • history (boolean) - not used
  • uid (string) - Service class UID to query
  • criteria (list) - not used
Returns: DirectResponse
Properties:
  • services: ([dictionary]) List of objects representing services
  • totalCount: (integer) Total number of services
  • hash: (string) Hashcheck of the current services state
  • disabled: (boolean) True if current user cannot manage services

getTree(self, id)

source code 

Returns the tree structure of an organizer hierarchy.

Parameters:
  • id (string) - Id of the root node of the tree to be returned
Returns: [dictionary]
Object representing the tree

getOrganizerTree(self, id)

source code 

Returns the tree structure of an organizer hierarchy, only including organizers.

Parameters:
  • id (string) - Id of the root node of the tree to be returned
Returns: [dictionary]
Object representing the organizer tree

getInfo(self, uid, keys=None)

source code 

Get the properties of a service.

Parameters:
  • uid (string) - Unique identifier of a service
  • keys (list) - (optional) List of keys to include in the returned dictionary. If None then all keys will be returned (default: None)
Returns: DirectResponse
Properties
  • data: (dictionary) Object representing a service's properties
  • disabled: (boolean) True if current user cannot manage services

setInfo(self, **data)

source code 

Set attributes on a service. This method accepts any keyword argument for the property that you wish to set. The only required property is "uid".

Parameters:
  • uid (string) - Unique identifier of a service
Returns: DirectResponse
Success message
Decorators:
  • @require('Manage DMD')

getInstances(self, uid, start=0, params=None, limit=50, sort='name', page=None, dir='ASC')

source code 

Get a list of instances for a service UID.

Parameters:
  • uid (string) - Service UID to get instances of
  • start (integer) - (optional) Offset to return the results from; used in pagination (default: 0)
  • params (dictionary) - (optional) Key-value pair of filters for this search.
  • limit (integer) - (optional) Number of items to return; used in pagination (default: 50)
  • sort (string) - (optional) Key on which to sort the return results (default: 'name')
  • dir (string) - (optional) Sort order; can be either 'ASC' or 'DESC' (default: 'ASC')
Returns: DirectResponse
Properties:
  • data: ([dictionary]) List of objects representing service instances
  • totalCount: (integer) Total number of instances

moveServices(self, sourceUids, targetUid)

source code 

Move service(s) from one organizer to another.

Parameters:
  • sourceUids ([string]) - UID(s) of the service(s) to move
  • targetUid (string) - UID of the organizer to move to
Returns: DirectResponse
Success messsage
Decorators:
  • @require('Manage DMD')

getUnmonitoredStartModes(self, uid)

source code 

Get a list of unmonitored start modes for a Windows service.

Parameters:
  • uid (string) - Unique ID of a Windows service.
Returns: DirectResponse
Properties:
  • data: ([string]) List of unmonitored start modes for a Windows service

getMonitoredStartModes(self, uid, query='')

source code 

Get a list of monitored start modes for a Windows service.

Parameters:
  • uid (string) - Unique ID of a Windows service.
Returns: DirectResponse
Properties:
  • data: ([string]) List of monitored start modes for a Windows service