use of com.sequenceiq.cloudbreak.cloud.model.CloudIpPool in project cloudbreak by hortonworks.
the class CloudIpPoolsToPlatformIpPoolsResponseConverter method convert.
@Override
public PlatformIpPoolsResponse convert(CloudIpPools source) {
Map<String, Set<IpPoolJson>> result = new HashMap<>();
for (Entry<String, Set<CloudIpPool>> entry : source.getCloudIpPools().entrySet()) {
Set<IpPoolJson> ipPoolJsonSet = new HashSet<>();
for (CloudIpPool ipPool : entry.getValue()) {
IpPoolJson actual = new IpPoolJson(ipPool.getName(), ipPool.getId(), ipPool.getProperties());
ipPoolJsonSet.add(actual);
}
result.put(entry.getKey(), ipPoolJsonSet);
}
return new PlatformIpPoolsResponse(result);
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudIpPool in project cloudbreak by hortonworks.
the class OpenStackPlatformResources method publicIpPool.
@Override
public CloudIpPools publicIpPool(CloudCredential cloudCredential, Region region, Map<String, String> filters) {
OSClient<?> osClient = openStackClient.createOSClient(cloudCredential);
Map<String, Set<CloudIpPool>> cloudIpPools = new HashMap<>();
CloudRegions regions = regions(cloudCredential, region, filters);
for (Entry<Region, List<AvailabilityZone>> regionListEntry : regions.getCloudRegions().entrySet()) {
Set<CloudIpPool> cloudGateWays = new HashSet<>();
List<? extends Network> networks = getNetworks(osClient);
List<? extends Network> networksWithExternalRouter = networks.stream().filter(Network::isRouterExternal).collect(Collectors.toList());
for (Network network : networksWithExternalRouter) {
CloudIpPool cloudIpPool = new CloudIpPool();
cloudIpPool.setId(network.getId());
cloudIpPool.setName(network.getName());
cloudGateWays.add(cloudIpPool);
}
for (AvailabilityZone availabilityZone : regionListEntry.getValue()) {
cloudIpPools.put(availabilityZone.value(), cloudGateWays);
}
}
LOGGER.info("openstack public ip pool result: {}", cloudIpPools);
return new CloudIpPools(cloudIpPools);
}
Aggregations