-
Notifications
You must be signed in to change notification settings - Fork 5
/
dvdisos.go
48 lines (44 loc) · 1.29 KB
/
dvdisos.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
package oneandone
import "net/http"
// Struct to describe a ISO image that can be used to boot a server.
//
// Values of this type describe ISO images that can be inserted into the servers virtual DVD drive.
//
//
type DvdIso struct {
Identity
OsFamily string `json:"os_family,omitempty"`
Os string `json:"os,omitempty"`
OsVersion string `json:"os_version,omitempty"`
Type string `json:"type,omitempty"`
AvailableDatacenters []string `json:"available_datacenters,omitempty"`
Architecture interface{} `json:"os_architecture,omitempty"`
ApiPtr
}
// GET /dvd_isos
func (api *API) ListDvdIsos(args ...interface{}) ([]DvdIso, error) {
url, err := processQueryParams(createUrl(api, dvdIsoPathSegment), args...)
if err != nil {
return nil, err
}
result := []DvdIso{}
err = api.Client.Get(url, &result, http.StatusOK)
if err != nil {
return nil, err
}
for index, _ := range result {
result[index].api = api
}
return result, nil
}
// GET /dvd_isos/{id}
func (api *API) GetDvdIso(dvd_id string) (*DvdIso, error) {
result := new(DvdIso)
url := createUrl(api, dvdIsoPathSegment, dvd_id)
err := api.Client.Get(url, &result, http.StatusOK)
if err != nil {
return nil, err
}
result.api = api
return result, nil
}