Computing > 8 - LoadBalancers Management > Get LoadBalancer Notifications

8.13 Get LoadBalancer Notifications

By the Aruba WsEndUser method GetLoadBalancerNotifications you can retrieve the list of notification to sent for the load balancer.

Parameters
loadBalancerID
Type: int
Load balancer identification number

loadBalancerRuleID
Type: int
Load balancer Rule identification number

startTime
Type: DateTime
Start time of statistics interval

endTime
Type: DateTime
End time of statistics interval


/// IWsEndUser.GetLoadBalancerNotifications Method (c# .NET)
public static string GetLoadBalancerNotifications(WsEndUserClient client,
        int loadBalancerID, int loadBalancerRuleID, 
        DateTime startDate, DateTime endDate)
{
    //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
        LoadBalancerNotificationsRequest request = 
            new LoadBalancerNotificationsRequest();
        request.LoadBalancerID = loadBalancerID;
        request.LoadBalancerRuleID = loadBalancerRuleID;
        request.StartDate = startDate;
        request.EndDate = endDate;

        // call method GetLoadBalancerNotifications 
        // obtaining a WsResultOfLoadBalancerRuleStatistics item
        WsResultOfLoadBalancerNotifications result = 
            client.GetLoadBalancerNotifications(request);

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

            LoadBalancerNotifications item = result.Value;

            stringBuilder.Append("\n CompanyID: ");
            stringBuilder.Append(item.CompanyID);
            stringBuilder.Append("\n DataCenterID: ");
            stringBuilder.Append(item.DataCenterID);
            stringBuilder.Append("\n Name: ");
            stringBuilder.Append(item.Name);
            stringBuilder.Append("\n LoadBalancerID: ");
            stringBuilder.Append(item.LoadBalancerID);

            if (item.RuleNotificationEvents != null)
            {
                foreach (RuleNotificationEvent entity in item.RuleNotificationEvents)
                {
                    stringBuilder.Append("\nEventDate: ");
                    stringBuilder.Append(entity.EventDate);
                    stringBuilder.Append("\nHostIP: ");
                    stringBuilder.Append(entity.HostIP);
                    stringBuilder.Append("\nLoadBalancerRuleID: ");
                    stringBuilder.Append(entity.LoadBalancerRuleID);

                    if (entity.Communications != null)
                    {
                        foreach (Communication comm in entity.Communications)
                        {
                            stringBuilder.Append("\nCommunication SendDate: ");
                            stringBuilder.Append(comm.SendDate);
                            stringBuilder.Append("\nCommunication NotificationType:");
                            stringBuilder.Append(comm.NotificationType);
                            stringBuilder.Append("\nCommunication Text : ");
                            stringBuilder.Append(comm.Text);
                        }
                    }
                }
            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// IWsEndUser.GetLoadBalancerNotifications Method (JAVA)
public static String GetLoadBalancerNotifications(IWsEndUser client,
     int loadBalancerID, int loadBalancerRuleID, 
     XMLGregorianCalendar startDate, XMLGregorianCalendar endDate)
{
    //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
       LoadBalancerNotificationsRequest request = 
          new LoadBalancerNotificationsRequest();
       request.setLoadBalancerID(loadBalancerID);
       request.setLoadBalancerRuleID(loadBalancerRuleID);
       request.setStartDate(startDate);
       request.setEndDate(endDate);

       // call method GetLoadBalancerNotifications 
       // obtaining a WsResultOfLoadBalancerRuleStatistics item
       WsResultOfLoadBalancerNotifications result =
          client.getLoadBalancerNotifications(request);

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

          LoadBalancerNotifications item = result.getValue();

          StringBuilder.append("\n CompanyID: ");
          StringBuilder.append(item.getCompanyID());
          StringBuilder.append("\n DataCenterID: ");
          StringBuilder.append(item.getDataCenterID());
          StringBuilder.append("\n Name: ");
          StringBuilder.append(item.getName());
          StringBuilder.append("\n LoadBalancerID: ");
          StringBuilder.append(item.getLoadBalancerID());

          if (item.getRuleNotificationEvents() != null)
          {
             ArrayOfRuleNotificationEvent arrayOfRuleNotificationEvent =
                item.getRuleNotificationEvents();
             List<RuleNotificationEvent> ruleNotificationEventList =
                arrayOfRuleNotificationEvent.getRuleNotificationEvent();
     
             for (Iterator<RuleNotificationEvent> it 
                = ruleNotificationEventList.iterator(); it.hasNext();)
             {
                RuleNotificationEvent entity = it.next();

                StringBuilder.append("\nEventDate: ");
                StringBuilder.append(entity.getEventDate());
                StringBuilder.append("\nHostIP: ");
                StringBuilder.append(entity.getHostIP());
                StringBuilder.append("\nLoadBalancerRuleID: ");
                StringBuilder.append(entity.getLoadBalancerRuleID());

                if (entity.getCommunications() != null)
                {
                   ArrayOfCommunication arrayOfCommunication =
                      entity.getCommunications();
                   List<Communication> communicationList = 
                      arrayOfCommunication.getCommunication();

                   for (Iterator<Communication> it2 = 
                      communicationList.iterator(); it2.hasNext();)
                   {
                      Communication comm = it2.next();
                      StringBuilder.append("\nCommunication SendDate: ");
                      StringBuilder.append(comm.getSendDate());
                      StringBuilder.append("\nCommunication NotificationType: ");
                      StringBuilder.append(comm.getNotificationType());
                      StringBuilder.append("\nCommunication Text : ");
                      StringBuilder.append(comm.getText());
                    }
                 }
              }
           }
       }
       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