INNER CODE UNIT · Go
FormatCostAndUsageOutputAsFileOutputs
kubernetes/k8s.io · infra/aws/aws-costexplorer-export/main.go:531
func FormatCostAndUsageOutputAsFileOutputs(costAndUsageOutput *costexplorer.GetCostAndUsageOutput) (fileOutputs FileOutputs) {
fileOutputs = FileOutputs{}
dimensionValueAttributes := map[string]string{}
outerLoop:
for _, value := range costAndUsageOutput.DimensionValueAttributes {
for id, description := range dimensionValueAttributes {
if *value.Value == id && value.Attributes["description"] == description {
log.Printf("Found duplicate of '%v = %v', skipping...\n", id, description)
continue outerLoop
}
}
if value.Value == nil || *value.Value == "" {
log.Println("Found empty value field, skipping...")
continue outerLoop
} else if value.Attributes["description"] == "" {
log.Println("Found empty description field, setting as 'UNKNOWN'")
value.Attributes["description"] = "UNKNOWN"