Search in sources :

Example 1 with FrontendIPConfigurationInner

use of com.microsoft.azure.management.network.implementation.FrontendIPConfigurationInner in project photon-model by vmware.

the class AzureLoadBalancerService method buildFrontendIPConfiguration.

/**
 * Build Azure Frontend IP configuration model
 *
 * @param context Azure load balancer context
 * @return List of frontendIPConfiguration objects
 */
private List<FrontendIPConfigurationInner> buildFrontendIPConfiguration(AzureLoadBalancerContext context) {
    List<FrontendIPConfigurationInner> frontendIPConfigurationInners = Lists.newArrayList();
    if (context.loadBalancerStateExpanded.internetFacing) {
        FrontendIPConfigurationInner frontendIPConfiguration = new FrontendIPConfigurationInner().withName(String.format("%s-public-frontend", context.loadBalancerStateExpanded.name));
        frontendIPConfiguration.withPublicIPAddress(new SubResource().withId(context.publicIPAddressInner.id()));
        frontendIPConfigurationInners.add(frontendIPConfiguration);
    } else {
        context.loadBalancerStateExpanded.subnets.forEach(subnet -> {
            FrontendIPConfigurationInner frontendIPConfiguration = new FrontendIPConfigurationInner().withName(String.format("%s-%s-frontend", context.loadBalancerStateExpanded.name, subnet.name));
            frontendIPConfiguration.withSubnet(new SubResource().withId(subnet.id));
            frontendIPConfiguration.withPrivateIPAllocationMethod(IPAllocationMethod.DYNAMIC);
            frontendIPConfigurationInners.add(frontendIPConfiguration);
        });
    }
    return frontendIPConfigurationInners;
}
Also used : SubResource(com.microsoft.azure.SubResource) FrontendIPConfigurationInner(com.microsoft.azure.management.network.implementation.FrontendIPConfigurationInner)

Aggregations

SubResource (com.microsoft.azure.SubResource)1 FrontendIPConfigurationInner (com.microsoft.azure.management.network.implementation.FrontendIPConfigurationInner)1