use of com.vmware.photon.controller.model.adapters.awsadapter.util.AWSCsvBillParser.AwsServices in project photon-model by vmware.
the class AWSCostStatsService method createResourceStatsForAccount.
protected void createResourceStatsForAccount(AWSCostStatsCreationContext statsData, AwsAccountDetailDto awsAccountDetailDto) {
Map<String, AwsServiceDetailDto> serviceDetails = awsAccountDetailDto.serviceDetailsMap;
List<AwsServices> supportedServices = Arrays.asList(AwsServices.EC2_Instance_Usage, AwsServices.EC2_EBS, AwsServices.S3);
for (String service : serviceDetails.keySet()) {
if (!supportedServices.contains(AwsServices.getByName(service))) {
continue;
}
Map<String, AwsResourceDetailDto> resourceDetailsMap = serviceDetails.get(service).resourceDetailsMap;
if (resourceDetailsMap == null) {
continue;
}
for (Entry<String, AwsResourceDetailDto> entry : resourceDetailsMap.entrySet()) {
String resourceId = entry.getKey();
AwsResourceDetailDto resourceDetails = entry.getValue();
if ((resourceDetails == null) || (resourceDetails.directCosts == null)) {
continue;
}
Set<String> resourceLinks = statsData.awsResourceLinksById.getOrDefault(resourceId, Collections.emptySet());
for (String resourceStateLink : resourceLinks) {
ComputeStats resourceStats = createStatsForResource(resourceStateLink, resourceDetails);
statsData.statsResponse.statsList.add(resourceStats);
}
}
}
}
Aggregations