Search in sources :

Example 11 with NetworkSubnetRequest

use of com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest 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 12 with NetworkSubnetRequest

use of com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest 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

NetworkSubnetRequest (com.sequenceiq.cloudbreak.cloud.model.network.NetworkSubnetRequest)12 SubnetRequest (com.sequenceiq.cloudbreak.cloud.model.network.SubnetRequest)9 Test (org.junit.Test)6 AmazonEc2Client (com.sequenceiq.cloudbreak.cloud.aws.common.client.AmazonEc2Client)5 CreatedCloudNetwork (com.sequenceiq.cloudbreak.cloud.model.network.CreatedCloudNetwork)3 NetworkCreationRequest (com.sequenceiq.cloudbreak.cloud.model.network.NetworkCreationRequest)3 ArrayList (java.util.ArrayList)3 CreateStackRequest (com.amazonaws.services.cloudformation.model.CreateStackRequest)2 AmazonCloudFormationClient (com.sequenceiq.cloudbreak.cloud.aws.client.AmazonCloudFormationClient)2 AwsCredentialView (com.sequenceiq.cloudbreak.cloud.aws.common.view.AwsCredentialView)2 CreatedSubnet (com.sequenceiq.cloudbreak.cloud.model.network.CreatedSubnet)2 HashSet (java.util.HashSet)2 AmazonServiceException (com.amazonaws.AmazonServiceException)1 DescribeStacksRequest (com.amazonaws.services.cloudformation.model.DescribeStacksRequest)1 Lists (com.google.common.collect.Lists)1 CloudException (com.microsoft.azure.CloudException)1 Deployment (com.microsoft.azure.management.resources.Deployment)1 ResourceGroup (com.microsoft.azure.management.resources.ResourceGroup)1 AzureClient (com.sequenceiq.cloudbreak.cloud.azure.client.AzureClient)1 AzureClientService (com.sequenceiq.cloudbreak.cloud.azure.client.AzureClientService)1