use of com.sequenceiq.cloudbreak.api.model.RegionResponse in project cloudbreak by hortonworks.
the class PlatformRegionsToRegionResponseConverter method convert.
@Override
public RegionResponse convert(CloudRegions source) {
RegionResponse json = new RegionResponse();
Set<String> regions = new HashSet<>();
for (Region region : source.getCloudRegions().keySet()) {
regions.add(region.value());
}
Map<String, Collection<String>> availabilityZones = new HashMap<>();
for (Entry<Region, List<AvailabilityZone>> regionListEntry : source.getCloudRegions().entrySet()) {
Collection<String> azs = new ArrayList<>();
for (AvailabilityZone availabilityZone : regionListEntry.getValue()) {
azs.add(availabilityZone.value());
}
availabilityZones.put(regionListEntry.getKey().value(), azs);
}
Map<String, String> displayNames = new HashMap<>();
for (Entry<Region, String> regionStringEntry : source.getDisplayNames().entrySet()) {
displayNames.put(regionStringEntry.getKey().value(), regionStringEntry.getValue());
}
json.setRegions(regions);
json.setAvailabilityZones(availabilityZones);
json.setDefaultRegion(source.getDefaultRegion());
json.setDisplayNames(displayNames);
return json;
}
Aggregations