-
Notifications
You must be signed in to change notification settings - Fork 4k
[Insights] Introduce announced breaking changes, implement ShouldProcess, rename parameters to singluar names and add aliases to keep it non-breaking #4875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… and adding aliases to keep the change non-breaking, implementing ShouldProcess, announcing deprecation of plural parameter names # Conflicts: # tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv
I think there are two empty lines at the end of the file Exceptions\BreakingChangeIssues.csv and they are breaking the StaticAnalysis. |
I do not know what the issue was this time. It failed very quickly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder some initial comments
{ | ||
// Calling with detailed output | ||
cmdlet.DetailedOutput = true; | ||
cmdlet.ExecuteCmdlet(); | ||
Assert.Null(selected); // Incorrect nameOrTargetUri clause with detailed output on | ||
// Assert.Null(selected); // Incorrect nameOrTargetUri clause with detailed output on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder please remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
@@ -104,7 +104,8 @@ public class GetAzureRmLogCommand : LogsCmdletBase | |||
/// <returns>The query filter with the conditions for particular parameters added</returns> | |||
protected override string ProcessParticularParameters(string currentQueryFilter) | |||
{ | |||
this.SetMaxEventsIfPresent(currentQueryFilter, this.MaxEvents); | |||
WriteWarning("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."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder please update the warning message to include the name of the cmdlet - this will help users running this cmdlet in a script easily find which cmdlet the warning message is coming from. Please do this for all warnings in cmdlets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I am including the cmdlet name in all warning messages.
@@ -53,7 +53,7 @@ public abstract class AddAzureRmAlertRuleCommandBase : ManagementCmdletBase | |||
/// </summary> | |||
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[ValidateNotNullOrEmpty] | |||
public string ResourceGroup { get; set; } | |||
public string ResourceGroupName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder please add an alias to ResourceGroup
to avoid undocumented breaking changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alias added... everywhere including documentation
@@ -41,7 +41,7 @@ public class GetAzureRmAlertRuleCommand : ManagementCmdletBase | |||
[Parameter(ParameterSetName = GetAzureRmAlertRuleWithNameParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[Parameter(ParameterSetName = GetAzureRmAlertRuleWithUriParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[ValidateNotNullOrEmpty] | |||
public string ResourceGroup { get; set; } | |||
public string ResourceGroupName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder same comment about adding an alias to ResourceGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -63,7 +64,7 @@ public class AddAzureRmAutoscaleSettingCommand : ManagementCmdletBase | |||
[Parameter(ParameterSetName = AddAzureRmAutoscaleSettingCreateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[Parameter(ParameterSetName = AddAzureRmAutoscaleSettingUpdateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[ValidateNotNullOrEmpty] | |||
public string ResourceGroup { get; set; } | |||
public string ResourceGroupName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder same comment about adding an alias to ResourceGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -37,7 +37,7 @@ public class GetAzureRmAutoscaleSettingCommand : ManagementCmdletBase | |||
/// </summary> | |||
[Parameter(ParameterSetName = GetAzureRmAutoscaleSettingParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[ValidateNotNullOrEmpty] | |||
public string ResourceGroup { get; set; } | |||
public string ResourceGroupName { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder same comment about adding an alias to ResourceGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -41,6 +41,7 @@ public class AddAzureRmAutoscaleSettingCommand : ManagementCmdletBase | |||
/// </summary> | |||
[Parameter(ParameterSetName = AddAzureRmAutoscaleSettingUpdateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The complete spec of an AutoscaleSetting")] | |||
[ValidateNotNullOrEmpty] | |||
[Alias("InputObject")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder I would make InputObject
the actual name of the parameter and add an alias to SettingSpec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -32,7 +32,7 @@ public class RemoveAzureRmAutoscaleSettingCommand : ManagementCmdletBase | |||
/// </summary> | |||
[Parameter(ParameterSetName = RemoveAzureRmAutoscaleSettingParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name")] | |||
[ValidateNotNullOrEmpty] | |||
public string ResourceGroup { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder same comment about adding an alias to ResourceGroup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -56,48 +56,57 @@ public class AddAzureRmLogProfileCommand : ManagementCmdletBase | |||
/// </summary> | |||
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The retention in days")] | |||
[ValidateNotNullOrEmpty] | |||
public int? RetentionInDays { get; set; } | |||
[Alias("RetentionInDays")] | |||
public int? RetentionInDay { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder for parameters with units (e.g., InDays
, InMinutes
, etc.), you don't have to worry about making them singluar
…nto release50ShouldProcOutChange # Conflicts: # src/ResourceManager/Insights/Commands.Insights/help/Add-AzureRmAutoscaleSetting.md # src/ResourceManager/Insights/Commands.Insights/help/Add-AzureRmLogAlertRule.md # src/ResourceManager/Insights/Commands.Insights/help/Add-AzureRmLogProfile.md # src/ResourceManager/Insights/Commands.Insights/help/Add-AzureRmMetricAlertRule.md # src/ResourceManager/Insights/Commands.Insights/help/Add-AzureRmWebtestAlertRule.md # src/ResourceManager/Insights/Commands.Insights/help/Get-AzureRmAlertRule.md # src/ResourceManager/Insights/Commands.Insights/help/Get-AzureRmAutoscaleSetting.md # src/ResourceManager/Insights/Commands.Insights/help/Get-AzureRmLog.md # src/ResourceManager/Insights/Commands.Insights/help/Get-AzureRmMetric.md # src/ResourceManager/Insights/Commands.Insights/help/Get-AzureRmMetricDefinition.md # src/ResourceManager/Insights/Commands.Insights/help/Get-AzureRmUsage.md # src/ResourceManager/Insights/Commands.Insights/help/New-AzureRmAlertRuleEmail.md # src/ResourceManager/Insights/Commands.Insights/help/New-AzureRmAlertRuleWebhook.md # src/ResourceManager/Insights/Commands.Insights/help/New-AzureRmAutoscaleNotification.md # src/ResourceManager/Insights/Commands.Insights/help/New-AzureRmAutoscaleProfile.md # src/ResourceManager/Insights/Commands.Insights/help/New-AzureRmAutoscaleWebhook.md # src/ResourceManager/Insights/Commands.Insights/help/Remove-AzureRmAlertRule.md # src/ResourceManager/Insights/Commands.Insights/help/Remove-AzureRmAutoscaleSetting.md # tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv
/// <param name="withTimeStamp">true if the message should include a timestamp, false (default) it no timestamp should be included</param> | ||
protected void WriteIdentifiedWarning(string topic, string message, bool withTimeStamp = false) | ||
{ | ||
string formattedMessage = Utilities.FormatIdentifiedMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder we are going to be creating our own mechanism for custom obsolete messages and attributes soon, similar to what you are doing here, so we recommend just making this simple for the time being since it will change in the near future
Rather than using the type of the class, I would just pass in the hard-coded name from the cmdlet itself as another parameter of this function (i.e., string cmdletName
, and from the GetAzureRmMetricDefinitionCommand
class, you can just call this.WriteIdenfitiedWarning("Get-AzureRmMetricDefinition", "Parameter deprecation", " The DetailedOutput parameter will be deprecated in a future breaking change release")
.
@@ -72,6 +73,8 @@ protected string ProcessParameters() | |||
/// </summary> | |||
protected override void ProcessRecordInternal() | |||
{ | |||
this.WriteIdentifiedWarning("Parameter deprecation", "The DetailedOutput parameter will be deprecated in May 2018."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder I would change "May 2018" to "future breaking change release" - even though the next breaking change release should be May 2018, we cannot be 100% positive that is when it is right now
@@ -36,11 +36,11 @@ public abstract class LogsCmdletBase : MonitorClientCmdletBase | |||
private const int MaxNumberOfReturnedRecords = 1000; | |||
private int MaxRecords = 0; | |||
|
|||
internal const string SubscriptionLevelName = "GetBySubscription"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder please revert the change made to these parameter set names - we want parameter sets to be singular strings with pascal casing. I'm not sure if this was just changed because of a merge or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I did not see this before I pushed the changes for the other comments.
Do you need me to make the names of the constants back to what they were? (I will need to change at least one of them since ResourceGroupName is the name of a parameter now. That's why I change them all.
Or do I need to change the value of the constants?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder sorry, I made this comment a few hours after when I was looking at a couple of last minute things on this PR. We've received feedback that parameter set names should be a string with no spaces instead of the space-delimited string you are currently using. I recently merged a PR where we fix this in all cmdlets who were using them. If it wouldn't be too much trouble, would you mind revert the set names back to what they were originally, but updating them to reflect the changes you made? That would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
The content of each of those constants is now a single string, Pascal casing. I also updated the documentation to reflect that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gucalder great, let me know when you push that update out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked the files and I have already pushed all those changes for parameter groups names: they are all single strings, Pascal casing.
…re/azure-powershell into release50ShouldProcOutChange
Description
This replaces PR #4873 issued from AuxMon organization.
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines