Tags¶
Tags organize the agent inventory and can be used in AgentFilter selections.
In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class.
Assigning tags to an agent¶
agent = client.get_agent("production", "support-agent")
settings = agent.get_settings()
tags = settings.get_raw()["configuration"].setdefault("tags", [])
if "production" not in tags:
tags.append("production")
settings.save()
Listing tags¶
tags = client.list_tags()
for tag in tags:
print(tag.name, tag.color)
The collection is a snapshot. Call list_tags() again after changes when you need a refreshed listing.
Changing a tag’s color¶
tag = client.list_tags().tag("production")
tag.color = "#336699"
tag.save()
Renaming or deleting a tag¶
These operations change the tag everywhere it is used, subject to the server’s access checks.
tag = client.list_tags().tag("production")
tag.rename("production-agents")
# Remove a different, unused organizational label from all agents:
client.list_tags().tag("obsolete-tag").delete()
tag(name) raises KeyError if the name is absent from the snapshot.
The name property is read-only; use rename() to change it.
Reference documentation¶
Classes¶
A snapshot of tags used by Agent Management agents, iterable as tag objects. |
|
An Agent Management tag. |
Functions¶
|
Deletes the tag everywhere it is used. |
|
Returns a handle to an agent. |
|
Returns the raw settings of this agent. |
Returns the settings of this agent. |
|
Lists tags used by Agent Management agents. |
|
|
Renames the tag everywhere it is used and updates this object's definition. |
|
Saves the settings of this agent, checking |
|
Saves the tag color. |
|
Returns a tag by its name. |
