Documentation ¶
Index ¶
- Variables
- func AddRawValue(r gjson.Result, key string, v interface{}) gjson.Result
- func CalculateCosts(project *Project)
- func MultiplyQuantities(resource *Resource, multiplier decimal.Decimal)
- func NewEmptyUsageMap() map[string]*UsageData
- func NewUsageMap(m map[string]interface{}) map[string]*UsageData
- func ParseAttributes(i interface{}) map[string]gjson.Result
- func SortResources(project *Project)
- type AttributeFilter
- type CostComponent
- func (c *CostComponent) CalculateCosts()
- func (c *CostComponent) CustomPrice() *decimal.Decimal
- func (c *CostComponent) Price() decimal.Decimal
- func (c *CostComponent) PriceHash() string
- func (c *CostComponent) SetCustomPrice(price *decimal.Decimal)
- func (c *CostComponent) SetPrice(price decimal.Decimal)
- func (c *CostComponent) SetPriceHash(priceHash string)
- func (c *CostComponent) UnitMultiplierHourlyQuantity() *decimal.Decimal
- func (c *CostComponent) UnitMultiplierMonthlyQuantity() *decimal.Decimal
- func (c *CostComponent) UnitMultiplierPrice() decimal.Decimal
- type EstimateFunc
- type PriceFilter
- type ProductFilter
- type Project
- type ProjectMetadata
- type Projects
- type Provider
- type ReferenceIDFunc
- type RegistryItem
- type Remediater
- type Resource
- type ResourceData
- func (d *ResourceData) AddReference(key string, reference *ResourceData, reverseRefAttrs []string)
- func (d *ResourceData) Get(key string) gjson.Result
- func (d *ResourceData) GetBoolOrDefault(key string, def bool) bool
- func (d *ResourceData) GetFloat64OrDefault(key string, def float64) float64
- func (d *ResourceData) GetInt64OrDefault(key string, def int64) int64
- func (d *ResourceData) GetStringOrDefault(key, def string) string
- func (d *ResourceData) IsEmpty(key string) bool
- func (d *ResourceData) References(keys ...string) []*ResourceData
- func (d *ResourceData) Set(key string, value interface{})
- type ResourceFunc
- type UsageData
- func (u *UsageData) CalcEstimationSummary() map[string]bool
- func (u *UsageData) Get(key string) gjson.Result
- func (u *UsageData) GetFloat(key string) *float64
- func (u *UsageData) GetInt(key string) *int64
- func (u *UsageData) GetString(key string) *string
- func (u *UsageData) GetStringArray(key string) *[]string
- func (u *UsageData) IsEmpty(key string) bool
- type UsageItem
- type UsageVariableType
Constants ¶
This section is empty.
Variables ¶
var HourToMonthUnitMultiplier = decimal.NewFromInt(730)
Functions ¶
func CalculateCosts ¶
func CalculateCosts(project *Project)
func MultiplyQuantities ¶ added in v0.7.4
func NewEmptyUsageMap ¶ added in v0.7.15
func NewUsageMap ¶ added in v0.7.15
func ParseAttributes ¶ added in v0.7.15
func SortResources ¶
func SortResources(project *Project)
Types ¶
type AttributeFilter ¶
type CostComponent ¶
type CostComponent struct { Name string Unit string UnitMultiplier decimal.Decimal IgnoreIfMissingPrice bool ProductFilter *ProductFilter PriceFilter *PriceFilter HourlyQuantity *decimal.Decimal MonthlyQuantity *decimal.Decimal MonthlyDiscountPerc float64 HourlyCost *decimal.Decimal MonthlyCost *decimal.Decimal // contains filtered or unexported fields }
func (*CostComponent) CalculateCosts ¶
func (c *CostComponent) CalculateCosts()
func (*CostComponent) CustomPrice ¶ added in v0.9.22
func (c *CostComponent) CustomPrice() *decimal.Decimal
func (*CostComponent) Price ¶
func (c *CostComponent) Price() decimal.Decimal
func (*CostComponent) PriceHash ¶
func (c *CostComponent) PriceHash() string
func (*CostComponent) SetCustomPrice ¶ added in v0.9.22
func (c *CostComponent) SetCustomPrice(price *decimal.Decimal)
func (*CostComponent) SetPrice ¶
func (c *CostComponent) SetPrice(price decimal.Decimal)
func (*CostComponent) SetPriceHash ¶
func (c *CostComponent) SetPriceHash(priceHash string)
func (*CostComponent) UnitMultiplierHourlyQuantity ¶ added in v0.7.0
func (c *CostComponent) UnitMultiplierHourlyQuantity() *decimal.Decimal
func (*CostComponent) UnitMultiplierMonthlyQuantity ¶ added in v0.7.0
func (c *CostComponent) UnitMultiplierMonthlyQuantity() *decimal.Decimal
func (*CostComponent) UnitMultiplierPrice ¶ added in v0.7.0
func (c *CostComponent) UnitMultiplierPrice() decimal.Decimal
type EstimateFunc ¶ added in v0.9.8
EstimateFunc queries cloud providers to gather past usage information, then projects future usage based on the results.
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 Project ¶ added in v0.7.19
type Project struct { Name string Metadata *ProjectMetadata PastResources []*Resource Resources []*Resource Diff []*Resource HasDiff bool }
Project contains the existing, planned state of resources and the diff between them.
func NewProject ¶ added in v0.7.19
func NewProject(name string, metadata *ProjectMetadata) *Project
func (*Project) AllResources ¶ added in v0.7.19
AllResources returns a pointer list of all resources of the state.
func (*Project) CalculateDiff ¶ added in v0.7.19
func (p *Project) CalculateDiff()
CalculateDiff calculates the diff of past and current resources
type ProjectMetadata ¶ added in v0.9.0
type ProjectMetadata struct { Path string `json:"path"` Type string `json:"type"` TerraformModulePath string `json:"terraformModulePath,omitempty"` TerraformWorkspace string `json:"terraformWorkspace,omitempty"` VCSSubPath string `json:"vcsSubPath,omitempty"` }
func (*ProjectMetadata) GenerateProjectName ¶ added in v0.10.10
func (m *ProjectMetadata) GenerateProjectName(repoURL string, dashboardEnabled bool) string
func (*ProjectMetadata) WorkspaceLabel ¶ added in v0.10.4
func (m *ProjectMetadata) WorkspaceLabel() string
type Projects ¶ added in v0.9.23
type Projects []*Project
Projects is a slice of Project that is ordered alphabetically by project name.
type ReferenceIDFunc ¶ added in v0.9.19
type ReferenceIDFunc func(d *ResourceData) []string
ReferenceIDFunc is used to let references be built using non-standard IDs (anything other than d.Get("id").string)
type RegistryItem ¶
type RegistryItem struct { Name string Notes []string RFunc ResourceFunc ReferenceAttributes []string CustomRefIDFunc ReferenceIDFunc DefaultRefIDFunc ReferenceIDFunc NoPrice bool }
type Remediater ¶ added in v0.9.8
type Remediater interface { // Describe provides an English description of the remediation action X that // would fit into a sentence "May we X?" (e.g. "enable bucket metrics"). // The description can be used to prompt the user before taking action. Describe() string // Remediate attempts to fix a problem in the cloud that prevents estimation, // e.g. by enabling metrics collection on certain resources. Remediate() error }
Remediater allows correction of cloud configuration issues so that future runs of Infracost will provide more accurate results.
type Resource ¶
type Resource struct { Name string CostComponents []*CostComponent SubResources []*Resource HourlyCost *decimal.Decimal MonthlyCost *decimal.Decimal IsSkipped bool NoPrice bool SkipMessage string ResourceType string Tags map[string]string UsageSchema []*UsageItem EstimateUsage EstimateFunc EstimationSummary map[string]bool Metadata map[string]gjson.Result }
func AllProjectResources ¶ added in v0.7.19
AllProjectResources returns the resources for all projects
func CalculateDiff ¶ added in v0.9.23
CalculateDiff calculates the diff of past and current resources
func (*Resource) CalculateCosts ¶
func (r *Resource) CalculateCosts()
func (*Resource) FlattenedSubResources ¶
func (*Resource) RemoveCostComponent ¶
func (r *Resource) RemoveCostComponent(costComponent *CostComponent)
type ResourceData ¶
type ResourceData struct { Type string ProviderName string Address string Tags map[string]string RawValues gjson.Result CFResource cloudformation.Resource UsageData *UsageData Metadata map[string]gjson.Result // contains filtered or unexported fields }
func NewCFResourceData ¶ added in v0.9.2
func NewCFResourceData(resourceType string, providerName string, address string, tags map[string]string, cfResource cloudformation.Resource) *ResourceData
func NewResourceData ¶
func (*ResourceData) AddReference ¶
func (d *ResourceData) AddReference(key string, reference *ResourceData, reverseRefAttrs []string)
func (*ResourceData) GetBoolOrDefault ¶ added in v0.9.19
func (d *ResourceData) GetBoolOrDefault(key string, def bool) bool
func (*ResourceData) GetFloat64OrDefault ¶ added in v0.9.21
func (d *ResourceData) GetFloat64OrDefault(key string, def float64) float64
GetFloat64OrDefault returns the value of key within ResourceData as a float64. If the retrieved value is not set GetFloat64OrDefault will return def.
func (*ResourceData) GetInt64OrDefault ¶ added in v0.9.19
func (d *ResourceData) GetInt64OrDefault(key string, def int64) int64
GetInt64OrDefault returns the value of key within ResourceData as an int64. If the retrieved value is not set GetInt64OrDefault will return def.
func (*ResourceData) GetStringOrDefault ¶ added in v0.9.19
func (d *ResourceData) GetStringOrDefault(key, def string) string
GetStringOrDefault returns the value of key within ResourceData as a string. If the retrieved value is not set GetStringOrDefault will return def.
func (*ResourceData) IsEmpty ¶ added in v0.9.11
func (d *ResourceData) IsEmpty(key string) bool
Return true if the key doesn't exist, is null, or is an empty string. Needed because gjson.Exists returns true as long as a key exists, even if it's empty or null.
func (*ResourceData) References ¶
func (d *ResourceData) References(keys ...string) []*ResourceData
func (*ResourceData) Set ¶
func (d *ResourceData) Set(key string, value interface{})
type ResourceFunc ¶
type ResourceFunc func(*ResourceData, *UsageData) *Resource
type UsageData ¶ added in v0.7.12
func NewUsageData ¶ added in v0.7.12
func (*UsageData) CalcEstimationSummary ¶ added in v0.9.8
CalcEstimationSummary returns a map where a value of true means the attribute key has an actual estimate, false means it is using the defaults
func (*UsageData) GetStringArray ¶ added in v0.9.7
type UsageItem ¶ added in v0.9.11
type UsageItem struct { Key string DefaultValue interface{} Value interface{} ValueType UsageVariableType Description string }
type UsageVariableType ¶ added in v0.9.2
type UsageVariableType int
const ( Int64 UsageVariableType = iota String Float64 StringArray SubResourceUsage )