flavors

package
v0.0.0-...-d823fe1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Overview

Package flavors enables management and retrieval of Flavors BMS service.

Example to List Flavors

listOpts := flavors.ListOpts{}
allFlavors, err := flavors.List(bmsClient, listOpts)
if err != nil {
	panic(err)
}

for _, flavor := range allFlavors {
	fmt.Printf("%+v\n", flavor)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessType

type AccessType string

The AccessType arguement is optional, and if it is not supplied, OpenStack returns the PublicAccess flavors.

const (
	// PublicAccess returns public flavors and private flavors associated with
	// that project.
	PublicAccess AccessType = "true"

	// PrivateAccess (admin only) returns private flavors, across all projects.
	PrivateAccess AccessType = "false"

	// AllAccess (admin only) returns public and private flavors across all
	// projects.
	AllAccess AccessType = "None"
)

type Flavor

type Flavor struct {
	// ID is the flavor's unique ID.
	ID string `json:"id"`

	// Disk is the amount of root disk, measured in GB.
	Disk int `json:"disk"`

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

	MinRAM int `json:"minRam"`

	// RAM is the amount of memory, measured in MB.
	RAM int `json:"ram"`

	// Name is the name of the flavor.
	Name string `json:"name"`

	// RxTxFactor describes bandwidth alterations of the flavor.
	RxTxFactor float64 `json:"rxtx_factor"`

	// Swap is the amount of swap space, measured in MB.
	Swap int `json:"-"`

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

	// IsPublic indicates whether the flavor is public.
	IsPublic bool `json:"os-flavor-access:is_public"`

	// Ephemeral is the amount of ephemeral disk space, measured in GB.
	Ephemeral int `json:"OS-FLV-EXT-DATA:ephemeral"`

	// Whether or not the flavor has been administratively disabled
	Disabled bool `json:"OS-FLV-DISABLED:disabled"`

	// Specifies the shortcut link of the BMS flavor.
	Links []golangsdk.Link `json:"links"`

	SortKey string `json:"sort_key"`

	//SortDir sets the direction, and is either `asc' or `desc'
	SortDir string `json:"sort_dir"`
}

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 List operation.

func FilterFlavors

func FilterFlavors(flavors []Flavor, opts ListOpts) ([]Flavor, error)

FilterFlavors used to filter flavors using Id and Name

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) ([]Flavor, error)

func (*Flavor) UnmarshalJSON

func (r *Flavor) UnmarshalJSON(b []byte) error

type FlavorPage

type FlavorPage struct {
	pagination.LinkedPageBase
}

FlavorPage contains a single page of all flavors from a List 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 ListOpts

type ListOpts struct {
	//Specifies the name of the BMS flavor
	Name string

	//Specifies the ID of the BMS flavor
	ID string

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

	MinRAM int `q:"minRam"`

	// AccessType, if provided, instructs List which set of flavors to return.
	// If IsPublic not provided, flavors for the current project are returned.
	AccessType AccessType `q:"is_public"`

	//SortKey allows you to sort by a particular attribute
	SortKey string `q:"sort_key"`

	//SortDir sets the direction, and is either `asc' or `desc'
	SortDir string `q:"sort_dir"`
}

ListOpts allows the filtering and sorting of paginated collections through the API. Filtering is achieved by passing in struct field values that map to the flavor attributes you want to see returned.

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