schema

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRawValue

func AddRawValue(r gjson.Result, key string, v interface{}) gjson.Result

func CalculateCosts

func CalculateCosts(resources []*Resource)

func SortResources

func SortResources(resources []*Resource)

Types

type AttributeFilter

type AttributeFilter struct {
	Key        string  `json:"key"`
	Value      *string `json:"value,omitempty"`
	ValueRegex *string `json:"value_regex,omitempty"`
}

type CostComponent

type CostComponent struct {
	Name                 string
	Unit                 string
	IgnoreIfMissingPrice bool
	ProductFilter        *ProductFilter
	PriceFilter          *PriceFilter
	HourlyQuantity       *decimal.Decimal
	MonthlyQuantity      *decimal.Decimal
	// contains filtered or unexported fields
}

func (*CostComponent) CalculateCosts

func (c *CostComponent) CalculateCosts()

func (*CostComponent) HourlyCost

func (c *CostComponent) HourlyCost() decimal.Decimal

func (*CostComponent) MonthlyCost

func (c *CostComponent) MonthlyCost() decimal.Decimal

func (*CostComponent) Price

func (c *CostComponent) Price() decimal.Decimal

func (*CostComponent) PriceHash

func (c *CostComponent) PriceHash() string

func (*CostComponent) SetPrice

func (c *CostComponent) SetPrice(price decimal.Decimal)

func (*CostComponent) SetPriceHash

func (c *CostComponent) SetPriceHash(priceHash string)

type PriceFilter

type PriceFilter struct {
	PurchaseOption     *string `json:"purchaseOption,omitempty"`
	Unit               *string `json:"unit,omitempty"`
	Description        *string `json:"description,omitempty"`
	DescriptionRegex   *string `json:"description_regex,omitempty"`
	StartUsageAmount   *string `json:"startUsageAmount,omitempty"`
	EndUsageAmount     *string `json:"endUsageAmount,omitempty"`
	TermLength         *string `json:"termLength,omitempty"`
	TermPurchaseOption *string `json:"termPurchaseOption,omitempty"`
	TermOfferingClass  *string `json:"termOfferingClass,omitempty"`
}

type ProductFilter

type ProductFilter struct {
	VendorName       *string            `json:"vendorName,omitempty"`
	Service          *string            `json:"service,omitempty"`
	ProductFamily    *string            `json:"productFamily,omitempty"`
	Region           *string            `json:"region,omitempty"`
	Sku              *string            `json:"sku,omitempty"`
	AttributeFilters []*AttributeFilter `json:"attributeFilters,omitempty"`
}

type Provider

type Provider interface {
	ProcessArgs(*cli.Context) error
	LoadResources() ([]*Resource, error)
}

type RegistryItem

type RegistryItem struct {
	Name    string
	Notes   []string
	RFunc   ResourceFunc
	NoPrice bool
}

type Resource

type Resource struct {
	Name           string
	CostComponents []*CostComponent
	SubResources   []*Resource

	IsSkipped    bool
	NoPrice      bool
	SkipMessage  string
	ResourceType string
	// contains filtered or unexported fields
}

func (*Resource) CalculateCosts

func (r *Resource) CalculateCosts()

func (*Resource) FlattenedSubResources

func (r *Resource) FlattenedSubResources() []*Resource

func (*Resource) HourlyCost

func (r *Resource) HourlyCost() decimal.Decimal

func (*Resource) MonthlyCost

func (r *Resource) MonthlyCost() decimal.Decimal

func (*Resource) RemoveCostComponent

func (r *Resource) RemoveCostComponent(costComponent *CostComponent)

type ResourceData

type ResourceData struct {
	Type         string
	ProviderName string
	Address      string
	// contains filtered or unexported fields
}

func NewResourceData

func NewResourceData(resourceType string, providerName string, address string, rawValues gjson.Result) *ResourceData

func (*ResourceData) AddReference

func (d *ResourceData) AddReference(key string, reference *ResourceData)

func (*ResourceData) Get

func (d *ResourceData) Get(key string) gjson.Result

func (*ResourceData) References

func (d *ResourceData) References(key string) []*ResourceData

func (*ResourceData) Set

func (d *ResourceData) Set(key string, value interface{})

type ResourceFunc

type ResourceFunc func(*ResourceData, *ResourceData) *Resource

type ResourceSummary added in v0.6.5

type ResourceSummary struct {
	SupportedCounts   map[string]int `json:"supportedCounts"`
	UnsupportedCounts map[string]int `json:"unsupportedCounts"`
	TotalSupported    int            `json:"totalSupported"`
	TotalUnsupported  int            `json:"totalUnsupported"`
	TotalNoPrice      int            `json:"totalNoPrice"`
	Total             int            `json:"total"`
}

func GenerateResourceSummary added in v0.6.5

func GenerateResourceSummary(resources []*Resource) *ResourceSummary

Jump to

Keyboard shortcuts

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