pricing

package
v1.121.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterPricing

type ClusterPricing struct {
	Properties ClusterPricingProperties `json:"properties" yaml:"properties"`
	Prices     Prices                   `json:"prices" yaml:"prices"`
}

func (*ClusterPricing) String

func (sp *ClusterPricing) String() string

type ClusterPricingProperties

type ClusterPricingProperties struct {
	Provider cloud.Provider `json:"provider,omitempty" yaml:"provider,omitempty"`
	Start    *time.Time     `json:"start,omitempty" yaml:"start,omitempty"`
	End      *time.Time     `json:"end,omitempty" yaml:"end,omitempty"`
}

func (*ClusterPricingProperties) String

func (sp *ClusterPricingProperties) String() string

type ClusterPricingSource

type ClusterPricingSource interface {
	NewClusterPricingReader(ctx context.Context) (reader.Reader[*ClusterPricing], error)
}

type MemoryPricingStore

type MemoryPricingStore struct {
	// contains filtered or unexported fields
}

func NewMemoryPricingStore

func NewMemoryPricingStore() *MemoryPricingStore

func (*MemoryPricingStore) GetPricingSet

func (mps *MemoryPricingStore) GetPricingSet(ctx context.Context) (*PricingSet, error)

GetPricingSet returns a deep copy of the stored pricing set so that callers cannot mutate the store's internal state through the returned pointer.

func (*MemoryPricingStore) SetPricingSet

func (mps *MemoryPricingStore) SetPricingSet(ctx context.Context, pricing *PricingSet) error

SetPricingSet stores a deep copy of the provided pricing set so that the caller cannot mutate the store's internal state after setting it.

type MockPricingModule

type MockPricingModule struct {
	ClusterPricing          []*ClusterPricing
	NetworkPricing          []*NetworkPricing
	NodePricing             []*NodePricing
	PersistentVolumePricing []*PersistentVolumePricing
	ServicePricing          []*ServicePricing
}

func NewMockPricingModule

func NewMockPricingModule() (*MockPricingModule, error)

func (*MockPricingModule) Checksum

func (mpm *MockPricingModule) Checksum(ctx context.Context) (string, error)

func (*MockPricingModule) GetPricingSet

func (mpm *MockPricingModule) GetPricingSet(ctx context.Context) (*PricingSet, error)

func (*MockPricingModule) NewClusterPricingReader

func (mpm *MockPricingModule) NewClusterPricingReader(ctx context.Context) (reader.Reader[*ClusterPricing], error)

func (*MockPricingModule) NewNetworkPricingReader

func (mpm *MockPricingModule) NewNetworkPricingReader(ctx context.Context) (reader.Reader[*NetworkPricing], error)

func (*MockPricingModule) NewNodePricingReader

func (mpm *MockPricingModule) NewNodePricingReader(ctx context.Context) (reader.Reader[*NodePricing], error)

func (*MockPricingModule) NewPersistentVolumePricingReader

func (mpm *MockPricingModule) NewPersistentVolumePricingReader(ctx context.Context) (reader.Reader[*PersistentVolumePricing], error)

func (*MockPricingModule) NewServicePricingReader

func (mpm *MockPricingModule) NewServicePricingReader(ctx context.Context) (reader.Reader[*ServicePricing], error)

func (*MockPricingModule) SourceKind

func (mpm *MockPricingModule) SourceKind() string

func (*MockPricingModule) SourceName

func (mpm *MockPricingModule) SourceName() string

type NetworkPricing

type NetworkPricing struct {
	Properties NetworkPricingProperties `json:"properties" yaml:"properties"`
	Prices     Prices                   `json:"prices" yaml:"prices"`
}

func (*NetworkPricing) String

func (sp *NetworkPricing) String() string

type NetworkPricingProperties

type NetworkPricingProperties struct {
	Provider cloud.Provider `json:"provider,omitempty" yaml:"provider,omitempty"`
	Start    *time.Time     `json:"start,omitempty" yaml:"start,omitempty"`
	End      *time.Time     `json:"end,omitempty" yaml:"end,omitempty"`
}

func (*NetworkPricingProperties) String

func (sp *NetworkPricingProperties) String() string

type NetworkPricingSource

type NetworkPricingSource interface {
	NewNetworkPricingReader(ctx context.Context) (reader.Reader[*NetworkPricing], error)
}

type NodePricing

