Tag service plugin allows users to set tags on their resources. Tagging resources can be used by external systems or any other clients of the Neutron REST API (and NOT backend drivers).
The following use cases refer to adding tags to networks, but the same can be applicable to any other Neutron resource:
Tag system uses standardattr mechanism so it’s targeting to resources have the mechanism. In Mitaka, they are networks, ports, routers, floating IPs, security group, security group rules and subnet pools but now tag system supports networks only.
Tag is not standalone resource. Tag is always related to existing resources. The following shows tag model:
+------------------+ +------------------+
| Network | | Tag |
+------------------+ +------------------+
| standard_attr_id +------> | standard_attr_id |
| | | tag |
| | | |
+------------------+ +------------------+
Tag has two columns only and tag column is just string. These tags are defined per resource. Tag is unique in a resource but it can be overlapped throughout.
The following shows basic API for tag. Tag is regarded as a subresource of resource so API always includes id of resource related to tag.
Add a single tag on a network
PUT /v2.0/networks/{network_id}/tags/{tag}
Returns 201 Created. If the tag already exists, no error is raised, it just returns the 201 Created because the OpenStack Development Mailing List discussion told us that PUT should be no issue updating an existing tag.
Replace set of tags on a network
PUT /v2.0/networks/{network_id}/tags
with request payload
{
'tags': ['foo', 'bar', 'baz']
}
Response
{
'tags': ['foo', 'bar', 'baz']
}
Check if a tag exists or not on a network
GET /v2.0/networks/{network_id}/tags/{tag}
Remove a single tag on a network
DELETE /v2.0/networks/{network_id}/tags/{tag}
Remove all tags on a network
DELETE /v2.0/networks/{network_id}/tags
PUT and DELETE for collections are the motivation of extending the API framework.