gophercloud: Index | Files

package flavors

import ""

Package flavors provides information and interaction with the flavor API resource in the OpenStack Compute service.

A flavor is an available hardware configuration for a server. Each flavor has a unique combination of disk space, memory capacity and priority for CPU time.


Package Files

doc.go requests.go results.go urls.go


var ErrCannotInterpet = errors.New("Unable to interpret a response body.")

ErrCannotInterpret is returned by an Extract call if the response body doesn't have the expected structure.

func ExtractFlavors Uses

func ExtractFlavors(page pagination.Page) ([]Flavor, error)

ExtractFlavors provides access to the list of flavors in a page acquired from the List operation.

func IDFromName Uses

func IDFromName(client *gophercloud.ServiceClient, name string) (string, error)

IDFromName is a convienience function that returns a flavor's ID given its name.

func ListDetail Uses

func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

ListDetail instructs OpenStack to provide a list of flavors. You may provide criteria by which List curtails its results for easier processing. See ListOpts for more details.

type Flavor Uses

type Flavor struct {
    // The Id field contains the flavor's unique identifier.
    // For example, this identifier will be useful when specifying which hardware configuration to use for a new server instance.
    ID  string `mapstructure:"id"`

    // The Disk and RA< fields provide a measure of storage space offered by the flavor, in GB and MB, respectively.
    Disk int `mapstructure:"disk"`
    RAM  int `mapstructure:"ram"`

    // The Name field provides a human-readable moniker for the flavor.
    Name string `mapstructure:"name"`

    RxTxFactor float64 `mapstructure:"rxtx_factor"`

    // Swap indicates how much space is reserved for swap.
    // If not provided, this field will be set to 0.
    Swap int `mapstructure:"swap"`

    // VCPUs indicates how many (virtual) CPUs are available for this flavor.
    VCPUs int `mapstructure:"vcpus"`

Flavor records represent (virtual) hardware configurations for server resources in a region.

type FlavorPage Uses

type FlavorPage struct {

FlavorPage contains a single page of the response from a List call.

func (FlavorPage) IsEmpty Uses

func (p FlavorPage) IsEmpty() (bool, error)

IsEmpty determines if a page contains any results.

func (FlavorPage) NextPageURL Uses

func (p FlavorPage) NextPageURL() (string, error)

NextPageURL uses the response's embedded link reference to navigate to the next page of results.

type GetResult Uses

type GetResult struct {

GetResult temporarily holds the response from a Get call.

func Get Uses

func Get(client *gophercloud.ServiceClient, id string) GetResult

Get instructs OpenStack to provide details on a single flavor, identified by its ID. Use ExtractFlavor to convert its result into a Flavor.

func (GetResult) Extract Uses

func (gr GetResult) Extract() (*Flavor, error)

Extract provides access to the individual Flavor returned by the Get function.

type ListOpts Uses

type ListOpts struct {

    // ChangesSince, if provided, instructs List to return only those things which have changed since the timestamp provided.
    ChangesSince string `q:"changes-since"`

    // MinDisk and MinRAM, if provided, elides flavors which do not meet your criteria.
    MinDisk int `q:"minDisk"`
    MinRAM  int `q:"minRam"`

    // Marker and Limit control paging.
    // Marker instructs List where to start listing from.
    Marker string `q:"marker"`

    // Limit instructs List to refrain from sending excessively large lists of flavors.
    Limit int `q:"limit"`

ListOpts helps control the results returned by the List() function. For example, a flavor with a minDisk field of 10 will not be returned if you specify MinDisk set to 20. Typically, software will use the last ID of the previous call to List to set the Marker for the current call.

func (ListOpts) ToFlavorListQuery Uses

func (opts ListOpts) ToFlavorListQuery() (string, error)

ToFlavorListQuery formats a ListOpts into a query string.

type ListOptsBuilder Uses

type ListOptsBuilder interface {
    ToFlavorListQuery() (string, error)

ListOptsBuilder allows extensions to add additional parameters to the List request.

Package flavors imports 6 packages (graph) and is imported by 361 packages. Updated 2017-06-01. Refresh now. Tools for package owners.