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

Class ApiRole

source code

         object --+        
                  |        
types.BaseApiObject --+    
                      |    
  types.BaseApiResource --+
                          |
                         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)
Returns the path to the resource.
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)
This endpoint is not supported as of v6.
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
 
list_commands_by_name(self)
Lists all the commands that can be executed by name on the provided role.
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)

_path(self)

source code 

Returns the path to the resource.

e.g., for a service 'foo' in cluster 'bar', this should return '/clusters/bar/services/foo'.

Overrides: types.BaseApiResource._path
(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')
Returns:
Dictionary with configuration data.

update_config(self, config)

source code 

Update the role's configuration.

Parameters:
  • config - Dictionary with configuration to update.
Returns:
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 

This endpoint is not supported as of v6. Use the timeseries API instead. To get all metrics for a role with the timeseries API use the query:

'select * where roleName = $ROLE_NAME'.

To get specific metrics for a role use a comma-separated list of the metric names as follows:

'select $METRIC_NAME1, $METRIC_NAME2 where roleName = $ROLE_NAME'.

For more information see http://tiny.cloudera.com/tsquery_doc

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')
Returns:
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

list_commands_by_name(self)

source code 

Lists all the commands that can be executed by name on the provided role.

Returns:
A list of command metadata objects

Since: API v6


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(), 'configStalene\
ssStatus': ROAttr(), 'haStatus': ROAttr(), 'roleUrl': ROAttr(), 'commi\
ssionState': ROAttr(), 'maintenanceMode': ROAttr(), 'maintenanceOwners\
': ROAttr(), 'roleConfigGroupRef': ROAttr(ApiRoleConfigGroupRef), 'zoo\
KeeperServerMode': ROAttr(),}