7cad745eba
Nova support tagging of instance or other resource like device etc. But those tags are allowed to be as empty string which does not make much sense or any real use case. Updating single tag with empty string is not possible as it will be 404 due to url itself has single tag as id. But updating all tags with few or all of them as empty string does not complain. In those cases, empty tags are being accepted and stored as same. Main issue with those is that empty tag cannot be deleted/show as single tag as it will again 404 with url not found. Only way to delete/show such tag is to delete all together. Empty tag should not be allowed at first. This commit makes empty string request to 400 which are currently 200. Doing for server and device tags and same can be adopted for other resource tagging also if any in future. Fixing this as bug fix hoping no backward incompatibility logically. If such tag could have been deleted alone then we could have fix this with microversion. Change-Id: I18a81f19205b2a40ca470067a9576f2f72ff0f13 Closes-Bug: #1648663
190 lines
3.6 KiB
ReStructuredText
190 lines
3.6 KiB
ReStructuredText
.. -*- rst -*-
|
|
|
|
=============================
|
|
Server tags (servers, tags)
|
|
=============================
|
|
|
|
Lists tags, creates, replaces or deletes one or more tags for a server, checks
|
|
the existence of a tag for a server.
|
|
|
|
Available since version 2.26
|
|
|
|
Tags have the following restrictions:
|
|
|
|
- Tag is a Unicode bytestring no longer than 60 characters.
|
|
|
|
- Tag is a non-empty string.
|
|
|
|
- Tags are case sensitive.
|
|
|
|
- '/' is not allowed to be in a tag name
|
|
|
|
- Comma is not allowed to be in a tag name in order to simplify requests that
|
|
specify lists of tags
|
|
|
|
- All other characters are allowed to be in a tag name
|
|
|
|
- Each server can have up to 50 tags.
|
|
|
|
List Tags
|
|
=========
|
|
|
|
.. rest_method:: GET /servers/{server_id}/tags
|
|
|
|
Lists all tags for a server.
|
|
|
|
Normal response codes: 200
|
|
|
|
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
Request
|
|
-------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- server_id: server_id_path
|
|
|
|
Response
|
|
--------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- tags: tags
|
|
|
|
**Example List Tags:**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-server-tags/v2.26/server-tags-index-resp.json
|
|
:language: javascript
|
|
|
|
Replace Tags
|
|
============
|
|
|
|
.. rest_method:: PUT /servers/{server_id}/tags
|
|
|
|
Replaces all tags on specified server with the new set of tags.
|
|
|
|
Normal response codes: 200
|
|
|
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
Request
|
|
-------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- server_id: server_id_path
|
|
- tags: tags
|
|
|
|
**Example Replace Tags:**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-server-tags/v2.26/server-tags-put-all-req.json
|
|
:language: javascript
|
|
|
|
Response
|
|
--------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- tags: tags
|
|
|
|
**Example Replace Tags:**
|
|
|
|
.. literalinclude:: ../../doc/api_samples/os-server-tags/v2.26/server-tags-put-all-resp.json
|
|
:language: javascript
|
|
|
|
Delete All Tags
|
|
===============
|
|
|
|
.. rest_method:: DELETE /servers/{server_id}/tags
|
|
|
|
Deletes all tags from the specified server.
|
|
|
|
Normal response codes: 204
|
|
|
|
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
Request
|
|
-------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- server_id: server_id_path
|
|
|
|
Response
|
|
--------
|
|
|
|
There is no body content for the response of a successful DELETE query
|
|
|
|
Check Tag Existence
|
|
===================
|
|
|
|
.. rest_method:: GET /servers/{server_id}/tags/{tag}
|
|
|
|
Checks tag existence on the server. If tag exists response with 204 status code
|
|
will be returned. Otherwise returns 404.
|
|
|
|
Normal response codes: 204
|
|
|
|
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
Request
|
|
-------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- server_id: server_id_path
|
|
- tag: tag
|
|
|
|
Add a Single Tag
|
|
================
|
|
|
|
.. rest_method:: PUT /servers/{server_id}/tags/{tag}
|
|
|
|
Adds a single tag to the server if server has no specified tag. Response code
|
|
in this case is 201.
|
|
|
|
If the server has specified tag just returns 204.
|
|
|
|
Normal response codes: 201, 204
|
|
|
|
Error response codes: badRequest(400), unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
Request
|
|
-------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- server_id: server_id_path
|
|
- tag: tag
|
|
|
|
Response
|
|
--------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- Location: tag_location
|
|
|
|
Delete a Single Tag
|
|
===================
|
|
|
|
.. rest_method:: DELETE /servers/{server_id}/tags/{tag}
|
|
|
|
Deletes a single tag from the specified server.
|
|
|
|
Normal response codes: 204
|
|
|
|
Error response codes: unauthorized(401), forbidden(403), itemNotFound(404)
|
|
|
|
Request
|
|
-------
|
|
|
|
.. rest_parameters:: parameters.yaml
|
|
|
|
- server_id: server_id_path
|
|
- tag: tag
|
|
|
|
Response
|
|
--------
|
|
|
|
There is no body content for the response of a successful DELETE query
|