Skip to content

Commit e0a4511

Browse files
author
Mahak Jain
committed
Resolve PR comments
1 parent 377c6da commit e0a4511

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

src/AlertsManagement/AlertsManagement.Test/ScenarioTests/SmartGroupTests.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Test Smart Group change state
1818
#>
1919
function Test-SmartGroupChangeState
2020
{
21-
$smartGroupId = "f52ed8ac-fe87-4234-8134-782825645204"
21+
# Get latest smart group
22+
$smartGroups = Get-AzSmartGroup -TimeRange 1h
23+
$smartGroupId = $smartGroups[0].Id
2224

2325
$oldSmartGroup = Get-AzSmartGroup -SmartGroupId $smartGroupId
2426
$newState = "Acknowledged"

src/AlertsManagement/AlertsManagement/ActionRuleCommands/SetAzureActionRule.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System.Collections.Generic;
16+
using System.Linq;
1617
using System.Management.Automation;
1718
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
1819
using Microsoft.Rest.Azure;
@@ -288,7 +289,7 @@ public class SetAzureActionRule : AlertsManagementBaseCmdlet
288289
HelpMessage = "Reccurent values, if applicable." +
289290
"In case of Weekly - 1,3,5 \n" +
290291
"In case of Monthly - 16,24,28 \n")]
291-
public List<int?> ReccurentValue { get; set; }
292+
public int[] ReccurentValue { get; set; }
292293

293294
/// <summary>
294295
/// Action rule simplified format : Action Group Id
@@ -347,9 +348,9 @@ protected override void ProcessRecordInternal()
347348
endTime: SuppressionEndTime.Split(' ')[1]
348349
);
349350

350-
if (ReccurentValue.Count > 0)
351+
if (ReccurentValue.Length > 0)
351352
{
352-
config.Schedule.RecurrenceValues = ReccurentValue;
353+
//config.Schedule.RecurrenceValues = new List<int?>(ReccurentValue.ToList<int?>());
353354
}
354355
}
355356

@@ -394,7 +395,6 @@ protected override void ProcessRecordInternal()
394395

395396
break;
396397
case ByInputObjectParameterSet:
397-
// TODO: Implement from InputObject
398398
break;
399399
}
400400

src/AlertsManagement/AlertsManagement/AlertCommands/MeasureAzureAlertStatistic.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,7 @@ protected override void ProcessRecordInternal()
140140
includeSmartGroupsCount: IncludeSmartGroupsCount
141141
).Result.Body);
142142

143-
// TODO: How to directly call overriden ToString() functions for custom output classes
144-
// Defined PSAggregatedCounts in PSSummary
145-
WriteObject(summary);
146-
WriteObject(summary.AggregatedCounts.ToString());
143+
WriteObject(summary.ToString());
147144
}
148145
}
149146
}

src/AlertsManagement/AlertsManagement/AlertsManagementBaseCmdlet.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ namespace Microsoft.Azure.Commands.AlertsManagement
2929
public abstract class AlertsManagementBaseCmdlet : AzureRMCmdlet
3030
{
3131
#region Client Declaration
32-
// TODO: Uncomment once SDK is published
3332
private IAlertsManagementClient alertsManagementClient;
3433

3534
/// <summary>

src/AlertsManagement/AlertsManagement/OutputModels/PSAlertsSummary.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,20 @@ public PSAlertsSummary(AlertsSummary summary)
3838
public int? TotalSmartGroups { get; }
3939

4040
public PSAggregatedCounts AggregatedCounts { get; }
41+
42+
public override string ToString()
43+
{
44+
var output = new StringBuilder();
45+
output.AppendLine();
46+
output.Append(string.Format("GroupBy : {0}", GroupBy));
47+
output.AppendLine();
48+
output.Append(string.Format("TotalAlerts : {0}", TotalAlerts));
49+
output.AppendLine();
50+
output.Append(string.Format("TotalSmartGroups : {0}", TotalSmartGroups));
51+
output.AppendLine();
52+
output.Append(string.Format("Summarization : {0}", AggregatedCounts.ToString()));
53+
output.AppendLine();
54+
return output.ToString();
55+
}
4156
}
4257
}

src/AlertsManagement/NuGet.Config

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

0 commit comments

Comments
 (0)