diff --git a/LogicMonitor.Api.Test/Users/RoleTests.cs b/LogicMonitor.Api.Test/Users/RoleTests.cs new file mode 100644 index 00000000..df937f90 --- /dev/null +++ b/LogicMonitor.Api.Test/Users/RoleTests.cs @@ -0,0 +1,15 @@ +namespace LogicMonitor.Api.Test.Users; + +public class RoleTests(ITestOutputHelper iTestOutputHelper) : TestWithOutput(iTestOutputHelper) +{ + [Fact] + public async Task GetAll() + { + var items = await LogicMonitorClient + .GetAllAsync(default) + .ConfigureAwait(true); + + items.Should().NotBeNull(); + items.Should().NotBeNullOrEmpty(); + } +} diff --git a/LogicMonitor.Api/Alerts/InstanceGroupAlertThresholdInfo.cs b/LogicMonitor.Api/Alerts/InstanceGroupAlertThresholdInfo.cs index 04f1f51c..07513418 100644 --- a/LogicMonitor.Api/Alerts/InstanceGroupAlertThresholdInfo.cs +++ b/LogicMonitor.Api/Alerts/InstanceGroupAlertThresholdInfo.cs @@ -36,4 +36,23 @@ public class InstanceGroupAlertThresholdInfo /// [DataMember(Name = "alertExpr")] public string AlertExpression { get; set; } = string.Empty; + + /// + /// The alert transition interval + /// + [DataMember(Name = "alertTransitionInterval")] + public string AlertTransitionInterval { get; set; } = string.Empty; + + /// + /// The alert clear transition interval + /// + [DataMember(Name = "alertClearTransitionInterval")] + public string AlertClearTransitionInterval { get; set; } = string.Empty; + + /// + /// The alert for no data value + /// + [DataMember(Name = "alertForNoData")] + public int AlertForNoData { get; set; } + } diff --git a/LogicMonitor.Api/LogicModules/DataPointConfiguration.cs b/LogicMonitor.Api/LogicModules/DataPointConfiguration.cs index d2313dc3..79f3d1b0 100644 --- a/LogicMonitor.Api/LogicModules/DataPointConfiguration.cs +++ b/LogicMonitor.Api/LogicModules/DataPointConfiguration.cs @@ -205,7 +205,13 @@ public class DataPointConfiguration : IdentifiedItem /// Parent Instance Group Alert Expression /// [DataMember(Name = "parentInstanceGroupAlertExpr")] - public string ParentInstanceGroupAlertExpression { get; set; } = string.Empty; + public InstanceGroupAlertThresholdInfo? ParentInstanceGroupAlertExpression { get; set; } + + /// + /// Parent Resource Group Alert Expression + /// + [DataMember(Name = "parentResourceDataSourceAlertExpr")] + public object? ParentResourceDataSourceAlertExpr { get; set; } /// /// Alert for no data diff --git a/LogicMonitor.Api/LogicModules/DataPointConfigurationCreationDTO.cs b/LogicMonitor.Api/LogicModules/DataPointConfigurationCreationDTO.cs index d5b18009..b19301a2 100644 --- a/LogicMonitor.Api/LogicModules/DataPointConfigurationCreationDTO.cs +++ b/LogicMonitor.Api/LogicModules/DataPointConfigurationCreationDTO.cs @@ -52,5 +52,5 @@ public class DataPointConfigurationCreationDTO : IdentifiedItem /// Parent Instance Group Alert Expression /// [DataMember(Name = "parentInstanceGroupAlertExpr")] - public string ParentInstanceGroupAlertExpression { get; set; } = string.Empty; + public InstanceGroupAlertThresholdInfo? ParentInstanceGroupAlertExpression { get; set; } } diff --git a/LogicMonitor.Api/LogicMonitorClient.cs b/LogicMonitor.Api/LogicMonitorClient.cs index b197a251..0de9c86d 100644 --- a/LogicMonitor.Api/LogicMonitorClient.cs +++ b/LogicMonitor.Api/LogicMonitorClient.cs @@ -467,7 +467,7 @@ public async Task PutAsync(string subUrl, object @item, CancellationToken cancel // Check the outer HTTP status code if (!httpResponseMessage.IsSuccessStatusCode) { - if ((int)httpResponseMessage.StatusCode != 429 && httpResponseMessage.ReasonPhrase != "Too Many Requests") + if ((int)httpResponseMessage.StatusCode != 429) { if (WaitDuringLogicMonitorUpgrades && httpResponseMessage.StatusCode == HttpStatusCode.ServiceUnavailable) { @@ -870,7 +870,7 @@ public async Task DeleteAsync(string subUrl, CancellationToken cancellationToken // Check the outer HTTP status code if (!httpResponseMessage.IsSuccessStatusCode) { - if ((int)httpResponseMessage.StatusCode != 429 && httpResponseMessage.ReasonPhrase != "Too Many Requests") + if ((int)httpResponseMessage.StatusCode != 429) { if (WaitDuringLogicMonitorUpgrades && httpResponseMessage.StatusCode == HttpStatusCode.ServiceUnavailable) { @@ -1017,7 +1017,7 @@ public async Task DeleteAsync(string subUrl, CancellationToken cancellationToken // NOT A SUCCESS :-( var statusCode = (int)httpResponseMessage.StatusCode; - var tooManyRequests = statusCode == 429 && httpResponseMessage.ReasonPhrase.Equals("Too Many Requests", StringComparison.OrdinalIgnoreCase); + var tooManyRequests = statusCode == 429; if (!tooManyRequests) { @@ -1188,11 +1188,10 @@ public async Task DeleteAsync(string subUrl, CancellationToken cancellationToken if (!httpResponseMessage.IsSuccessStatusCode) { - if ((int)httpResponseMessage.StatusCode != 429 && httpResponseMessage.ReasonPhrase != "Too Many Requests") + if ((int)httpResponseMessage.StatusCode != 429) { if (WaitDuringLogicMonitorUpgrades && httpResponseMessage.StatusCode == HttpStatusCode.ServiceUnavailable) { - // TODO: could also check the reason phrase, and / or the RESPONSE (which contains "Service Temporarily Unavailable") _logger.LogDebug("{Prefix} Service Unavailable. Waiting 10000ms", prefix); await Task.Delay(10000, cancellationToken).ConfigureAwait(false); continue; @@ -1296,7 +1295,7 @@ public async Task DeleteAsync(string subUrl, CancellationToken cancellationToken // Check the outer HTTP status code if (!httpResponseMessage.IsSuccessStatusCode) { - if ((int)httpResponseMessage.StatusCode != 429 && httpResponseMessage.ReasonPhrase != "Too Many Requests") + if ((int)httpResponseMessage.StatusCode != 429) { if (WaitDuringLogicMonitorUpgrades && httpResponseMessage.StatusCode == HttpStatusCode.ServiceUnavailable) { diff --git a/LogicMonitor.Api/Users/PrivilegeObjectType.cs b/LogicMonitor.Api/Users/PrivilegeObjectType.cs index f613fd8d..c06ac077 100644 --- a/LogicMonitor.Api/Users/PrivilegeObjectType.cs +++ b/LogicMonitor.Api/Users/PrivilegeObjectType.cs @@ -107,5 +107,11 @@ public enum PrivilegeObjectType /// Module /// [DataMember(Name = "module")] - Module + Module, + + /// + /// Cost Optimzsation + /// + [DataMember(Name = "costOptimization")] + CostOptimization } diff --git a/LogicMonitor.Api/Users/User.cs b/LogicMonitor.Api/Users/User.cs index e12a29a3..edcdfdff 100644 --- a/LogicMonitor.Api/Users/User.cs +++ b/LogicMonitor.Api/Users/User.cs @@ -216,6 +216,12 @@ public class User : IdentifiedItem, IHasEndpoint [DataMember(Name = "immediateForceLogout")] public bool ImmediateForceLogout { get; set; } + /// + /// The last authorized IP address + /// + [DataMember(Name = "lastAuthIp")] + public string LastAuthIp { get; set; } = string.Empty; + /// /// The endpoint ///