Search in sources :

Example 1 with RegionsSpecification

use of com.sequenceiq.cloudbreak.cloud.model.RegionsSpecification in project cloudbreak by hortonworks.

the class PlatformParameters method readRegions.

default Map<Region, List<AvailabilityZone>> readRegions(String zone) {
    Map<Region, List<AvailabilityZone>> regions = new HashMap<>();
    try {
        RegionsSpecification oRegions = JsonUtil.readValue(zone, RegionsSpecification.class);
        for (RegionSpecification regionSpecification : oRegions.getItems()) {
            List<AvailabilityZone> av = new ArrayList<>();
            for (String s : regionSpecification.getZones()) {
                av.add(AvailabilityZone.availabilityZone(s));
            }
            av.sort(new StringTypesCompare());
            regions.put(Region.region(regionSpecification.getName()), av);
        }
    } catch (IOException ignored) {
        return regions;
    }
    return sortMap(regions);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Region(com.sequenceiq.cloudbreak.cloud.model.Region) RegionSpecification(com.sequenceiq.cloudbreak.cloud.model.RegionSpecification) AvailabilityZone(com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone) ArrayList(java.util.ArrayList) List(java.util.List) StringTypesCompare(com.sequenceiq.cloudbreak.cloud.model.StringTypesCompare) RegionsSpecification(com.sequenceiq.cloudbreak.cloud.model.RegionsSpecification) IOException(java.io.IOException)

Aggregations

AvailabilityZone (com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone)1 Region (com.sequenceiq.cloudbreak.cloud.model.Region)1 RegionSpecification (com.sequenceiq.cloudbreak.cloud.model.RegionSpecification)1 RegionsSpecification (com.sequenceiq.cloudbreak.cloud.model.RegionsSpecification)1 StringTypesCompare (com.sequenceiq.cloudbreak.cloud.model.StringTypesCompare)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1