/// <summary> /// Process Records /// </summary> protected override void ProcessRecord() { var queries = new Dictionary <string, string>(); if (MaxAlerts.HasValue) { queries.Add("maxAlerts", MaxAlerts.ToString()); } if (ResolutionIds != null && ResolutionIds.Any()) { queries.Add("resolutionIdList", string.Join(",", ResolutionIds)); } if (AlertIds != null && AlertIds.Any()) { queries.Add("alertIdList", string.Join(",", AlertIds)); } if (StartTime.HasValue) { queries.Add("startDateUsecs", StartTime.ToString()); } if (EndTime.HasValue) { queries.Add("endDateUsecs", EndTime.ToString()); } var queryString = string.Empty; if (queries.Any()) { queryString = "?" + string.Join("&", queries.Select(q => $"{q.Key}={q.Value}")); } var preparedUrl = $"/public/alertResolutions{queryString}"; WriteDebug(preparedUrl); var result = Session.ApiClient.Get <IEnumerable <Models.AlertResolution> >(preparedUrl); WriteObject(result, true); }
/// <summary> /// Process Records /// </summary> protected override void ProcessRecord() { var queries = new Dictionary <string, string>(); if (MaxAlerts.HasValue) { queries.Add("maxAlerts", MaxAlerts.ToString()); } if (AlertCategories != null && AlertCategories.Any()) { List <string> alertCategories = AlertCategories.ToList().ConvertAll <string>(x => x.ToString().First().ToString().ToLower() + x.ToString().Substring(1)); queries.Add("alertCategoryList", string.Join(",", alertCategories)); } if (AlertStates != null && AlertStates.Any()) { List <string> alertStates = AlertStates.ToList().ConvertAll <string>(x => x.ToString().First().ToString().ToLower() + x.ToString().Substring(1)); queries.Add("alertStateList", string.Join(",", alertStates)); } if (AlertSeverities != null && AlertSeverities.Any()) { List <string> alertSeverities = AlertSeverities.ToList().ConvertAll <string>(x => x.ToString().First().ToString().ToLower() + x.ToString().Substring(1)); queries.Add("alertSeverityList", string.Join(",", alertSeverities)); } if (ResolutionIds != null && ResolutionIds.Any()) { queries.Add("resolutionIdList", string.Join(",", ResolutionIds)); } if (AlertIds != null && AlertIds.Any()) { queries.Add("alertIdList", string.Join(",", AlertIds)); } if (AlertTypes != null && AlertTypes.Any()) { queries.Add("alertTypeList", string.Join(",", AlertTypes)); } if (StartTime.HasValue) { queries.Add("startDateUsecs", StartTime.ToString()); } if (EndTime.HasValue) { queries.Add("endDateUsecs", EndTime.ToString()); } var queryString = string.Empty; if (queries.Any()) { queryString = "?" + string.Join("&", queries.Select(q => $"{q.Key}={q.Value}")); } var preparedUrl = $"/public/alerts{queryString}"; WriteDebug(preparedUrl); var result = Session.ApiClient.Get <IEnumerable <Model.Alert> >(preparedUrl); WriteObject(result, true); }