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 1 commit
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
3 changes: 3 additions & 0 deletions src/alertsmanagement/azext_alertsmanagement/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
- 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"
- 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/0b1f6471-1bf0-4dda-aec3-cb9272f09590/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
Jing-song marked this conversation as resolved.
Show resolved Hide resolved
"""

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