blob: 9126b935bccf28d9ce6b95929217a4b030fb56a1 [file] [log] [blame]
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -07001package gophercloud
2
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -07003import (
4 "github.com/racker/perigee"
5)
6
7// See the CloudImagesProvider interface for details.
8func (gsp *genericServersProvider) ListImages() ([]Image, error) {
9 var is []Image
10 url := gsp.endpoint + "/images"
11 err := perigee.Get(url, perigee.Options{
12 CustomClient: gsp.context.httpClient,
13 Results: &struct{ Images *[]Image }{&is},
14 MoreHeaders: map[string]string{
15 "X-Auth-Token": gsp.access.AuthToken(),
16 },
17 })
18 return is, err
19}
20
Samuel A. Falvo IIbc0d54a2013-07-08 14:45:21 -070021// ImageLink provides a reference to a image by either ID or by direct URL.
22// Some services use just the ID, others use just the URL.
23// This structure provides a common means of expressing both in a single field.
24type ImageLink struct {
25 Id string `json:"id"`
26 Links []Link `json:"links"`
27}
Samuel A. Falvo II0a6e45a2013-07-11 17:00:41 -070028
29// Image is used for JSON (un)marshalling.
30// It provides a description of an OS image.
31//
32// The Id field contains the image's unique identifier.
33// For example, this identifier will be useful for specifying which operating system to install on a new server instance.
34//
35// The MinDisk and MinRam fields specify the minimum resources a server must provide to be able to install the image.
36//
37// The Name field provides a human-readable moniker for the OS image.
38//
39// The Progress and Status fields indicate image-creation status.
40// Any usable image will have 100% progress.
41//
42// The Updated field indicates the last time this image was changed.
43//
44// OsDcfDiskConfig indicates the server's boot volume configuration.
45// Valid values are:
46// AUTO
47// ----
48// The server is built with a single partition the size of the target flavor disk.
49// The file system is automatically adjusted to fit the entire partition.
50// This keeps things simple and automated.
51// AUTO is valid only for images and servers with a single partition that use the EXT3 file system.
52// This is the default setting for applicable Rackspace base images.
53//
54// MANUAL
55// ------
56// The server is built using whatever partition scheme and file system is in the source image.
57// If the target flavor disk is larger,
58// the remaining disk space is left unpartitioned.
59// This enables images to have non-EXT3 file systems, multiple partitions, and so on,
60// and enables you to manage the disk configuration.
61//
62type Image struct {
63 Created string `json:"created"`
64 Id string `json:"id"`
65 Links []Link `json:"links"`
66 MinDisk int `json:"minDisk"`
67 MinRam int `json:"minRam"`
68 Name string `json:"name"`
69 Progress int `json:"progress"`
70 Status string `json:"status"`
71 Updated string `json:"updated"`
72 OsDcfDiskConfig string `json:"OS-DCF:diskConfig"`
73}
74