blob: 6c25030b91c6deed445855dd78aa76e36f226a11 [file] [log] [blame]
Ash Wilson69c08742014-10-21 14:04:40 -04001// +build fixtures
2package servers
3
4import (
5 os "github.com/rackspace/gophercloud/openstack/compute/v2/servers"
6)
7
8// ListOutput is the recorded output of a Rackspace servers.List request.
9const ListOutput = `
10{
11 "servers": [
12 {
13 "OS-DCF:diskConfig": "MANUAL",
14 "OS-EXT-STS:power_state": 1,
15 "OS-EXT-STS:task_state": null,
16 "OS-EXT-STS:vm_state": "active",
17 "accessIPv4": "1.2.3.4",
18 "accessIPv6": "1111:4822:7818:121:2000:9b5e:7438:a2d0",
19 "addresses": {
20 "private": [
21 {
22 "addr": "10.208.230.113",
23 "version": 4
24 }
25 ],
26 "public": [
27 {
28 "addr": "2001:4800:7818:101:2000:9b5e:7428:a2d0",
29 "version": 6
30 },
31 {
32 "addr": "104.130.131.164",
33 "version": 4
34 }
35 ]
36 },
37 "created": "2014-09-23T12:34:58Z",
38 "flavor": {
39 "id": "performance1-8",
40 "links": [
41 {
42 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8",
43 "rel": "bookmark"
44 }
45 ]
46 },
47 "hostId": "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475",
48 "id": "59818cee-bc8c-44eb-8073-673ee65105f7",
49 "image": {
50 "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14",
51 "links": [
52 {
53 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14",
54 "rel": "bookmark"
55 }
56 ]
57 },
58 "key_name": "mykey",
59 "links": [
60 {
61 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
62 "rel": "self"
63 },
64 {
65 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
66 "rel": "bookmark"
67 }
68 ],
69 "metadata": {},
70 "name": "devstack",
71 "progress": 100,
72 "status": "ACTIVE",
73 "tenant_id": "111111",
74 "updated": "2014-09-23T12:38:19Z",
75 "user_id": "14ae7bb21d81422694655f3cc30f2930"
76 },
77 {
78 "OS-DCF:diskConfig": "MANUAL",
79 "OS-EXT-STS:power_state": 1,
80 "OS-EXT-STS:task_state": null,
81 "OS-EXT-STS:vm_state": "active",
82 "accessIPv4": "1.1.2.3",
83 "accessIPv6": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
84 "addresses": {
85 "private": [
86 {
87 "addr": "10.10.20.30",
88 "version": 4
89 }
90 ],
91 "public": [
92 {
93 "addr": "1.1.2.3",
94 "version": 4
95 },
96 {
97 "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
98 "version": 6
99 }
100 ]
101 },
102 "created": "2014-07-21T19:32:55Z",
103 "flavor": {
104 "id": "performance1-2",
105 "links": [
106 {
107 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2",
108 "rel": "bookmark"
109 }
110 ]
111 },
112 "hostId": "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c",
113 "id": "25f1c7f5-e00a-4715-b354-16e24b2f4630",
114 "image": {
115 "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca",
116 "links": [
117 {
118 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca",
119 "rel": "bookmark"
120 }
121 ]
122 },
123 "key_name": "otherkey",
124 "links": [
125 {
126 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
127 "rel": "self"
128 },
129 {
130 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
131 "rel": "bookmark"
132 }
133 ],
134 "metadata": {},
135 "name": "peril-dfw",
136 "progress": 100,
137 "status": "ACTIVE",
138 "tenant_id": "111111",
139 "updated": "2014-07-21T19:34:24Z",
140 "user_id": "14ae7bb21d81422694655f3cc30f2930"
141 }
142 ]
143}
144`
145
146// GetOutput is the recorded output of a Rackspace servers.Get request.
147const GetOutput = `
148{
149 "server": {
150 "OS-DCF:diskConfig": "AUTO",
151 "OS-EXT-STS:power_state": 1,
152 "OS-EXT-STS:task_state": null,
153 "OS-EXT-STS:vm_state": "active",
154 "accessIPv4": "1.2.4.8",
155 "accessIPv6": "2001:4800:6666:105:2a0f:c056:f594:7777",
156 "addresses": {
157 "private": [
158 {
159 "addr": "10.20.40.80",
160 "version": 4
161 }
162 ],
163 "public": [
164 {
165 "addr": "1.2.4.8",
166 "version": 4
167 },
168 {
169 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
170 "version": 6
171 }
172 ]
173 },
174 "created": "2014-10-21T14:42:16Z",
175 "flavor": {
176 "id": "performance1-1",
177 "links": [
178 {
179 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
180 "rel": "bookmark"
181 }
182 ]
183 },
184 "hostId": "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
185 "id": "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
186 "image": {
187 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
188 "links": [
189 {
190 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
191 "rel": "bookmark"
192 }
193 ]
194 },
195 "key_name": null,
196 "links": [
197 {
198 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
199 "rel": "self"
200 },
201 {
202 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
203 "rel": "bookmark"
204 }
205 ],
206 "metadata": {},
207 "name": "Gophercloud-pxpGGuey",
208 "progress": 100,
209 "status": "ACTIVE",
210 "tenant_id": "111111",
211 "updated": "2014-10-21T14:42:57Z",
212 "user_id": "14ae7bb21d81423694655f4dd30f2930"
213 }
214}
215`
216
217// DevstackServer is the expected first result from parsing ListOutput.
218var DevstackServer = os.Server{
219 ID: "59818cee-bc8c-44eb-8073-673ee65105f7",
220 Name: "devstack",
221 TenantID: "111111",
222 UserID: "14ae7bb21d81422694655f3cc30f2930",
223 HostID: "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475",
224 Updated: "2014-09-23T12:38:19Z",
225 Created: "2014-09-23T12:34:58Z",
226 AccessIPv4: "1.2.3.4",
227 AccessIPv6: "1111:4822:7818:121:2000:9b5e:7438:a2d0",
228 Progress: 100,
229 Status: "ACTIVE",
230 Image: map[string]interface{}{
231 "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14",
232 "links": []interface{}{
233 map[string]interface{}{
234 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14",
235 "rel": "bookmark",
236 },
237 },
238 },
239 Flavor: map[string]interface{}{
240 "id": "performance1-8",
241 "links": []interface{}{
242 map[string]interface{}{
243 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8",
244 "rel": "bookmark",
245 },
246 },
247 },
248 Addresses: map[string]interface{}{
249 "private": []interface{}{
250 map[string]interface{}{
251 "addr": "10.20.30.40",
252 "version": float64(4.0),
253 },
254 },
255 "public": []interface{}{
256 map[string]interface{}{
257 "addr": "1111:4822:7818:121:2000:9b5e:7438:a2d0",
258 "version": float64(6.0),
259 },
260 map[string]interface{}{
261 "addr": "1.2.3.4",
262 "version": float64(4.0),
263 },
264 },
265 },
266 Metadata: map[string]interface{}{},
267 Links: []interface{}{
268 map[string]interface{}{
269 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59918cee-bd9d-44eb-8173-673ee75105f7",
270 "rel": "self",
271 },
272 map[string]interface{}{
273 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
274 "rel": "bookmark",
275 },
276 },
277 KeyName: "mykey",
278 AdminPass: "",
279}
280
281// PerilServer is the expected second result from parsing ListOutput.
282var PerilServer = os.Server{
283 ID: "25f1c7f5-e00a-4715-b354-16e24b2f4630",
284 Name: "peril-dfw",
285 TenantID: "111111",
286 UserID: "14ae7bb21d81422694655f3cc30f2930",
287 HostID: "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c",
288 Updated: "2014-07-21T19:34:24Z",
289 Created: "2014-07-21T19:32:55Z",
290 AccessIPv4: "1.1.2.3",
291 AccessIPv6: "2222:4444:7817:101:be76:4eff:f0e5:9e02",
292 Progress: 100,
293 Status: "ACTIVE",
294 Image: map[string]interface{}{
295 "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca",
296 "links": []interface{}{
297 map[string]interface{}{
298 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca",
299 "rel": "bookmark",
300 },
301 },
302 },
303 Flavor: map[string]interface{}{
304 "id": "performance1-2",
305 "links": []interface{}{
306 map[string]interface{}{
307 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2",
308 "rel": "bookmark",
309 },
310 },
311 },
312 Addresses: map[string]interface{}{
313 "private": []interface{}{
314 map[string]interface{}{
315 "addr": "10.10.20.30",
316 "version": float64(4.0),
317 },
318 },
319 "public": []interface{}{
320 map[string]interface{}{
321 "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
322 "version": float64(6.0),
323 },
324 map[string]interface{}{
325 "addr": "1.1.2.3",
326 "version": float64(4.0),
327 },
328 },
329 },
330 Metadata: map[string]interface{}{},
331 Links: []interface{}{
332 map[string]interface{}{
333 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
334 "rel": "self",
335 },
336 map[string]interface{}{
337 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
338 "rel": "bookmark",
339 },
340 },
341 KeyName: "otherkey",
342 AdminPass: "",
343}
344
345// GophercloudServer is the expected result from parsing GetOutput.
346var GophercloudServer = os.Server{
347 ID: "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
348 Name: "Gophercloud-pxpGGuey",
349 TenantID: "111111",
350 UserID: "14ae7bb21d81423694655f4dd30f2930",
351 HostID: "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
352 Updated: "2014-10-21T14:42:57Z",
353 Created: "2014-10-21T14:42:16Z",
354 AccessIPv4: "1.2.4.8",
355 AccessIPv6: "2001:4800:6666:105:2a0f:c056:f594:7777",
356 Progress: 100,
357 Status: "ACTIVE",
358 Image: map[string]interface{}{
359 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
360 "links": []interface{}{
361 map[string]interface{}{
362 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
363 "rel": "bookmark",
364 },
365 },
366 },
367 Flavor: map[string]interface{}{
368 "id": "performance1-1",
369 "links": []interface{}{
370 map[string]interface{}{
371 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
372 "rel": "bookmark",
373 },
374 },
375 },
376 Addresses: map[string]interface{}{
377 "private": []interface{}{
378 map[string]interface{}{
379 "addr": "10.20.40.80",
380 "version": float64(4.0),
381 },
382 },
383 "public": []interface{}{
384 map[string]interface{}{
385 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
386 "version": float64(6.0),
387 },
388 map[string]interface{}{
389 "addr": "1.2.4.8",
390 "version": float64(4.0),
391 },
392 },
393 },
394 Metadata: map[string]interface{}{},
395 Links: []interface{}{
396 map[string]interface{}{
397 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
398 "rel": "self",
399 },
400 map[string]interface{}{
401 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
402 "rel": "bookmark",
403 },
404 },
405 KeyName: "",
406 AdminPass: "",
407}
408
409// ExpectedServerSlice is the collection of servers, in order, that should be parsed from ListOutput.
410var ExpectedServerSlice = []os.Server{DevstackServer, PerilServer}