Documentation ¶
Index ¶
- Constants
- func BucketPricePerMonth(bucket cloud.Bucket) float64
- func ImageCostPerDay(image cloud.Image) float64
- func InstancePricePerHour(instance cloud.Instance) float64
- func ResourceCostPerDay(resource cloud.Resource) float64
- func SnapshotCostPerDay(snapshot cloud.Snapshot) float64
- func VolumeCostPerDay(volume cloud.Volume) float64
- type CostList
- type DetailedCost
- type Report
- type ReportItem
- type Reporter
- type User
- type UserList
Constants ¶
const ( // MinimumTotalCost is also used in notify.MonthToDateReport MinimumTotalCost = 10.0 // MinimumCost is also used in notify.MonthToDateReport MinimumCost = 5.0 )
Variables ¶
This section is empty.
Functions ¶
func BucketPricePerMonth ¶
BucketPricePerMonth will return the monthly price in USD for a specified bucket. It will not take any account wide discounts that might have been collected for using a certain amount of storage every month.
func ImageCostPerDay ¶
ImageCostPerDay returns the daily cost in USD for a certain image
func InstancePricePerHour ¶
InstancePricePerHour will return the hourly price in USD for a specified instance.
func ResourceCostPerDay ¶
ResourceCostPerDay returns the daily cost of a resource in USD
func SnapshotCostPerDay ¶
SnapshotCostPerDay returns the daily cost in USD for a certain snapshot
func VolumeCostPerDay ¶
VolumeCostPerDay returns the daily cost in USD for a certain volume
Types ¶
type DetailedCost ¶
DetailedCost represents a Cost and Description for a Users expense
type Report ¶
type Report struct { CSP cloud.CSP Items []ReportItem }
Report contains a collection of items, and some metadata about when the items were collected and which dates they span. The report struct also has methods to help work with all the items.
func GenerateReport ¶
GenerateReport generates a Month-to-date billing report for the current month
func (*Report) FormatReport ¶
FormatReport returns a simple version of the Month-to-date billing report. It takes a mapping form account/project ID to employee username in order to more easily distinguish the owner of a cost.
func (*Report) SortedTagsByTotalCost ¶
SortedTagsByTotalCost returns a sorted list of grouped sort tag values, sorted by their total cost.
func (*Report) SortedUsersByTotalCost ¶
SortedUsersByTotalCost returns a sorted list of Users by TotalCost
type ReportItem ¶
type ReportItem struct { Owner string Description string Cost float64 // contains filtered or unexported fields }
ReportItem represent a single item in a report. This is usually the cost for a specific service for a certain user in a certain account/project.
type Reporter ¶
Reporter is a general interface that can be implemented for both AWS and GCP to generate expense reports.
func NewReporterAWS ¶
NewReporterAWS will initialize a new Reporter for the AWS cloud. This requires specifying the account which holds the billing information, the bucket where the billing CSVs can be found as well as which region this bucket is in. None of these arguments must be empty.
func NewReporterGCP ¶
NewReporterGCP initializes and returns a new Reporter for the GCP cloud. This requires specifying a bucket where the billing CSVs can be found, as well as the prefix of these CSV files. The prefix will be prepended to the date and .csv suffix (e.g. <YOUR PREFIX>-2018-10-09.csv). None of these argument must be empty.