in scripts/go/analyzeCUR/analyzeCUR.go [125:158]
func getParams(configFile *string, sourceBucket *string, destBucket *string, account *string, curReportName *string, curReportPath *string, curDestPath *string, dateOverride *string) error {
// Define input command line config parameter and parse it
flag.StringVar(configFile, "config", defaultConfigPath, "Input config file for analyzeDBR")
flag.StringVar(sourceBucket, "bucket", "", "AWS Bucket where CUR files sit")
flag.StringVar(destBucket, "destbucket", "", "AWS Bucket where where Parquet files will be uploaded (Optional - use as override-only) ")
flag.StringVar(account, "account", "", "AWS Account #")
flag.StringVar(curReportName, "reportname", "", "CUR Report Name")
flag.StringVar(curReportPath, "reportpath", "", "CUR Report PAth")
flag.StringVar(curDestPath, "destpath", "", "Destination Path for converted CUR to be uploaded too")
flag.StringVar(dateOverride, "date", "", "Optional date flag to over-ride the processing CUR month")
flag.Parse()
// check input against defined regex's
regexEmpty := regexp.MustCompile(`^$`)
regexAccount := regexp.MustCompile(`^\d+$`)
if regexEmpty.MatchString(*sourceBucket) {
return errors.New("Config Error: Must provide valid AWS DBR bucket")
}
if !regexAccount.MatchString(*account) {
return errors.New("Config Error: Must provide valid AWS account number")
}
if regexEmpty.MatchString(*curReportName) {
return errors.New("Config Error: Must provide valid CUR Report Name")
}
if destBucket == nil || len(*destBucket) < 1 {
*destBucket = *sourceBucket
}
return nil
}