File: traits.inc

package info (click to toggle)
placement 14.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,380 kB
  • sloc: python: 17,629; sh: 310; makefile: 61; pascal: 30
file content (135 lines) | stat: -rw-r--r-- 2,994 bytes parent folder | download | duplicates (2)
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
======
Traits
======

Traits are *qualitative* characteristics of resource providers.
The classic example for traits can be requesting disk from different
providers: a user may request 80GiB of disk space for an instance
(quantitative), but may also expect that the disk be SSD instead of
spinning disk (qualitative). Traits provide a way to mark that a
storage provider is SSD or spinning.

.. note:: Traits API requests are available starting from version 1.6.

List traits
===========

Return a list of valid trait strings according to parameters specified.

.. rest_method:: GET /traits

Normal Response Codes: 200

Request
-------

Several query parameters are available to filter the returned list of
traits. If multiple different parameters are provided, the results
of all filters are merged with a boolean `AND`.

.. rest_parameters:: parameters.yaml

  - name: trait_name_query
  - associated: trait_associated

Response
--------

.. rest_parameters:: parameters.yaml

  - traits: traits

Response Example
----------------

.. literalinclude:: ./samples/traits/get-traits.json
   :language: javascript

Show traits
===========

Check if a trait name exists in this cloud.

.. rest_method:: GET /traits/{name}

Normal Response Codes: 204

Error response codes: itemNotFound(404)

Request
-------

.. rest_parameters:: parameters.yaml

  - name: trait_name

Response
--------

No body content is returned on a successful GET.

Update traits
=============

Insert a new custom trait. If traits already exists 204 will be returned.

There are two kinds of traits: the standard traits and the custom traits.
The standard traits are interoperable across different OpenStack cloud
deployments. The definition of standard traits comes from the `os-traits`
library. The standard traits are read-only in the placement API which means
that the user can't modify any standard traits through API.
The custom traits are used by admin users to manage the non-standard
qualitative information of resource providers.

.. rest_method:: PUT /traits/{name}

Normal Response Codes: 201, 204

Error response codes: badRequest(400)

* `400 BadRequest` if trait name is not prefixed with `CUSTOM_` prefix.

Request
-------

.. rest_parameters:: parameters.yaml

  - name: trait_name

Response
--------

.. rest_parameters:: parameters.yaml

  - Location: location

No body content is returned on a successful PUT.

Delete traits
=============

Delete the trait specified be `{name}`. Note that only custom traits can be
deleted.

.. rest_method:: DELETE /traits/{name}

Normal Response Codes: 204

Error response codes: badRequest(400), itemNotFound(404), conflict(409)

* `400 BadRequest` if the name to delete is standard trait.
* `404 Not Found` if no such trait exists.
* `409 Conflict` if the name to delete has associations with any
  ResourceProvider.

Request
-------

.. rest_parameters:: parameters.yaml

  - name: trait_name

Response
--------

No body content is returned on a successful DELETE.