Search in sources :

Example 1 with LoadBalancerBackend

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

the class VirtualMachineScaleSetImpl method getBackendsAssociatedWithIpConfiguration.

private static Map<String, LoadBalancerBackend> getBackendsAssociatedWithIpConfiguration(LoadBalancer loadBalancer, VirtualMachineScaleSetIPConfigurationInner ipConfig) {
    String loadBalancerId = loadBalancer.id();
    Map<String, LoadBalancerBackend> attachedBackends = new HashMap<>();
    Map<String, LoadBalancerBackend> lbBackends = loadBalancer.backends();
    for (LoadBalancerBackend lbBackend : lbBackends.values()) {
        String backendId = mergePath(loadBalancerId, "backendAddressPools", lbBackend.name());
        for (SubResource subResource : ipConfig.loadBalancerBackendAddressPools()) {
            if (subResource.id().equalsIgnoreCase(backendId)) {
                attachedBackends.put(lbBackend.name(), lbBackend);
            }
        }
    }
    return attachedBackends;
}
Also used : SubResource(com.microsoft.azure.SubResource) HashMap(java.util.HashMap) LoadBalancerBackend(com.microsoft.azure.management.network.LoadBalancerBackend)

Example 2 with LoadBalancerBackend

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

the class VirtualMachineScaleSetImpl method associateLoadBalancerToIpConfiguration.

private static void associateLoadBalancerToIpConfiguration(LoadBalancer loadBalancer, VirtualMachineScaleSetIPConfigurationInner ipConfig) {
    Collection<LoadBalancerBackend> backends = loadBalancer.backends().values();
    String[] backendNames = new String[backends.size()];
    int i = 0;
    for (LoadBalancerBackend backend : backends) {
        backendNames[i] = backend.name();
        i++;
    }
    associateBackEndsToIpConfiguration(loadBalancer.id(), ipConfig, backendNames);
    Collection<LoadBalancerInboundNatPool> inboundNatPools = loadBalancer.inboundNatPools().values();
    String[] natPoolNames = new String[inboundNatPools.size()];
    i = 0;
    for (LoadBalancerInboundNatPool inboundNatPool : inboundNatPools) {
        natPoolNames[i] = inboundNatPool.name();
        i++;
    }
    associateInboundNATPoolsToIpConfiguration(loadBalancer.id(), ipConfig, natPoolNames);
}
Also used : LoadBalancerInboundNatPool(com.microsoft.azure.management.network.LoadBalancerInboundNatPool) LoadBalancerBackend(com.microsoft.azure.management.network.LoadBalancerBackend)

Example 3 with LoadBalancerBackend

use of com.microsoft.azure.management.network.LoadBalancerBackend in project cloudbreak by hortonworks.

the class AzureMetadataCollector method collect.

