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

Make some parameters optional #1123

Merged
merged 1 commit into from
Mar 11, 2022
Merged
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
12 changes: 6 additions & 6 deletions arm/Microsoft.Insights/scheduledQueryRules/deploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ param kind string = 'LogAlert'
param autoMitigate bool = true

@description('Optional. If specified (in ISO 8601 duration format) then overrides the query time range. Relevant only for rules of the kind LogAlert.')
param queryTimeRange string
param queryTimeRange string = ''

@description('Optional. The flag which indicates whether the provided query should be validated or not. Relevant only for rules of the kind LogAlert.')
param skipQueryValidation bool = false
Expand Down Expand Up @@ -49,7 +49,7 @@ param severity int = 3
param evaluationFrequency string = ''

@description('Optional. The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required only for rules of the kind LogAlert.')
param windowSize string
param windowSize string = ''

@description('Optional. Actions to invoke when the alert fires.')
param actions array = []
Expand Down Expand Up @@ -94,14 +94,14 @@ resource queryRule 'Microsoft.Insights/scheduledQueryRules@2021-02-01-preview' =
description: alertDescription
displayName: name
enabled: enabled
evaluationFrequency: (kind == 'LogAlert') ? evaluationFrequency : null
muteActionsDuration: (kind == 'LogAlert') ? suppressForMinutes : null
overrideQueryTimeRange: (kind == 'LogAlert') ? queryTimeRange : null
evaluationFrequency: (kind == 'LogAlert' && !empty(evaluationFrequency)) ? evaluationFrequency : null
muteActionsDuration: (kind == 'LogAlert' && !empty(suppressForMinutes)) ? suppressForMinutes : null
overrideQueryTimeRange: (kind == 'LogAlert' && !empty(queryTimeRange)) ? queryTimeRange : null
scopes: scopes
severity: (kind == 'LogAlert') ? severity : null
skipQueryValidation: (kind == 'LogAlert') ? skipQueryValidation : null
targetResourceTypes: (kind == 'LogAlert') ? targetResourceTypes : null
windowSize: (kind == 'LogAlert') ? windowSize : null
windowSize: (kind == 'LogAlert' && !empty(windowSize)) ? windowSize : null
}
}

Expand Down