usage

package
v0.7.17 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateTierRequests added in v0.7.16

func CalculateTierRequests(requestCount decimal.Decimal, tierLimits []int) map[string]decimal.Decimal

TODO: can we possibly refactor this function so it handles the following cases.

I think the function can always returns the same number of items as in the tiers
array so the caller can use `if tier[x] > 0` to add that cost component.
Not sure if another parameter is required for the "over x" bit, or if tierBuckets is a better name...

a) 150 requests with tiers [first 10, over 10] should return [10, 140] b) 150 requests with tiers [first 10, next 90, over 100] should return [10, 90, 50] c) 99 requests with tiers [first 10, next 90, over 100] should return [10, 89, 0] d) 150 requests with tiers [first 10, next 90] should return [10, 90] as there is no "over x" tier

func LoadFromFile

func LoadFromFile(usageFile string) (map[string]*schema.UsageData, error)

Types

type UsageFile

type UsageFile struct {
	Version       string                 `yaml:"version"`
	ResourceUsage map[string]interface{} `yaml:"resource_usage"`
}

Jump to

Keyboard shortcuts

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