stingray.apiclient

Client

class stingray.apiclient.Client(host=None, port=None, user=None, password=None, api_version=None, ssl_verify=None)[source]

Bases: object

Client class to access the Stingray REST API.

get_config_endpoints()[source]

Get all configuration endpoints.

Returns:Endpoint names and paths
Return type:(dict)
get_status()[source]

Get a status object for the REST API status/local_tm/ endpoint.

Returns:(StatusAPI)
get_supported_versions()[source]

Query the REST API for the version(s) it supports.

Returns:Supported versions
Return type:(list)
update()[source]

Convenience method to update the properties for an endpoint on the load balancer

StatusAPI

class stingray.apiclient.StatusAPI(host=None, port=None, user=None, password=None, api_version=None, ssl_verify=None)[source]

Bases: stingray.apiclient.Client

Class for interacting with the status/local_tm/ endpoints. Not supported in version 1.0 of the REST API

backup(backup_name)[source]

Get the properties of an individual backup

Parameters:backup_name (str) – The name of the backup to get
Returns:Parameters for the backup
Return type:(dict)
backups()[source]

List current backups

Returns:List of dicts with backup name and path
Return type:(list)
classmethod from_client(client)[source]
information()[source]

Get version and uuid for the load balancer.

Returns:tm_version and uuid
Return type:(dict)
state()[source]

Get state information for load balancer components.

Returns:
List of dicts with state for error level, errors, failed
nodes, license, pools, tip errors, and virtual servers
Return type:(list)
statistic(type, stat=None, stat_target=None)[source]

Get either the list of statistics for an endpoint, or the statistic data. Some endpoints have nested children, some have multiple nested children.

Parameters:
  • type (str) – The statistic type, or name, from the list of available statistics, e.g. cache, pools, etc.
  • stat (str) – For single level nested stats, this is the name of the stat to get information on. For multiple levels of nesting this is the next level in the path.
  • stat_target (str) – For multiple level nested stats this is the name of the stat to get information for.
Returns:

Available statistics for the type and their paths (dict): Data for the requested statistic

Return type:

(dict)

statistics()[source]

Get the list of statistics for load balancer components

Returns:Statistic type and path
Return type:(dict)