Computing > 8 - LoadBalancers Management > Add LoadBalancer Contacts

8.14 Add LoadBalancer Contacts

By the Aruba WsEndUser method SetAddLoadBalancerContacts you can add a contact to the load balancer. The method require to specify the LoadBalancerID and the contact parameters.

Parameters
loadBalancerID
Type: int
Load balancer identification number

notificationContacts
Type: NotificationContact
Array of NotificationContact objects with the set of contact to add to balancer


/// IWsEndUser.SetAddLoadBalancerContacts Method (c# .NET)
public static string SetAddLoadBalancerContacts(WsEndUserClient client,
        int loadBalancerID, NotificationContact[] notificationContacts)
{
    //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
        AddLoadBalancerContactsRequest request = new AddLoadBalancerContactsRequest();
        request.LoadBalancerID = loadBalancerID;
        request.NotificationContacts = notificationContacts;

        // call method SetAddLoadBalancerContacts 
        // obtaining a WsResult item
        WsResult result = client.SetAddLoadBalancerContacts(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.SetAddLoadBalancerContacts Method (JAVA)
public static String SetAddLoadBalancerContacts(IWsEndUser client,
     int loadBalancerID, ArrayOfNotificationContact notificationContacts)
{
    //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
        AddLoadBalancerContactsRequest request = new AddLoadBalancerContactsRequest();
        request.setLoadBalancerID(loadBalancerID);
        request.setNotificationContacts(notificationContacts);

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