if (start.compareTo(end) > 0) {
return 0;
}
S3StorageConfiguration storageConfiguration = (S3StorageConfiguration) BaseEntity.initializeAndUnproxy(orgStorageConfig.getStorageConfigurations().get(0));
com.amazonaws.auth.AWSCredentials credentials = new BasicAWSCredentials(storageConfiguration.getAccessKey(), storageConfiguration.getSecretKey());
AmazonDynamoDBClient dynamoDB = new AmazonDynamoDBClient(credentials);
//TODO get hash key and range key names from table description
HashMap<String, Condition> scanFilter = new HashMap<String, Condition>();
Condition hashCondition = new Condition()
.withComparisonOperator(ComparisonOperator.EQ.toString())
.withAttributeValueList(new AttributeValue().withS(orgStorageConfig.getPrefix()));
scanFilter.put("bucket_prefix", hashCondition);
Condition rangeCondition = getRangeCondition(start, end);
scanFilter.put("time", rangeCondition);
ScanRequest scanRequest = new ScanRequest(bandwidthTableName).withScanFilter(scanFilter);
ScanResult scanResult;
try {
scanResult = dynamoDB.scan(scanRequest);
} catch (Exception e) {
log.error("Error scanning DynamoDB table: " + bandwidthTableName, e);
return 0;
}