@Override
public List<CloudVmMetaDataStatus> collect(AuthenticatedContext authenticatedContext, List<CloudResource> resources, List<CloudInstance> vms) {
    CloudResource resource = azureUtils.getTemplateResource(resources);
    List<CloudVmMetaDataStatus> results = new ArrayList<>();
    List<InstanceTemplate> templates = Lists.transform(vms, CloudInstance::getTemplate);
    String resourceName = resource.getName();
    Map<String, InstanceTemplate> templateMap = Maps.uniqueIndex(templates, from -> azureUtils.getPrivateInstanceId(resourceName, from.getGroupName(), Long.toString(from.getPrivateId())));
    try {
        for (Entry<String, InstanceTemplate> instance : templateMap.entrySet()) {
            AzureClient azureClient = authenticatedContext.getParameter(AzureClient.class);
            VirtualMachine vm = azureClient.getVirtualMachine(resourceName, instance.getKey());
            String subnetId = vm.getPrimaryNetworkInterface().primaryIPConfiguration().subnetName();
            String privateIp = null;
            String publicIp = null;
            Integer faultDomainCount = azureClient.getFaultDomainNumber(resourceName, vm.name());
            String platform = authenticatedContext.getCloudContext().getPlatform().value();
            String location = authenticatedContext.getCloudContext().getLocation().getRegion().value();
            String hostgroupNm = instance.getValue().getGroupName();
            StringBuilder localityIndicatorBuilder = new StringBuilder();
            localityIndicatorBuilder.append(LOCALITY_SEPARATOR).append(platform).append(LOCALITY_SEPARATOR).append(location).append(LOCALITY_SEPARATOR).append(resourceName).append(LOCALITY_SEPARATOR).append(hostgroupNm).append(LOCALITY_SEPARATOR).append(faultDomainCount);
            AzureUtils.removeBlankSpace(localityIndicatorBuilder);
            List<String> networkInterfaceIdList = vm.networkInterfaceIds();
            for (String networkInterfaceId : networkInterfaceIdList) {
                NetworkInterface networkInterface = azureClient.getNetworkInterfaceById(networkInterfaceId);
                privateIp = networkInterface.primaryPrivateIP();
                PublicIPAddress publicIpAddress = networkInterface.primaryIPConfiguration().getPublicIPAddress();
                List<LoadBalancerBackend> backends = networkInterface.primaryIPConfiguration().listAssociatedLoadBalancerBackends();
                List<LoadBalancerInboundNatRule> inboundNatRules = networkInterface.primaryIPConfiguration().listAssociatedLoadBalancerInboundNatRules();
                if (!backends.isEmpty() || !inboundNatRules.isEmpty()) {
                    publicIp = azureClient.getLoadBalancerIps(resource.getName(), azureUtils.getLoadBalancerId(resource.getName())).get(0);
                }
                if (publicIpAddress != null && publicIpAddress.ipAddress() != null) {
                    publicIp = publicIpAddress.ipAddress();
                }
            }
            String instanceId = instance.getKey();
            CloudInstanceMetaData md = new CloudInstanceMetaData(privateIp, publicIp, faultDomainCount == null ? null : localityIndicatorBuilder.toString());
            InstanceTemplate template = templateMap.get(instanceId);
            if (template != null) {
                Map<String, Object> params = new HashMap<>(1);
                params.put(CloudInstance.SUBNET_ID, subnetId);
                // TODO use shhkey here
                CloudInstance cloudInstance = new CloudInstance(instanceId, template, null, params);
                CloudVmInstanceStatus status = new CloudVmInstanceStatus(cloudInstance, InstanceStatus.CREATED);
                results.add(new CloudVmMetaDataStatus(status, md));
            }
        }
    } catch (RuntimeException e) {
        throw new CloudConnectorException(e.getMessage(), e);
    }
    return results;
}
Also used : HashMap(java.util.HashMap) CloudVmInstanceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus) ArrayList(java.util.ArrayList) PublicIPAddress(com.microsoft.azure.management.network.PublicIPAddress) LoadBalancerInboundNatRule(com.microsoft.azure.management.network.LoadBalancerInboundNatRule) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) NetworkInterface(com.microsoft.azure.management.network.NetworkInterface) LoadBalancerBackend(com.microsoft.azure.management.network.LoadBalancerBackend) AzureClient(com.sequenceiq.cloudbreak.cloud.azure.client.AzureClient) CloudInstanceMetaData(com.sequenceiq.cloudbreak.cloud.model.CloudInstanceMetaData) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) CloudResource(com.sequenceiq.cloudbreak.cloud.model.CloudResource) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) VirtualMachine(com.microsoft.azure.management.compute.VirtualMachine)

Example 4 with LoadBalancerBackend

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

the class Utils method print.

/**
     * Print load balancer.
     * @param resource a load balancer
     */
