Skip to content
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

[alertsmanagement] Add an example were the recurrence type is set to once #3797

Merged
merged 3 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/alertsmanagement/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
Release History
===============

0.1.1
++++++
* Add an example were the recurrence type is set to once.
* Fix error: when the recurrence type is set to once, 'Action Rule property 'properties.suppressionConfig.schedule' cannot be null.'

0.1.0
++++++
* Initial release.
5 changes: 4 additions & 1 deletion src/alertsmanagement/azext_alertsmanagement/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --suppression-recurrence-type Always --alert-context Contains Computer-01 --monitor-service Equals "Log Analytics"
- name: Create an action rule to suppress notifications in a resource group
text: |-
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --scope-type ResourceGroup --scope /subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/rg --suppression-recurrence-type Always --alert-context Contains Computer-01 --monitor-service Equals "Log Analytics"
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --scope-type ResourceGroup --scope /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg --suppression-recurrence-type Always --alert-context Contains Computer-01 --monitor-service Equals "Log Analytics"
- name: Create an action rule with a recurrenceType of Once
text: |-
az monitor action-rule create --resource-group rg --name rule --location Global --status Enabled --rule-type Suppression --scope-type ResourceGroup --scope /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg --severity Equals Sev0 Sev2 --monitor-service Equals Platform "Application Insights" --monitor-condition Equals Fired --target-resource-type NotEquals Microsoft.Compute/VirtualMachines --suppression-recurrence-type Once --suppression-start-date 08/09/2021 --suppression-end-date 08/10/2021 --suppression-start-time 06:00:00 --suppression-end-time 14:00:00
"""

helps['monitor action-rule update'] = """
Expand Down
2 changes: 1 addition & 1 deletion src/alertsmanagement/azext_alertsmanagement/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def create_alertsmanagement_action_rule(cmd, client,
properties['suppressionConfig'] = {
'recurrenceType': suppression_recurrence_type
}
if suppression_recurrence_type not in ['Always', 'Once']:
if suppression_recurrence_type not in ['Always']:
properties['suppressionConfig']['schedule'] = {
'startDate': suppression_start_date,
'endDate': suppression_end_date,
Expand Down
Loading