Skip to content

Commit

Permalink
Merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandbanks committed Jan 8, 2024
2 parents 59c883b + 7119c93 commit 7886e89
Show file tree
Hide file tree
Showing 20 changed files with 1,053 additions and 20 deletions.
2 changes: 1 addition & 1 deletion LogicMonitor.Api.Test/Alerts/NewAlertTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public async Task MultipleLevels()
var alerts = await LogicMonitorClient
.GetAllAsync(filter, default)
.ConfigureAwait(true);
alerts.Should().AllSatisfy(alert => severities.Contains(alert.Severity).Should().BeTrue());
alerts.Should().AllSatisfy(alert => severities.Should().Contain(alert.Severity));
}

[Fact]
Expand Down
22 changes: 11 additions & 11 deletions LogicMonitor.Api.Test/Converters/DoubleOrNAConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public void ReadJson_DataIsThreeValidDoubles_DeserializesCorrectly()
var result = JsonConvert.DeserializeObject<CustomGraphWidgetDataLine>(json);

result.Should().NotBeNull();
result!.Data[0].Should().Be(1.25);
result!.Data[1].Should().Be(1.205);
result!.Data[2].Should().Be(1.2005);
result!.Data.Should().HaveElementAt(0, 1.25);
result!.Data.Should().HaveElementAt(1, 1.205);
result!.Data.Should().HaveElementAt(2, 1.2005);
}

[Fact]
Expand Down Expand Up @@ -68,10 +68,10 @@ public void ReadJson_DataIsThreeValidDoublesPlusOneNAString_DeserializesCorrectl
var result = JsonConvert.DeserializeObject<CustomGraphWidgetDataLine>(json);

result.Should().NotBeNull();
result!.Data[0].Should().Be(1.25);
result!.Data[1].Should().Be(1.205);
result!.Data[2].Should().Be(1.2005);
result!.Data[3].Should().Be(double.MinValue);
result!.Data.Should().HaveElementAt(0, 1.25);
result!.Data.Should().HaveElementAt(1, 1.205);
result!.Data.Should().HaveElementAt(2, 1.2005);
result!.Data.Should().HaveElementAt(3, double.MinValue);
}

[Fact]
Expand Down Expand Up @@ -104,9 +104,9 @@ public void ReadJson_FourNAStrings_DeserializesCorrectly()
var result = JsonConvert.DeserializeObject<CustomGraphWidgetDataLine>(json);

result.Should().NotBeNull();
result!.Data[0].Should().Be(double.MinValue);
result!.Data[1].Should().Be(double.MinValue);
result!.Data[2].Should().Be(double.MinValue);
result!.Data[3].Should().Be(double.MinValue);
result!.Data.Should().HaveElementAt(0, double.MinValue);
result!.Data.Should().HaveElementAt(1, double.MinValue);
result!.Data.Should().HaveElementAt(2, double.MinValue);
result!.Data.Should().HaveElementAt(3, double.MinValue);
}
}
2 changes: 1 addition & 1 deletion LogicMonitor.Api.Test/Settings/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public async Task GetIntegrations()
.ConfigureAwait(true);

// Text should be set
integrations.Should().AllSatisfy(on => string.IsNullOrWhiteSpace(on.Name).Should().BeFalse());
integrations.Should().AllSatisfy(on => on.Name.Should().NotBeNullOrWhiteSpace());
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion LogicMonitor.Api.Test/Settings/OpsNotesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public async Task GetOpsNotesTags()
}, default).ConfigureAwait(true);

// Text should be set
allOpsNotesTags.Should().AllSatisfy(on => string.IsNullOrWhiteSpace(on.Name).Should().BeFalse());
allOpsNotesTags.Should().AllSatisfy(on => on.Name.Should().NotBeNullOrWhiteSpace());
}
}
2 changes: 1 addition & 1 deletion LogicMonitor.Api/Alerts/EscalationChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ public class EscalationChain : NamedItem, IHasEndpoint

/// <inheritdoc />
public string Endpoint() => "setting/alert/chains";
}
}
67 changes: 67 additions & 0 deletions LogicMonitor.Api/Alerts/EscalationChainCreationDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
namespace LogicMonitor.Api.Alerts;

