types

package
v0.0.0-...-2215086 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Memory represents the memory attribute for the product info
	Memory = "memory"

	// Cpu represents the cpu attribute for the product info
	CPU = "cpu"
)
View Source
const (

	// NtwLow the low network performance category
	NtwLow = "low"
	// NtwMedium the medium network performance category
	NtwMedium = "medium"
	// NtwHight the high network performance category
	NtwHight = "high"
	// NtwExtra the highest network performance category
	NtwExtra = "extra"

	// Telescopes supports categories of virtual machines
	CategoryGeneral = "General purpose"
	CategoryCompute = "Compute optimized"
	CategoryMemory  = "Memory optimized"
	CategoryGpu     = "GPU instance"
	CategoryStorage = "Storage optimized"

	ContinentNorthAmerica = "North America"
	ContinentSouthAmerica = "South America"
	ContinentEurope       = "Europe"
	ContinentAfrica       = "Africa"
	ContinentAsia         = "Asia"
	ContinentAustralia    = "Australia"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudInfo

type CloudInfo interface {
	// GetProviders returns the supported providers
	GetProviders() ([]Provider, error)

	// GetProvider retrieves information about the provider
	GetProvider(provider string) (Provider, error)

	// GetServices returns the supported services for a provider
	GetServices(provider string) ([]Service, error)

	// GetZones returns all the availability zones for a region
	GetZones(provider, service, region string) ([]string, error)

	// GetRegions returns all the regions for a cloud provider
	GetRegions(provider string, service string) (map[string]string, error)

	GetStatus(provider string) (string, error)

	GetProductDetails(provider, service, region string) ([]ProductDetails, error)

	GetServiceImages(provider, service, region string) ([]Image, error)

	GetVersions(provider, service, region string) ([]LocationVersion, error)

	GetContinentsData(provider, service string) (map[string][]Region, error)

	GetContinents() []string
}

CloudInfo is the main entry point for retrieving vm type characteristics and pricing information on different cloud providers

type Image

type Image struct {
	Name         string            `json:"name"`
	CreationDate time.Time         `json:"creationDate,omitempty"`
	Version      string            `json:"version,omitempty"`
	GpuAvailable bool              `json:"gpu,omitempty"`
	Tags         map[string]string `json:"tags,omitempty"`
}

Image represents an image

func NewImage

func NewImage(name, version string, gpu bool) Image

NewImage create new provider describer struct

type LocationVersion

type LocationVersion struct {
	Location string   `json:"location"`
	Versions []string `json:"versions"`
	Default  string   `json:"default"`
}

LocationVersion struct for displaying version information per location

func NewLocationVersion

func NewLocationVersion(location string, versions []string, def string) LocationVersion

NewLocationVersion creates a new location version struct

type NetworkPerfMapper

type NetworkPerfMapper interface {
	// MapNetworkPerf gets the network performance category for the given
	MapNetworkPerf(ntwPerf string) (string, error)
}

NetworkPerfMapper operations related to mapping between virtual machines to network performance categories

type Price

type Price struct {
	OnDemandPrice float64       `json:"onDemandPrice"`
	SpotPrice     SpotPriceInfo `json:"spotPrice"`
}

Price describes the on demand price and spot prices per availability zones

type ProductDetailSource

type ProductDetailSource interface {
	// GetProductDetails gathers the product details information known by telescope
	GetProductDetails(provider string, region string) ([]ProductDetails, error)
}

ProductDetailSource product details related set of operations

type ProductDetails

type ProductDetails struct {
	// Embedded struct!
	VMInfo

	// Burst this is derived for now
	Burst bool `json:"burst,omitempty"`
}

ProductDetails extended view of the virtual machine details

func NewProductDetails

func NewProductDetails(vm VMInfo) *ProductDetails

NewProductDetails creates a new ProductDetails struct and returns a pointer to it

type Provider

type Provider struct {
	Provider string    `json:"provider"`
	Services []Service `json:"services"`
}

Provider represents a cloud provider

func NewProvider

func NewProvider(name string) Provider

NewProvider create new provider describer struct

func (Provider) ProviderName

func (p Provider) ProviderName() string

ProviderName returns the name of the provider

type ProviderDescriber

type ProviderDescriber interface {
	// ProviderName returns the name of the provider
	ProviderName() string
}

ProviderDescriber describes a provider

type Region

type Region struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Region hold the id and name of a cloud provider region

type Service

type Service struct {
	Service  string `json:"service"`
	IsStatic bool   `json:"isStatic"`
}

Service represents a service supported by a given provider. it's intended to implement the ServiceDescriber interface

func (Service) ServiceName

func (s Service) ServiceName() string

ServiceName returns the service name

type ServiceDescriber

type ServiceDescriber interface {
	// ServiceName abstracts the name assembly for the service
	ServiceName() string
}

ServiceDescriber represents a service; eg.: oke, eks Extend this interface with other operations if needed

type SpotPriceInfo

type SpotPriceInfo map[string]float64

SpotPriceInfo represents different prices per availability zones

type VMInfo

type VMInfo struct {
	Category      string            `json:"category"`
	Type          string            `json:"type"`
	OnDemandPrice float64           `json:"onDemandPrice"`
	SpotPrice     []ZonePrice       `json:"spotPrice"`
	Cpus          float64           `json:"cpusPerVm"`
	Mem           float64           `json:"memPerVm"`
	Gpus          float64           `json:"gpusPerVm"`
	NtwPerf       string            `json:"ntwPerf"`
	NtwPerfCat    string            `json:"ntwPerfCategory"`
	Zones         []string          `json:"zones"`
	Attributes    map[string]string `json:"attributes"`
	// CurrentGen signals whether the instance type generation is the current one. Only applies for amazon
	CurrentGen bool `json:"currentGen"`
}

VMInfo representation of a virtual machine

func (VMInfo) IsBurst

func (vm VMInfo) IsBurst() bool

IsBurst returns true if the EC2 instance vCPU is burst type the decision is made based on the instance type

type Version

type Version struct {
	Version string `json:"versions"`
}

Version represents a version

func (Version) VersionName

func (v Version) VersionName() string

VersionName returns the name of the version

type ZonePrice

type ZonePrice struct {
	Zone  string  `json:"zone"`
	Price float64 `json:"price"`
}

ZonePrice struct for displaying price information per zone

func NewZonePrice

func NewZonePrice(zone string, price float64) *ZonePrice

NewZonePrice creates a new zone price struct and returns its pointer

Jump to

Keyboard shortcuts

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