Documentation ¶
Index ¶
- func CalculateTierBuckets(requestCount decimal.Decimal, tierLimits []int) []decimal.Decimal
- func CreateUsageFile(path string) error
- func ResourceUsagesToYAML(resourceUsages []*ResourceUsage) (yamlv3.Node, bool)
- type ContextEnv
- type ReferenceFile
- type ReplaceResourceUsagesOpts
- type ResourceUsage
- type SyncResult
- type UsageFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateTierBuckets ¶ added in v0.7.19
func CreateUsageFile ¶ added in v0.9.11
CreateUsageFile creates a blank usage file if it does not exists
func ResourceUsagesToYAML ¶ added in v0.9.11
func ResourceUsagesToYAML(resourceUsages []*ResourceUsage) (yamlv3.Node, bool)
Types ¶
type ContextEnv ¶ added in v0.10.0
type ContextEnv struct{}
type ReferenceFile ¶ added in v0.9.11
type ReferenceFile struct {
*UsageFile
}
ReferenceFile represents the reference example usage file
func LoadReferenceFile ¶ added in v0.9.11
func LoadReferenceFile() (*ReferenceFile, error)
LoadReferenceFile loads the reference example usage file
func (*ReferenceFile) FindMatchingResourceUsage ¶ added in v0.9.11
func (u *ReferenceFile) FindMatchingResourceUsage(name string) *ResourceUsage
FindMatchingResourceUsage returns the matching resource usage for the given resource name by looking for a resource with the same resource type
func (*ReferenceFile) SetDefaultValues ¶ added in v0.9.11
func (u *ReferenceFile) SetDefaultValues()
SetDefaultValues updates the reference file to strip the values and set the default values
type ReplaceResourceUsagesOpts ¶ added in v0.9.11
type ReplaceResourceUsagesOpts struct {
OverrideValueType bool
}
type ResourceUsage ¶ added in v0.9.11
ResourceUsage represents a resource block in the usage file
func ResourceUsagesFromYAML ¶ added in v0.9.11
func ResourceUsagesFromYAML(raw yamlv3.Node) ([]*ResourceUsage, error)
func (*ResourceUsage) Map ¶ added in v0.9.11
func (r *ResourceUsage) Map() map[string]interface{}
func (*ResourceUsage) MergeResourceUsage ¶ added in v0.9.11
func (r *ResourceUsage) MergeResourceUsage(src *ResourceUsage)
MergeResourceUsage merge ResourceItem from src to r without overriding r
type SyncResult ¶ added in v0.9.8
func SyncUsageData ¶ added in v0.8.3
func SyncUsageData(projectCtx *config.ProjectContext, usageFile *UsageFile, projects []*schema.Project) (*SyncResult, error)
func (*SyncResult) Merge ¶ added in v0.9.13
func (s *SyncResult) Merge(other *SyncResult)
func (*SyncResult) ProjectContext ¶ added in v0.9.11
func (s *SyncResult) ProjectContext() map[string]interface{}
type UsageFile ¶
type UsageFile struct { Version string `yaml:"version"` // We represent resource usage in using a YAML node so we have control over the comments RawResourceUsage yamlv3.Node `yaml:"resource_usage"` // The raw usage is then parsed into this struct ResourceUsages []*ResourceUsage `yaml:"-"` }
func LoadUsageFile ¶ added in v0.9.11
func LoadUsageFileFromString ¶ added in v0.9.11
func NewBlankUsageFile ¶ added in v0.9.11
func NewBlankUsageFile() *UsageFile
func (*UsageFile) InvalidKeys ¶ added in v0.9.11
InvalidKeys returns a list of keys that are invalid in the usage file. It currently checks the reference usage file for a list of valid keys. In the future we will want this to usage the resource usage schema structs as well.