flavors

package
v0.5.26 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
}

FilterOpts 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 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 FilterVersions

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

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

func List

func List(client *golangsdk.ServiceClient) ([]Version, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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