github.com/1and1/oneandone-cloudserver-sdk-go@v1.4.1/dvdisos.go (about)

     1  package oneandone
     2  
     3  import "net/http"
     4  
     5  // Struct to describe a ISO image that can be used to boot a server.
     6  //
     7  // Values of this type describe ISO images that can be inserted into the servers virtual DVD drive.
     8  //
     9  //
    10  type DvdIso struct {
    11  	Identity
    12  	OsFamily             string      `json:"os_family,omitempty"`
    13  	Os                   string      `json:"os,omitempty"`
    14  	OsVersion            string      `json:"os_version,omitempty"`
    15  	Type                 string      `json:"type,omitempty"`
    16  	AvailableDatacenters []string    `json:"available_datacenters,omitempty"`
    17  	Architecture         interface{} `json:"os_architecture,omitempty"`
    18  	ApiPtr
    19  }
    20  
    21  // GET /dvd_isos
    22  func (api *API) ListDvdIsos(args ...interface{}) ([]DvdIso, error) {
    23  	url, err := processQueryParams(createUrl(api, dvdIsoPathSegment), args...)
    24  	if err != nil {
    25  		return nil, err
    26  	}
    27  	result := []DvdIso{}
    28  	err = api.Client.Get(url, &result, http.StatusOK)
    29  	if err != nil {
    30  		return nil, err
    31  	}
    32  	for index, _ := range result {
    33  		result[index].api = api
    34  	}
    35  	return result, nil
    36  }
    37  
    38  // GET /dvd_isos/{id}
    39  func (api *API) GetDvdIso(dvd_id string) (*DvdIso, error) {
    40  	result := new(DvdIso)
    41  	url := createUrl(api, dvdIsoPathSegment, dvd_id)
    42  	err := api.Client.Get(url, &result, http.StatusOK)
    43  	if err != nil {
    44  		return nil, err
    45  	}
    46  	result.api = api
    47  	return result, nil
    48  }