public static void print(LoadBalancer resource) {
    StringBuilder info = new StringBuilder();
    info.append("Load balancer: ").append(resource.id()).append("Name: ").append(resource.name()).append("\n\tResource group: ").append(resource.resourceGroupName()).append("\n\tRegion: ").append(resource.region()).append("\n\tTags: ").append(resource.tags()).append("\n\tBackends: ").append(resource.backends().keySet().toString());
    // Show public IP addresses
    info.append("\n\tPublic IP address IDs: ").append(resource.publicIPAddressIds().size());
    for (String pipId : resource.publicIPAddressIds()) {
        info.append("\n\t\tPIP id: ").append(pipId);
    }
    // Show TCP probes
    info.append("\n\tTCP probes: ").append(resource.tcpProbes().size());
    for (LoadBalancerTcpProbe probe : resource.tcpProbes().values()) {
        info.append("\n\t\tProbe name: ").append(probe.name()).append("\n\t\t\tPort: ").append(probe.port()).append("\n\t\t\tInterval in seconds: ").append(probe.intervalInSeconds()).append("\n\t\t\tRetries before unhealthy: ").append(probe.numberOfProbes());
        // Show associated load balancing rules
        info.append("\n\t\t\tReferenced from load balancing rules: ").append(probe.loadBalancingRules().size());
        for (LoadBalancingRule rule : probe.loadBalancingRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
    }
    // Show HTTP probes
    info.append("\n\tHTTP probes: ").append(resource.httpProbes().size());
    for (LoadBalancerHttpProbe probe : resource.httpProbes().values()) {
        info.append("\n\t\tProbe name: ").append(probe.name()).append("\n\t\t\tPort: ").append(probe.port()).append("\n\t\t\tInterval in seconds: ").append(probe.intervalInSeconds()).append("\n\t\t\tRetries before unhealthy: ").append(probe.numberOfProbes()).append("\n\t\t\tHTTP request path: ").append(probe.requestPath());
        // Show associated load balancing rules
        info.append("\n\t\t\tReferenced from load balancing rules: ").append(probe.loadBalancingRules().size());
        for (LoadBalancingRule rule : probe.loadBalancingRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
    }
    // Show load balancing rules
    info.append("\n\tLoad balancing rules: ").append(resource.loadBalancingRules().size());
    for (LoadBalancingRule rule : resource.loadBalancingRules().values()) {
        info.append("\n\t\tLB rule name: ").append(rule.name()).append("\n\t\t\tProtocol: ").append(rule.protocol()).append("\n\t\t\tFloating IP enabled? ").append(rule.floatingIPEnabled()).append("\n\t\t\tIdle timeout in minutes: ").append(rule.idleTimeoutInMinutes()).append("\n\t\t\tLoad distribution method: ").append(rule.loadDistribution().toString());
        LoadBalancerFrontend frontend = rule.frontend();
        info.append("\n\t\t\tFrontend: ");
        if (frontend != null) {
            info.append(frontend.name());
        } else {
            info.append("(None)");
        }
        info.append("\n\t\t\tFrontend port: ").append(rule.frontendPort());
        LoadBalancerBackend backend = rule.backend();
        info.append("\n\t\t\tBackend: ");
        if (backend != null) {
            info.append(backend.name());
        } else {
            info.append("(None)");
        }
        info.append("\n\t\t\tBackend port: ").append(rule.backendPort());
        LoadBalancerProbe probe = rule.probe();
        info.append("\n\t\t\tProbe: ");
        if (probe == null) {
            info.append("(None)");
        } else {
            info.append(probe.name()).append(" [").append(probe.protocol().toString()).append("]");
        }
    }
    // Show frontends
    info.append("\n\tFrontends: ").append(resource.frontends().size());
    for (LoadBalancerFrontend frontend : resource.frontends().values()) {
        info.append("\n\t\tFrontend name: ").append(frontend.name()).append("\n\t\t\tInternet facing: ").append(frontend.isPublic());
        if (frontend.isPublic()) {
            info.append("\n\t\t\tPublic IP Address ID: ").append(((LoadBalancerPublicFrontend) frontend).publicIPAddressId());
        } else {
            info.append("\n\t\t\tVirtual network ID: ").append(((LoadBalancerPrivateFrontend) frontend).networkId()).append("\n\t\t\tSubnet name: ").append(((LoadBalancerPrivateFrontend) frontend).subnetName()).append("\n\t\t\tPrivate IP address: ").append(((LoadBalancerPrivateFrontend) frontend).privateIPAddress()).append("\n\t\t\tPrivate IP allocation method: ").append(((LoadBalancerPrivateFrontend) frontend).privateIPAllocationMethod());
        }
        // Inbound NAT pool references
        info.append("\n\t\t\tReferenced inbound NAT pools: ").append(frontend.inboundNatPools().size());
        for (LoadBalancerInboundNatPool pool : frontend.inboundNatPools().values()) {
            info.append("\n\t\t\t\tName: ").append(pool.name());
        }
        // Inbound NAT rule references
        info.append("\n\t\t\tReferenced inbound NAT rules: ").append(frontend.inboundNatRules().size());
        for (LoadBalancerInboundNatRule rule : frontend.inboundNatRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
        // Load balancing rule references
        info.append("\n\t\t\tReferenced load balancing rules: ").append(frontend.loadBalancingRules().size());
        for (LoadBalancingRule rule : frontend.loadBalancingRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
    }
    // Show inbound NAT rules
    info.append("\n\tInbound NAT rules: ").append(resource.inboundNatRules().size());
    for (LoadBalancerInboundNatRule natRule : resource.inboundNatRules().values()) {
        info.append("\n\t\tInbound NAT rule name: ").append(natRule.name()).append("\n\t\t\tProtocol: ").append(natRule.protocol().toString()).append("\n\t\t\tFrontend: ").append(natRule.frontend().name()).append("\n\t\t\tFrontend port: ").append(natRule.frontendPort()).append("\n\t\t\tBackend port: ").append(natRule.backendPort()).append("\n\t\t\tBackend NIC ID: ").append(natRule.backendNetworkInterfaceId()).append("\n\t\t\tBackend NIC IP config name: ").append(natRule.backendNicIPConfigurationName()).append("\n\t\t\tFloating IP? ").append(natRule.floatingIPEnabled()).append("\n\t\t\tIdle timeout in minutes: ").append(natRule.idleTimeoutInMinutes());
    }
    // Show inbound NAT pools
    info.append("\n\tInbound NAT pools: ").append(resource.inboundNatPools().size());
    for (LoadBalancerInboundNatPool natPool : resource.inboundNatPools().values()) {
        info.append("\n\t\tInbound NAT pool name: ").append(natPool.name()).append("\n\t\t\tProtocol: ").append(natPool.protocol().toString()).append("\n\t\t\tFrontend: ").append(natPool.frontend().name()).append("\n\t\t\tFrontend port range: ").append(natPool.frontendPortRangeStart()).append("-").append(natPool.frontendPortRangeEnd()).append("\n\t\t\tBackend port: ").append(natPool.backendPort());
    }
    // Show backends
    info.append("\n\tBackends: ").append(resource.backends().size());
    for (LoadBalancerBackend backend : resource.backends().values()) {
        info.append("\n\t\tBackend name: ").append(backend.name());
        // Show assigned backend NICs
        info.append("\n\t\t\tReferenced NICs: ").append(backend.backendNicIPConfigurationNames().entrySet().size());
        for (Map.Entry<String, String> entry : backend.backendNicIPConfigurationNames().entrySet()) {
            info.append("\n\t\t\t\tNIC ID: ").append(entry.getKey()).append(" - IP Config: ").append(entry.getValue());
        }
        // Show assigned virtual machines
        Set<String> vmIds = backend.getVirtualMachineIds();
        info.append("\n\t\t\tReferenced virtual machine ids: ").append(vmIds.size());
        for (String vmId : vmIds) {
            info.append("\n\t\t\t\tVM ID: ").append(vmId);
        }
        // Show assigned load balancing rules
        info.append("\n\t\t\tReferenced load balancing rules: ").append(new ArrayList<String>(backend.loadBalancingRules().keySet()));
    }
    System.out.println(info.toString());
}
Also used : LoadBalancerHttpProbe(com.microsoft.azure.management.network.LoadBalancerHttpProbe) LoadBalancingRule(com.microsoft.azure.management.network.LoadBalancingRule) LoadBalancerProbe(com.microsoft.azure.management.network.LoadBalancerProbe) LoadBalancerTcpProbe(com.microsoft.azure.management.network.LoadBalancerTcpProbe) ConnectionString(com.microsoft.azure.management.appservice.ConnectionString) LoadBalancerFrontend(com.microsoft.azure.management.network.LoadBalancerFrontend) LoadBalancerInboundNatPool(com.microsoft.azure.management.network.LoadBalancerInboundNatPool) LoadBalancerInboundNatRule(com.microsoft.azure.management.network.LoadBalancerInboundNatRule) LoadBalancerBackend(com.microsoft.azure.management.network.LoadBalancerBackend) Map(java.util.Map)

Example 5 with LoadBalancerBackend

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

the class TestLoadBalancer method printLB.

// Print LB info
static void printLB(LoadBalancer resource) {
    StringBuilder info = new StringBuilder();
    info.append("Load balancer: ").append(resource.id()).append("Name: ").append(resource.name()).append("\n\tResource group: ").append(resource.resourceGroupName()).append("\n\tRegion: ").append(resource.region()).append("\n\tTags: ").append(resource.tags()).append("\n\tBackends: ").append(resource.backends().keySet().toString());
    // Show public IP addresses
    info.append("\n\tPublic IP address IDs: ").append(resource.publicIPAddressIds().size());
    for (String pipId : resource.publicIPAddressIds()) {
        info.append("\n\t\tPIP id: ").append(pipId);
    }
    // Show TCP probes
    info.append("\n\tTCP probes: ").append(resource.tcpProbes().size());
    for (LoadBalancerTcpProbe probe : resource.tcpProbes().values()) {
        info.append("\n\t\tProbe name: ").append(probe.name()).append("\n\t\t\tPort: ").append(probe.port()).append("\n\t\t\tInterval in seconds: ").append(probe.intervalInSeconds()).append("\n\t\t\tRetries before unhealthy: ").append(probe.numberOfProbes());
        // Show associated load balancing rules
        info.append("\n\t\t\tReferenced from load balancing rules: ").append(probe.loadBalancingRules().size());
        for (LoadBalancingRule rule : probe.loadBalancingRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
    }
    // Show HTTP probes
    info.append("\n\tHTTP probes: ").append(resource.httpProbes().size());
    for (LoadBalancerHttpProbe probe : resource.httpProbes().values()) {
        info.append("\n\t\tProbe name: ").append(probe.name()).append("\n\t\t\tPort: ").append(probe.port()).append("\n\t\t\tInterval in seconds: ").append(probe.intervalInSeconds()).append("\n\t\t\tRetries before unhealthy: ").append(probe.numberOfProbes()).append("\n\t\t\tHTTP request path: ").append(probe.requestPath());
        // Show associated load balancing rules
        info.append("\n\t\t\tReferenced from load balancing rules: ").append(probe.loadBalancingRules().size());
        for (LoadBalancingRule rule : probe.loadBalancingRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
    }
    // Show load balancing rules
    info.append("\n\tLoad balancing rules: ").append(resource.loadBalancingRules().size());
    for (LoadBalancingRule rule : resource.loadBalancingRules().values()) {
        info.append("\n\t\tLB rule name: ").append(rule.name()).append("\n\t\t\tProtocol: ").append(rule.protocol()).append("\n\t\t\tFloating IP enabled? ").append(rule.floatingIPEnabled()).append("\n\t\t\tIdle timeout in minutes: ").append(rule.idleTimeoutInMinutes()).append("\n\t\t\tLoad distribution method: ").append(rule.loadDistribution().toString());
        LoadBalancerFrontend frontend = rule.frontend();
        info.append("\n\t\t\tFrontend: ");
        if (frontend != null) {
            info.append(frontend.name());
        } else {
            info.append("(None)");
        }
        info.append("\n\t\t\tFrontend port: ").append(rule.frontendPort());
        LoadBalancerBackend backend = rule.backend();
        info.append("\n\t\t\tBackend: ");
        if (backend != null) {
            info.append(backend.name());
        } else {
            info.append("(None)");
        }
        info.append("\n\t\t\tBackend port: ").append(rule.backendPort());
        LoadBalancerProbe probe = rule.probe();
        info.append("\n\t\t\tProbe: ");
        if (probe == null) {
            info.append("(None)");
        } else {
            info.append(probe.name()).append(" [").append(probe.protocol().toString()).append("]");
        }
    }
    // Show frontends
    info.append("\n\tFrontends: ").append(resource.frontends().size());
    for (LoadBalancerFrontend frontend : resource.frontends().values()) {
        info.append("\n\t\tFrontend name: ").append(frontend.name()).append("\n\t\t\tInternet facing: ").append(frontend.isPublic());
        if (frontend.isPublic()) {
            info.append("\n\t\t\tPublic IP Address ID: ").append(((LoadBalancerPublicFrontend) frontend).publicIPAddressId());
        } else {
            info.append("\n\t\t\tVirtual network ID: ").append(((LoadBalancerPrivateFrontend) frontend).networkId()).append("\n\t\t\tSubnet name: ").append(((LoadBalancerPrivateFrontend) frontend).subnetName()).append("\n\t\t\tPrivate IP address: ").append(((LoadBalancerPrivateFrontend) frontend).privateIPAddress()).append("\n\t\t\tPrivate IP allocation method: ").append(((LoadBalancerPrivateFrontend) frontend).privateIPAllocationMethod());
        }
        // Inbound NAT pool references
        info.append("\n\t\t\tReferenced inbound NAT pools: ").append(frontend.inboundNatPools().size());
        for (LoadBalancerInboundNatPool pool : frontend.inboundNatPools().values()) {
            info.append("\n\t\t\t\tName: ").append(pool.name());
        }
        // Inbound NAT rule references
        info.append("\n\t\t\tReferenced inbound NAT rules: ").append(frontend.inboundNatRules().size());
        for (LoadBalancerInboundNatRule rule : frontend.inboundNatRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
        // Load balancing rule references
        info.append("\n\t\t\tReferenced load balancing rules: ").append(frontend.loadBalancingRules().size());
        for (LoadBalancingRule rule : frontend.loadBalancingRules().values()) {
            info.append("\n\t\t\t\tName: ").append(rule.name());
        }
    }
    // Show inbound NAT rules
    info.append("\n\tInbound NAT rules: ").append(resource.inboundNatRules().size());
    for (LoadBalancerInboundNatRule natRule : resource.inboundNatRules().values()) {
        info.append("\n\t\tInbound NAT rule name: ").append(natRule.name()).append("\n\t\t\tProtocol: ").append(natRule.protocol().toString()).append("\n\t\t\tFrontend: ").append(natRule.frontend().name()).append("\n\t\t\tFrontend port: ").append(natRule.frontendPort()).append("\n\t\t\tBackend port: ").append(natRule.backendPort()).append("\n\t\t\tBackend NIC ID: ").append(natRule.backendNetworkInterfaceId()).append("\n\t\t\tBackend NIC IP config name: ").append(natRule.backendNicIPConfigurationName()).append("\n\t\t\tFloating IP? ").append(natRule.floatingIPEnabled()).append("\n\t\t\tIdle timeout in minutes: ").append(natRule.idleTimeoutInMinutes());
    }
    // Show inbound NAT pools
    info.append("\n\tInbound NAT pools: ").append(resource.inboundNatPools().size());
    for (LoadBalancerInboundNatPool natPool : resource.inboundNatPools().values()) {
        info.append("\n\t\tInbound NAT pool name: ").append(natPool.name()).append("\n\t\t\tProtocol: ").append(natPool.protocol().toString()).append("\n\t\t\tFrontend: ").append(natPool.frontend().name()).append("\n\t\t\tFrontend port range: ").append(natPool.frontendPortRangeStart()).append("-").append(natPool.frontendPortRangeEnd()).append("\n\t\t\tBackend port: ").append(natPool.backendPort());
    }
    // Show backends
    info.append("\n\tBackends: ").append(resource.backends().size());
    for (LoadBalancerBackend backend : resource.backends().values()) {
        info.append("\n\t\tBackend name: ").append(backend.name());
        // Show assigned backend NICs
        info.append("\n\t\t\tReferenced NICs: ").append(backend.backendNicIPConfigurationNames().entrySet().size());
        for (Entry<String, String> entry : backend.backendNicIPConfigurationNames().entrySet()) {
            info.append("\n\t\t\t\tNIC ID: ").append(entry.getKey()).append(" - IP Config: ").append(entry.getValue());
        }
        // Show assigned virtual machines
        Set<String> vmIds = backend.getVirtualMachineIds();
        info.append("\n\t\t\tReferenced virtual machine ids: ").append(vmIds.size());
        for (String vmId : vmIds) {
            info.append("\n\t\t\t\tVM ID: ").append(vmId);
        }
        // Show assigned load balancing rules
        info.append("\n\t\t\tReferenced load balancing rules: ").append(new ArrayList<String>(backend.loadBalancingRules().keySet()));
    }
    System.out.println(info.toString());
}
Also used : LoadBalancerHttpProbe(com.microsoft.azure.management.network.LoadBalancerHttpProbe) LoadBalancingRule(com.microsoft.azure.management.network.LoadBalancingRule) LoadBalancerProbe(com.microsoft.azure.management.network.LoadBalancerProbe) LoadBalancerTcpProbe(com.microsoft.azure.management.network.LoadBalancerTcpProbe) LoadBalancerFrontend(com.microsoft.azure.management.network.LoadBalancerFrontend) LoadBalancerInboundNatPool(com.microsoft.azure.management.network.LoadBalancerInboundNatPool) LoadBalancerInboundNatRule(com.microsoft.azure.management.network.LoadBalancerInboundNatRule) LoadBalancerBackend(com.microsoft.azure.management.network.LoadBalancerBackend)

Aggregations

LoadBalancerBackend (com.microsoft.azure.management.network.LoadBalancerBackend)7 LoadBalancerInboundNatRule (com.microsoft.azure.management.network.LoadBalancerInboundNatRule)4 LoadBalancerInboundNatPool (com.microsoft.azure.management.network.LoadBalancerInboundNatPool)3 HashMap (java.util.HashMap)3 LoadBalancerFrontend (com.microsoft.azure.management.network.LoadBalancerFrontend)2 LoadBalancerHttpProbe (com.microsoft.azure.management.network.LoadBalancerHttpProbe)2 LoadBalancerProbe (com.microsoft.azure.management.network.LoadBalancerProbe)2 LoadBalancerTcpProbe (com.microsoft.azure.management.network.LoadBalancerTcpProbe)2 LoadBalancingRule (com.microsoft.azure.management.network.LoadBalancingRule)2 ArrayList (java.util.ArrayList)2 SubResource (com.microsoft.azure.SubResource)1 ConnectionString (com.microsoft.azure.management.appservice.ConnectionString)1 VirtualMachine (com.microsoft.azure.management.compute.VirtualMachine)1 LoadBalancer (com.microsoft.azure.management.network.LoadBalancer)1 NetworkInterface (com.microsoft.azure.management.network.NetworkInterface)1 NicIPConfiguration (com.microsoft.azure.management.network.NicIPConfiguration)1 PublicIPAddress (com.microsoft.azure.management.network.PublicIPAddress)1 AzureClient (com.sequenceiq.cloudbreak.cloud.azure.client.AzureClient)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)1