Help us shape the future of Go! Take the 2026 Go Developer Survey

flavors

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List(client *golangsdk.ServiceClient) (p pagination.Pager)

Types

type FilterOpts

type FilterOpts struct {
	Version string

	// One of ess, ess-master, ess-client, ess-cloud
	Type string

	// Name of the searched flavor
	FlavorName string

	DiskMin *Limit

	DiskMax *Limit

	// Region - region the flavor is available for
	Region string

	CPU *Limit

	// RAM - memory size, GB
	RAM *Limit
}

Options to filter version list by

type Flavor

type Flavor struct {
	// RAM - memory size of an instance.
	// Unit: GB
	RAM int `json:"ram"`

	// CPU - number of vCPUs of an instance.
	CPU int `json:"cpu"`

	// Name - flavor name.
	Name string `json:"name"`

	Region string `json:"region"`

	// DiskMin - minimal disk capacity of an instance.
	DiskMin int `json:"-"`
	// DiskMax - maximum disk capacity of an instance.
	DiskMax int `json:"-"`

	// FlavorID - ID of a flavor.
	FlavorID string `json:"flavor_id"`
}

func FindFlavor

func FindFlavor(versions []Version, opts FilterOpts) *Flavor

FindFlavor - finds first flavor matching options

func (*Flavor) UnmarshalJSON

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

type Limit

type Limit struct {
	Min int
	Max int
}

func (Limit) Matches

func (r Limit) Matches(value int) bool

type ListResult

type ListResult struct {
	golangsdk.Result
}

type Version

type Version struct {
	// Version - engine version
	Version string `json:"version"`

	// Type - instance type.
	// The options are `ess`, `ess-cold`, `ess-master`, and `ess-client`.
	Type string `json:"type"`

	// Flavors - list of flavors
	Flavors []Flavor `json:"flavors"`
}

func ExtractVersions

func ExtractVersions(p pagination.Page) ([]Version, error)

func FilterVersions

func FilterVersions(versions []Version, opts FilterOpts) []Version

FilterVersions - filters flavors in version list by given options (with AND operator)

type VersionPage

type VersionPage struct {
	pagination.SinglePageBase
}

func (VersionPage) IsEmpty

func (v VersionPage) IsEmpty() (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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