Computing > 8 - LoadBalancers Management > Remove LoadBalancer Instances

8.12 Remove LoadBalancer Instances

By the Aruba WsEndUser method SetEnqueueLoadBalancerRemoveInstances you can remove the IP addresses from load balancer. The method require to specify the LoadBalancerID and the IP addresses to add.

Parameters
loadBalancerID
Type: int
Load balancer identification number

ipAddresses
Type: string
Array of string values with the set of IP addresses to balance


/// IWsEndUser.SetEnqueueLoadBalancerRemoveInstances Method (c# .NET)
public static string SetEnqueueLoadBalancerRemoveInstances(WsEndUserClient client,
        int loadBalancerID, string[] ipAddresses)
{
    //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
        LoadBalancerInstancesRequest request = new LoadBalancerInstancesRequest();
        request.LoadBalancerID = loadBalancerID;
        request.Instances = new LoadBalancerInstance[ipAddresses.Length];
        for (int i = 0; i < ipAddresses.Length; i++)
        {
            LoadBalancerInstance item = new LoadBalancerInstance();
            item.IPAddress = ipAddresses[i];
            request.Instances[i] = item;
        }


        // call method SetEnqueueLoadBalancerRemoveInstances 
        // obtaining a WsResult item
        WsResult result = client.SetEnqueueLoadBalancerRemoveInstances(request);

        //if the call is Success print value
        if (result.Success)
        {
            // get Value returned from server
            stringBuilder.Append(" Operation ends successfully. Result Code : ");
            stringBuilder.Append(result.ResultCode);
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// IWsEndUser.SetEnqueueLoadBalancerRemoveInstances Method (JAVA)
public static String SetEnqueueLoadBalancerRemoveInstances(IWsEndUser client,
     int loadBalancerID, String[] ipAddresses)
{
    //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
    {
        ArrayOfLoadBalancerInstance arrayOfLoadBalancerInstance = 
            new ArrayOfLoadBalancerInstance();
        // create the request object
        LoadBalancerInstancesRequest request = new LoadBalancerInstancesRequest();
        request.setLoadBalancerID(loadBalancerID);
        request.setInstances(arrayOfLoadBalancerInstance);
        List<LoadBalancerInstance> loadBalancerInstanceList =
            arrayOfLoadBalancerInstance.getLoadBalancerInstance();
        
        for(int i=0; i <ipAddresses.length; i++)
        {
            LoadBalancerInstance item  = new LoadBalancerInstance();
            item.setIPAddress(ipAddresses[i]);
            loadBalancerInstanceList.add(item);
        }


        // call method SetEnqueueLoadBalancerRemoveInstances 
        // obtaining a WsResult item
        WsResult result = client.setEnqueueLoadBalancerRemoveInstances(request);

        //if the call is Success print value
        if (result.isSuccess())
        {
            // get Value returned from server
            StringBuilder.append(" Operation ends successfully. Result Code : ");
            StringBuilder.append(result.getResultCode());
        }
        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