summaryrefslogtreecommitdiff
path: root/api-ref/source/os-server-tags.inc
blob: 9ed62702e80ac35a824c95cef01304ba3f670d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
.. -*- 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.

-  '/' 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_no_min

**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_no_min

**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_no_min

**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