/// <summary>
/// An Escalation chain creation DTO
/// </summary>
public class EscalationChainCreationDto : CreationDto<EscalationChain>
{
/// <summary>
/// The LogicMonitor Name
/// </summary>
[DataMember(Name = "name")]
public string Name { get; set; } = string.Empty;

/// <summary>
/// The LogicMonitor Description
/// </summary>
[DataMember(Name = "description")]
public string Description { get; set; } = string.Empty;

/// <summary>
/// Whether throttling is enabled
/// </summary>
[DataMember(Name = "enableThrottling")]
public bool EnableThrottling { get; set; }

/// <summary>
/// The throttling period in seconds
/// </summary>
[DataMember(Name = "throttlingPeriod")]
public int ThrottlingPeriodMinutes { get; set; }

/// <summary>
/// The alert count for throttling
/// </summary>
[DataMember(Name = "throttlingAlerts")]
public int ThrottlingAlertCount { get; set; }

/// <summary>
/// Whether in alerting
/// </summary>
[DataMember(Name = "inAlerting")]
public bool InAlerting { get; set; }

/// <summary>
/// The cc destinations
/// </summary>
[DataMember(Name = "ccdestination")]
public List<Destination> CcDestination { get; set; } = [];

/// <summary>
/// The CC destinations
/// </summary>
[DataMember(Name = "ccDestinations")]
public List<Destination> CcDestinations { get; set; } = [];

/// <summary>
/// The destinations
/// </summary>
[DataMember(Name = "destination")]
public List<Destination> Destination { get; set; } = [];

/// <summary>
/// The destinations
/// </summary>
[DataMember(Name = "destinations")]
public List<Destination> Destinations { get; set; } = [];
}
4 changes: 2 additions & 2 deletions LogicMonitor.Api/Settings/AlertRule.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace LogicMonitor.Api.Settings;

/// <summary>
/// A LogicMonitor alert
/// A LogicMonitor Alert Rule
/// </summary>
[DataContract]
public class AlertRule : NamedItem, IHasEndpoint
Expand Down Expand Up @@ -94,4 +94,4 @@ public class AlertRule : NamedItem, IHasEndpoint
/// The endpoint
/// </summary>
public string Endpoint() => "setting/alert/rules";
}
}
104 changes: 104 additions & 0 deletions LogicMonitor.Api/Settings/AlertRuleCreationDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
namespace LogicMonitor.Api.Settings;

/// <summary>
/// A LogicMonitor alert rule creation DTO
/// </summary>
[DataContract]
public class AlertRuleCreationDto : CreationDto<AlertRule>
{
/// <summary>
/// The LogicMonitor Name
/// </summary>
[DataMember(Name = "name")]
public string Name { get; set; } = string.Empty;

/// <summary>
/// The LogicMonitor Description
/// </summary>
[DataMember(Name = "description")]
public string Description { get; set; } = string.Empty;

/// <summary>
/// The priority
/// </summary>
[DataMember(Name = "priority")]
public int Priority { get; set; }

/// <summary>
/// The level (as a string)
/// </summary>
[DataMember(Name = "levelStr")]
public string LevelString { get; set; } = string.Empty;

/// <summary>
/// The device filter
/// </summary>
[DataMember(Name = "devices")]
public List<string> Devices { get; set; } = [];

/// <summary>
/// The device group filter
/// </summary>
[DataMember(Name = "deviceGroups")]
public List<string> DeviceGroups { get; set; } = [];

/// <summary>
/// The affected DataSource name filter
/// </summary>
[DataMember(Name = "datasource")]
public string DataSourceName { get; set; } = string.Empty;

/// <summary>
/// The data source instance name filter
/// </summary>
[DataMember(Name = "instance")]
public string DataSourceInstanceName { get; set; } = string.Empty;

/// <summary>
/// The datapoint filter
/// </summary>
[DataMember(Name = "datapoint")]
public string DataPoint { get; set; } = string.Empty;

/// <summary>
/// The escalation chain interval in minutes
/// </summary>
[DataMember(Name = "escalationInterval")]
public int EscalationChainIntervalMinutes { get; set; }

/// <summary>
/// The Escalating Chain Id
/// </summary>
[DataMember(Name = "escalatingChainId")]
public int EscalationChainId { get; set; }

/// <summary>
/// The Escalation Chain
/// </summary>
[DataMember(Name = "escalatingChain")]
public EscalationChain EscalationChain { get; set; } = new();

/// <summary>
/// The resource property filters list
/// </summary>
[DataMember(Name = "resourceProperties")]
public List<DeviceProperty> ResourceProperties { get; set; } = [];

/// <summary>
/// send anomaly suppressed alert
/// </summary>
[DataMember(Name = "sendAnomalySuppressedAlert")]
public bool SendAnomalySuppressedAlert { get; set; }

/// <summary>
/// Whether to suppress Alert clears
/// </summary>
[DataMember(Name = "suppressAlertClear")]
public bool SuppressAlertClear { get; set; }

/// <summary>
/// Whether to suppress Alert ack sdts
/// </summary>
[DataMember(Name = "suppressAlertAckSdt")]
public bool SuppressAlertAckSdt { get; set; }
}
2 changes: 1 addition & 1 deletion LogicMonitor.Api/Settings/AutoTaskIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ public class AutoTaskIntegration : HttpIntegration
/// </summary>
[DataMember(Name = "statusAckTicket")]
public int StatusAckTicket { get; set; }
}
}
81 changes: 81 additions & 0 deletions LogicMonitor.Api/Settings/AutoTaskIntegrationCreationDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
namespace LogicMonitor.Api.Settings;

