Search in sources :

Example 1 with AwsServices

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);
            }
        }
    }
}
Also used : AwsResourceDetailDto(com.vmware.photon.controller.model.adapters.aws.dto.AwsResourceDetailDto) AwsServiceDetailDto(com.vmware.photon.controller.model.adapters.aws.dto.AwsServiceDetailDto) ComputeStats(com.vmware.photon.controller.model.adapterapi.ComputeStatsResponse.ComputeStats) AwsServices(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSCsvBillParser.AwsServices)

Aggregations

ComputeStats (com.vmware.photon.controller.model.adapterapi.ComputeStatsResponse.ComputeStats)1 AwsResourceDetailDto (com.vmware.photon.controller.model.adapters.aws.dto.AwsResourceDetailDto)1 AwsServiceDetailDto (com.vmware.photon.controller.model.adapters.aws.dto.AwsServiceDetailDto)1 AwsServices (com.vmware.photon.controller.model.adapters.awsadapter.util.AWSCsvBillParser.AwsServices)1