Documentation ¶
Overview ¶
Package flavors contains functionality for working with ECL Baremetal Server's flavor resources.
Example to list flavors
listOpts := flavors.ListOpts{ TenantID: "a99e9b4e620e4db09a2dfb6e42a01e66", } allPages, err := flavors.List(client, listOpts).AllPages() if err != nil { panic(err) } allFlavors, err := flavors.ExtractFlavors(allPages) if err != nil { panic(err) } for _, flavor := range allFlavors { fmt.Printf("%+v", flavor) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IDFromName ¶
IDFromName is a convenience function that returns a flavor's ID given its name.
func List ¶
func List(client *eclcloud.ServiceClient, opts ListOptsBuilder) pagination.Pager
List returns Flavor optionally limited by the conditions provided in ListOpts.
Types ¶
type Flavor ¶
type Flavor struct { // ID is the flavor's unique ID. ID string `json:"id"` // Name is the name of the flavor. Name string `json:"name"` // Disk is the amount of root disk, measured in GB. Disk int `json:"disk"` // RAM is the amount of memory, measured in MB. RAM int `json:"ram"` // VCPUs indicates how many (virtual) CPUs are available for this flavor. VCPUs int `json:"vcpus"` }
Flavor represent (virtual) hardware configurations for server resources in a region.
func ExtractFlavors ¶
func ExtractFlavors(r pagination.Page) ([]Flavor, error)
ExtractFlavors provides access to the list of flavors in a page acquired from the ListDetail operation.
type FlavorPage ¶
type FlavorPage struct {
pagination.LinkedPageBase
}
FlavorPage contains a single page of all flavors from a ListDetails call.
func (FlavorPage) IsEmpty ¶
func (page FlavorPage) IsEmpty() (bool, error)
IsEmpty determines if a FlavorPage contains any results.
func (FlavorPage) NextPageURL ¶
func (page FlavorPage) NextPageURL() (string, error)
NextPageURL uses the response's embedded link reference to navigate to the next page of results.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the result of Get operations. Call its Extract method to interpret it as a Flavor.
type ListOpts ¶
type ListOpts struct { }
ListOpts holds options for listing flavors. It is passed to the flavors.List function.
func (ListOpts) ToFlavorListQuery ¶
ToFlavorListQuery formats a ListOpts into a query string.
type ListOptsBuilder ¶
ListOptsBuilder allows extensions to add additional parameters to the List request.