8.01 Get LoadBalancers

By the Aruba WsEndUser method GetLoadBalancers you can retrieve the list of load balancers.

Parameters
loadBalancerID
Type: int
Load balancer identification number. Not mandatory.


/// IWsEndUser.GetLoadBalancers Method (c# .NET)
public static string GetLoadBalancers(WsEndUserClient client,
        int loadBalancerID)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the request object
        LoadBalancersFilter request = new LoadBalancersFilter();
        request.LoadBalancerID = loadBalancerID;

        // call method GetLoadBalancers 
        // obtaining a WsResultOfArrayOfLoadBalancer item
        WsResultOfArrayOfLoadBalancer result = client.GetLoadBalancers(request);

        //if the call is Success print values
        if (result.Success)
        {
            stringBuilder.Append(" Operation ends successfully.");

            LoadBalancer[] items = result.Value;

            if (items != null)
            {
                foreach (LoadBalancer item in items)
                {
                    stringBuilder.Append("\n CompanyID: ");
                    stringBuilder.Append(item.CompanyID);
                    stringBuilder.Append("\n CreationDate: ");
                    stringBuilder.Append(item.CreationDate);
                    stringBuilder.Append("\n DataCenterID: ");
                    stringBuilder.Append(item.DataCenterID);
                    stringBuilder.Append("\n Name: ");
                    stringBuilder.Append(item.Name);
                    stringBuilder.Append("\n ProductID: ");
                    stringBuilder.Append(item.ProductID);
                    stringBuilder.Append("\n ResourceID: ");
                    stringBuilder.Append(item.ResourceID);
                    stringBuilder.Append("\n HealthCheckNotification: ");
                    stringBuilder.Append(item.HealthCheckNotification);

                    if (item.Instances != null)
                    {
                        foreach (LoadBalancerInstance entity in item.Instances)
                        {
                            stringBuilder.Append("\n IPAddress: ");
                            stringBuilder.Append(entity.IPAddress);
                        }
                    }

                    if (item.LoadBalancerRules != null)
                    {
                        foreach (LoadBalancerRule entity in item.LoadBalancerRules)
                        {
                            stringBuilder.Append("\nLoadBalancerRules BalanceType: ");
                            stringBuilder.Append(entity.BalanceType);
                            stringBuilder.Append("\nLoadBalancerRules Id: ");
                            stringBuilder.Append(entity.ID);
                            stringBuilder.Append("\nLoadBalancerRules Protocol: ");
                            stringBuilder.Append(entity.Protocol);
                        }
                    }

                    if (item.NotificationContacts != null)
                    {
                        foreach (NotificationContact entity in item.NotificationContacts)
                        {
                            stringBuilder.Append("\nNotificationContact ContactValue: ");
                            stringBuilder.Append(entity.ContactValue);
                            stringBuilder.Append("\nNotificationContact Type: ");
                            stringBuilder.Append(entity.Type);
                        }
                    }
                }
            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// IWsEndUser.GetLoadBalancers Method (JAVA)
public static String GetLoadBalancers(IWsEndUser client,
    int loadBalancerID)
{
        //specify the account login details 
        ((BindingProvider) client).getRequestContext()
             .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
        ((BindingProvider) client).getRequestContext()
             .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");
    
        StringBuilder StringBuilder = new StringBuilder();

        try
        {
            // create the request object
            LoadBalancersFilter request = new LoadBalancersFilter();
            request.setLoadBalancerID(loadBalancerID);

            // call method GetLoadBalancers 
            // obtaining a WsResultOfArrayOfLoadBalancer item
            WsResultOfArrayOfLoadBalancer result = client.getLoadBalancers(request);

            //if the call is Success print values
            if (result.isSuccess())
            {
            StringBuilder.append(" Operation ends successfully.");

            ArrayOfLoadBalancer items = result.getValue();
            List<LoadBalancer> loadBalancerList = items.getLoadBalancer();
     
            for (Iterator<LoadBalancer> it2 = loadBalancerList.iterator(); 
                it2.hasNext();)
            {
                 LoadBalancer item = it2.next();
                 StringBuilder.append("\n CompanyID: ");
                 StringBuilder.append(item.getCompanyID());
                 StringBuilder.append("\n CreationDate: ");
                 StringBuilder.append(item.getCreationDate());
                 StringBuilder.append("\n DataCenterID: ");
                 StringBuilder.append(item.getDataCenterID());
                 StringBuilder.append("\n Name: ");
                 StringBuilder.append(item.getName());
                 StringBuilder.append("\n ProductID: ");
                 StringBuilder.append(item.getProductID());
                 StringBuilder.append("\n ResourceID: ");
                 StringBuilder.append(item.getResourceID());

                 ArrayOfLoadBalancerInstance arrayOfLoadBalancerInstance =
                 item.getInstances();
                 List<LoadBalancerInstance> loadBalancerInstanceList =
                     arrayOfLoadBalancerInstance.getLoadBalancerInstance();
                 for (Iterator<LoadBalancerInstance> it3 =
                     loadBalancerInstanceList.iterator(); it3.hasNext();)
                 {
                     LoadBalancerInstance entity = it3.next();
                     StringBuilder.append("\n IPAddress: ");
                     StringBuilder.append(entity.getIPAddress());
                 }

             }
         }
         else
         {
             throw new Exception(result.getResultMessage());
         }
    }
    catch (Exception ex)
    {
        //show error
        System.out.println(ex);
    }

    return StringBuilder.toString();
}
Version
API: v2.8 URL:https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl