Computing > 8 - LoadBalancers Management > Create LoadBalancer

8.02 Create LoadBalancer

By the Aruba WsEndUser method SetEnqueueLoadBalancerCreation you can create a load balancer. The method require to specify the name, the IP Address of balancer, the Class of Service of balancer, the load balancing algorithm, the rules for load balancing and the IP addresses to balance.

Parameters
name
Type: string
Name to assign to balancer

rules
Type: LoadBalancerRule
Array of LoadBalancerRule objects with the set of rules to assign to balancer

ipAddressesResourceId
Type: int
Array of integeres values with the set of IP addresses to balance

loadBalancerClassOfServiceID
Type: int
Class of Service of balancer.


/// IWsEndUser.SetEnqueueLoadBalancerCreation Method (c# .NET)
public static string SetEnqueueLoadBalancerCreation(WsEndUserClient client,
    string name, LoadBalancerRule[] rules,
    int[] ipAddressesResourceId, int loadBalancerClassOfServiceID)
{
    //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
        LoadBalancerCreationRequest request = new LoadBalancerCreationRequest();
        request.IpAddressResourceId = ipAddressesResourceId;
        request.LoadBalancerClassOfServiceID = loadBalancerClassOfServiceID;
        request.Name = name;
        request.Rules = rules;

        // call method SetEnqueueLoadBalancerCreation 
        // obtaining a WsResult item
        WsResult result = client.SetEnqueueLoadBalancerCreation(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.SetEnqueueLoadBalancerCreation Method (JAVA)
public static String SetEnqueueLoadBalancerCreation(IWsEndUser client,
    String name, ArrayOfLoadBalancerRule rules,
    ArrayOfint ipAddressesResourceId, int loadBalancerClassOfServiceID)
{
    //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
        LoadBalancerCreationRequest request = new LoadBalancerCreationRequest();
        request.setIpAddressResourceId(ipAddressesResourceId);
        request.setLoadBalancerClassOfServiceID(loadBalancerClassOfServiceID);
        request.setName(name);
        request.setRules(rules);

        // call method SetEnqueueLoadBalancerCreation 
        // obtaining a WsResult item
        WsResult result = client.setEnqueueLoadBalancerCreation(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