b1oph Class¶
- class bloxone.b1oph(cfg_file='config.ini')[source]¶
Class to simplify access to the BloxOne Platform APIs
- app_process_control(name='', app='', action='')[source]¶
Start or stop an application process
- Parameters
name (str) – display_name of OPH
app (str) – App Name, e.g. DNS
- Returns
bool
- create(objpath, body='')[source]¶
Generic create object wrapper for platform objects
- Parameters
objpath (str) – Swagger object path
body (str) – JSON formatted data payload
- Returns
Requests response object
- Return type
response object
- delete(objpath, id='')[source]¶
Generic delete object wrapper for platform objects
- Parameters
objpath (str) – Swagger object path
id (str) – Object id to delete
- Returns
Requests response object
- Return type
response object
- disable_app(name='', app='')[source]¶
Disable specified app on named OPH
- Parameters
name (str) – display_name of OPH
app (str) – App Name, e.g. DNS
- Returns
bool
- enable_app(name='', app='')[source]¶
Enable specified app on named OPH
- Parameters
name (str) – display_name of OPH
app (str) – App Name, e.g. DNS
- Returns
bool
- get(objpath, id='', action='', **params)[source]¶
Generic get object wrapper for platform calls
- Parameters
objpath (str) – Swagger object path
id (str) – Optional Object ID
action (str) – Optional object action, e.g. “nextavailableip”
- Returns
Requests response object
- Return type
response object
- get_app_state(name, app)[source]¶
Get status of application for an OPH
- Parameters
name (str) – display_name of OPH
app (str) – App Name, e.g. DNS
- Returns
Status or error msg as text
- Return type
app_status (str)
- get_id(objpath, *, key='', value='', include_path=False)[source]¶
Get object id using key/value pair
- Parameters
objpath (str) – Swagger object path
key (str) – name of key to match
value (str) – value to match
include_path (bool) – Include path to object id
- Returns
object id or “”
- Return type
id (str)
- get_ophid(name='')[source]¶
Return the ophid of named OPH
- Parameters
name (str) – display name of OPH
- Returns
ophid of the specified OPH
- Return type
ophid(str)
- get_tags(objpath, id='')[source]¶
Get tags for an object id
- Parameters
objpath (str) – Swagger object path
id (str) – id of object
- Returns
- Dictionary of current tags
or empty dict if none
- Return type
tags (dict)
Todo
make generic, however, this requires the below
Lookup dictionary of ‘required fields’ per object type
- manage_app(name='', app='', action='status')[source]¶
Perform action on named OPH for specified app
- Parameters
name (str) – display_name of OPH
app (str) – App Name, e.g. DNS
action (str) – action to perform for app
- Returns
bool
- on_prem_hosts(**params)[source]¶
Method to retrieve On Prem Hosts (undocumented)
- Parameters
**params (dict) – Generic API parameters
- Returns
Requests response object
- Return type
response object
- oph_add_tag(id='', tagname='', tagvalue='')[source]¶
Method to add a tag to an existing On Prem Host
- Parameters
objpath (str) – Swagger object path
tagname (str) – Name of tag to add
tagvalue (str) – Value to associate
- Returns
Requests response object
- Return type
response object
- oph_app_status(oph_data)[source]¶
Translate App status info in JSON data for an OPH
- Parameters
oph_data (dict) – Data for individual OPH
- Returns
Dict of translated status elements
- Return type
oph_apps
- oph_delete_tag(id='', tagname='')[source]¶
Method to delete a tag from an existing On Prem Host
- Parameters
objpath (str) – Swagger object path
tagname (str) – Name of tag to add
- Returns
Requests response object
- Return type
response object
- oph_status(oph_data)[source]¶
Translate status info in JSON data for an OPH
- Parameters
oph_data (dict) – Data for individual OPH
- Returns
Dict of translated status elements
- Return type
oph_status
- oph_status_rpt(json_data, tags=False)[source]¶
Build status report from GET /on_prem_hosts data
- Parameters
json_data (json) – API JSON data for On Prem Hosts call
tags (bool) – Include tags in response, default False
- Returns
Dict of status elements
- Return type
rpt
- oph_status_summary(name='', id='', tags=False)[source]¶
Get OPH status information for one or more OPHs
- Parameters
name (ste) – Display name of OPH
id (str) – id of a specific OPH
tags (bool) – include tags in report
- Returns
Dict of translated status elements
- Return type
rpt