Skip to content

Commit 51c9f89

Browse files
committed
[Insights] Including more feedback from PR
1 parent d47cecd commit 51c9f89

18 files changed

+140
-97
lines changed

src/ResourceManager/Insights/Commands.Insights/ActivityLogs/GetAzureRmLogCommand.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class GetAzureRmLogCommand : LogsCmdletBase
3030
/// </summary>
3131
[Parameter(ParameterSetName = CorrelationIdParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "The correlationId of the query")]
3232
[Parameter(ParameterSetName = ResourceIdParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resourceId of the query")]
33-
[Parameter(ParameterSetName = LogsCmdletBase.ResourceGroupParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name of the query")]
33+
[Parameter(ParameterSetName = ResourceGroupParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name of the query")]
3434
[Parameter(ParameterSetName = ResourceProviderParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource provider name of the query")]
3535
[Parameter(ParameterSetName = SubscriptionLevelParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "The subscriptionId of the query")]
3636
public override DateTime? StartTime { get; set; }
@@ -105,7 +105,10 @@ public class GetAzureRmLogCommand : LogsCmdletBase
105105
/// <returns>The query filter with the conditions for particular parameters added</returns>
106106
protected override string ProcessParticularParameters(string currentQueryFilter)
107107
{
108-
this.WriteIdentifiedWarning("Parameter name change", "The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names.");
108+
this.WriteIdentifiedWarning(
109+
cmdletName: "Get-AzureRmLog",
110+
topic: "Parameter name change",
111+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
109112
this.SetMaxEventsIfPresent(currentQueryFilter, this.MaxRecord);
110113

111114
string extendedQuery = this.AddConditionIfPResent(currentQueryFilter, "correlationId", this.CorrelationId);

src/ResourceManager/Insights/Commands.Insights/Alerts/AddAzureRmAlertRuleCommandBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ public abstract class AddAzureRmAlertRuleCommandBase : ManagementCmdletBase
7878
/// </summary>
7979
protected override void ProcessRecordInternal()
8080
{
81-
this.WriteIdentifiedWarning("Parameter name change", "The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names.");
81+
this.WriteIdentifiedWarning(
82+
cmdletName: this.GetCmdletName(),
83+
topic: "Parameter name change",
84+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
8285
if (ShouldProcess(
8386
target: string.Format("Create/update an alert rule: {0} from resource group: {1}", this.Name, this.ResourceGroupName),
8487
action: "Create/update an alert rule"))

src/ResourceManager/Insights/Commands.Insights/Alerts/GetAzureRmAlertRuleCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ private static string ExtractTargetResourceId(AlertRuleResource alertRuleResourc
107107
/// </summary>
108108
protected override void ProcessRecordInternal()
109109
{
110-
this.WriteIdentifiedWarning("Parameter deprecation", "The DetailedOutput parameter will be deprecated in May 2018.");
110+
this.WriteIdentifiedWarning(
111+
cmdletName: "Get-AzureRmAlertRule",
112+
topic: "Parameter deprecation",
113+
message: "The DetailedOutput parameter will be deprecated in a future breaking change release.");
111114
if (string.IsNullOrWhiteSpace(this.Name))
112115
{
113116
// Retrieve all the AlertRules for a ResourceGroup

src/ResourceManager/Insights/Commands.Insights/Alerts/NewAzureRmAlertRuleEmailCommand.cs

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

15-
using Microsoft.Azure.Commands.ResourceManager.Common;
1615
using Microsoft.Azure.Management.Monitor.Management.Models;
1716
using System;
18-
using System.Globalization;
1917
using System.Management.Automation;
2018

2119
namespace Microsoft.Azure.Commands.Insights.Alerts
@@ -24,7 +22,7 @@ namespace Microsoft.Azure.Commands.Insights.Alerts
2422
/// Create an AlertRuleWebhook action
2523
/// </summary>
2624
[Cmdlet(VerbsCommon.New, "AzureRmAlertRuleEmail"), OutputType(typeof(RuleEmailAction))]
27-
public class NewAzureRmAlertRuleEmailCommand : AzureRMCmdlet
25+
public class NewAzureRmAlertRuleEmailCommand : MonitorCmdletBase
2826
{
2927
/// <summary>
3028
/// Gets or sets the CustomEmails list of the action. A comma-separated list of e-mail addresses
@@ -41,16 +39,21 @@ public class NewAzureRmAlertRuleEmailCommand : AzureRMCmdlet
4139
[Alias("SendToServiceOwners")]
4240
public SwitchParameter SendToServiceOwner { get; set; }
4341

42+
/// <summary>
43+
/// Executes the Cmdlet. This is a callback function to simplify the exception handling
44+
/// </summary>
45+
protected override void ProcessRecordInternal()
46+
{ }
47+
4448
/// <summary>
4549
/// Execute the cmdlet
4650
/// </summary>
4751
public override void ExecuteCmdlet()
4852
{
49-
WriteWarning(
50-
Utilities.FormatIdentifiedMessage(
51-
this.GetType(),
52-
"Parameter name change",
53-
"The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names."));
53+
this.WriteIdentifiedWarning(
54+
cmdletName: "New-AzureRmAlertRuleEmail",
55+
topic: "Parameter name change",
56+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
5457
if (!this.SendToServiceOwner && (this.CustomEmail == null || this.CustomEmail.Length < 1))
5558
{
5659
throw new ArgumentException("Either SendToServiceOwners must be set or at least one custom email must be present");

src/ResourceManager/Insights/Commands.Insights/Alerts/NewAzureRmAlertRuleWebhookCommand.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ResourceManager.Common;
1615
using Microsoft.Azure.Management.Monitor.Management.Models;
1716
using System.Collections;
1817
using System.Collections.Generic;
@@ -25,7 +24,7 @@ namespace Microsoft.Azure.Commands.Insights.Alerts
2524
/// Create an AlertRuleWebhook action
2625
/// </summary>
2726
[Cmdlet(VerbsCommon.New, "AzureRmAlertRuleWebhook"), OutputType(typeof(RuleWebhookAction))]
28-
public class NewAzureRmAlertRuleWebhookCommand : AzureRMCmdlet
27+
public class NewAzureRmAlertRuleWebhookCommand : MonitorCmdletBase
2928
{
3029
/// <summary>
3130
/// Gets or sets the ServiceUri of the action
@@ -40,16 +39,21 @@ public class NewAzureRmAlertRuleWebhookCommand : AzureRMCmdlet
4039
[Alias("Properties")]
4140
public Hashtable Property { get; set; }
4241

42+
/// <summary>
43+
/// Executes the Cmdlet. This is a callback function to simplify the exception handling
44+
/// </summary>
45+
protected override void ProcessRecordInternal()
46+
{ }
47+
4348
/// <summary>
4449
/// Execute the cmdlet
4550
/// </summary>
4651
public override void ExecuteCmdlet()
4752
{
48-
WriteWarning(
49-
Utilities.FormatIdentifiedMessage(
50-
this.GetType(),
51-
"Parameter name change",
52-
"The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names."));
53+
this.WriteIdentifiedWarning(
54+
cmdletName: "New-AzureRmAlertRuleWebhook",
55+
topic: "Parameter name change",
56+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
5357
Utilities.ValidateUri(this.ServiceUri, "ServiceUri");
5458

5559
var dictionary = this.Property == null

src/ResourceManager/Insights/Commands.Insights/Autoscale/AddAzureRmAutoscaleSettingCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ public class AddAzureRmAutoscaleSettingCommand : ManagementCmdletBase
106106
/// </summary>
107107
protected override void ProcessRecordInternal()
108108
{
109-
this.WriteIdentifiedWarning("Parameter name change", "The parameter plural names for the parameters will be deprecated in May 2018 in favor of he singular versions of the same names.");
109+
this.WriteIdentifiedWarning(
110+
cmdletName: "Add-AzureRmAutoscaleSetting",
111+
topic: "Parameter name change",
112+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of he singular versions of the same names.");
110113
if (ShouldProcess(
111114
target: string.Format("Create/update an autoscale setting: {0} from resource group: {1}", this.Name, this.ResourceGroupName),
112115
action: "Create/update an autoscale setting"))

src/ResourceManager/Insights/Commands.Insights/Autoscale/GetAzureRmAutoscaleSettingCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ public class GetAzureRmAutoscaleSettingCommand : ManagementCmdletBase
6060
/// </summary>
6161
protected override void ProcessRecordInternal()
6262
{
63-
this.WriteIdentifiedWarning("Parameter deprecation", "The DetailedOutput parameter will be deprecated in May 2018.");
63+
this.WriteIdentifiedWarning(
64+
cmdletName: "Get-AzureRmAutoscaleSetting",
65+
topic: "Parameter deprecation",
66+
message: "The DetailedOutput parameter will be deprecated in a future breaking change release.");
6467
if (string.IsNullOrWhiteSpace(this.Name))
6568
{
6669
// Retrieve all the Autoscale settings for a resource group

src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAzureRmAutoscaleNotificationCommand.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ResourceManager.Common;
1615
using Microsoft.Azure.Management.Monitor.Management.Models;
1716
using System;
1817
using System.Management.Automation;
@@ -23,7 +22,7 @@ namespace Microsoft.Azure.Commands.Insights.Autoscale
2322
/// Create an AutoscaleNotification
2423
/// </summary>
2524
[Cmdlet(VerbsCommon.New, "AzureRmAutoscaleNotification"), OutputType(typeof(AutoscaleNotification))]
26-
public class NewAzureRmAutoscaleNotificationCommand : AzureRMCmdlet
25+
public class NewAzureRmAutoscaleNotificationCommand : MonitorCmdletBase
2726
{
2827
private const string Operation = "Scale";
2928

@@ -55,16 +54,21 @@ public class NewAzureRmAutoscaleNotificationCommand : AzureRMCmdlet
5554
[Alias("SendEmailToSubscriptionCoAdministrators")]
5655
public SwitchParameter SendEmailToSubscriptionCoAdministrator { get; set; }
5756

57+
/// <summary>
58+
/// Executes the Cmdlet. This is a callback function to simplify the exception handling
59+
/// </summary>
60+
protected override void ProcessRecordInternal()
61+
{ }
62+
5863
/// <summary>
5964
/// Execute the cmdlet
6065
/// </summary>
6166
public override void ExecuteCmdlet()
6267
{
63-
WriteWarning(
64-
Utilities.FormatIdentifiedMessage(
65-
this.GetType(),
66-
"Parameter name change",
67-
"The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names."));
68+
this.WriteIdentifiedWarning(
69+
cmdletName: "New-AzureRmAutoscaleNotification",
70+
topic: "Parameter name change",
71+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
6872
if (!(this.SendEmailToSubscriptionAdministrator || this.SendEmailToSubscriptionCoAdministrator) &&
6973
((this.Webhook == null || this.Webhook.Length < 1) && (this.CustomEmail == null || this.CustomEmail.Length < 1)))
7074
{

src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAzureRmAutoscaleProfileCommand.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ResourceManager.Common;
1615
using Microsoft.Azure.Management.Monitor.Management.Models;
1716
using System;
1817
using System.Collections.Generic;
@@ -24,7 +23,7 @@ namespace Microsoft.Azure.Commands.Insights.Autoscale
2423
/// Create an autoscale profile
2524
/// </summary>
2625
[Cmdlet(VerbsCommon.New, "AzureRmAutoscaleProfile"), OutputType(typeof(AutoscaleProfile))]
27-
public class NewAzureRmAutoscaleProfileCommand : AzureRMCmdlet
26+
public class NewAzureRmAutoscaleProfileCommand : MonitorCmdletBase
2827
{
2928
private const string AddAutoscaleProfileNoScheduleParamGroup = "CreateWithoutScheduledTimes";
3029
private const string AddAutoscaleProfileFixDateParamGroup = "CreateWithFixedDateScheduling";
@@ -135,16 +134,21 @@ public class NewAzureRmAutoscaleProfileCommand : AzureRMCmdlet
135134

136135
#endregion
137136

137+
/// <summary>
138+
/// Executes the Cmdlet. This is a callback function to simplify the exception handling
139+
/// </summary>
140+
protected override void ProcessRecordInternal()
141+
{ }
142+
138143
/// <summary>
139144
/// Execute the cmdlet
140145
/// </summary>
141146
public override void ExecuteCmdlet()
142147
{
143-
WriteWarning(
144-
Utilities.FormatIdentifiedMessage(
145-
this.GetType(),
146-
"Parameter name change",
147-
"The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names."));
148+
this.WriteIdentifiedWarning(
149+
cmdletName: "New-AzureRmAutoscaleProfile",
150+
topic: "Parameter name change",
151+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
148152
AutoscaleProfile profile = this.CreateSettingProfile();
149153
WriteObject(profile);
150154
}

src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAzureRmAutoscaleRuleCommand.cs

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

1515
using Microsoft.Azure.Commands.Insights.Properties;
16-
using Microsoft.Azure.Commands.ResourceManager.Common;
1716
using Microsoft.Azure.Management.Monitor.Management.Models;
1817
using System;
1918
using System.Management.Automation;
@@ -24,7 +23,7 @@ namespace Microsoft.Azure.Commands.Insights.Autoscale
2423
/// Create an Autoscale rule
2524
/// </summary>
2625
[Cmdlet(VerbsCommon.New, "AzureRmAutoscaleRule"), OutputType(typeof(ScaleRule))]
27-
public class NewAzureRmAutoscaleRuleCommand : AzureRMCmdlet
26+
public class NewAzureRmAutoscaleRuleCommand : MonitorCmdletBase
2827
{
2928
private readonly TimeSpan MinimumTimeWindow = TimeSpan.FromMinutes(5);
3029
private readonly TimeSpan MinimumTimeGrain = TimeSpan.FromMinutes(1);
@@ -109,6 +108,12 @@ public class NewAzureRmAutoscaleRuleCommand : AzureRMCmdlet
109108

110109
#endregion
111110

111+
/// <summary>
112+
/// Executes the Cmdlet. This is a callback function to simplify the exception handling
113+
/// </summary>
114+
protected override void ProcessRecordInternal()
115+
{ }
116+
112117
/// <summary>
113118
/// Execute the cmdlet
114119
/// </summary>

src/ResourceManager/Insights/Commands.Insights/Autoscale/NewAzureRmAutoscaleWebhookCommand.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.Azure.Commands.ResourceManager.Common;
1615
using Microsoft.Azure.Management.Monitor.Management.Models;
1716
using System.Collections;
1817
using System.Collections.Generic;
@@ -25,7 +24,7 @@ namespace Microsoft.Azure.Commands.Insights.Autoscale
2524
/// Create an WebhookNotification
2625
/// </summary>
2726
[Cmdlet(VerbsCommon.New, "AzureRmAutoscaleWebhook"), OutputType(typeof(WebhookNotification))]
28-
public class NewAzureRmAutoscaleWebhookCommand : AzureRMCmdlet
27+
public class NewAzureRmAutoscaleWebhookCommand : MonitorCmdletBase
2928
{
3029
/// <summary>
3130
/// Gets or sets the ServiceUri of the notification
@@ -40,16 +39,21 @@ public class NewAzureRmAutoscaleWebhookCommand : AzureRMCmdlet
4039
[Alias("Properties")]
4140
public Hashtable Property { get; set; }
4241

42+
/// <summary>
43+
/// Executes the Cmdlet. This is a callback function to simplify the exception handling
44+
/// </summary>
45+
protected override void ProcessRecordInternal()
46+
{}
47+
4348
/// <summary>
4449
/// Execute the cmdlet
4550
/// </summary>
4651
public override void ExecuteCmdlet()
4752
{
48-
WriteWarning(
49-
Utilities.FormatIdentifiedMessage(
50-
this.GetType(),
51-
"Parameter name change",
52-
"The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names."));
53+
this.WriteIdentifiedWarning(
54+
cmdletName: "New-AzureRmAutoscaleWebhook",
55+
topic: "Parameter name change",
56+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
5357
Utilities.ValidateUri(this.ServiceUri, "ServiceUri");
5458

5559
var dictionary = this.Property == null

src/ResourceManager/Insights/Commands.Insights/LogProfiles/AddAzureRmLogProfileCommand.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ public class AddAzureRmLogProfileCommand : ManagementCmdletBase
7878

7979
protected override void ProcessRecordInternal()
8080
{
81-
this.WriteIdentifiedWarning("Parameter name change", "The parameter plural names for the parameters will be deprecated in May 2018 in favor of the singular versions of the same names.");
81+
this.WriteIdentifiedWarning(
82+
cmdletName: "Add-AzureRmLogProfile",
83+
topic: "Parameter name change",
84+
message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
8285
if (ShouldProcess(
8386
target: string.Format("Create/update a log profile: {0}", this.Name),
8487
action: "Create/update a log profile"))

0 commit comments

Comments
 (0)