Search in sources :

Example 26 with SubnetRequest

use of com.sequenceiq.cloudbreak.cloud.model.network.SubnetRequest in project cloudbreak by hortonworks.

the class AzureSubnetRequestProvider method getSubnetRequest.

private SubnetRequest getSubnetRequest(String region, NetworkSubnetRequest networkSubnetRequest) {
    SubnetRequest subnetRequest = new SubnetRequest();
    subnetRequest.setPublicSubnetCidr(networkSubnetRequest.getCidr());
    subnetRequest.setType(networkSubnetRequest.getType());
    subnetRequest.setAvailabilityZone(region);
    return subnetRequest;
}
Also used : SubnetRequest(com.sequenceiq.cloudbreak.cloud.model.network.SubnetRequest) NetworkSubnetRequest(com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest)

Example 27 with SubnetRequest

use of com.sequenceiq.cloudbreak.cloud.model.network.SubnetRequest in project cloudbreak by hortonworks.

the class AzureSubnetRequestProvider method provide.

public List<SubnetRequest> provide(String region, List<NetworkSubnetRequest> publicSubnets, List<NetworkSubnetRequest> privateSubnets, boolean privateSubnetEnabled) {
    List<SubnetRequest> subnets = new ArrayList<>();
    int index = 0;
    for (int i = 0; i < publicSubnets.size(); i++) {
        NetworkSubnetRequest networkSubnetRequest = publicSubnets.get(i);
        SubnetRequest subnetRequest = getSubnetRequest(region, networkSubnetRequest);
        subnetRequest.setSubnetGroup(i % publicSubnets.size());
        subnetRequest.setIndex(index++);
        subnets.add(subnetRequest);
    }
    if (privateSubnetEnabled) {
        for (int i = 0; i < privateSubnets.size(); i++) {
            NetworkSubnetRequest networkSubnetRequest = privateSubnets.get(i);
            SubnetRequest subnetRequest = getSubnetRequest(region, networkSubnetRequest);
            subnetRequest.setSubnetGroup(i % publicSubnets.size());
            subnetRequest.setIndex(index++);
            subnets.add(subnetRequest);
        }
    }
    return subnets;
}
Also used : NetworkSubnetRequest(com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest) SubnetRequest(com.sequenceiq.cloudbreak.cloud.model.network.SubnetRequest) NetworkSubnetRequest(com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest) ArrayList(java.util.ArrayList)

Aggregations

SubnetRequest (com.sequenceiq.cloudbreak.cloud.model.network.SubnetRequest)27 NetworkSubnetRequest (com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest)12 NetworkCreationRequest (com.sequenceiq.cloudbreak.cloud.model.network.NetworkCreationRequest)11 AmazonEc2Client (com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonEc2Client)9 Template (freemarker.template.Template)8 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 Test (org.junit.Test)6 Test (org.junit.jupiter.api.Test)6 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)5 CreatedSubnet (com.sequenceiq.cloudbreak.cloud.model.network.CreatedSubnet)5 File (java.io.File)5 AwsCredentialView (com.sequenceiq.cloudbreak.cloud.aws.common.view.AwsCredentialView)4 CreatedCloudNetwork (com.sequenceiq.cloudbreak.cloud.model.network.CreatedCloudNetwork)4 ArrayList (java.util.ArrayList)4 AmazonCloudFormationClient (com.sequenceiq.cloudbreak.cloud.aws.client.AmazonCloudFormationClient)3 HashSet (java.util.HashSet)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2