use of com.sequenceiq.cloudbreak.cloud.aws.view.AwsServiceEndpointView in project cloudbreak by hortonworks.
the class AwsNetworkCfTemplateProvider method createInterfaceServiceEndpointsIfNeeded.
private List<AwsServiceEndpointView> createInterfaceServiceEndpointsIfNeeded(NetworkCreationRequest networkCreationRequest, List<SubnetRequest> subnets) {
PrivateEndpointType privateEndpointType = networkCreationRequest.getEndpointType();
if (USE_VPC_ENDPOINT == privateEndpointType && CollectionUtils.isNotEmpty(interfaceServices)) {
List<AwsServiceEndpointView> interfaceServiceEndpoints = createInterfaceServiceEndpoints(networkCreationRequest, subnets);
LOGGER.debug("The following interface endpoints will be created in the new vpc: {}", interfaceServiceEndpoints);
return interfaceServiceEndpoints;
} else {
LOGGER.debug("No interface endpoints will be created in the new vpc. serviceEndpointCreation: {}, interfaceServices: {}", privateEndpointType, interfaceServices);
return List.of();
}
}
use of com.sequenceiq.cloudbreak.cloud.aws.view.AwsServiceEndpointView in project cloudbreak by hortonworks.
the class AwsNetworkCfTemplateProvider method createInterfaceServiceEndpoints.
private List<AwsServiceEndpointView> createInterfaceServiceEndpoints(NetworkCreationRequest networkCreationRequest, List<SubnetRequest> subnets) {
Map<String, String> endpointNameMappings = interfaceServices.stream().collect(Collectors.toMap(s -> String.format(VPC_INTERFACE_SERVICE_ENDPOINT_NAME_PATTERN, networkCreationRequest.getRegion().value(), s), s -> s));
List<ServiceDetail> serviceDetails = describeVpcServiceDetails(networkCreationRequest, endpointNameMappings);
Map<String, SubnetRequest> subnetByZoneMap = createPublicSubnetByZoneMap(subnets);
List<AwsServiceEndpointView> interfaceServceEndpoints = new ArrayList<>();
for (ServiceDetail serviceDetail : serviceDetails) {
List<SubnetRequest> subnetRequests = serviceDetail.getAvailabilityZones().stream().filter(az -> subnetByZoneMap.containsKey(az)).map(az -> subnetByZoneMap.get(az)).collect(Collectors.toList());
if (!subnetRequests.isEmpty()) {
interfaceServceEndpoints.add(new AwsServiceEndpointView(endpointNameMappings.get(serviceDetail.getServiceName()), subnetRequests));
}
}
return interfaceServceEndpoints;
}
Aggregations