type NodePricing struct {
	Properties NodePricingProperties `json:"properties" yaml:"properties"`
	Prices     Prices                `json:"prices" yaml:"prices"`
}

func (*NodePricing) String

func (np *NodePricing) String() string

type NodePricingProperties

type NodePricingProperties struct {
	Provider     cloud.Provider    `json:"provider,omitempty" yaml:"provider,omitempty"`
	Region       string            `json:"region,omitempty" yaml:"region,omitempty"`
	InstanceType string            `json:"instanceType,omitempty" yaml:"instanceType,omitempty"`
	Provisioning ProvisioningType  `json:"provisioning,omitempty" yaml:"provisioning,omitempty"`
	Cluster      string            `json:"cluster,omitempty" yaml:"cluster,omitempty"`
	ProviderID   string            `json:"providerID,omitempty" yaml:"providerID,omitempty"`
	Labels       map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Start        *time.Time        `json:"start,omitempty" yaml:"start,omitempty"`
	End          *time.Time        `json:"end,omitempty" yaml:"end,omitempty"`
}

func (*NodePricingProperties) String

func (np *NodePricingProperties) String() string

type NodePricingSource

type NodePricingSource interface {
	NewNodePricingReader(ctx context.Context) (reader.Reader[*NodePricing], error)
}

type PersistentVolumePricing

type PersistentVolumePricing struct {
	Properties PersistentVolumePricingProperties `json:"properties" yaml:"properties"`
	Prices     Prices                            `json:"prices" yaml:"prices"`
}

func (*PersistentVolumePricing) String

func (vp *PersistentVolumePricing) String() string

type PersistentVolumePricingProperties

type PersistentVolumePricingProperties struct {
	Provider   cloud.Provider    `json:"provider,omitempty" yaml:"provider,omitempty"`
	Region     string            `json:"region,omitempty" yaml:"region,omitempty"`
	VolumeType VolumeType        `json:"volumeType,omitempty" yaml:"volumeType,omitempty"`
	Cluster    string            `json:"cluster,omitempty" yaml:"cluster,omitempty"`
	ProviderID string            `json:"providerID,omitempty" yaml:"providerID,omitempty"`
	Labels     map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Start      *time.Time        `json:"start,omitempty" yaml:"start,omitempty"`
	End        *time.Time        `json:"end,omitempty" yaml:"end,omitempty"`
}

func (*PersistentVolumePricingProperties) String

type PersistentVolumePricingSource

type PersistentVolumePricingSource interface {
	NewPersistentVolumePricingReader(ctx context.Context) (reader.Reader[*PersistentVolumePricing], error)
}

type Price

type Price struct {
	Unit  unit.Unit `json:"unit" yaml:"unit"`
	Price float64   `json:"price" yaml:"price"`
}

type Prices

type Prices map[Resource]Price

func (Prices) String

func (p Prices) String() string

type PricingModule

type PricingModule interface {
	PricingSource
	Checksum(context.Context) (string, error)
}

type PricingSet

type PricingSet struct {
	ClusterPricing          []*ClusterPricing          `json:"clusterPricing" yaml:"clusterPricing"`
	NetworkPricing          []*NetworkPricing          `json:"networkPricing" yaml:"networkPricing"`
	NodePricing             []*NodePricing             `json:"nodePricing" yaml:"nodePricing"`
	PersistentVolumePricing []*PersistentVolumePricing `json:"persistentVolumePricing" yaml:"persistentVolumePricing"`
	ServicePricing          []*ServicePricing          `json:"servicePricing" yaml:"servicePricing"`
}

func (*PricingSet) Checksum

func (ps *PricingSet) Checksum() (string, error)

Checksum returns a hash that is stable across map and slice ordering and sensitive to both pricing properties and price values.

TODO: Consider commutative hash folding via a multiset hashing algorithm if the string-based Checksum() implementation is too resource intensive for large pricing sets. For now, this string version is more readable.

func (*PricingSet) Clone

func (ps *PricingSet) Clone() *PricingSet

Clone returns a deep copy of the PricingSet. Mutating the returned set (including its nested slices, maps, and time pointers) does not affect the original, and vice versa. A nil receiver returns an empty, non-nil set.

func (*PricingSet) IsEmpty

func (ps *PricingSet) IsEmpty() bool

func (*PricingSet) Sort

func (ps *PricingSet) Sort()

Sort sorts the pricing data to ensure deterministic serialization.

type PricingStore

