use of com.vmware.photon.controller.model.adapters.azure.model.cost.AzureResource in project photon-model by vmware.
the class AzureCostStatsService method createStatsForAzureResources.
private void createStatsForAzureResources(Context context, AzureService service, List<ComputeStats> resourceCostStats) {
// Now creating cost stats for VMs only
if (service.meterCategory.equals(AzureCostConstants.METER_CATEGORY_VIRTUAL_MACHINES)) {
// Check if there are resources under this subscription
Map<String, List<String>> instanceIdToComputeLinks = context.subscriptionGuidToResources.getOrDefault(service.getSubscriptionId(), new ConcurrentHashMap<>());
// Create compute stats for resources present
service.resourceDetailsMap.keySet().forEach(instanceId -> {
List<String> computeLinks = instanceIdToComputeLinks.getOrDefault(instanceId.toLowerCase(), new ArrayList<>());
AzureResource azureResource = service.resourceDetailsMap.get(instanceId);
// Create stats for each of the compute links
computeLinks.forEach(computeLink -> {
ComputeStats resourceComputeStat = createComputeStatsForResource(computeLink, azureResource);
if (!resourceComputeStat.statValues.isEmpty()) {
resourceCostStats.add(resourceComputeStat);
}
});
});
}
}
Aggregations