cost

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cost provides simulated cost tracking for cloud operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceCost

type ServiceCost struct {
	Service   string
	Operation string
	UnitCost  float64
	Quantity  int
	Total     float64
}

ServiceCost defines the cost structure for a single service operation.

type Tracker

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

Tracker tracks simulated costs across all cloud operations.

func New

func New() *Tracker

New creates a new cost tracker with default cloud pricing rates.

func (*Tracker) AllCosts

func (t *Tracker) AllCosts() []ServiceCost

AllCosts returns a copy of all recorded cost events.

func (*Tracker) CostByOperation

func (t *Tracker) CostByOperation() map[string]float64

CostByOperation returns the total cost grouped by service:operation.

func (*Tracker) CostByService

func (t *Tracker) CostByService() map[string]float64

CostByService returns the total cost grouped by service.

func (*Tracker) Record

func (t *Tracker) Record(service, operation string, quantity int)

Record records a cost event for a service operation.

func (*Tracker) Reset

func (t *Tracker) Reset()

Reset clears all recorded costs.

func (*Tracker) SetRate

func (t *Tracker) SetRate(service, operation string, rate float64)

SetRate overrides the default rate for a service operation.

func (*Tracker) TotalCost

func (t *Tracker) TotalCost() float64

TotalCost returns the total simulated cost across all operations.

Jump to

Keyboard shortcuts

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