4.4.4. Tags

API for working with tags for assets.

class axonius_api_client.api.assets.labels.Labels(parent)[source]

Bases: axonius_api_client.api.mixins.ChildMixins

API for working with tags for the parent asset type.

Examples

Create a client using axonius_api_client.connect.Connect and assume apiobj is either client.devices or client.users

>>> apiobj = client.devices  # or client.users
Parameters

parent (axonius_api_client.api.mixins.Model) –

get()[source]

Get all known tags.

Examples

Get all known tags for this asset type

>>> apiobj.labels.get()
['tag1', 'tag2']
Return type

typing.List[str]

add(rows, labels)[source]

Add tags to assets.

Examples

Get some assets to tag

>>> rows = apiobj.get(wiz_entries=[{'type': 'simple', 'value': 'name equals test'}])
>>> len(rows)
1
>>> apiobj.labels.add(rows=rows, labels=['api tag 1', 'api tag 2'])
1
Parameters
Return type

int

remove(rows, labels)[source]

Remove tags from assets.

Examples

Get some assets to un-tag

>>> rows = apiobj.get(wiz_entries=[{'type': 'simple', 'value': 'name equals test'}])
>>> len(rows)
1
>>> apiobj.labels.remove(rows=rows, labels=['api tag 1', 'api tag 2'])
1
Parameters
  • rows (typing.List[dict]) – list of internal_axon_id strs or list of assets returned from a get method

  • labels (typing.List[str]) – tags to remove

Return type

int

_get_ids(rows)[source]

Get the internal_axon_id from a list of assets.

Parameters

rows (typing.Union[typing.List[dict], str]) – list of internal_axon_id strs or list of assets returned from a get method

Return type

typing.List[str]

_add(labels, ids)[source]

Direct API method to add labels/tags to assets.

Parameters
Return type

int

_get()[source]

Direct API method to get all known labels/tags.

Return type

typing.List[str]

_remove(labels, ids)[source]

Direct API method to remove labels/tags from assets.

Parameters
Return type

int

__init__(parent)

Mixins model for API child objects.

Parameters

parent (axonius_api_client.api.mixins.Model) – parent API model of this child

__repr__()

Show info for this model object.

Return type

str

__str__()

Show info for this model object.

Return type

str

_init(parent)

Post init method for subclasses to use for extra setup.

Parameters

parent (axonius_api_client.api.mixins.Model) – parent API model of this child