use of com.sequenceiq.cloudbreak.cloud.model.CloudIpPools in project cloudbreak by hortonworks.
the class PlatformParameterV1Controller method getIpPoolsCredentialId.
@Override
public PlatformIpPoolsResponse getIpPoolsCredentialId(PlatformResourceRequestJson resourceRequestJson) {
resourceRequestJson = prepareAccountAndOwner(resourceRequestJson, authenticatedUserService.getCbUser());
PlatformResourceRequest convert = conversionService.convert(resourceRequestJson, PlatformResourceRequest.class);
CloudIpPools cloudIpPools = cloudParameterService.getPublicIpPools(convert.getCredential(), convert.getRegion(), convert.getPlatformVariant(), convert.getFilters());
return conversionService.convert(cloudIpPools, PlatformIpPoolsResponse.class);
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudIpPools 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);
}
use of com.sequenceiq.cloudbreak.cloud.model.CloudIpPools in project cloudbreak by hortonworks.
the class GetPlatformIpPoolsHandler method accept.
@Override
public void accept(Event<GetPlatformCloudIpPoolsRequest> getPlatformIpPoolsRequest) {
LOGGER.info("Received event: {}", getPlatformIpPoolsRequest);
GetPlatformCloudIpPoolsRequest request = getPlatformIpPoolsRequest.getData();
try {
CloudPlatformVariant cloudPlatformVariant = new CloudPlatformVariant(Platform.platform(request.getExtendedCloudCredential().getCloudPlatform()), Variant.variant(request.getVariant()));
CloudIpPools cloudIpPools = cloudPlatformConnectors.get(cloudPlatformVariant).platformResources().publicIpPool(request.getCloudCredential(), Region.region(request.getRegion()), request.getFilters());
GetPlatformCloudIpPoolsResult getPlatformIpPoolsResult = new GetPlatformCloudIpPoolsResult(request, cloudIpPools);
request.getResult().onNext(getPlatformIpPoolsResult);
LOGGER.info("Query platform ip pool types finished.");
} catch (Exception e) {
request.getResult().onNext(new GetPlatformCloudIpPoolsResult(e.getMessage(), e, request));
}
}
Aggregations