Search in sources :

Example 1 with PrivateEndpointType

use of com.sequenceiq.common.model.PrivateEndpointType 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();
    }
}
Also used : PrivateEndpointType(com.sequenceiq.common.model.PrivateEndpointType) AwsServiceEndpointView(com.sequenceiq.cloudbreak.cloud.aws.view.AwsServiceEndpointView)

Example 2 with PrivateEndpointType

use of com.sequenceiq.common.model.PrivateEndpointType in project cloudbreak by hortonworks.

the class NetworkParameterAdder method addParameters.

public Map<String, Object> addParameters(Map<String, Object> parameters, DetailedEnvironmentResponse environmentResponse, CloudPlatform cloudPlatform, DBStack dbStack) {
    switch(cloudPlatform) {
        case AWS:
            parameters.put(VPC_CIDR, environmentResponse.getNetwork().getNetworkCidr());
            parameters.put(VPC_CIDRS, environmentResponse.getNetwork().getNetworkCidrs());
            parameters.put(VPC_ID, environmentResponse.getNetwork().getAws().getVpcId());
            break;
        case AZURE:
            PrivateEndpointType privateEndpointType = serviceEndpointCreationToEndpointTypeConverter.convert(environmentResponse.getNetwork().getServiceEndpointCreation(), cloudPlatform.name());
            parameters.put(ENDPOINT_TYPE, privateEndpointType);
            if (PrivateEndpointType.USE_PRIVATE_ENDPOINT == privateEndpointType) {
                parameters.put(SUBNET_FOR_PRIVATE_ENDPOINT, getAzureSubnetToUseWithPrivateEndpoint(environmentResponse, dbStack));
                parameters.put(EXISTING_PRIVATE_DNS_ZONE_ID, environmentResponse.getNetwork().getAzure().getDatabasePrivateDnsZoneId());
            }
            break;
        case GCP:
            if (!Strings.isNullOrEmpty(environmentResponse.getNetwork().getGcp().getSharedProjectId())) {
                parameters.put(SHARED_PROJECT_ID, environmentResponse.getNetwork().getGcp().getSharedProjectId());
            }
            break;
        case MOCK:
            parameters.put(VPC_ID, environmentResponse.getNetwork().getMock().getVpcId());
            break;
        default:
            throw new RedbeamsException(String.format("Support for cloud platform %s not yet added", cloudPlatform.name()));
    }
    return parameters;
}
Also used : PrivateEndpointType(com.sequenceiq.common.model.PrivateEndpointType) RedbeamsException(com.sequenceiq.redbeams.exception.RedbeamsException)

Aggregations

PrivateEndpointType (com.sequenceiq.common.model.PrivateEndpointType)2 AwsServiceEndpointView (com.sequenceiq.cloudbreak.cloud.aws.view.AwsServiceEndpointView)1 RedbeamsException (com.sequenceiq.redbeams.exception.RedbeamsException)1