packer-cn/vendor/github.com/1and1/oneandone-cloudserver-sdk-go/dvdisos.go

49 lines
1.3 KiB
Go
Raw Normal View History

2016-11-13 17:34:36 -05:00
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
}