-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
AlertRuleData.cs
111 lines (104 loc) · 7.55 KB
/
AlertRuleData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Collections.Generic;
using Azure.Core;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
namespace Azure.ResourceManager.Monitor
{
/// <summary>
/// A class representing the AlertRule data model.
/// The alert rule resource.
/// </summary>
public partial class AlertRuleData : TrackedResourceData
{
/// <summary> Initializes a new instance of AlertRuleData. </summary>
/// <param name="location"> The location. </param>
/// <param name="alertRuleName"> the name of the alert rule. </param>
/// <param name="isEnabled"> the flag that indicates whether the alert rule is enabled. </param>
/// <param name="condition">
/// the condition that results in the alert rule being activated.
/// Please note <see cref="AlertRuleCondition"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="LocationThresholdRuleCondition"/>, <see cref="ManagementEventRuleCondition"/> and <see cref="ThresholdRuleCondition"/>.
/// </param>
/// <exception cref="ArgumentNullException"> <paramref name="alertRuleName"/> or <paramref name="condition"/> is null. </exception>
public AlertRuleData(AzureLocation location, string alertRuleName, bool isEnabled, AlertRuleCondition condition) : base(location)
{
Argument.AssertNotNull(alertRuleName, nameof(alertRuleName));
Argument.AssertNotNull(condition, nameof(condition));
AlertRuleName = alertRuleName;
IsEnabled = isEnabled;
Condition = condition;
Actions = new ChangeTrackingList<AlertRuleAction>();
}
/// <summary> Initializes a new instance of AlertRuleData. </summary>
/// <param name="id"> The id. </param>
/// <param name="name"> The name. </param>
/// <param name="resourceType"> The resourceType. </param>
/// <param name="systemData"> The systemData. </param>
/// <param name="tags"> The tags. </param>
/// <param name="location"> The location. </param>
/// <param name="alertRuleName"> the name of the alert rule. </param>
/// <param name="description"> the description of the alert rule that will be included in the alert email. </param>
/// <param name="provisioningState"> the provisioning state. </param>
/// <param name="isEnabled"> the flag that indicates whether the alert rule is enabled. </param>
/// <param name="condition">
/// the condition that results in the alert rule being activated.
/// Please note <see cref="AlertRuleCondition"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="LocationThresholdRuleCondition"/>, <see cref="ManagementEventRuleCondition"/> and <see cref="ThresholdRuleCondition"/>.
/// </param>
/// <param name="action">
/// action that is performed when the alert rule becomes active, and when an alert condition is resolved.
/// Please note <see cref="AlertRuleAction"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="RuleEmailAction"/> and <see cref="RuleWebhookAction"/>.
/// </param>
/// <param name="actions">
/// the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
/// Please note <see cref="AlertRuleAction"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="RuleEmailAction"/> and <see cref="RuleWebhookAction"/>.
/// </param>
/// <param name="lastUpdatedOn"> Last time the rule was updated in ISO8601 format. </param>
internal AlertRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary<string, string> tags, AzureLocation location, string alertRuleName, string description, string provisioningState, bool isEnabled, AlertRuleCondition condition, AlertRuleAction action, IList<AlertRuleAction> actions, DateTimeOffset? lastUpdatedOn) : base(id, name, resourceType, systemData, tags, location)
{
AlertRuleName = alertRuleName;
Description = description;
ProvisioningState = provisioningState;
IsEnabled = isEnabled;
Condition = condition;
Action = action;
Actions = actions;
LastUpdatedOn = lastUpdatedOn;
}
/// <summary> the name of the alert rule. </summary>
public string AlertRuleName { get; set; }
/// <summary> the description of the alert rule that will be included in the alert email. </summary>
public string Description { get; set; }
/// <summary> the provisioning state. </summary>
public string ProvisioningState { get; set; }
/// <summary> the flag that indicates whether the alert rule is enabled. </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// the condition that results in the alert rule being activated.
/// Please note <see cref="AlertRuleCondition"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="LocationThresholdRuleCondition"/>, <see cref="ManagementEventRuleCondition"/> and <see cref="ThresholdRuleCondition"/>.
/// </summary>
public AlertRuleCondition Condition { get; set; }
/// <summary>
/// action that is performed when the alert rule becomes active, and when an alert condition is resolved.
/// Please note <see cref="AlertRuleAction"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="RuleEmailAction"/> and <see cref="RuleWebhookAction"/>.
/// </summary>
public AlertRuleAction Action { get; set; }
/// <summary>
/// the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
/// Please note <see cref="AlertRuleAction"/> is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include <see cref="RuleEmailAction"/> and <see cref="RuleWebhookAction"/>.
/// </summary>
public IList<AlertRuleAction> Actions { get; }
/// <summary> Last time the rule was updated in ISO8601 format. </summary>
public DateTimeOffset? LastUpdatedOn { get; }
}
}