blob: c46d196cbf2c70322b5217e0504d3d59835375d7 [file] [log] [blame]
Ash Wilsond5506542014-10-21 09:02:16 -04001// +build fixtures
2package images
3
4import (
5 os "github.com/rackspace/gophercloud/openstack/compute/v2/images"
6)
7
8// ListOutput is an example response from an /images/detail request.
9const ListOutput = `
10{
11 "images": [
12 {
13 "OS-DCF:diskConfig": "MANUAL",
14 "OS-EXT-IMG-SIZE:size": 1.017415075e+09,
15 "created": "2014-10-01T15:49:02Z",
16 "id": "30aa010e-080e-4d4b-a7f9-09fc55b07d69",
17 "links": [
18 {
19 "href": "https://iad.servers.api.rackspacecloud.com/v2/111222/images/30aa010e-080e-4d4b-a7f9-09fc55b07d69",
20 "rel": "self"
21 },
22 {
23 "href": "https://iad.servers.api.rackspacecloud.com/111222/images/30aa010e-080e-4d4b-a7f9-09fc55b07d69",
24 "rel": "bookmark"
25 },
26 {
27 "href": "https://iad.servers.api.rackspacecloud.com/111222/images/30aa010e-080e-4d4b-a7f9-09fc55b07d69",
28 "rel": "alternate",
29 "type": "application/vnd.openstack.image"
30 }
31 ],
32 "metadata": {
33 "auto_disk_config": "disabled",
34 "cache_in_nova": "True",
35 "com.rackspace__1__build_core": "1",
36 "com.rackspace__1__build_managed": "1",
37 "com.rackspace__1__build_rackconnect": "1",
38 "com.rackspace__1__options": "0",
39 "com.rackspace__1__platform_target": "PublicCloud",
40 "com.rackspace__1__release_build_date": "2014-10-01_15-46-08",
41 "com.rackspace__1__release_id": "100",
42 "com.rackspace__1__release_version": "10",
43 "com.rackspace__1__source": "kickstart",
44 "com.rackspace__1__visible_core": "1",
45 "com.rackspace__1__visible_managed": "0",
46 "com.rackspace__1__visible_rackconnect": "0",
47 "image_type": "base",
48 "org.openstack__1__architecture": "x64",
49 "org.openstack__1__os_distro": "org.archlinux",
50 "org.openstack__1__os_version": "2014.8",
51 "os_distro": "arch",
52 "os_type": "linux",
53 "vm_mode": "hvm"
54 },
55 "minDisk": 20,
56 "minRam": 512,
57 "name": "Arch 2014.10 (PVHVM)",
58 "progress": 100,
59 "status": "ACTIVE",
60 "updated": "2014-10-01T19:37:58Z"
61 },
62 {
63 "OS-DCF:diskConfig": "AUTO",
64 "OS-EXT-IMG-SIZE:size": 1.060306463e+09,
65 "created": "2014-10-01T12:58:11Z",
66 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
67 "links": [
68 {
69 "href": "https://iad.servers.api.rackspacecloud.com/v2/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
70 "rel": "self"
71 },
72 {
73 "href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
74 "rel": "bookmark"
75 },
76 {
77 "href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
78 "rel": "alternate",
79 "type": "application/vnd.openstack.image"
80 }
81 ],
82 "metadata": {
83 "auto_disk_config": "True",
84 "cache_in_nova": "True",
85 "com.rackspace__1__build_core": "1",
86 "com.rackspace__1__build_managed": "1",
87 "com.rackspace__1__build_rackconnect": "1",
88 "com.rackspace__1__options": "0",
89 "com.rackspace__1__platform_target": "PublicCloud",
90 "com.rackspace__1__release_build_date": "2014-10-01_12-31-03",
91 "com.rackspace__1__release_id": "1007",
92 "com.rackspace__1__release_version": "6",
93 "com.rackspace__1__source": "kickstart",
94 "com.rackspace__1__visible_core": "1",
95 "com.rackspace__1__visible_managed": "1",
96 "com.rackspace__1__visible_rackconnect": "1",
97 "image_type": "base",
98 "org.openstack__1__architecture": "x64",
99 "org.openstack__1__os_distro": "com.ubuntu",
100 "org.openstack__1__os_version": "14.04",
101 "os_distro": "ubuntu",
102 "os_type": "linux",
103 "vm_mode": "xen"
104 },
105 "minDisk": 20,
106 "minRam": 512,
107 "name": "Ubuntu 14.04 LTS (Trusty Tahr)",
108 "progress": 100,
109 "status": "ACTIVE",
110 "updated": "2014-10-01T15:51:44Z"
111 }
112 ]
113}
114`
115
116// GetOutput is an example response from an /images request.
117const GetOutput = `
118{
119 "image": {
120 "OS-DCF:diskConfig": "AUTO",
121 "OS-EXT-IMG-SIZE:size": 1060306463,
122 "created": "2014-10-01T12:58:11Z",
123 "id": "e19a734c-c7e6-443a-830c-242209c4d65d",
124 "links": [
125 {
126 "href": "https://iad.servers.api.rackspacecloud.com/v2/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
127 "rel": "self"
128 },
129 {
130 "href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
131 "rel": "bookmark"
132 },
133 {
134 "href": "https://iad.servers.api.rackspacecloud.com/111222/images/e19a734c-c7e6-443a-830c-242209c4d65d",
135 "rel": "alternate",
136 "type": "application/vnd.openstack.image"
137 }
138 ],
139 "metadata": {
140 "auto_disk_config": "True",
141 "cache_in_nova": "True",
142 "com.rackspace__1__build_core": "1",
143 "com.rackspace__1__build_managed": "1",
144 "com.rackspace__1__build_rackconnect": "1",
145 "com.rackspace__1__options": "0",
146 "com.rackspace__1__platform_target": "PublicCloud",
147 "com.rackspace__1__release_build_date": "2014-10-01_12-31-03",
148 "com.rackspace__1__release_id": "1007",
149 "com.rackspace__1__release_version": "6",
150 "com.rackspace__1__source": "kickstart",
151 "com.rackspace__1__visible_core": "1",
152 "com.rackspace__1__visible_managed": "1",
153 "com.rackspace__1__visible_rackconnect": "1",
154 "image_type": "base",
155 "org.openstack__1__architecture": "x64",
156 "org.openstack__1__os_distro": "com.ubuntu",
157 "org.openstack__1__os_version": "14.04",
158 "os_distro": "ubuntu",
159 "os_type": "linux",
160 "vm_mode": "xen"
161 },
162 "minDisk": 20,
163 "minRam": 512,
164 "name": "Ubuntu 14.04 LTS (Trusty Tahr)",
165 "progress": 100,
166 "status": "ACTIVE",
167 "updated": "2014-10-01T15:51:44Z"
168 }
169}
170`
171
172// ArchImage is the first Image structure that should be parsed from ListOutput.
173var ArchImage = os.Image{
174 ID: "30aa010e-080e-4d4b-a7f9-09fc55b07d69",
175 Name: "Arch 2014.10 (PVHVM)",
176 Created: "2014-10-01T15:49:02Z",
177 Updated: "2014-10-01T19:37:58Z",
178 MinDisk: 20,
179 MinRAM: 512,
180 Progress: 100,
181 Status: "ACTIVE",
182}
183
184// UbuntuImage is the second Image structure that should be parsed from ListOutput and
185// the only image that should be extracted from GetOutput.
186var UbuntuImage = os.Image{
187 ID: "e19a734c-c7e6-443a-830c-242209c4d65d",
188 Name: "Ubuntu 14.04 LTS (Trusty Tahr)",
189 Created: "2014-10-01T12:58:11Z",
190 Updated: "2014-10-01T15:51:44Z",
191 MinDisk: 20,
192 MinRAM: 512,
193 Progress: 100,
194 Status: "ACTIVE",
195}
196
197// ExpectedImageSlice is the collection of images that should be parsed from ListOutput,
198// in order.
199var ExpectedImageSlice = []os.Image{ArchImage, UbuntuImage}