Data
Initiate a Data object for the instance of Discovery you intend to query.
Syntax:
tideway.data(__target__, __token__ [, _api_version_ ] [, _ssl_verify_ ] [, _limit_ ] [, _offset_ ])
Initiation:
>>> import tideway
>>> tw = tideway.appliance('appliance-hostname','auth-token')
>>> data = tw.data()
get_data_search()
Default search. See search for usage.
post_data_search()
Alternative search method. See search for usage.
get_data_search_object()
Search defaulted to ‘object’ format. See search for usage.
post_data_search_object()
Alternative search method defaulted to ‘object’ format. See search for usage.
get_data_search_tree()
Search defaulted to ‘tree’ format. See search for usage.
post_data_search_tree()
Alternative search method defaulted to ‘tree’ format. See search for usage.
search()
Run a search query. By default all paginated results are retrieved and returned as a JSON list. Set bulk=False to get a single requests.Response object.
Syntax:
.search(__query__ [, _offset_ ] [, _results_id_ ] [, _format_ ] [, _limit_ ] [, _delete_ ] [, _bulk_ ] [, _record_limit_ ] [, _call_limit_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| query | <ul><li>String</li><li>JSON Object</li></ul> | Yes | N/A | N/A |
| offset | Integer | No | N/A | N/A |
| results_id | String | No | N/A | N/A |
| format | String | No | N/A | <ul><li>“object”</li><li>“tree”</li></ul> |
| limit | Integer | No | 100 | N/A |
| delete | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
| bulk | Boolean | No | True | <ul><li>True</li><li>False</li></ul> |
| record_limit | Integer | No | N/A | N/A |
| call_limit | Integer | No | N/A | N/A |
Example:
>>> search = data.search("search Host show os_type process with unique()")
>>> print(search)
[
{
'count': 12,
'headings': [
'os_type'
],
'kind': 'Unique row',
'offset': 0,
'results': [
[
'Ubuntu Linux'
],
[
'Windows'
],
[
'CentOS Linux'
],
[
'GNU/Linux'
],
...
search_bulk()
Run a search bulk search query, looping through paginated results and returning all records as a JSON list object. record_limit stops collecting after the specified number of records and call_limit restricts additional API calls.
This function may take a long time to run as it will be run multiple API calls until the entire query is fulfilled.
Syntax:
.search_bulk(__query__ [, _format_ ] [, _limit_ ] [, _delete_ ] [, _record_limit_ ] [, _call_limit_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| query | <ul><li>String</li><li>JSON Object</li></ul> | Yes | N/A | <ul><li>“search string”</li><li>{“query”:”search string”}</li></ul> |
| format | String | No | N/A | <ul><li>“object”</li><li>“tree”</li></ul> |
| limit | Integer | No | 100 | N/A |
| delete | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
| record_limit | Integer | No | N/A | N/A |
| call_limit | Integer | No | N/A | N/A |
Example: This search_bulk() returns 500 results each time, and makes 2 additional API calls
>>> search_results = data.search_bulk("search Host show name", limit=500)
>>> print(len(search_results))
1510
post_data_condition()
Search using a condition, return tabular results as arrays.
Syntax:
.post_data_condition(__body__ [, _offset_ ] [, _results_id_ ] [, _format_ ] [, _limit_ ] [, _delete_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| body | JSON Object | Yes | N/A | N/A |
| offset | Integer | No | N/A | N/A |
| results_id | String | No | N/A | N/A |
| format | String | No | N/A | <ul><li>“object”</li><li>“tree”</li></ul> |
| limit | Integer | No | 100 | N/A |
| delete | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
post_data_condition_param_values()
Get possible parameter values for a condition.
Syntax:
.post_data_condition_param_values(__body__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| body | JSON Object | Yes | N/A | N/A |
get_data_condition_params()
Retrieve the list of available condition parameters.
Syntax:
.get_data_condition_params
get_data_condition_template()
Get the properties of a specific template or a list of all templates.
Syntax:
.get_data_condition_template([ _template_id_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| template_id | String | No | N/A | N/A |
Example:
>>> templates = data.get_data_condition_template()
>>> print(templates.text)
[]
get_data_condition_templates
Property alias for listing all condition templates. See get_data_condition_template.
Syntax: .get_data_condition_templates
post_data_candidate()
The node object of the best candidate based on the provided parameters.
Syntax:
.post_data_candidate(__body__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| body | JSON Object | Yes | N/A | N/A |
Example:
>>> candidates = data.post_data_candidate({"hostname": "disco","kind" : "Host"})
>>> print(candates.text)
{
"#id": "30c577625e064d10300b17ea6e486f7374",
"__all_dns_names": [
"disco.local"
],
"__all_ip_addrs": [
"10.16.15.99",
"fe80::4bcc:a31c:43a:c258"
],
"__all_mac_addrs": [
"02:11:32:23:29:f0"
],
...
post_data_candidates()
Enter parameters to identify a device, the response is a list of candidate nodes ordered by descending score.
Syntax:
.post_data_candidates(__body__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| body | JSON Object | Yes | N/A | N/A |
get_data_nodes()
Get the state of a node with specified id.
Syntax:
.get_data_nodes(__node_id__ [, _relationships_ ] [, _traverse_ ] [, _flags_ ] [, _attributes_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| node_id | JSON Object | Yes | N/A | N/A |
| relationships | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
| traverse | String | No | N/A | “NodeKind:Relationship:NodeKind:Node” |
| flags | String | No | N/A | <ul><li>“include_destroyed”</li><li>“exclude_current”</li></ul> |
| attributes | String | No | N/A | Comma-separated attributes |
Example:
>>> node = data.get_data_nodes("a1b2c3d4e5f6")
>>> print(node.json()['state']['os_type'])
Windows Desktop
get_data_nodes_graph()
Graph data represents a set of nodes and relationships that are associated to the given node.
Syntax:
.get_data_nodes_graph(__node_id__ [, _focus_ ] [, _apply_rules_ ] [, _complete_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| node_id | JSON Object | Yes | N/A | N/A |
| focus | String | No | “software-connected” | <ul><li>“software-connected”</li><li>“software”</li><li>“infrastructure”</li></ul> |
| apply_rules | Boolean | No | True | <ul><li>True</li><li>False</li></ul> |
| complete | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
get_data_kinds()
Finds all nodes of a specified node kind.
Syntax:
.get_data_kinds(__kind__ [, _offset_ ] [, _results_id_ ] [, _format_ ] [, _limit_ ] [, _delete_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| kind | String | Yes | N/A | Any node kind |
| offset | Integer | No | N/A | N/A |
| results_id | String | No | N/A | N/A |
| format | String | No | N/A | “object” |
| limit | Integer | No | 100 | N/A |
| delete | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
Example: Gets result #50 from list of nodes
>>> sis = data.get_data_kinds("SoftwareInstance")
>>> print(sis.json()[0]['results'][50])
['0x7761771a5876f667606e53426', 'Apache Webserver', 'Apache Webserver 2.4 on batman3', '2.4', 'batman3']
get_data_kinds_values()
Retrieve values for an attribute of a node kind.
Syntax:
.get_data_kinds_values(__kind__, __attribute__ [, _offset_ ] [, _results_id_ ] [, _format_ ] [, _limit_ ] [, _delete_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| kind | String | Yes | N/A | Any node kind |
| attribute | String | Yes | N/A | N/A |
| offset | Integer | No | N/A | N/A |
| results_id | String | No | N/A | N/A |
| format | String | No | N/A | “object” |
| limit | Integer | No | 100 | N/A |
| delete | Boolean | No | False | <ul><li>True</li><li>False</li></ul> |
partitions()
Get names and IDs of partitions available on the appliance.
Syntax:
.partitions()
Example:
>>> partitions = data.partitions()
>>> from pprint import pprint
>>> pprint(partitions.json())
{
"Audit": "fb30ac60bb23b90471917ae7",
"Conjecture": "fb30ac60bb23b9047191a1f9",
"DDD": "fb30ac60bb23b9047191a1fa",
"Default": "fb30ac60bb23b90471917ae5",
"Logs": "fb30ac60bb23b9047191a1fc",
"Taxonomy": "fb30ac60bb23b90471917ae6",
"_System": "fb30ac60bb23b9047191a1fb"
}
post_data_partitions()
Create a Partition.
Syntax:
.post_data_partitions(__json__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| json | JSON Object | Yes | N/A | N/A |
post_data_import()
Imports data. Returns the import UUID.
Syntax:
.post_data_import(__json__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| json | JSON Object | Yes | N/A | N/A |
post_data_import_graph()
Import graph data. Returns the import UUID.
Syntax:
.post_data_import_graph(__json__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| json | JSON Object | Yes | N/A | N/A |
post_data_write()
Perform arbitrary write operations.
Syntax:
.post_data_write(__json__)
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| json | JSON Object | Yes | N/A | N/A |
get_data_external_consumer()
Retrieve external consumer information. With no arguments all consumers are returned.
Syntax:
.get_data_external_consumer([ _consumer_name_ ] [, _path_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| consumer_name | String | No | N/A | N/A |
| path | String | No | N/A | N/A |
get_data_external_consumers
Property alias for listing all external consumers. See get_data_external_consumer.
Syntax: .get_data_external_consumers
post_data_external_consumer()
Create or interact with an external consumer resource.
Syntax:
.post_data_external_consumer(__json__ [, _consumer_name_ ] [, _path_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| json | JSON Object | Yes | N/A | N/A |
| consumer_name | String | No | N/A | N/A |
| path | String | No | N/A | N/A |
patch_data_external_consumer()
Update an external consumer resource.
Syntax:
.patch_data_external_consumer(__consumer_name__, __json__ [, _path_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| consumer_name | String | Yes | N/A | N/A |
| json | JSON Object | Yes | N/A | N/A |
| path | String | No | N/A | N/A |
delete_data_external_consumer()
Delete an external consumer resource.
Syntax:
.delete_data_external_consumer(__consumer_name__ [, _path_ ])
| Parameters | Type | Required | Default Value | Options |
|---|---|---|---|---|
| consumer_name | String | Yes | N/A | N/A |
| path | String | No | N/A | N/A |