forked from rackspace/gophercloud
/
fixtures.go
199 lines (193 loc) · 6.2 KB
/
fixtures.go
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
// +build fixtures
package images
import (
os "github.com/rackspace/gophercloud/openstack/compute/v2/images"
)
// ListOutput is an example response from an /images/detail request.
const ListOutput = `
{
"images": [
{
"OS-DCF:diskConfig": "MANUAL",
"OS-EXT-IMG-SIZE:size": 1.017415075e+09,
"created": "2014-10-01T15:49:02Z",
"id": "30aa010e-080e-4d4b-a7f9-09fc55b07d69",
"links": [
{
"href": "https://iad.servers.api.rackspacecloud.com/v2/111222/images/30aa010e-080e-4d4b-a7f9-09fc55b07d69",
"rel": "self"
},
{
"href": "https://iad.servers.api.rackspacecloud.com/111222/images/30aa010e-080e-4d4b-a7f9-09fc55b07d69",
"rel": "bookmark"
},
{
"href": "https://iad.servers.api.rackspacecloud.com/111222/images/30aa010e-080e-4d4b-a7f9-09fc55b07d69",
"rel": "alternate",
"type": "application/vnd.openstack.image"
}
],
"metadata": {
"auto_disk_config": "disabled",
"cache_in_nova": "True",
"com.rackspace__1__build_core": "1",
"com.rackspace__1__build_managed": "1",
"com.rackspace__1__build_rackconnect": "1",
"com.rackspace__1__options": "0",
"com.rackspace__1__platform_target": "PublicCloud",
"com.rackspace__1__release_build_date": "2014-10-01_15-46-08",
"com.rackspace__1__release_id": "100",
"com.rackspace__1__release_version": "10",
"com.rackspace__1__source": "kickstart",
"com.rackspace__1__visible_core": "1",
"com.rackspace__1__visible_managed": "0",
"com.rackspace__1__visible_rackconnect": "0",
"image_type": "base",
"org.openstack__1__architecture": "x64",
"org.openstack__1__os_distro": "org.archlinux",
"org.openstack__1__os_version": "2014.8",
"os_distro": "arch",
"os_type": "linux",
"vm_mode": "hvm"
},
"minDisk": 20,
"minRam": 512,
"name": "Arch 2014.10 (PVHVM)",
"progress": 100,
"status": "ACTIVE",
"updated": "2014-10-01T19:37:58Z"
},
{
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-IMG-SIZE:size": 1.060306463e+09,
"created": "2014-10-01T12:58:11Z",
"id": "e19a734c-c7e6-443a-830c-242209c4d65d",
"links": [
{
"href": "https://iad.servers.api.rackspacecloud.com/v2/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
"rel": "self"
},
{
"href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
"rel": "bookmark"
},
{
"href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
"rel": "alternate",
"type": "application/vnd.openstack.image"
}
],
"metadata": {
"auto_disk_config": "True",
"cache_in_nova": "True",
"com.rackspace__1__build_core": "1",
"com.rackspace__1__build_managed": "1",
"com.rackspace__1__build_rackconnect": "1",
"com.rackspace__1__options": "0",
"com.rackspace__1__platform_target": "PublicCloud",
"com.rackspace__1__release_build_date": "2014-10-01_12-31-03",
"com.rackspace__1__release_id": "1007",
"com.rackspace__1__release_version": "6",
"com.rackspace__1__source": "kickstart",
"com.rackspace__1__visible_core": "1",
"com.rackspace__1__visible_managed": "1",
"com.rackspace__1__visible_rackconnect": "1",
"image_type": "base",
"org.openstack__1__architecture": "x64",
"org.openstack__1__os_distro": "com.ubuntu",
"org.openstack__1__os_version": "14.04",
"os_distro": "ubuntu",
"os_type": "linux",
"vm_mode": "xen"
},
"minDisk": 20,
"minRam": 512,
"name": "Ubuntu 14.04 LTS (Trusty Tahr)",
"progress": 100,
"status": "ACTIVE",
"updated": "2014-10-01T15:51:44Z"
}
]
}
`
// GetOutput is an example response from an /images request.
const GetOutput = `
{
"image": {
"OS-DCF:diskConfig": "AUTO",
"OS-EXT-IMG-SIZE:size": 1060306463,
"created": "2014-10-01T12:58:11Z",
"id": "e19a734c-c7e6-443a-830c-242209c4d65d",
"links": [
{
"href": "https://iad.servers.api.rackspacecloud.com/v2/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
"rel": "self"
},
{
"href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
"rel": "bookmark"
},
{
"href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
"rel": "alternate",
"type": "application/vnd.openstack.image"
}
],
"metadata": {
"auto_disk_config": "True",
"cache_in_nova": "True",
"com.rackspace__1__build_core": "1",
"com.rackspace__1__build_managed": "1",
"com.rackspace__1__build_rackconnect": "1",
"com.rackspace__1__options": "0",
"com.rackspace__1__platform_target": "PublicCloud",
"com.rackspace__1__release_build_date": "2014-10-01_12-31-03",
"com.rackspace__1__release_id": "1007",
"com.rackspace__1__release_version": "6",
"com.rackspace__1__source": "kickstart",
"com.rackspace__1__visible_core": "1",
"com.rackspace__1__visible_managed": "1",
"com.rackspace__1__visible_rackconnect": "1",
"image_type": "base",
"org.openstack__1__architecture": "x64",
"org.openstack__1__os_distro": "com.ubuntu",
"org.openstack__1__os_version": "14.04",
"os_distro": "ubuntu",
"os_type": "linux",
"vm_mode": "xen"
},
"minDisk": 20,
"minRam": 512,
"name": "Ubuntu 14.04 LTS (Trusty Tahr)",
"progress": 100,
"status": "ACTIVE",
"updated": "2014-10-01T15:51:44Z"
}
}
`
// ArchImage is the first Image structure that should be parsed from ListOutput.
var ArchImage = os.Image{
ID: "30aa010e-080e-4d4b-a7f9-09fc55b07d69",
Name: "Arch 2014.10 (PVHVM)",
Created: "2014-10-01T15:49:02Z",
Updated: "2014-10-01T19:37:58Z",
MinDisk: 20,
MinRAM: 512,
Progress: 100,
Status: "ACTIVE",
}
// UbuntuImage is the second Image structure that should be parsed from ListOutput and
// the only image that should be extracted from GetOutput.
var UbuntuImage = os.Image{
ID: "e19a734c-c7e6-443a-830c-242209c4d65d",
Name: "Ubuntu 14.04 LTS (Trusty Tahr)",
Created: "2014-10-01T12:58:11Z",
Updated: "2014-10-01T15:51:44Z",
MinDisk: 20,
MinRAM: 512,
Progress: 100,
Status: "ACTIVE",
}
// ExpectedImageSlice is the collection of images that should be parsed from ListOutput,
// in order.
var ExpectedImageSlice = []os.Image{ArchImage, UbuntuImage}