cmd/scollector: Added Azure Enterprise Agreement billing collector#1903
Conversation
| "bosun.org/opentsdb" | ||
| ) | ||
|
|
||
| var azureeabillingconfig = azureEABillingConfig{} |
There was a problem hiding this comment.
Also since it is used a a lot I would make it shorter. AzBillConf maybe .. or something better
kylebrandt
left a comment
There was a problem hiding this comment.
style comments mostly, haven't got into logic yet. Is the CSV helper lib really helping that much or would it be simple to use the standard encoding?
| } | ||
|
|
||
| //Process the report list | ||
| err = processAzureEAReports(reports, &md) |
There was a problem hiding this comment.
if err ...; err != nil { sytax is better here
| thisMonth := baseTime.Format("2006-01") | ||
| lastMonth := time.Date(baseTime.Year(), baseTime.Month()-1, 1, 0, 0, 0, 0, time.UTC).Format("2006-01") | ||
| for _, r := range reports.AvailableMonths { | ||
| if thisMonth == r.Month || lastMonth == r.Month { |
There was a problem hiding this comment.
inverse condition to and continue so rest of code is not indented
| for _, r := range reports.AvailableMonths { | ||
| if thisMonth == r.Month || lastMonth == r.Month { | ||
| csv := azureeabillingconfig.AZEABillingConfig.GetMonthReportsCSV(r, azureeabilling.DownloadForStructs) | ||
| ioutil.WriteFile("c:\\temp\\ea-price.csv", []byte(csv.PriceSheetReport), 0755) |
| resourceString = fmt.Sprintf("%s-%s", strings.ToLower(p.ResourceGroup), resourceString) | ||
| } | ||
|
|
||
| resourceString, _ = opentsdb.Clean(resourceString) |
There was a problem hiding this comment.
ignoring err intentional, if so comment maybe
569fa2b to
5f46c13
Compare
|
The CSV library was very helpful - the standard library choked because the Azure CSV is formatted stupidly. This new library also allows the fields to potentially be re-ordered in the future, as it uses the header titles from the first line in the CSV to match them to their correct field in the struct tags when unmarshalling. |
Added Azure Enterprise Agreement billing collector into scollector.