Skip to content

Commit

Permalink
Add support for localized billing accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
vishesh92 committed Aug 1, 2017
1 parent e8afb5b commit 25e9374
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/java/com/netflix/ice/common/AwsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
*/
public class AwsUtils {
private final static Logger logger = LoggerFactory.getLogger(AwsUtils.class);
private static Pattern billingFileWithTagsPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-resources-and-tags-(\\d\\d\\d\\d-\\d\\d).csv.zip");
private static Pattern billingFileWithMonitoringPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-monitoring-(\\d\\d\\d\\d-\\d\\d).csv");
private static Pattern billingFilePattern = Pattern.compile(".+-aws-billing-detailed-line-items-(\\d\\d\\d\\d-\\d\\d).csv.zip");
private static Pattern billingFileWithTagsPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-resources-and-tags-([A-Z]+-)?(\\d\\d\\d\\d-\\d\\d).csv.zip");
private static Pattern billingFileWithMonitoringPattern = Pattern.compile(".+-aws-billing-detailed-line-items-with-monitoring-([A-Z]+-)?(\\d\\d\\d\\d-\\d\\d).csv");
private static Pattern billingFilePattern = Pattern.compile(".+-aws-billing-detailed-line-items-([A-Z]+-)?(\\d\\d\\d\\d-\\d\\d).csv.zip");
public static final DateTimeFormatter monthDateFormat = DateTimeFormat.forPattern("yyyy-MM").withZone(DateTimeZone.UTC);
public static final DateTimeFormatter dayDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd").withZone(DateTimeZone.UTC);
public static final DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("yyyy-MM-dd HHa").withZone(DateTimeZone.UTC);
Expand Down Expand Up @@ -210,23 +210,23 @@ public static Set<DateTime> listMonths(String bucket, String prefix) {
public static DateTime getDateTimeFromFileNameWithMonitoring(String fileName) {
Matcher matcher = billingFileWithMonitoringPattern.matcher(fileName);
if (matcher.matches())
return monthDateFormat.parseDateTime(matcher.group(1));
return monthDateFormat.parseDateTime(matcher.group(2));
else
return null;
}

public static DateTime getDateTimeFromFileNameWithTags(String fileName) {
Matcher matcher = billingFileWithTagsPattern.matcher(fileName);
if (matcher.matches())
return monthDateFormat.parseDateTime(matcher.group(1));
return monthDateFormat.parseDateTime(matcher.group(2));
else
return null;
}

public static DateTime getDateTimeFromFileName(String fileName) {
Matcher matcher = billingFilePattern.matcher(fileName);
if (matcher.matches())
return monthDateFormat.parseDateTime(matcher.group(1));
return monthDateFormat.parseDateTime(matcher.group(2));
else
return null;
}
Expand Down

0 comments on commit 25e9374

Please sign in to comment.