|
| 1 | +// Copyright Datalust and contributors. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +using System; |
| 16 | +using System.Collections.Generic; |
| 17 | +using Seq.Api.Model.LogEvents; |
| 18 | +using Seq.Api.Model.Security; |
| 19 | +using Seq.Api.Model.Shared; |
| 20 | +using Seq.Api.Model.Signals; |
| 21 | + |
| 22 | +namespace Seq.Api.Model.Alerting |
| 23 | +{ |
| 24 | + /// <summary> |
| 25 | + /// An alert. |
| 26 | + /// </summary> |
| 27 | + public class AlertEntity : Entity |
| 28 | + { |
| 29 | + /// <summary> |
| 30 | + /// A friendly, human-readable title for the alert. |
| 31 | + /// </summary> |
| 32 | + public string Title { get; set; } |
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// An optional long-form description of the alert. |
| 36 | + /// </summary> |
| 37 | + public string Description { get; set; } |
| 38 | + |
| 39 | + /// <summary> |
| 40 | + /// The user id of the user who owns the alert; if <c>null</c>, the alert is shared. |
| 41 | + /// </summary> |
| 42 | + public string OwnerId { get; set; } |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// If <c>true</c>, the alert can only be modified by users with the <see cref="Permission.Setup"/> permission. |
| 46 | + /// </summary> |
| 47 | + public bool IsProtected { get; set; } |
| 48 | + |
| 49 | + /// <summary> |
| 50 | + /// If <c>true</c>, the alert will not be processed, and notifications will not be sent. |
| 51 | + /// </summary> |
| 52 | + public bool IsDisabled { get; set; } |
| 53 | + |
| 54 | + /// <summary> |
| 55 | + /// An optional <see cref="SignalExpressionPart"/> limiting the data source that triggers the alert. |
| 56 | + /// </summary> |
| 57 | + public SignalExpressionPart SignalExpression { get; set; } |
| 58 | + |
| 59 | + /// <summary> |
| 60 | + /// An optional <c>where</c> clause limiting the data source that triggers the alert. |
| 61 | + /// </summary> |
| 62 | + public string Where { get; set; } |
| 63 | + |
| 64 | + /// <summary> |
| 65 | + /// Additional groupings applied to the data source. The <c>time()</c> grouping is controlled by the alerting |
| 66 | + /// infrastructure according to the <see cref="TimeGrouping"/> property and should not be specified here. |
| 67 | + /// </summary> |
| 68 | + public List<GroupingColumnPart> GroupBy { get; set; } = new List<GroupingColumnPart>(); |
| 69 | + |
| 70 | + /// <summary> |
| 71 | + /// The interval over which the alert condition will be measured. |
| 72 | + /// </summary> |
| 73 | + public TimeSpan TimeGrouping { get; set; } |
| 74 | + |
| 75 | + /// <summary> |
| 76 | + /// The individual measurements that will be tested by the alert condition. |
| 77 | + /// </summary> |
| 78 | + public List<ColumnPart> Select { get; set; } = new List<ColumnPart>(); |
| 79 | + |
| 80 | + /// <summary> |
| 81 | + /// The alert condition. This is a <c>having</c> clause over the grouped results |
| 82 | + /// computed by the alert query. |
| 83 | + /// </summary> |
| 84 | + public string Having { get; set; } |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// A level indicating the severity or priority of the alert. |
| 88 | + /// </summary> |
| 89 | + public LogEventLevel NotificationLevel { get; set; } |
| 90 | + |
| 91 | + /// <summary> |
| 92 | + /// Additional properties that will be attached to the generated notification. |
| 93 | + /// </summary> |
| 94 | + public List<EventPropertyPart> NotificationProperties { get; set; } = new List<EventPropertyPart>(); |
| 95 | + |
| 96 | + /// <summary> |
| 97 | + /// The channels that will receive notifications when the alert is triggered. |
| 98 | + /// </summary> |
| 99 | + public List<NotificationChannelPart> NotificationChannels { get; set; } = new List<NotificationChannelPart>(); |
| 100 | + |
| 101 | + /// <summary> |
| 102 | + /// The time after the alert is triggered within which no further notifications will be sent. |
| 103 | + /// </summary> |
| 104 | + public TimeSpan SuppressionTime { get; set; } |
| 105 | + |
| 106 | + /// <summary> |
| 107 | + /// Any recent activity for the alert. |
| 108 | + /// </summary> |
| 109 | + public AlertActivityPart Activity { get; set; } |
| 110 | + } |
| 111 | +} |
0 commit comments