Computing > 8 - LoadBalancers Management > Remove LoadBalancer Rule

8.10 Remove LoadBalancer Rule

By the Aruba WsEndUser method SetRemoveLoadBalancerRule you can remove a rule from load balancer. The method require to specify the LoadBalancerRuleID.

Parameters
ruleId
Type: int
Rule identification number


/// IWsEndUser.SetRemoveLoadBalancerRule Method (c# .NET)
public static string SetRemoveLoadBalancerRule(WsEndUserClient client,
    int ruleId)
{
    //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
        RemoveLoadBalancerRuleRequest request = 
            new RemoveLoadBalancerRuleRequest();
        request.LoadBalancerRuleID = ruleId;

        // call method SetRemoveLoadBalancerRule 
        // obtaining a WsResult item
        WsResult result = client.SetRemoveLoadBalancerRule(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.SetRemoveLoadBalancerRule Method (JAVA)
public static String SetRemoveLoadBalancerRule(IWsEndUser client,
    int ruleId)
{
    //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
        RemoveLoadBalancerRuleRequest request = new RemoveLoadBalancerRuleRequest();
        request.setLoadBalancerRuleID(ruleId);

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