IWsMonitoringGetLogs Method |
Namespace: Aruba.Cloud.WsMonitoring
[OperationContractAttribute] WsResult<List<MonitoringLogEntity>> GetLogs( GetLogEntity getLogEntity )
/// WsMonitoring.GetLogs Method (c# .NET) public static string GetLogs(WsMonitoringClient client, DateTime fromDate, DateTime toDate) { //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 GetLogEntity request = new GetLogEntity(); request.From = fromDate; request.To = toDate; // call method GetLogs // obtaining a WsResultOfArrayOfMonitoringLogEntity item WsResultOfArrayOfMonitoringLogEntity result = client.GetLogs(request); // if the call is Success print returned values if (result.Success) { stringBuilder.Append("Operation ends successfully\n"); // get Value returned from server MonitoringLogEntity[] items = result.Value; // for each item print the information foreach (MonitoringLogEntity item in items) { stringBuilder.Append("\nJobID: "); stringBuilder.Append(item.JobID); stringBuilder.Append("\nResourceId: "); stringBuilder.Append(item.ResourceId); stringBuilder.Append("\nOperationName: "); stringBuilder.Append(item.OperationName); } } else { throw new ApplicationException(result.ResultMessage); } } catch (Exception ex) { // re-run the error throw new ApplicationException(ex.Message); } return stringBuilder.ToString(); }