flavors

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2014 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

View Source
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.

Functions

func ListDetail

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.

Types

type Flavor

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.

func ExtractFlavors

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

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

type FlavorPage

type FlavorPage struct {
	pagination.LinkedPageBase
}

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

func (FlavorPage) IsEmpty

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

IsEmpty determines if a page contains any results.

func (FlavorPage) NextPageURL

func (p 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 {
	gophercloud.Result
}

GetResult temporarily holds the response from a Get call.

func Get

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

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

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

type ListOpts

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

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

ToFlavorListQuery formats a ListOpts into a query string.

type ListOptsBuilder

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL