resources

package
v0.0.0-...-7bdeeeb Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComputeDisk

type ComputeDisk struct {
	Name        string
	ID          string
	Type        string
	Regional    bool
	Zones       []string
	Region      string
	Image       string
	Snapshot    string
	SizeGiB     int64
	Description Description
	UnitPricing PricingInfo
}

ComputeDisk holds information about the compute disk resource type.

func NewComputeDisk

func NewComputeDisk(details *cd.ResourceDetail, name, id, diskType string, zones []string, image, snapshot string, size int64) (*ComputeDisk, error)

NewComputeDisk builds a compute disk with the specified fields and fills the other resource details. Image, snapshot and size parameters are considered null fields when "" or <= 0. Priority of size-related parameters is: size, image/snapshot size, default size. Currently not supported: snapshots.

type ComputeDiskState

type ComputeDiskState struct {
	Before *ComputeDisk
	After  *ComputeDisk
	Action string
}

ComputeDiskState holdsthe before and after states of a compute disk and the action performed.

func (*ComputeDiskState) CompletePricingInfo

func (state *ComputeDiskState) CompletePricingInfo(catalog *billing.ComputeEngineCatalog) error

CompletePricingInfo completes pricing information of both before and after states.

func (*ComputeDiskState) GetDelta

func (state *ComputeDiskState) GetDelta() float64

func (*ComputeDiskState) GetSummaryRow

func (state *ComputeDiskState) GetSummaryRow() (table.Row, error)

GetSummaryRow() returns the row for SummaryTable to be outputted about the certain state.

func (*ComputeDiskState) GetWebTables

func (state *ComputeDiskState) GetWebTables(stateNum int) *web.PricingTypeTables

GetWebTables returns html pricing information table strings to be displayed in a web page.

func (*ComputeDiskState) ToStateOut

func (state *ComputeDiskState) ToStateOut() (js.JSONOut, error)

ToStateOut returns a json output.

func (*ComputeDiskState) ToTable

func (state *ComputeDiskState) ToTable() (*table.Table, error)

ToTable creates a table.Table and fills it with the pricing information from ComputeDiskState.

type ComputeInstance

type ComputeInstance struct {
	ID          string
	Name        string
	MachineType string
	Description Description
	Region      string
	Zone        string
	UsageType   string
	Memory      MemoryInfo
	Cores       CoreInfo
}

ComputeInstance stores information about the compute instance resource type.

func NewComputeInstance

func NewComputeInstance(details *cd.ResourceDetail, id, name, machineType, zone, usageType string) (*ComputeInstance, error)

NewComputeInstance builds a compute instance with the specified fields nd fills the other resource details.

func (*ComputeInstance) CompletePricingInfo

func (instance *ComputeInstance) CompletePricingInfo(catalog *billing.ComputeEngineCatalog) error

CompletePricingInfo fills the pricing information fields.

type ComputeInstanceState

type ComputeInstanceState struct {
	Before *ComputeInstance
	After  *ComputeInstance
	Action string
}

ComputeInstanceState holds the before and after states of a compute instance and the action performed (created, destroyed etc.)

func (*ComputeInstanceState) CompletePricingInfo

func (state *ComputeInstanceState) CompletePricingInfo(catalog *billing.ComputeEngineCatalog) error

CompletePricingInfo completes pricing information of both before and after states.

func (*ComputeInstanceState) GetDelta

func (state *ComputeInstanceState) GetDelta() float64

func (*ComputeInstanceState) GetSummaryRow

func (state *ComputeInstanceState) GetSummaryRow() (table.Row, error)

GetSummaryRow() returns the row for SummaryTable to be outputted about the certain state.

func (*ComputeInstanceState) GetWebTables

func (state *ComputeInstanceState) GetWebTables(stateNum int) *web.PricingTypeTables

GetWebTables returns html pricing information table with hourly, monthly and yearly pricing.

func (*ComputeInstanceState) ToStateOut

func (state *ComputeInstanceState) ToStateOut() (js.JSONOut, error)

ToStateOut creates ComputeInstanceStateOut from state struct to render output in json format.

func (*ComputeInstanceState) ToTable

func (state *ComputeInstanceState) ToTable() (*table.Table, error)

ToTable creates a table.Table and fills it with the pricing information from ComputeInstanceState.

type CoreInfo

type CoreInfo struct {
	Type          string
	ResourceGroup string
	Number        int
	Fractional    float64
	UnitPricing   PricingInfo
}

CoreInfo stores CPU core details.

type Description

type Description struct {
	Contains []string
	Omits    []string
}

Description holds information about information of the SKU description, whith strings to be included/omitted.

type MemoryInfo

type MemoryInfo struct {
	Type          string
	ResourceGroup string
	AmountGiB     float64
	Extended      bool
	UnitPricing   PricingInfo
}

MemoryInfo stores memory details.

type PricingInfo

type PricingInfo struct {
	UsageUnit       string
	HourlyUnitPrice float64
	CurrencyType    string
}

PricingInfo stores the information from the billing API.

type ResourceState

type ResourceState interface {
	CompletePricingInfo(catalog *billing.ComputeEngineCatalog) error
	GetDelta() float64
	GetWebTables(stateNum int) *web.PricingTypeTables
	ToTable() (*table.Table, error)
	GetSummaryRow() (table.Row, error)
	ToStateOut() (js.JSONOut, error)
}

ResourceState is the interface of a general before/after resource state(ComputeInstance,...).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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