blob: 75cccd04181fbff5f2323b5d317740e13f8fff95 [file] [log] [blame]
Ash Wilson69c08742014-10-21 14:04:40 -04001// +build fixtures
Ash Wilson15e0f272014-10-21 15:33:02 -04002
Ash Wilson69c08742014-10-21 14:04:40 -04003package servers
4
5import (
6 os "github.com/rackspace/gophercloud/openstack/compute/v2/servers"
7)
8
9// ListOutput is the recorded output of a Rackspace servers.List request.
10const ListOutput = `
11{
12 "servers": [
13 {
14 "OS-DCF:diskConfig": "MANUAL",
15 "OS-EXT-STS:power_state": 1,
16 "OS-EXT-STS:task_state": null,
17 "OS-EXT-STS:vm_state": "active",
18 "accessIPv4": "1.2.3.4",
19 "accessIPv6": "1111:4822:7818:121:2000:9b5e:7438:a2d0",
20 "addresses": {
21 "private": [
22 {
23 "addr": "10.208.230.113",
24 "version": 4
25 }
26 ],
27 "public": [
28 {
29 "addr": "2001:4800:7818:101:2000:9b5e:7428:a2d0",
30 "version": 6
31 },
32 {
33 "addr": "104.130.131.164",
34 "version": 4
35 }
36 ]
37 },
38 "created": "2014-09-23T12:34:58Z",
39 "flavor": {
40 "id": "performance1-8",
41 "links": [
42 {
43 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8",
44 "rel": "bookmark"
45 }
46 ]
47 },
48 "hostId": "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475",
49 "id": "59818cee-bc8c-44eb-8073-673ee65105f7",
50 "image": {
51 "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14",
52 "links": [
53 {
54 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14",
55 "rel": "bookmark"
56 }
57 ]
58 },
59 "key_name": "mykey",
60 "links": [
61 {
62 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
63 "rel": "self"
64 },
65 {
66 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
67 "rel": "bookmark"
68 }
69 ],
70 "metadata": {},
71 "name": "devstack",
72 "progress": 100,
73 "status": "ACTIVE",
74 "tenant_id": "111111",
75 "updated": "2014-09-23T12:38:19Z",
76 "user_id": "14ae7bb21d81422694655f3cc30f2930"
77 },
78 {
79 "OS-DCF:diskConfig": "MANUAL",
80 "OS-EXT-STS:power_state": 1,
81 "OS-EXT-STS:task_state": null,
82 "OS-EXT-STS:vm_state": "active",
83 "accessIPv4": "1.1.2.3",
84 "accessIPv6": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
85 "addresses": {
86 "private": [
87 {
88 "addr": "10.10.20.30",
89 "version": 4
90 }
91 ],
92 "public": [
93 {
94 "addr": "1.1.2.3",
95 "version": 4
96 },
97 {
98 "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
99 "version": 6
100 }
101 ]
102 },
103 "created": "2014-07-21T19:32:55Z",
104 "flavor": {
105 "id": "performance1-2",
106 "links": [
107 {
108 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2",
109 "rel": "bookmark"
110 }
111 ]
112 },
113 "hostId": "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c",
114 "id": "25f1c7f5-e00a-4715-b354-16e24b2f4630",
115 "image": {
116 "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca",
117 "links": [
118 {
119 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca",
120 "rel": "bookmark"
121 }
122 ]
123 },
124 "key_name": "otherkey",
125 "links": [
126 {
127 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
128 "rel": "self"
129 },
130 {
131 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
132 "rel": "bookmark"
133 }
134 ],
135 "metadata": {},
136 "name": "peril-dfw",
137 "progress": 100,
138 "status": "ACTIVE",
139 "tenant_id": "111111",
140 "updated": "2014-07-21T19:34:24Z",
141 "user_id": "14ae7bb21d81422694655f3cc30f2930"
142 }
143 ]
144}
145`
146
147// GetOutput is the recorded output of a Rackspace servers.Get request.
148const GetOutput = `
149{
150 "server": {
151 "OS-DCF:diskConfig": "AUTO",
152 "OS-EXT-STS:power_state": 1,
153 "OS-EXT-STS:task_state": null,
154 "OS-EXT-STS:vm_state": "active",
155 "accessIPv4": "1.2.4.8",
156 "accessIPv6": "2001:4800:6666:105:2a0f:c056:f594:7777",
157 "addresses": {
158 "private": [
159 {
160 "addr": "10.20.40.80",
161 "version": 4
162 }
163 ],
164 "public": [
165 {
166 "addr": "1.2.4.8",
167 "version": 4
168 },
169 {
170 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
171 "version": 6
172 }
173 ]
174 },
175 "created": "2014-10-21T14:42:16Z",
176 "flavor": {
177 "id": "performance1-1",
178 "links": [
179 {
180 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
181 "rel": "bookmark"
182 }
183 ]
184 },
185 "hostId": "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
186 "id": "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
187 "image": {
188 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
189 "links": [
190 {
191 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
192 "rel": "bookmark"
193 }
194 ]
195 },
196 "key_name": null,
197 "links": [
198 {
199 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
200 "rel": "self"
201 },
202 {
203 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
204 "rel": "bookmark"
205 }
206 ],
207 "metadata": {},
208 "name": "Gophercloud-pxpGGuey",
209 "progress": 100,
210 "status": "ACTIVE",
211 "tenant_id": "111111",
212 "updated": "2014-10-21T14:42:57Z",
213 "user_id": "14ae7bb21d81423694655f4dd30f2930"
214 }
215}
216`
217
Jon Perritt723a24b2015-02-02 10:06:42 -0700218// UpdateOutput is the recorded output of a Rackspace servers.Update request.
219const UpdateOutput = `
220{
221 "server": {
222 "OS-DCF:diskConfig": "AUTO",
223 "OS-EXT-STS:power_state": 1,
224 "OS-EXT-STS:task_state": null,
225 "OS-EXT-STS:vm_state": "active",
226 "accessIPv4": "1.2.4.8",
227 "accessIPv6": "2001:4800:6666:105:2a0f:c056:f594:7777",
228 "addresses": {
229 "private": [
230 {
231 "addr": "10.20.40.80",
232 "version": 4
233 }
234 ],
235 "public": [
236 {
237 "addr": "1.2.4.8",
238 "version": 4
239 },
240 {
241 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
242 "version": 6
243 }
244 ]
245 },
246 "created": "2014-10-21T14:42:16Z",
247 "flavor": {
248 "id": "performance1-1",
249 "links": [
250 {
251 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
252 "rel": "bookmark"
253 }
254 ]
255 },
256 "hostId": "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
257 "id": "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
258 "image": {
259 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
260 "links": [
261 {
262 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
263 "rel": "bookmark"
264 }
265 ]
266 },
267 "key_name": null,
268 "links": [
269 {
270 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
271 "rel": "self"
272 },
273 {
274 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
275 "rel": "bookmark"
276 }
277 ],
278 "metadata": {},
279 "name": "test-server-updated",
280 "progress": 100,
281 "status": "ACTIVE",
282 "tenant_id": "111111",
283 "updated": "2014-10-21T14:42:57Z",
284 "user_id": "14ae7bb21d81423694655f4dd30f2930"
285 }
286}
287`
288
Ash Wilson7a20cc92014-10-21 15:53:03 -0400289// CreateOutput contains a sample of Rackspace's response to a Create call.
290const CreateOutput = `
291{
292 "server": {
293 "OS-DCF:diskConfig": "AUTO",
294 "adminPass": "v7tADqbE5pr9",
295 "id": "bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
296 "links": [
297 {
298 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
299 "rel": "self"
300 },
301 {
302 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
303 "rel": "bookmark"
304 }
305 ]
306 }
307}
308`
309
Ash Wilson69c08742014-10-21 14:04:40 -0400310// DevstackServer is the expected first result from parsing ListOutput.
311var DevstackServer = os.Server{
312 ID: "59818cee-bc8c-44eb-8073-673ee65105f7",
313 Name: "devstack",
314 TenantID: "111111",
315 UserID: "14ae7bb21d81422694655f3cc30f2930",
316 HostID: "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475",
317 Updated: "2014-09-23T12:38:19Z",
318 Created: "2014-09-23T12:34:58Z",
319 AccessIPv4: "1.2.3.4",
320 AccessIPv6: "1111:4822:7818:121:2000:9b5e:7438:a2d0",
321 Progress: 100,
322 Status: "ACTIVE",
323 Image: map[string]interface{}{
324 "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14",
325 "links": []interface{}{
326 map[string]interface{}{
327 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14",
328 "rel": "bookmark",
329 },
330 },
331 },
332 Flavor: map[string]interface{}{
333 "id": "performance1-8",
334 "links": []interface{}{
335 map[string]interface{}{
336 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8",
337 "rel": "bookmark",
338 },
339 },
340 },
341 Addresses: map[string]interface{}{
342 "private": []interface{}{
343 map[string]interface{}{
344 "addr": "10.20.30.40",
345 "version": float64(4.0),
346 },
347 },
348 "public": []interface{}{
349 map[string]interface{}{
350 "addr": "1111:4822:7818:121:2000:9b5e:7438:a2d0",
351 "version": float64(6.0),
352 },
353 map[string]interface{}{
354 "addr": "1.2.3.4",
355 "version": float64(4.0),
356 },
357 },
358 },
359 Metadata: map[string]interface{}{},
360 Links: []interface{}{
361 map[string]interface{}{
362 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59918cee-bd9d-44eb-8173-673ee75105f7",
363 "rel": "self",
364 },
365 map[string]interface{}{
366 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
367 "rel": "bookmark",
368 },
369 },
370 KeyName: "mykey",
371 AdminPass: "",
372}
373
374// PerilServer is the expected second result from parsing ListOutput.
375var PerilServer = os.Server{
376 ID: "25f1c7f5-e00a-4715-b354-16e24b2f4630",
377 Name: "peril-dfw",
378 TenantID: "111111",
379 UserID: "14ae7bb21d81422694655f3cc30f2930",
380 HostID: "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c",
381 Updated: "2014-07-21T19:34:24Z",
382 Created: "2014-07-21T19:32:55Z",
383 AccessIPv4: "1.1.2.3",
384 AccessIPv6: "2222:4444:7817:101:be76:4eff:f0e5:9e02",
385 Progress: 100,
386 Status: "ACTIVE",
387 Image: map[string]interface{}{
388 "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca",
389 "links": []interface{}{
390 map[string]interface{}{
391 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca",
392 "rel": "bookmark",
393 },
394 },
395 },
396 Flavor: map[string]interface{}{
397 "id": "performance1-2",
398 "links": []interface{}{
399 map[string]interface{}{
400 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2",
401 "rel": "bookmark",
402 },
403 },
404 },
405 Addresses: map[string]interface{}{
406 "private": []interface{}{
407 map[string]interface{}{
408 "addr": "10.10.20.30",
409 "version": float64(4.0),
410 },
411 },
412 "public": []interface{}{
413 map[string]interface{}{
414 "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
415 "version": float64(6.0),
416 },
417 map[string]interface{}{
418 "addr": "1.1.2.3",
419 "version": float64(4.0),
420 },
421 },
422 },
423 Metadata: map[string]interface{}{},
424 Links: []interface{}{
425 map[string]interface{}{
426 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
427 "rel": "self",
428 },
429 map[string]interface{}{
430 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
431 "rel": "bookmark",
432 },
433 },
434 KeyName: "otherkey",
435 AdminPass: "",
436}
437
438// GophercloudServer is the expected result from parsing GetOutput.
439var GophercloudServer = os.Server{
440 ID: "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
441 Name: "Gophercloud-pxpGGuey",
442 TenantID: "111111",
443 UserID: "14ae7bb21d81423694655f4dd30f2930",
444 HostID: "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
445 Updated: "2014-10-21T14:42:57Z",
446 Created: "2014-10-21T14:42:16Z",
447 AccessIPv4: "1.2.4.8",
448 AccessIPv6: "2001:4800:6666:105:2a0f:c056:f594:7777",
449 Progress: 100,
450 Status: "ACTIVE",
451 Image: map[string]interface{}{
452 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
453 "links": []interface{}{
454 map[string]interface{}{
455 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
456 "rel": "bookmark",
457 },
458 },
459 },
460 Flavor: map[string]interface{}{
461 "id": "performance1-1",
462 "links": []interface{}{
463 map[string]interface{}{
464 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
465 "rel": "bookmark",
466 },
467 },
468 },
469 Addresses: map[string]interface{}{
470 "private": []interface{}{
471 map[string]interface{}{
472 "addr": "10.20.40.80",
473 "version": float64(4.0),
474 },
475 },
476 "public": []interface{}{
477 map[string]interface{}{
478 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
479 "version": float64(6.0),
480 },
481 map[string]interface{}{
482 "addr": "1.2.4.8",
483 "version": float64(4.0),
484 },
485 },
486 },
487 Metadata: map[string]interface{}{},
488 Links: []interface{}{
489 map[string]interface{}{
490 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
491 "rel": "self",
492 },
493 map[string]interface{}{
494 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
495 "rel": "bookmark",
496 },
497 },
498 KeyName: "",
499 AdminPass: "",
500}
501
Jon Perritt723a24b2015-02-02 10:06:42 -0700502// GophercloudUpdatedServer is the expected result from parsing UpdateOutput.
503var GophercloudUpdatedServer = os.Server{
504 ID: "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
505 Name: "test-server-updated",
506 TenantID: "111111",
507 UserID: "14ae7bb21d81423694655f4dd30f2930",
508 HostID: "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
509 Updated: "2014-10-21T14:42:57Z",
510 Created: "2014-10-21T14:42:16Z",
511 AccessIPv4: "1.2.4.8",
512 AccessIPv6: "2001:4800:6666:105:2a0f:c056:f594:7777",
513 Progress: 100,
514 Status: "ACTIVE",
515 Image: map[string]interface{}{
516 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
517 "links": []interface{}{
518 map[string]interface{}{
519 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
520 "rel": "bookmark",
521 },
522 },
523 },
524 Flavor: map[string]interface{}{
525 "id": "performance1-1",
526 "links": []interface{}{
527 map[string]interface{}{
528 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
529 "rel": "bookmark",
530 },
531 },
532 },
533 Addresses: map[string]interface{}{
534 "private": []interface{}{
535 map[string]interface{}{
536 "addr": "10.20.40.80",
537 "version": float64(4.0),
538 },
539 },
540 "public": []interface{}{
541 map[string]interface{}{
542 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
543 "version": float64(6.0),
544 },
545 map[string]interface{}{
546 "addr": "1.2.4.8",
547 "version": float64(4.0),
548 },
549 },
550 },
551 Metadata: map[string]interface{}{},
552 Links: []interface{}{
553 map[string]interface{}{
554 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
555 "rel": "self",
556 },
557 map[string]interface{}{
558 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
559 "rel": "bookmark",
560 },
561 },
562 KeyName: "",
563 AdminPass: "",
564}
565
Ash Wilson7a20cc92014-10-21 15:53:03 -0400566// CreatedServer is the partial Server struct that can be parsed from CreateOutput.
567var CreatedServer = os.Server{
568 ID: "bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
569 AdminPass: "v7tADqbE5pr9",
570 Links: []interface{}{},
571}
572
Ash Wilson69c08742014-10-21 14:04:40 -0400573// ExpectedServerSlice is the collection of servers, in order, that should be parsed from ListOutput.
574var ExpectedServerSlice = []os.Server{DevstackServer, PerilServer}