Package cm_api :: Package endpoints :: Module roles :: Class ApiRole
[hide private]
[frames] | no frames]

Class ApiRole

source code

         object --+    
                  |    
types.BaseApiObject --+
                      |
                     ApiRole

Instance Methods [hide private]
 
__init__(self, resource_root, name=None, type=None, hostRef=None)
Initializes internal state and sets all known writable properties of the object to None.
source code
 
__str__(self)
Default implementation of __str__.
source code
 
_path(self) source code
 
_cmd(self, cmd, data=None) source code
 
_get_log(self, log) source code
 
get_commands(self, view=None)
Retrieve a list of running commands for this role.
source code
 
get_config(self, view=None)
Retrieve the role's configuration.
source code
 
update_config(self, config)
Update the role's configuration.
source code
 
get_full_log(self)
Retrieve the contents of the role's log file.
source code
 
get_stdout(self)
Retrieve the contents of the role's standard output.
source code
 
get_stderr(self)
Retrieve the contents of the role's standard error.
source code
 
get_metrics(self, from_time=None, to_time=None, metrics=None, view=None)
Retrieve metric readings for the role.
source code
 
enter_maintenance_mode(self)
Put the role in maintenance mode.
source code
 
exit_maintenance_mode(self)
Take the role out of maintenance mode.
source code

Inherited from types.BaseApiObject: __setattr__, to_json_dict

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

Class Methods [hide private]

Inherited from types.BaseApiObject: from_json_dict

Inherited from types.BaseApiObject (private): _get_attributes

Static Methods [hide private]

Inherited from types.BaseApiObject: init

Class Variables [hide private]
  _ATTRIBUTES = {'name': None, 'type': None, 'hostRef': Attr(Api...

Inherited from types.BaseApiObject (private): _WHITELIST

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, resource_root, name=None, type=None, hostRef=None)
(Constructor)

source code 

Initializes internal state and sets all known writable properties of the object to None. Then initializes the properties given in the provided attributes dictionary.

Parameters:
  • resource_root - API resource object.
  • attrs - optional dictionary of attributes to set. This should only contain r/w attributes.
Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

Default implementation of __str__. Uses the type name and the first attribute retrieved from the attribute map to create the string.

Overrides: object.__str__
(inherited documentation)

get_commands(self, view=None)

source code 

Retrieve a list of running commands for this role.

Parameters:
  • view - View to materialize ('full' or 'summary')
Returns:
A list of running commands.

get_config(self, view=None)

source code 

Retrieve the role's configuration.

The 'summary' view contains strings as the dictionary values. The full view contains ApiConfig instances as the values.

Parameters:
  • view - View to materialize ('full' or 'summary') @return Dictionary with configuration data.

update_config(self, config)

source code 

Update the role's configuration.

@param config Dictionary with configuration to update. @return Dictionary with updated configuration.

get_full_log(self)

source code 

Retrieve the contents of the role's log file.

Returns:
Contents of log file.

get_stdout(self)

source code 

Retrieve the contents of the role's standard output.

Returns:
Contents of stdout.

get_stderr(self)

source code 

Retrieve the contents of the role's standard error.

Returns:
Contents of stderr.

get_metrics(self, from_time=None, to_time=None, metrics=None, view=None)

source code 

Retrieve metric readings for the role.

Parameters:
  • from_time - A datetime; start of the period to query (optional).
  • to_time - A datetime; end of the period to query (default = now).
  • metrics - List of metrics to query (default = all).
  • view - View to materialize ('full' or 'summary') @return List of metrics and their readings.

enter_maintenance_mode(self)

source code 

Put the role in maintenance mode.

Returns:
Reference to the completed command.

Since: API v2

exit_maintenance_mode(self)

source code 

Take the role out of maintenance mode.

Returns:
Reference to the completed command.

Since: API v2


Class Variable Details [hide private]

_ATTRIBUTES

Value:
{'name': None, 'type': None, 'hostRef': Attr(ApiHostRef), 'roleState':\
 ROAttr(), 'healthSummary': ROAttr(), 'healthChecks': ROAttr(), 'servi\
ceRef': ROAttr(ApiServiceRef), 'configStale': ROAttr(), 'haStatus': RO\
Attr(), 'roleUrl': ROAttr(), 'commissionState': ROAttr(), 'maintenance\
Mode': ROAttr(), 'maintenanceOwners': ROAttr(), 'roleConfigGroupRef': \
ROAttr(ApiRoleConfigGroupRef),}