Skip to content

Commit df62882

Browse files
authored
[Monitor] clean activitylogalert related models (Azure#19850)
* clean activitylogalert related models * Create BreakingChangeIssues.csv
1 parent 4fd076a commit df62882

12 files changed

+43
-247
lines changed

src/Monitor/Monitor.Test/Alerts/AddAzureRmMetricAlertRuleV2Tests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.Azure.Commands.Insights.OutputClasses;
1717
using Microsoft.Azure.Management.Monitor;
1818
using Microsoft.Azure.Management.Monitor.Models;
19+
using Microsoft.Azure.Management.Monitor.Management.Models;
1920
using Microsoft.Rest.Azure;
2021
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2122
using Moq;
@@ -87,8 +88,8 @@ public void NewMetricAlertRuleV2ByTargetResourceScopeAndActionGroupParametersPro
8788
{
8889
_cmdlet.TargetResourceScope = new[] { "resourceId1", "resourceId2" };
8990
_cmdlet.ActionGroup = new[] {
90-
new ActivityLogAlertActionGroup("actionGroupId1", null),
91-
new ActivityLogAlertActionGroup("actionGroupId2", null)
91+
new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup("actionGroupId1", null),
92+
new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup("actionGroupId2", null)
9293
};
9394

9495
_cmdlet.ExecuteCmdlet();
@@ -112,8 +113,8 @@ public void NewMetricAlertRuleV2ByTargetResourceScopeActionGroupAndActionGroupId
112113
{
113114
_cmdlet.TargetResourceScope = new[] { "resourceId1", "resourceId2" };
114115
_cmdlet.ActionGroup = new[] {
115-
new ActivityLogAlertActionGroup("actionGroupId1", new Dictionary<string, string> {{"key1", "value1"}}),
116-
new ActivityLogAlertActionGroup("actionGroupId2", null)
116+
new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup("actionGroupId1", new Dictionary<string, string> {{"key1", "value1"}}),
117+
new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup("actionGroupId2", null)
117118
};
118119

119120
_cmdlet.ActionGroupId = new[] { "actionGroupId1", "actionGroupId3" };

src/Monitor/Monitor/Alerts/AddAzureRmMetricAlertRuleV2Command.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
1717
using Microsoft.Azure.Management.Monitor;
1818
using Microsoft.Azure.Management.Monitor.Models;
19+
using Microsoft.Azure.Management.Monitor.Management.Models;
1920
using System;
2021
using System.Collections.Generic;
2122
using System.Linq;
@@ -110,7 +111,7 @@ public class AddAzureRmMetricAlertRuleV2Command : ManagementCmdletBase
110111
[Parameter(Mandatory = false, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Action Group for rule")]
111112
[Alias("Actions")]
112113
[AllowEmptyCollection]
113-
public ActivityLogAlertActionGroup[] ActionGroup { get; set; }
114+
public Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup[] ActionGroup { get; set; }
114115

115116
/// <summary>
116117
/// Gets or sets the ActionGroupId parameter

src/Monitor/Monitor/Monitor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<PsModuleName>Monitor</PsModuleName>

src/Monitor/Monitor/OutputClasses/PSActivityLogAlertResource.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Monitor/Monitor/OutputClasses/PSMetricAlertRuleV2.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
1616
using Microsoft.Azure.Management.Monitor.Models;
17+
using Microsoft.Azure.Management.Monitor.Management.Models;
1718
using Newtonsoft.Json;
1819
using System;
1920
using System.Collections.Generic;
@@ -53,10 +54,10 @@ public PSMetricAlertRuleV2(MetricAlertResource metricAlertResource)
5354
{
5455
//Web-Test
5556
}
56-
Actions = new ActivityLogAlertActionGroup[metricAlertResource.Actions.Count];
57+
Actions = new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup[metricAlertResource.Actions.Count];
5758
for(int i = 0; i < metricAlertResource.Actions.Count;i++)
5859
{
59-
Actions[i] = new ActivityLogAlertActionGroup(metricAlertResource.Actions[i].ActionGroupId, metricAlertResource.Actions[i].WebHookProperties);
60+
Actions[i] = new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup(metricAlertResource.Actions[i].ActionGroupId, metricAlertResource.Actions[i].WebHookProperties);
6061
}
6162

6263
var resourceIdentifier = new ResourceIdentifier(metricAlertResource.Id);
@@ -73,7 +74,7 @@ public PSMetricAlertRuleV2(MetricAlertResource metricAlertResource)
7374
/// Gets or sets list of action groups.
7475
/// </summary>
7576
[JsonProperty(PropertyName = "actions")]
76-
public new ActivityLogAlertActionGroup[] Actions { get; set; }
77+
public new Microsoft.Azure.Management.Monitor.Management.Models.ActivityLogAlertActionGroup[] Actions { get; set; }
7778

7879
///<summary>
7980
///Gets or sets the resource group name

src/Monitor/Monitor/TransitionalClasses/ActivityLogAlertActionGroup.cs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,48 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Newtonsoft.Json;
16+
using System.Collections.Generic;
17+
1518
namespace Microsoft.Azure.Management.Monitor.Management.Models
1619
{
1720
/// <summary>
1821
/// This class is intended to help in the transition between namespaces, since it will be a breaking change that needs to be announced and delayed 6 months.
1922
/// It is identical to the MetricSettings, but in the old namespace
2023
/// </summary>
21-
public class ActivityLogAlertActionGroup : Monitor.Models.ActivityLogAlertActionGroup
24+
public class ActivityLogAlertActionGroup
2225
{
2326
/// <summary>
2427
/// Initializes a new instance of the ActivityLogAlertActionGroup class.
2528
/// </summary>
2629
public ActivityLogAlertActionGroup()
27-
: base()
2830
{ }
2931

3032
/// <summary>
31-
/// Initializes a new instance of the ActivityLogAlertActionGroup class.
33+
/// Initializes a new instance of the ActivityLogAlertActionGroup
34+
/// class.
3235
/// </summary>
33-
/// <param name="activityLogAlertActionGroup">The ActivityLogAlertActionGroup object</param>
34-
public ActivityLogAlertActionGroup(Monitor.Models.ActivityLogAlertActionGroup activityLogAlertActionGroup)
35-
: base(
36-
actionGroupId: activityLogAlertActionGroup?.ActionGroupId,
37-
webhookProperties: activityLogAlertActionGroup?.WebhookProperties)
36+
/// <param name="actionGroupId">The resourceId of the action group.
37+
/// This cannot be null or empty.</param>
38+
/// <param name="webhookProperties">the dictionary of custom properties
39+
/// to include with the post operation. These data are appended to the
40+
/// webhook payload.</param>
41+
public ActivityLogAlertActionGroup(string actionGroupId, IDictionary<string, string> webhookProperties = default(IDictionary<string, string>))
3842
{
43+
ActionGroupId = actionGroupId;
44+
WebhookProperties = webhookProperties;
3945
}
46+
47+
/// <summary>
48+
/// Gets or sets the resourceId of the action group. This cannot be
49+
/// null or empty.
50+
/// </summary>
51+
public string ActionGroupId { get; set; }
52+
53+
/// <summary>
54+
/// Gets or sets the dictionary of custom properties to include with
55+
/// the post operation. These data are appended to the webhook payload.
56+
/// </summary>
57+
public IDictionary<string, string> WebhookProperties { get; set; }
4058
}
4159
}

src/Monitor/Monitor/TransitionalClasses/ActivityLogAlertActionList.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/Monitor/Monitor/TransitionalClasses/ActivityLogAlertAllOfCondition.cs

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/Monitor/Monitor/TransitionalClasses/ActivityLogAlertLeafCondition.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Monitor/Monitor/TransitionalClasses/ActivityLogAlertResource.cs

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)