blob: f0b26915f5a3ba1be98563e5939cf7f02247a085 [file] [log] [blame]
Jorge Chai83ba4ee2014-04-15 18:58:08 +00001
2# Copyright (c) 2014 Rackspace, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
Malini Kamalambal7458b4b2014-05-29 11:47:28 -040017
Jorge Chai83ba4ee2014-04-15 18:58:08 +000018list_link = {
19 'type': 'object',
20 'properties': {
21 'rel': {'type': 'string'},
22 'href': {
23 'type': 'string',
24 'format': 'uri'
25 }
26 },
27 'required': ['href', 'rel']
28}
29
30list_queue = {
31 'type': 'object',
32 'properties': {
33 'name': {'type': 'string'},
34 'href': {
35 'type': 'string',
36 'format': 'uri'
37 },
38 'metadata': {'type': 'object'}
39 },
40 'required': ['name', 'href']
41}
42
43list_queues = {
44 'status_code': [200, 204],
45 'response_body': {
46 'type': 'object',
47 'properties': {
48 'links': {
49 'type': 'array',
50 'items': list_link,
51 'maxItems': 1
52 },
53 'queues': {
54 'type': 'array',
55 'items': list_queue
56 }
57 },
58 'required': ['links', 'queues']
59 }
60}
61
Malini Kamalambal7458b4b2014-05-29 11:47:28 -040062age = {
63 'type': 'number',
64 'minimum': 0
65}
66
Jorge Chai83ba4ee2014-04-15 18:58:08 +000067message_link = {
68 'type': 'object',
69 'properties': {
70 'href': {
71 'type': 'string',
72 'format': 'uri'
73 },
Malini Kamalambal7458b4b2014-05-29 11:47:28 -040074 'age': age,
Jorge Chai83ba4ee2014-04-15 18:58:08 +000075 'created': {
76 'type': 'string',
77 'format': 'date-time'
78 }
79 },
80 'required': ['href', 'age', 'created']
81}
82
83messages = {
84 'type': 'object',
85 'properties': {
86 'free': {'type': 'number'},
87 'claimed': {'type': 'number'},
88 'total': {'type': 'number'},
89 'oldest': message_link,
90 'newest': message_link
91 },
92 'required': ['free', 'claimed', 'total']
93}
94
95queue_stats = {
96 'status_code': [200],
97 'response_body': {
98 'type': 'object',
99 'properties': {
100 'messages': messages
101 },
102 'required': ['messages']
103 }
104}
Malini Kamalambal7458b4b2014-05-29 11:47:28 -0400105
106resource_schema = {
107 'type': 'array',
108 'items': 'string',
109 'minItems': 1
110}
111
112post_messages = {
113 'status_code': [201],
114 'response_body': {
115 'type': 'object',
116 'properties': {
117 'resources': resource_schema,
118 'partial': {'type': 'boolean'}
119 }
120 },
121 'required': ['resources', 'partial']
122}
123
124message_ttl = {
125 'type': 'number',
126 'minimum': 1
127}
128
129list_messages_links = {
130 'type': 'array',
131 'maxItems': 1,
132 'minItems': 1,
133 'items': {
134 'type': 'object',
135 'properties': {
136 'rel': {'type': 'string'},
137 'href': {'type': 'string'}
138 },
139 'required': ['rel', 'href']
140 }
141}
142
143list_messages_response = {
144 'type': 'array',
145 'minItems': 1,
146 'items': {
147 'type': 'object',
148 'properties': {
149 'href': {'type': 'string'},
150 'ttl': message_ttl,
151 'age': age,
152 'body': {'type': 'object'}
153 },
154 'required': ['href', 'ttl', 'age', 'body']
155 }
156}
157
158list_messages = {
159 'status_code': [200, 204],
160 'response_body': {
161 'type': 'object',
162 'properties': {
163 'links': list_messages_links,
164 'messages': list_messages_response
165 }
166 },
167 'required': ['links', 'messages']
168}
169
170single_message = {
171 'type': 'object',
172 'properties': {
173 'href': {'type': 'string'},
174 'ttl': message_ttl,
175 'age': age,
176 'body': {'type': 'object'}
177 },
178 'required': ['href', 'ttl', 'age', 'body']
179}
180
181get_single_message = {
182 'status_code': [200],
183 'response_body': single_message
184}
185
186get_multiple_messages = {
187 'status_code': [200],
188 'response_body': {
189 'type': 'array',
190 'items': single_message,
191 'minItems': 1
192 }
193}
194
195messages_claimed = {
196 'type': 'object',
197 'properties': {
198 'href': {
199 'type': 'string',
200 'format': 'uri'
201 },
202 'ttl': message_ttl,
203 'age': {'type': 'number'},
204 'body': {'type': 'object'}
205 },
206 'required': ['href', 'ttl', 'age', 'body']
207}
208
209claim_messages = {
210 'status_code': [201, 204],
211 'response_body': {
212 'type': 'array',
213 'items': messages_claimed,
214 'minItems': 1
215 }
216}
217
218claim_ttl = {
219 'type': 'number',
220 'minimum': 1
221}
222
223query_claim = {
224 'status_code': [200],
225 'response_body': {
226 'type': 'object',
227 'properties': {
228 'age': {'type': 'number'},
229 'ttl': claim_ttl,
230 'messages': {
231 'type': 'array',
232 'minItems': 1
233 }
234 },
235 'required': ['ttl', 'age', 'messages']
236 }
237}