/// <summary>
/// AutoTask Integration Creation Dto
/// </summary>
[DataContract]
public class AutoTaskIntegrationCreationDto : IntegrationCreationDto<AutoTaskIntegration>
{
/// <summary>
/// Constructor
/// </summary>
public AutoTaskIntegrationCreationDto() : base("autotask")
{
}

/// <summary>
/// The zone
/// </summary>
[DataMember(Name = "zone")]
public int Zone { get; set; }

/// <summary>
/// The accountId
/// </summary>
[DataMember(Name = "accountId")]
public int AccountId { get; set; }

/// <summary>
/// The dueDateTime
/// </summary>
[DataMember(Name = "dueDateTime")]
public string DueDateTime { get; set; } = string.Empty;

/// <summary>
/// The queueId
/// </summary>
[DataMember(Name = "queueId")]
public int QueueId { get; set; }

/// <summary>
/// The warnPriority
/// </summary>
[DataMember(Name = "warnPriority")]
public int WarnPriority { get; set; }

/// <summary>
/// The errorPriority
/// </summary>
[DataMember(Name = "errorPriority")]
public int ErrorPriority { get; set; }

/// <summary>
/// The criticalPriority
/// </summary>
[DataMember(Name = "criticalPriority")]
public int CriticalPriority { get; set; }

/// <summary>
/// The statusNewTicket
/// </summary>
[DataMember(Name = "statusNewTicket")]
public int StatusNewTicket { get; set; }

/// <summary>
/// The statusUpdateTicket
/// </summary>
[DataMember(Name = "statusUpdateTicket")]
public int StatusUpdateTicket { get; set; }

/// <summary>
/// The statusCloseTicket
/// </summary>
[DataMember(Name = "statusCloseTicket")]
public int StatusCloseTicket { get; set; }

/// <summary>
/// The statusAckTicket
/// </summary>
[DataMember(Name = "statusAckTicket")]
public int StatusAckTicket { get; set; }
}
38 changes: 38 additions & 0 deletions LogicMonitor.Api/Settings/EmailIntegrationCreationDto.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace LogicMonitor.Api.Settings;

/// <summary>
/// Email Integration Creation Dto
/// </summary>
[DataContract]
public class EmailIntegrationCreationDto : IntegrationCreationDto<EmailIntegration>
{
/// <summary>
/// Constructor
/// </summary>
public EmailIntegrationCreationDto() : base("http")
{
}
/// <summary>
/// The sender
/// </summary>
[DataMember(Name = "sender")]
public string Sender { get; set; } = string.Empty;

/// <summary>
/// The receivers
/// </summary>
[DataMember(Name = "receivers")]
public string Receivers { get; set; } = string.Empty;

/// <summary>
/// The subject
/// </summary>
[DataMember(Name = "subject")]
public string Subject { get; set; } = string.Empty;

/// <summary>
/// The body
/// </summary>
[DataMember(Name = "body")]
public string Body { get; set; } = string.Empty;
}
Loading

0 comments on commit 7886e89

Please sign in to comment.