Search in sources :

Example 1 with LoadBalancerPublicFrontend

use of com.microsoft.azure.management.network.LoadBalancerPublicFrontend in project azure-sdk-for-java by Azure.

the class PublicIPAddressImpl method getAssignedLoadBalancerFrontend.

@Override
public LoadBalancerPublicFrontend getAssignedLoadBalancerFrontend() {
    if (this.hasAssignedLoadBalancer()) {
        final String refId = this.inner().ipConfiguration().id();
        final String loadBalancerId = ResourceUtils.parentResourceIdFromResourceId(refId);
        final LoadBalancer lb = this.myManager.loadBalancers().getById(loadBalancerId);
        final String frontendName = ResourceUtils.nameFromResourceId(refId);
        return (LoadBalancerPublicFrontend) lb.frontends().get(frontendName);
    } else {
        return null;
    }
}
Also used : LoadBalancer(com.microsoft.azure.management.network.LoadBalancer) LoadBalancerPublicFrontend(com.microsoft.azure.management.network.LoadBalancerPublicFrontend)

Example 2 with LoadBalancerPublicFrontend

use of com.microsoft.azure.management.network.LoadBalancerPublicFrontend in project azure-sdk-for-java by Azure.

the class LoadBalancerImpl method publicIPAddressIds.

@Override
public List<String> publicIPAddressIds() {
    List<String> publicIPAddressIds = new ArrayList<>();
    for (LoadBalancerFrontend frontend : this.frontends().values()) {
        if (frontend.isPublic()) {
            String pipId = ((LoadBalancerPublicFrontend) frontend).publicIPAddressId();
            publicIPAddressIds.add(pipId);
        }
    }
    return Collections.unmodifiableList(publicIPAddressIds);
}
Also used : ArrayList(java.util.ArrayList) LoadBalancerPublicFrontend(com.microsoft.azure.management.network.LoadBalancerPublicFrontend) LoadBalancerFrontend(com.microsoft.azure.management.network.LoadBalancerFrontend)

Example 3 with LoadBalancerPublicFrontend

use of com.microsoft.azure.management.network.LoadBalancerPublicFrontend in project azure-sdk-for-java by Azure.

the class TestPublicIPAddress method printPIP.

public static void printPIP(PublicIPAddress resource) {
    StringBuilder info = new StringBuilder().append("Public IP Address: ").append(resource.id()).append("\n\tName: ").append(resource.name()).append("\n\tResource group: ").append(resource.resourceGroupName()).append("\n\tRegion: ").append(resource.region()).append("\n\tTags: ").append(resource.tags()).append("\n\tIP Address: ").append(resource.ipAddress()).append("\n\tLeaf domain label: ").append(resource.leafDomainLabel()).append("\n\tFQDN: ").append(resource.fqdn()).append("\n\tReverse FQDN: ").append(resource.reverseFqdn()).append("\n\tIdle timeout (minutes): ").append(resource.idleTimeoutInMinutes()).append("\n\tIP allocation method: ").append(resource.ipAllocationMethod().toString()).append("\n\tIP version: ").append(resource.version().toString());
    // Show the associated load balancer if any
    info.append("\n\tLoad balancer association: ");
    if (resource.hasAssignedLoadBalancer()) {
        final LoadBalancerPublicFrontend frontend = resource.getAssignedLoadBalancerFrontend();
        final LoadBalancer lb = frontend.parent();
        info.append("\n\t\tLoad balancer ID: ").append(lb.id()).append("\n\t\tFrontend name: ").append(frontend.name());
    } else {
        info.append("(None)");
    }
    // Show the associated NIC if any
    info.append("\n\tNetwork interface association: ");
    if (resource.hasAssignedNetworkInterface()) {
        final NicIPConfiguration nicIp = resource.getAssignedNetworkInterfaceIPConfiguration();
        final NetworkInterface nic = nicIp.parent();
        info.append("\n\t\tNetwork interface ID: ").append(nic.id()).append("\n\t\tIP config name: ").append(nicIp.name());
    } else {
        info.append("(None)");
    }
    System.out.println(info.toString());
}
Also used : LoadBalancerPublicFrontend(com.microsoft.azure.management.network.LoadBalancerPublicFrontend) LoadBalancer(com.microsoft.azure.management.network.LoadBalancer) NetworkInterface(com.microsoft.azure.management.network.NetworkInterface) NicIPConfiguration(com.microsoft.azure.management.network.NicIPConfiguration)

Aggregations

LoadBalancerPublicFrontend (com.microsoft.azure.management.network.LoadBalancerPublicFrontend)3 LoadBalancer (com.microsoft.azure.management.network.LoadBalancer)2 LoadBalancerFrontend (com.microsoft.azure.management.network.LoadBalancerFrontend)1 NetworkInterface (com.microsoft.azure.management.network.NetworkInterface)1 NicIPConfiguration (com.microsoft.azure.management.network.NicIPConfiguration)1 ArrayList (java.util.ArrayList)1