Skip to content

Commit 51a43a9

Browse files
committed
Switch from 'Total' cost to 'Amortized' cost
1 parent e23dc4b commit 51a43a9

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

cloudability.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type ResultsEntry struct {
2828
AccountID string `json:"vendor_account_identifier"`
2929
AccountName string `json:"vendor_account_name"`
3030
CloudProvider string `json:"vendor"`
31-
Cost string `json:"unblended_cost"`
31+
Cost string `json:"total_amortized_cost"`
3232
CostCenter string `json:"category4"`
3333
PayerAccountId string `json:"account_identifier"`
3434
UsageFamily string `json:"usage_family"`
@@ -110,8 +110,10 @@ func getCloudabilityData(configMap Configuration, options CommandLineOptions) *C
110110
}
111111

112112
costType := *options.costTypePtr
113-
if costType == "UnblendedCost" {
114-
costType = "unblended_cost"
113+
if costType == "AmortizedCost" {
114+
costType = "total_amortized_cost"
115+
} else {
116+
log.Fatalf("Unexpected cost type: %q -- this requires a change to the ResultsEntry.Cost tag", costType)
115117
}
116118

117119
qParams := cUrl.Query()

costpuller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func main() {
5656
options := CommandLineOptions{
5757
accountsFilePtr: flag.String("accounts", "accounts.yaml", "file to read accounts list from"),
5858
awsWriteTagsPtr: flag.Bool("awswritetags", false, "write tags to AWS accounts (USE WITH CARE!)"),
59-
costTypePtr: flag.String("costtype", "UnblendedCost", `cost type to pull, one of "AmortizedCost", "BlendedCost", "NetAmortizedCost", "NetUnblendedCost", "NormalizedUsageAmount", "UnblendedCost", or "UsageQuantity"`),
59+
costTypePtr: flag.String("costtype", "AmortizedCost", `cost type to pull, one of "AmortizedCost", "BlendedCost", "NetAmortizedCost", "NetUnblendedCost", "NormalizedUsageAmount", "UnblendedCost", or "UsageQuantity"`),
6060
csvfilePtr: flag.String("csv", defaultCsvFile, "output file for csv data"),
6161
debugPtr: flag.Bool("debug", false, "outputs debug info"),
6262
monthPtr: flag.String("month", defaultMonth, `context month in format yyyy-mm`),

0 commit comments

Comments
 (0)