Documentation

Overview

Package flavors provides information and interaction with the flavor API resource for the Rackspace Cloud Servers service.

+build fixtures

Index

Constants

View Source
const GetOutput = `` /* 736-byte string literal not displayed */

GetOutput is a sample response from a flavor Get request. Its contents correspond to the Performance1Flavor struct.

View Source
const ListOutput = `` /* 1575-byte string literal not displayed */

ListOutput is a sample response of a flavor List request.

Variables

ExpectedFlavorSlice is the slice of Flavor structs that are expected to be parsed from ListOutput.

View Source
var Performance1Flavor = os.Flavor{
	ID:         "performance1-1",
	Disk:       20,
	RAM:        1024,
	Name:       "1 GB Performance",
	RxTxFactor: 200.0,
	Swap:       0,
	VCPUs:      1,
}

Performance1Flavor is the expected result of parsing GetOutput, or the first element of ListOutput.

View Source
var Performance2Flavor = os.Flavor{
	ID:         "performance1-2",
	Disk:       40,
	RAM:        2048,
	Name:       "2 GB Performance",
	RxTxFactor: 400.0,
	Swap:       0,
	VCPUs:      2,
}

Performance2Flavor is the second result expected from parsing ListOutput.

Functions

func ExtractFlavors

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

ExtractFlavors interprets a page of List results as Flavors.

func Get

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

Get returns details about a single flavor, identity by ID.

func ListDetail

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

ListDetail enumerates the server images available to your account.

Types

type ListOpts

type ListOpts struct {

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

	// Marker specifies the ID of the last flavor in the previous page.
	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.

func (ListOpts) ToFlavorListQuery

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

ToFlavorListQuery formats a ListOpts into a query string.