forked from ionos-enterprise/ionos-enterprise-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.go
80 lines (73 loc) · 3.06 KB
/
image.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
package profitbricks
import (
"net/http"
)
//Image object
type Image struct {
ID string `json:"id,omitempty"`
PBType string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
Metadata *Metadata `json:"metadata,omitempty"`
Properties ImageProperties `json:"properties,omitempty"`
Response string `json:"Response,omitempty"`
Headers *http.Header `json:"headers,omitempty"`
StatusCode int `json:"statuscode,omitempty"`
}
//ImageProperties object
type ImageProperties struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Location string `json:"location,omitempty"`
Size float64 `json:"size,omitempty"`
CPUHotPlug bool `json:"cpuHotPlug,omitempty"`
CPUHotUnplug bool `json:"cpuHotUnplug,omitempty"`
RAMHotPlug bool `json:"ramHotPlug,omitempty"`
RAMHotUnplug bool `json:"ramHotUnplug,omitempty"`
NicHotPlug bool `json:"nicHotPlug,omitempty"`
NicHotUnplug bool `json:"nicHotUnplug,omitempty"`
DiscVirtioHotPlug bool `json:"discVirtioHotPlug,omitempty"`
DiscVirtioHotUnplug bool `json:"discVirtioHotUnplug,omitempty"`
DiscScsiHotPlug bool `json:"discScsiHotPlug,omitempty"`
DiscScsiHotUnplug bool `json:"discScsiHotUnplug,omitempty"`
LicenceType string `json:"licenceType,omitempty"`
ImageType string `json:"imageType,omitempty"`
ImageAliases []string `json:"imageAliases,omitempty"`
Public bool `json:"public,omitempty"`
Response string `json:"Response,omitempty"`
Headers *http.Header `json:"headers,omitempty"`
StatusCode int `json:"statuscode,omitempty"`
}
//Images object
type Images struct {
ID string `json:"id,omitempty"`
PBType string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
Items []Image `json:"items,omitempty"`
Response string `json:"Response,omitempty"`
Headers *http.Header `json:"headers,omitempty"`
StatusCode int `json:"statuscode,omitempty"`
}
//Cdroms object
type Cdroms struct {
ID string `json:"id,omitempty"`
PBType string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
Items []Image `json:"items,omitempty"`
Response string `json:"Response,omitempty"`
Headers *http.Header `json:"headers,omitempty"`
StatusCode int `json:"statuscode,omitempty"`
}
// ListImages returns an Collection struct
func (c *Client) ListImages() (*Images, error) {
url := imagesPath()
ret := &Images{}
err := c.Get(url, ret, http.StatusOK)
return ret, err
}
// GetImage returns an Instance struct where id ==imageid
func (c *Client) GetImage(imageid string) (*Image, error) {
url := imagePath(imageid)
ret := &Image{}
err := c.Get(url, ret, http.StatusOK)
return ret, err
}