All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.monitoring.kotlin.ScheduledQueryRulesAlertArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.21.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.monitoring.kotlin

import com.pulumi.azure.monitoring.ScheduledQueryRulesAlertArgs.builder
import com.pulumi.azure.monitoring.kotlin.inputs.ScheduledQueryRulesAlertActionArgs
import com.pulumi.azure.monitoring.kotlin.inputs.ScheduledQueryRulesAlertActionArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.ScheduledQueryRulesAlertTriggerArgs
import com.pulumi.azure.monitoring.kotlin.inputs.ScheduledQueryRulesAlertTriggerArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages an AlertingAction Scheduled Query Rules resource within Azure Monitor.
 * ## Import
 * Scheduled Query Rule Alerts can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:monitoring/scheduledQueryRulesAlert:ScheduledQueryRulesAlert example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/scheduledQueryRules/myrulename
 * ```
 * @property action An `action` block as defined below.
 * @property authorizedResourceIds List of Resource IDs referred into query.
 * @property autoMitigationEnabled Should the alerts in this Metric Alert be auto resolved? Defaults to `false`.
 * > **NOTE** `auto_mitigation_enabled` and `throttling` are mutually exclusive and cannot both be set.
 * @property dataSourceId The resource URI over which log search query is to be run. Changing this forces a new resource to be created.
 * @property description The description of the scheduled query rule.
 * @property enabled Whether this scheduled query rule is enabled. Default is `true`.
 * @property frequency Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
 * @property location Specifies the Azure Region where the resource should exist. Changing this forces a new resource to be created.
 * @property name The name of the scheduled query rule. Changing this forces a new resource to be created.
 * @property query Log search query.
 * @property queryType The type of query results. Possible values are `ResultCount` and `Number`. Default is `ResultCount`. If set to `ResultCount`, `query` must include an `AggregatedValue` column of a numeric type, for example, `Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)`.
 * @property resourceGroupName The name of the resource group in which to create the scheduled query rule instance. Changing this forces a new resource to be created.
 * @property severity Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
 * @property tags A mapping of tags to assign to the resource.
 * @property throttling Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
 * @property timeWindow Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
 * @property trigger A `trigger` block as defined below.
 */
public data class ScheduledQueryRulesAlertArgs(
    public val action: Output? = null,
    public val authorizedResourceIds: Output>? = null,
    public val autoMitigationEnabled: Output? = null,
    public val dataSourceId: Output? = null,
    public val description: Output? = null,
    public val enabled: Output? = null,
    public val frequency: Output? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val query: Output? = null,
    public val queryType: Output? = null,
    public val resourceGroupName: Output? = null,
    public val severity: Output? = null,
    public val tags: Output>? = null,
    public val throttling: Output? = null,
    public val timeWindow: Output? = null,
    public val trigger: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.monitoring.ScheduledQueryRulesAlertArgs =
        com.pulumi.azure.monitoring.ScheduledQueryRulesAlertArgs.builder()
            .action(action?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .authorizedResourceIds(authorizedResourceIds?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .autoMitigationEnabled(autoMitigationEnabled?.applyValue({ args0 -> args0 }))
            .dataSourceId(dataSourceId?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .enabled(enabled?.applyValue({ args0 -> args0 }))
            .frequency(frequency?.applyValue({ args0 -> args0 }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .query(query?.applyValue({ args0 -> args0 }))
            .queryType(queryType?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .severity(severity?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .throttling(throttling?.applyValue({ args0 -> args0 }))
            .timeWindow(timeWindow?.applyValue({ args0 -> args0 }))
            .trigger(trigger?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) })).build()
}

/**
 * Builder for [ScheduledQueryRulesAlertArgs].
 */
@PulumiTagMarker
public class ScheduledQueryRulesAlertArgsBuilder internal constructor() {
    private var action: Output? = null

    private var authorizedResourceIds: Output>? = null

    private var autoMitigationEnabled: Output? = null

    private var dataSourceId: Output? = null

    private var description: Output? = null

    private var enabled: Output? = null

    private var frequency: Output? = null

    private var location: Output? = null

    private var name: Output? = null

    private var query: Output? = null

    private var queryType: Output? = null

    private var resourceGroupName: Output? = null

    private var severity: Output? = null

    private var tags: Output>? = null

    private var throttling: Output? = null

    private var timeWindow: Output? = null

    private var trigger: Output? = null

    /**
     * @param value An `action` block as defined below.
     */
    @JvmName("edmdlndyhnxidpiu")
    public suspend fun action(`value`: Output) {
        this.action = value
    }

    /**
     * @param value List of Resource IDs referred into query.
     */
    @JvmName("vgasofayplbqapwq")
    public suspend fun authorizedResourceIds(`value`: Output>) {
        this.authorizedResourceIds = value
    }

    @JvmName("dhiidmdeelmyarcx")
    public suspend fun authorizedResourceIds(vararg values: Output) {
        this.authorizedResourceIds = Output.all(values.asList())
    }

    /**
     * @param values List of Resource IDs referred into query.
     */
    @JvmName("buofpaohhbrrnjrn")
    public suspend fun authorizedResourceIds(values: List>) {
        this.authorizedResourceIds = Output.all(values)
    }

    /**
     * @param value Should the alerts in this Metric Alert be auto resolved? Defaults to `false`.
     * > **NOTE** `auto_mitigation_enabled` and `throttling` are mutually exclusive and cannot both be set.
     */
    @JvmName("rcrybbcmccdiuwox")
    public suspend fun autoMitigationEnabled(`value`: Output) {
        this.autoMitigationEnabled = value
    }

    /**
     * @param value The resource URI over which log search query is to be run. Changing this forces a new resource to be created.
     */
    @JvmName("swtcskcvrocyqkam")
    public suspend fun dataSourceId(`value`: Output) {
        this.dataSourceId = value
    }

    /**
     * @param value The description of the scheduled query rule.
     */
    @JvmName("qowvlpasrqmhumjc")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Whether this scheduled query rule is enabled. Default is `true`.
     */
    @JvmName("nxkcaaifqltdyilk")
    public suspend fun enabled(`value`: Output) {
        this.enabled = value
    }

    /**
     * @param value Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
     */
    @JvmName("tdwrvydtptdolplv")
    public suspend fun frequency(`value`: Output) {
        this.frequency = value
    }

    /**
     * @param value Specifies the Azure Region where the resource should exist. Changing this forces a new resource to be created.
     */
    @JvmName("uvdgqtbvgjhlhtcq")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value The name of the scheduled query rule. Changing this forces a new resource to be created.
     */
    @JvmName("vlshuxtcwcuhefmr")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Log search query.
     */
    @JvmName("oetplnqqphianauy")
    public suspend fun query(`value`: Output) {
        this.query = value
    }

    /**
     * @param value The type of query results. Possible values are `ResultCount` and `Number`. Default is `ResultCount`. If set to `ResultCount`, `query` must include an `AggregatedValue` column of a numeric type, for example, `Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)`.
     */
    @JvmName("rfcybpvctyupfckk")
    public suspend fun queryType(`value`: Output) {
        this.queryType = value
    }

    /**
     * @param value The name of the resource group in which to create the scheduled query rule instance. Changing this forces a new resource to be created.
     */
    @JvmName("dnkwcogeclaqrecs")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
     */
    @JvmName("nlnegeaocupmkaon")
    public suspend fun severity(`value`: Output) {
        this.severity = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("lgnkmjdxbodtkkmb")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
     */
    @JvmName("fxbhuxqwnwdjnngd")
    public suspend fun throttling(`value`: Output) {
        this.throttling = value
    }

    /**
     * @param value Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
     */
    @JvmName("xjipuuvpjdfdmrpb")
    public suspend fun timeWindow(`value`: Output) {
        this.timeWindow = value
    }

    /**
     * @param value A `trigger` block as defined below.
     */
    @JvmName("yywyqqnqshhtwxji")
    public suspend fun trigger(`value`: Output) {
        this.trigger = value
    }

    /**
     * @param value An `action` block as defined below.
     */
    @JvmName("rrvcjwmvbqwwtrkx")
    public suspend fun action(`value`: ScheduledQueryRulesAlertActionArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param argument An `action` block as defined below.
     */
    @JvmName("qcybkesfplefqobd")
    public suspend
    fun action(argument: suspend ScheduledQueryRulesAlertActionArgsBuilder.() -> Unit) {
        val toBeMapped = ScheduledQueryRulesAlertActionArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.action = mapped
    }

    /**
     * @param value List of Resource IDs referred into query.
     */
    @JvmName("urcxovkurqbiqosl")
    public suspend fun authorizedResourceIds(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.authorizedResourceIds = mapped
    }

    /**
     * @param values List of Resource IDs referred into query.
     */
    @JvmName("edlkrwddadivadsw")
    public suspend fun authorizedResourceIds(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.authorizedResourceIds = mapped
    }

    /**
     * @param value Should the alerts in this Metric Alert be auto resolved? Defaults to `false`.
     * > **NOTE** `auto_mitigation_enabled` and `throttling` are mutually exclusive and cannot both be set.
     */
    @JvmName("grocvhyjeqanudsf")
    public suspend fun autoMitigationEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.autoMitigationEnabled = mapped
    }

    /**
     * @param value The resource URI over which log search query is to be run. Changing this forces a new resource to be created.
     */
    @JvmName("hbfubwdeiefybpek")
    public suspend fun dataSourceId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.dataSourceId = mapped
    }

    /**
     * @param value The description of the scheduled query rule.
     */
    @JvmName("iksjdktakhhdlwrk")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Whether this scheduled query rule is enabled. Default is `true`.
     */
    @JvmName("layqwelwlvjvmatt")
    public suspend fun enabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabled = mapped
    }

    /**
     * @param value Frequency (in minutes) at which rule condition should be evaluated. Values must be between 5 and 1440 (inclusive).
     */
    @JvmName("sigabxsfglsuhmri")
    public suspend fun frequency(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.frequency = mapped
    }

    /**
     * @param value Specifies the Azure Region where the resource should exist. Changing this forces a new resource to be created.
     */
    @JvmName("tpwneevqxyomtdws")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value The name of the scheduled query rule. Changing this forces a new resource to be created.
     */
    @JvmName("daxclaydrjlgexxh")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Log search query.
     */
    @JvmName("uvgteavkxuxmjbpq")
    public suspend fun query(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.query = mapped
    }

    /**
     * @param value The type of query results. Possible values are `ResultCount` and `Number`. Default is `ResultCount`. If set to `ResultCount`, `query` must include an `AggregatedValue` column of a numeric type, for example, `Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)`.
     */
    @JvmName("gvplswghpocjvcss")
    public suspend fun queryType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.queryType = mapped
    }

    /**
     * @param value The name of the resource group in which to create the scheduled query rule instance. Changing this forces a new resource to be created.
     */
    @JvmName("ofihhfmhjmeimqyd")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Severity of the alert. Possible values include: 0, 1, 2, 3, or 4.
     */
    @JvmName("dneicgeigluwbdih")
    public suspend fun severity(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.severity = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("jkfbuenqlbghlwho")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("mrnnqswxjgnkxyxb")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Time (in minutes) for which Alerts should be throttled or suppressed. Values must be between 0 and 10000 (inclusive).
     */
    @JvmName("bdntgsrmjmlpdire")
    public suspend fun throttling(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.throttling = mapped
    }

    /**
     * @param value Time window for which data needs to be fetched for query (must be greater than or equal to `frequency`). Values must be between 5 and 2880 (inclusive).
     */
    @JvmName("fyocheyyftqwlwuu")
    public suspend fun timeWindow(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.timeWindow = mapped
    }

    /**
     * @param value A `trigger` block as defined below.
     */
    @JvmName("wrswjjbheelhyyfd")
    public suspend fun trigger(`value`: ScheduledQueryRulesAlertTriggerArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.trigger = mapped
    }

    /**
     * @param argument A `trigger` block as defined below.
     */
    @JvmName("kufeletobmpqxngc")
    public suspend
    fun trigger(argument: suspend ScheduledQueryRulesAlertTriggerArgsBuilder.() -> Unit) {
        val toBeMapped = ScheduledQueryRulesAlertTriggerArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.trigger = mapped
    }

    internal fun build(): ScheduledQueryRulesAlertArgs = ScheduledQueryRulesAlertArgs(
        action = action,
        authorizedResourceIds = authorizedResourceIds,
        autoMitigationEnabled = autoMitigationEnabled,
        dataSourceId = dataSourceId,
        description = description,
        enabled = enabled,
        frequency = frequency,
        location = location,
        name = name,
        query = query,
        queryType = queryType,
        resourceGroupName = resourceGroupName,
        severity = severity,
        tags = tags,
        throttling = throttling,
        timeWindow = timeWindow,
        trigger = trigger,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy