use of com.sequenceiq.cloudbreak.cloud.model.CloudNetworks in project cloudbreak by hortonworks.
the class AzurePlatformResources method networks.
@Override
public CloudNetworks networks(CloudCredential cloudCredential, Region region, Map<String, String> filters) {
AzureClient client = azureClientService.getClient(cloudCredential);
Map<String, Set<CloudNetwork>> result = new HashMap<>();
for (Network network : client.getNetworks()) {
String actualRegion = network.region().label();
if (regionMatch(actualRegion, region)) {
Map<String, String> subnets = new HashMap<>();
for (Entry<String, Subnet> subnet : network.subnets().entrySet()) {
subnets.put(subnet.getKey(), subnet.getKey());
}
Map<String, Object> properties = new HashMap<>();
properties.put("addressSpaces", network.addressSpaces());
properties.put("dnsServerIPs", network.dnsServerIPs());
properties.put("resourceGroupName", network.resourceGroupName());
CloudNetwork cloudNetwork = new CloudNetwork(network.name(), network.id(), subnets, properties);
result.computeIfAbsent(actualRegion, s -> new HashSet<>()).add(cloudNetwork);
}
}
if (result.isEmpty() && Objects.nonNull(region)) {
result.put(region.value(), new HashSet<>());
}
return new CloudNetworks(result);
}
Aggregations