use of com.sequenceiq.cloudbreak.cloud.model.RegionCoordinateSpecification in project cloudbreak by hortonworks.
the class AzureRegionProvider method readEnabledRegions.
private Map<Region, Coordinate> readEnabledRegions() {
String displayNames = resourceDefinition();
Map<Region, Coordinate> regionCoordinates = new HashMap<>();
try {
RegionCoordinateSpecifications regionCoordinateSpecifications = JsonUtil.readValue(displayNames, RegionCoordinateSpecifications.class);
for (RegionCoordinateSpecification regionCoordinateSpecification : regionCoordinateSpecifications.getItems()) {
regionCoordinates.put(region(regionCoordinateSpecification.getName()), coordinate(regionCoordinateSpecification.getLongitude(), regionCoordinateSpecification.getLatitude(), findByLabelOrName(regionCoordinateSpecification.getName()).label(), findByLabelOrName(regionCoordinateSpecification.getName()).name(), regionCoordinateSpecification.isK8sSupported(), regionCoordinateSpecification.getEntitlements()));
}
} catch (IOException ignored) {
LOGGER.error("Failed to read enabled Azure regions from file.");
return regionCoordinates;
}
return regionCoordinates;
}
use of com.sequenceiq.cloudbreak.cloud.model.RegionCoordinateSpecification in project cloudbreak by hortonworks.
the class AwsPlatformResources method readRegionDisplayNames.
private Map<Region, DisplayName> readRegionDisplayNames(String displayNames) {
Map<Region, DisplayName> regionDisplayNames = new HashMap<>();
try {
RegionCoordinateSpecifications regionCoordinateSpecifications = JsonUtil.readValue(displayNames, RegionCoordinateSpecifications.class);
for (RegionCoordinateSpecification regionCoordinateSpecification : regionCoordinateSpecifications.getItems()) {
Region region = region(regionCoordinateSpecification.getName());
if (!enabledRegions.contains(region)) {
continue;
}
regionDisplayNames.put(region, displayName(regionCoordinateSpecification.getDisplayName()));
}
} catch (IOException ignored) {
return regionDisplayNames;
}
return regionDisplayNames;
}
use of com.sequenceiq.cloudbreak.cloud.model.RegionCoordinateSpecification in project cloudbreak by hortonworks.
the class AwsPlatformResources method readRegionCoordinates.
private Map<Region, Coordinate> readRegionCoordinates(String displayNames) {
Map<Region, Coordinate> regionCoordinates = new HashMap<>();
try {
RegionCoordinateSpecifications regionCoordinateSpecifications = JsonUtil.readValue(displayNames, RegionCoordinateSpecifications.class);
for (RegionCoordinateSpecification regionCoordinateSpecification : regionCoordinateSpecifications.getItems()) {
Region region = region(regionCoordinateSpecification.getName());
if (!enabledRegions.contains(region)) {
continue;
}
Optional<Entry<Region, DisplayName>> regionEntry = regionDisplayNames.entrySet().stream().filter(e -> e.getKey().getRegionName().equalsIgnoreCase(regionCoordinateSpecification.getName())).findFirst();
regionCoordinates.put(region, coordinate(regionCoordinateSpecification.getLongitude(), regionCoordinateSpecification.getLatitude(), regionCoordinateSpecification.getDisplayName(), regionEntry.isPresent() ? regionEntry.get().getKey().value() : regionCoordinateSpecification.getDisplayName(), regionCoordinateSpecification.isK8sSupported(), regionCoordinateSpecification.getEntitlements()));
}
} catch (IOException ignored) {
return regionCoordinates;
}
return regionCoordinates;
}
Aggregations