blob: b22a28998d1b2571865444a5b5dc9a9afa53b4b8 [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
Ash Wilson7a20cc92014-10-21 15:53:03 -0400218// CreateOutput contains a sample of Rackspace's response to a Create call.
219const CreateOutput = `
220{
221 "server": {
222 "OS-DCF:diskConfig": "AUTO",
223 "adminPass": "v7tADqbE5pr9",
224 "id": "bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
225 "links": [
226 {
227 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
228 "rel": "self"
229 },
230 {
231 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
232 "rel": "bookmark"
233 }
234 ]
235 }
236}
237`
238
Ash Wilson69c08742014-10-21 14:04:40 -0400239// DevstackServer is the expected first result from parsing ListOutput.
240var DevstackServer = os.Server{
241 ID: "59818cee-bc8c-44eb-8073-673ee65105f7",
242 Name: "devstack",
243 TenantID: "111111",
244 UserID: "14ae7bb21d81422694655f3cc30f2930",
245 HostID: "e8951a524bc465b0898aeac7674da6fe1495e253ae1ea17ddb2c2475",
246 Updated: "2014-09-23T12:38:19Z",
247 Created: "2014-09-23T12:34:58Z",
248 AccessIPv4: "1.2.3.4",
249 AccessIPv6: "1111:4822:7818:121:2000:9b5e:7438:a2d0",
250 Progress: 100,
251 Status: "ACTIVE",
252 Image: map[string]interface{}{
253 "id": "255df5fb-e3d4-45a3-9a07-c976debf7c14",
254 "links": []interface{}{
255 map[string]interface{}{
256 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/255df5fb-e3d4-45a3-9a07-c976debf7c14",
257 "rel": "bookmark",
258 },
259 },
260 },
261 Flavor: map[string]interface{}{
262 "id": "performance1-8",
263 "links": []interface{}{
264 map[string]interface{}{
265 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-8",
266 "rel": "bookmark",
267 },
268 },
269 },
270 Addresses: map[string]interface{}{
271 "private": []interface{}{
272 map[string]interface{}{
273 "addr": "10.20.30.40",
274 "version": float64(4.0),
275 },
276 },
277 "public": []interface{}{
278 map[string]interface{}{
279 "addr": "1111:4822:7818:121:2000:9b5e:7438:a2d0",
280 "version": float64(6.0),
281 },
282 map[string]interface{}{
283 "addr": "1.2.3.4",
284 "version": float64(4.0),
285 },
286 },
287 },
288 Metadata: map[string]interface{}{},
289 Links: []interface{}{
290 map[string]interface{}{
291 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59918cee-bd9d-44eb-8173-673ee75105f7",
292 "rel": "self",
293 },
294 map[string]interface{}{
295 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/59818cee-bc8c-44eb-8073-673ee65105f7",
296 "rel": "bookmark",
297 },
298 },
299 KeyName: "mykey",
300 AdminPass: "",
301}
302
303// PerilServer is the expected second result from parsing ListOutput.
304var PerilServer = os.Server{
305 ID: "25f1c7f5-e00a-4715-b354-16e24b2f4630",
306 Name: "peril-dfw",
307 TenantID: "111111",
308 UserID: "14ae7bb21d81422694655f3cc30f2930",
309 HostID: "f859679906d6b1a38c1bd516b78f4dcc7d5fcf012578fa3ce460716c",
310 Updated: "2014-07-21T19:34:24Z",
311 Created: "2014-07-21T19:32:55Z",
312 AccessIPv4: "1.1.2.3",
313 AccessIPv6: "2222:4444:7817:101:be76:4eff:f0e5:9e02",
314 Progress: 100,
315 Status: "ACTIVE",
316 Image: map[string]interface{}{
317 "id": "bb02b1a3-bc77-4d17-ab5b-421d89850fca",
318 "links": []interface{}{
319 map[string]interface{}{
320 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/bb02b1a3-bc77-4d17-ab5b-421d89850fca",
321 "rel": "bookmark",
322 },
323 },
324 },
325 Flavor: map[string]interface{}{
326 "id": "performance1-2",
327 "links": []interface{}{
328 map[string]interface{}{
329 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-2",
330 "rel": "bookmark",
331 },
332 },
333 },
334 Addresses: map[string]interface{}{
335 "private": []interface{}{
336 map[string]interface{}{
337 "addr": "10.10.20.30",
338 "version": float64(4.0),
339 },
340 },
341 "public": []interface{}{
342 map[string]interface{}{
343 "addr": "2222:4444:7817:101:be76:4eff:f0e5:9e02",
344 "version": float64(6.0),
345 },
346 map[string]interface{}{
347 "addr": "1.1.2.3",
348 "version": float64(4.0),
349 },
350 },
351 },
352 Metadata: map[string]interface{}{},
353 Links: []interface{}{
354 map[string]interface{}{
355 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
356 "rel": "self",
357 },
358 map[string]interface{}{
359 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/25f1c7f5-e00a-4715-b355-16e24b2f4630",
360 "rel": "bookmark",
361 },
362 },
363 KeyName: "otherkey",
364 AdminPass: "",
365}
366
367// GophercloudServer is the expected result from parsing GetOutput.
368var GophercloudServer = os.Server{
369 ID: "8c65cb68-0681-4c30-bc88-6b83a8a26aee",
370 Name: "Gophercloud-pxpGGuey",
371 TenantID: "111111",
372 UserID: "14ae7bb21d81423694655f4dd30f2930",
373 HostID: "430d2ae02de0a7af77012c94778145eccf67e75b1fac0528aa10d4a7",
374 Updated: "2014-10-21T14:42:57Z",
375 Created: "2014-10-21T14:42:16Z",
376 AccessIPv4: "1.2.4.8",
377 AccessIPv6: "2001:4800:6666:105:2a0f:c056:f594:7777",
378 Progress: 100,
379 Status: "ACTIVE",
380 Image: map[string]interface{}{
381 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
382 "links": []interface{}{
383 map[string]interface{}{
384 "href": "https://dfw.servers.api.rackspacecloud.com/111111/images/e19a734c-c7e6-443a-830c-242209c4d65d",
385 "rel": "bookmark",
386 },
387 },
388 },
389 Flavor: map[string]interface{}{
390 "id": "performance1-1",
391 "links": []interface{}{
392 map[string]interface{}{
393 "href": "https://dfw.servers.api.rackspacecloud.com/111111/flavors/performance1-1",
394 "rel": "bookmark",
395 },
396 },
397 },
398 Addresses: map[string]interface{}{
399 "private": []interface{}{
400 map[string]interface{}{
401 "addr": "10.20.40.80",
402 "version": float64(4.0),
403 },
404 },
405 "public": []interface{}{
406 map[string]interface{}{
407 "addr": "2001:4800:6666:105:2a0f:c056:f594:7777",
408 "version": float64(6.0),
409 },
410 map[string]interface{}{
411 "addr": "1.2.4.8",
412 "version": float64(4.0),
413 },
414 },
415 },
416 Metadata: map[string]interface{}{},
417 Links: []interface{}{
418 map[string]interface{}{
419 "href": "https://dfw.servers.api.rackspacecloud.com/v2/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
420 "rel": "self",
421 },
422 map[string]interface{}{
423 "href": "https://dfw.servers.api.rackspacecloud.com/111111/servers/8c65cb68-0681-4c30-bc88-6b83a8a26aee",
424 "rel": "bookmark",
425 },
426 },
427 KeyName: "",
428 AdminPass: "",
429}
430
Ash Wilson7a20cc92014-10-21 15:53:03 -0400431// CreatedServer is the partial Server struct that can be parsed from CreateOutput.
432var CreatedServer = os.Server{
433 ID: "bb63327b-6a2f-34bc-b0ef-4b6d97ea637e",
434 AdminPass: "v7tADqbE5pr9",
435 Links: []interface{}{},
436}
437
Ash Wilson69c08742014-10-21 14:04:40 -0400438// ExpectedServerSlice is the collection of servers, in order, that should be parsed from ListOutput.
439var ExpectedServerSlice = []os.Server{DevstackServer, PerilServer}