Documentation
¶
Overview ¶
Package spec handles local pricing specifications.
When plugins don't provide pricing for a resource type, the engine falls back to local YAML-based pricing specifications.
Specification Location ¶
Specs are stored in ~/.finfocus/specs/ as YAML files.
Specification Format ¶
Example pricing spec (aws-ec2-t3-micro.yaml):
resource_type: aws:ec2:Instance instance_type: t3.micro pricing: hourly: 0.0104 currency: USD
Usage ¶
Specs provide fallback pricing when:
- No plugin is available for a resource type
- Plugin returns no pricing data
- Plugin query fails
Index ¶
Constants ¶
View Source
const (
// ExpectedPartsCount is the number of parts expected in a spec filename (provider-service-sku).
ExpectedPartsCount = 3
)
Variables ¶
View Source
var ( // ErrSpecNotFound is returned when a requested spec file does not exist. ErrSpecNotFound = errors.New("spec file not found") )
Functions ¶
func ParseSpecFilename ¶
ParseSpecFilename parses a spec filename to extract provider, service, and SKU.
func ValidateSpec ¶
func ValidateSpec(spec *PricingSpec) error
ValidateSpec validates that a pricing spec has all required fields.
Types ¶
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads pricing specifications from a directory.
func (*Loader) ListSpecs ¶
ListSpecs returns a list of all available spec filenames in the spec directory.
type PricingSpec ¶
type PricingSpec struct {
Provider string `yaml:"provider"`
Service string `yaml:"service"`
SKU string `yaml:"sku"`
Currency string `yaml:"currency"`
Pricing map[string]interface{} `yaml:"pricing"`
Metadata map[string]interface{} `yaml:"metadata,omitempty"`
}
PricingSpec represents a pricing specification for a cloud service SKU.
Click to show internal directories.
Click to hide internal directories.