-
Notifications
You must be signed in to change notification settings - Fork 4k
Powershell Cmdlets for Alerts Management #9495
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
Can one of the admins verify this patch? |
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.
Soem review comments - also, there appears to be a build failure
src/AlertsManagement/AlertsManagement/ActionRuleCommands/GetAzureActionRule.cs
Outdated
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/ActionRuleCommands/RemoveAzureActionRule.cs
Outdated
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/ActionRuleCommands/GetAzureActionRule.cs
Outdated
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/ActionRuleCommands/RemoveAzureActionRule.cs
Outdated
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/ActionRuleCommands/RemoveAzureActionRule.cs
Outdated
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/AlertCommands/UpdateAzureAlertState.cs
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/AlertsManagementBaseCmdlet.cs
Outdated
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/help/Update-AzSmartGroupState.md
Outdated
Show resolved
Hide resolved
@markcowl I have few queries -
|
src/AlertsManagement/AlertsManagement/help/Az.AlertsManagement.md
Outdated
Show resolved
Hide resolved
@mahakjain314 I identified the issue you are having in the analysis runs, and the security-tools issue is just that you need to check the issues it identified and suppress them if they are not existing credentials Please let us know if you have any questions |
Few questions - |
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.
Well, the number of issues are getting smaller every time, so progress
src/AlertsManagement/AlertsManagement/ActionRuleCommands/GetAzureActionRule.cs
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/ActionRuleCommands/SetAzureActionRule.cs
Outdated
Show resolved
Hide resolved
[Parameter(Mandatory = false, | ||
ParameterSetName = BySimplifiedFormatDiagnosticsActionRuleParameterSet, | ||
HelpMessage = "Description of Action Rule")] | ||
public string Description { 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.
This parameter must be in the InputObject poarameter set - when someone supplies an InputObject, they should be able to override any particular property using the parameters. This enables scenarios like:
Get-AzActionRule | Select {...} | Set-AzActionRule -Status Disabled
This is explicitly called out in the sample Set cmdlet here: https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/examples/set-cmdlet-example.md although it is fine to simply use the passed-in object and override its properties with the specified ones.
src/AlertsManagement/AlertsManagement/ActionRuleCommands/UpdateAzureActionRule.cs
Show resolved
Hide resolved
[Parameter(Mandatory = false, | ||
ParameterSetName = AlertsListByTargetResourceGroupFilterParameterSet, | ||
HelpMessage = "Filter on Moniter Service")] | ||
[Parameter(Mandatory = false, |
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.
Simplification note for the future (not a required change now) Optional parameters that occur in every parameter set just need a single parameter attribute with no parametersetname
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.
Sure. I'll prefer mentioning explicitly initially to avoid confusion.
[Parameter(Mandatory = false, | ||
ParameterSetName = AlertsListByTargetResourceGroupFilterParameterSet, | ||
HelpMessage = "Include EgressConfig - true/false")] | ||
public bool IncludeEgressConfig { 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.
See my above response. InputObject parameter set for Set cmdlets should include all the non-identity parameters. This allows a user to override proeprties of an input object in piping scenarios.
src/AlertsManagement/AlertsManagement/AlertCommands/MeasureAzureAlertStatistic.cs
Show resolved
Hide resolved
src/AlertsManagement/AlertsManagement/AlertsManagementBaseCmdlet.cs
Outdated
Show resolved
Hide resolved
/azp run azure-powershell - powershell-core |
Azure Pipelines successfully started running 1 pipeline(s). |
[Parameter(Mandatory = false, | ||
ParameterSetName = BySimplifiedFormatDiagnosticsActionRuleParameterSet, | ||
HelpMessage = "Description of Action Rule")] | ||
public string Description { 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.
This change is deferred until GA
HelpMessage = "Status of Action Rule.")] | ||
[ValidateNotNullOrEmpty] | ||
[PSArgumentCompleter("Enabled", "Disabled")] | ||
public string Status { 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.
This change is deferred until GA
[Parameter(ParameterSetName = ByInputObjectParameterSet, Mandatory = false, HelpMessage = "Action rule status")] | ||
[Parameter(ParameterSetName = ByNameSimplifiedPatchParameterSet, Mandatory = false, HelpMessage = "Action rule status")] | ||
[PSArgumentCompleter(ActionRuleStatus.Enabled, ActionRuleStatus.Disabled)] | ||
public string Status { 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.
For future reference: this should be split into Enable/Disable cmdlets, since there is no other function of the update cmdlet.
[Parameter(Mandatory = false, | ||
ParameterSetName = AlertsListByTargetResourceGroupFilterParameterSet, | ||
HelpMessage = "Include EgressConfig - true/false")] | ||
public bool IncludeEgressConfig { 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.
This needs to be updated for GA
Description
This feature enables customers to perform the operations supported by AlertsManagement RP on alerts, action rule and smart groups through Powershell.
Design Review - https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/315
Checklist
CONTRIBUTING.md
platyPS
module