type PricingStore interface {
	GetPricingSet(ctx context.Context) (*PricingSet, error)
	SetPricingSet(ctx context.Context, pricing *PricingSet) error
}

type ProvisioningType

type ProvisioningType string
const (
	ProvisioningOnDemand ProvisioningType = "on-demand"
	ProvisioningSpot     ProvisioningType = "spot"
)

type Resource

type Resource string
const (
	ResourceNil               Resource = ""
	ResourceNode              Resource = "node"
	ResourceCPU               Resource = "cpu"
	ResourceRAM               Resource = "ram"
	ResourceGPU               Resource = "gpu"
	ResourceStorage           Resource = "storage"
	ResourceCluster           Resource = "cluster"
	ResourceService           Resource = "service"
	ResourceLocalEgress       Resource = "local-egress"
	ResourceCrossZoneEgress   Resource = "x-zone-egress"
	ResourceCrossRegionEgress Resource = "x-region-egress"
	ResourceInternetEgress    Resource = "internet-egress"
	ResourceNATGatewayEgress  Resource = "nat-egress"
	ResourceNATGatewayIngress Resource = "nat-ingress"
)

func ParseResource

func ParseResource(str string) (Resource, error)

type ServicePricing

type ServicePricing struct {
	Properties ServicePricingProperties `json:"properties" yaml:"properties"`
	Prices     Prices                   `json:"prices" yaml:"prices"`
}

func (*ServicePricing) String

func (sp *ServicePricing) String() string

type ServicePricingProperties

type ServicePricingProperties struct {
	Provider cloud.Provider `json:"provider,omitempty" yaml:"provider,omitempty"`
	Region   string         `json:"region,omitempty" yaml:"region,omitempty"`
	Start    *time.Time     `json:"start,omitempty" yaml:"start,omitempty"`
	End      *time.Time     `json:"end,omitempty" yaml:"end,omitempty"`
}

func (*ServicePricingProperties) String

func (sp *ServicePricingProperties) String() string

type ServicePricingSource

type ServicePricingSource interface {
	NewServicePricingReader(ctx context.Context) (reader.Reader[*ServicePricing], error)
}

type StoragePricingStore

type StoragePricingStore struct {
	// contains filtered or unexported fields
}

func NewStoragePricingStore

func NewStoragePricingStore(ctx context.Context, store storage.Storage, path string) (*StoragePricingStore, error)

func (*StoragePricingStore) GetPricingSet

func (sps *StoragePricingStore) GetPricingSet(ctx context.Context) (*PricingSet, error)

func (*StoragePricingStore) SetPricingSet

func (sps *StoragePricingStore) SetPricingSet(ctx context.Context, pricing *PricingSet) error

type VolumeType

type VolumeType string
const (
	VolumeTypeNil VolumeType = ""

	// General purpose SSD
	VolumeTypeGP2 VolumeType = "gp2"
	VolumeTypeGP3 VolumeType = "gp3"

	// Provisioned IOPS SSD
	VolumeTypeIO1 VolumeType = "io1"
	VolumeTypeIO2 VolumeType = "io2"

	// Throughput optimized HDD
	VolumeTypeST1 VolumeType = "st1"

	// Cold HDD
	VolumeTypeSC1 VolumeType = "sc1"

	// Magnetic (previous-generation / legacy)
	VolumeTypeStandard VolumeType = "standard"

	// HDD
	VolumeTypeStandardHDDLRS VolumeType = "Standard_LRS"

	// Standard SSD
	VolumeTypeStandardSSDLRS VolumeType = "StandardSSD_LRS"

	// Premium SSD
	VolumeTypePremiumLRS   VolumeType = "Premium_LRS"
	VolumeTypePremiumV2LRS VolumeType = "PremiumV2_LRS"

	// Ultra
	VolumeTypeUltraSSDLRS VolumeType = "UltraSSD_LRS"

	// Persistent Disk
	VolumeTypePDStandard VolumeType = "pd-standard"
	VolumeTypePDBalanced VolumeType = "pd-balanced"
	VolumeTypePDSSD      VolumeType = "pd-ssd"
	VolumeTypePDExtreme  VolumeType = "pd-extreme"

	// Hyperdisk
	VolumeTypeHyperdiskBalanced   VolumeType = "hyperdisk-balanced"
	VolumeTypeHyperdiskExtreme    VolumeType = "hyperdisk-extreme"
	VolumeTypeHyperdiskThroughput VolumeType = "hyperdisk-throughput"
)

Jump to

Keyboard shortcuts

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