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

com.pulumi.azurenative.insights.kotlin.AlertRuleArgs.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: 2.82.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azurenative.insights.kotlin

import com.pulumi.azurenative.insights.AlertRuleArgs.builder
import com.pulumi.azurenative.insights.kotlin.inputs.RuleEmailActionArgs
import com.pulumi.azurenative.insights.kotlin.inputs.RuleWebhookActionArgs
import com.pulumi.core.Either
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Any
import kotlin.Boolean
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * The alert rule resource.
 * Azure REST API version: 2016-03-01. Prior API version in Azure Native 1.x: 2016-03-01.
 * ## Example Usage
 * ### Create or update an alert rule
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertRule = new AzureNative.Insights.AlertRule("alertRule", new()
 *     {
 *         Actions = new[] {},
 *         Condition = new AzureNative.Insights.Inputs.ThresholdRuleConditionArgs
 *         {
 *             DataSource = new AzureNative.Insights.Inputs.RuleMetricDataSourceArgs
 *             {
 *                 MetricName = "Requests",
 *                 OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
 *                 ResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest",
 *             },
 *             OdataType = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
 *             Operator = AzureNative.Insights.ConditionOperator.GreaterThan,
 *             Threshold = 3,
 *             TimeAggregation = AzureNative.Insights.TimeAggregationOperator.Total,
 *             WindowSize = "PT5M",
 *         },
 *         Description = "Pura Vida",
 *         IsEnabled = true,
 *         Location = "West US",
 *         Name = "chiricutin",
 *         ResourceGroupName = "Rac46PostSwapRG",
 *         RuleName = "chiricutin",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	insights "github.com/pulumi/pulumi-azure-native-sdk/insights/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := insights.NewAlertRule(ctx, "alertRule", &insights.AlertRuleArgs{
 * 			Actions: pulumi.Array{},
 * 			Condition: &insights.ThresholdRuleConditionArgs{
 * 				DataSource: insights.RuleMetricDataSource{
 * 					MetricName:  "Requests",
 * 					OdataType:   "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
 * 					ResourceUri: "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest",
 * 				},
 * 				OdataType:       pulumi.String("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"),
 * 				Operator:        insights.ConditionOperatorGreaterThan,
 * 				Threshold:       pulumi.Float64(3),
 * 				TimeAggregation: insights.TimeAggregationOperatorTotal,
 * 				WindowSize:      pulumi.String("PT5M"),
 * 			},
 * 			Description:       pulumi.String("Pura Vida"),
 * 			IsEnabled:         pulumi.Bool(true),
 * 			Location:          pulumi.String("West US"),
 * 			Name:              pulumi.String("chiricutin"),
 * 			ResourceGroupName: pulumi.String("Rac46PostSwapRG"),
 * 			RuleName:          pulumi.String("chiricutin"),
 * 			Tags:              nil,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.insights.AlertRule;
 * import com.pulumi.azurenative.insights.AlertRuleArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var alertRule = new AlertRule("alertRule", AlertRuleArgs.builder()
 *             .actions()
 *             .condition(LocationThresholdRuleConditionArgs.builder()
 *                 .dataSource(RuleManagementEventDataSourceArgs.builder()
 *                     .metricName("Requests")
 *                     .odataType("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource")
 *                     .resourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest")
 *                     .build())
 *                 .odataType("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition")
 *                 .operator("GreaterThan")
 *                 .threshold(3)
 *                 .timeAggregation("Total")
 *                 .windowSize("PT5M")
 *                 .build())
 *             .description("Pura Vida")
 *             .isEnabled(true)
 *             .location("West US")
 *             .name("chiricutin")
 *             .resourceGroupName("Rac46PostSwapRG")
 *             .ruleName("chiricutin")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:insights:AlertRule chiricutin /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}
 * ```
 * @property action action that is performed when the alert rule becomes active, and when an alert condition is resolved.
 * @property actions the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
 * @property condition the condition that results in the alert rule being activated.
 * @property description the description of the alert rule that will be included in the alert email.
 * @property isEnabled the flag that indicates whether the alert rule is enabled.
 * @property location Resource location
 * @property name the name of the alert rule.
 * @property provisioningState the provisioning state.
 * @property resourceGroupName The name of the resource group. The name is case insensitive.
 * @property ruleName The name of the rule.
 * @property tags Resource tags
 */
public data class AlertRuleArgs(
    public val action: Output>? = null,
    public val actions: Output>>? = null,
    public val condition: Output? = null,
    public val description: Output? = null,
    public val isEnabled: Output? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val provisioningState: Output? = null,
    public val resourceGroupName: Output? = null,
    public val ruleName: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.insights.AlertRuleArgs =
        com.pulumi.azurenative.insights.AlertRuleArgs.builder()
            .action(
                action?.applyValue({ args0 ->
                    args0.transform({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    }, { args0 -> args0.let({ args0 -> args0.toJava() }) })
                }),
            )
            .actions(
                actions?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.transform({ args0 ->
                            args0.let({ args0 -> args0.toJava() })
                        }, { args0 -> args0.let({ args0 -> args0.toJava() }) })
                    })
                }),
            )
            .condition(condition?.applyValue({ args0 -> args0 }))
            .description(description?.applyValue({ args0 -> args0 }))
            .isEnabled(isEnabled?.applyValue({ args0 -> args0 }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .provisioningState(provisioningState?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .ruleName(ruleName?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

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

    private var actions: Output>>? = null

    private var condition: Output? = null

    private var description: Output? = null

    private var isEnabled: Output? = null

    private var location: Output? = null

    private var name: Output? = null

    private var provisioningState: Output? = null

    private var resourceGroupName: Output? = null

    private var ruleName: Output? = null

    private var tags: Output>? = null

    /**
     * @param value action that is performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("pglrpaxyoiuhwajx")
    public suspend fun action(`value`: Output>) {
        this.action = value
    }

    /**
     * @param value the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("arvqavcrgeiwyfui")
    public suspend fun actions(`value`: Output>>) {
        this.actions = value
    }

    @JvmName("ivfwwlxgpuvbrnik")
    public suspend fun actions(vararg values: Output>) {
        this.actions = Output.all(values.asList())
    }

    /**
     * @param values the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("xqukofgipjugyysr")
    public suspend fun actions(values: List>>) {
        this.actions = Output.all(values)
    }

    /**
     * @param value the condition that results in the alert rule being activated.
     */
    @JvmName("urmgwvclesdtkuhq")
    public suspend fun condition(`value`: Output) {
        this.condition = value
    }

    /**
     * @param value the description of the alert rule that will be included in the alert email.
     */
    @JvmName("hibilqannrpngseo")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value the flag that indicates whether the alert rule is enabled.
     */
    @JvmName("jqodjjfnxqrglxxy")
    public suspend fun isEnabled(`value`: Output) {
        this.isEnabled = value
    }

    /**
     * @param value Resource location
     */
    @JvmName("nhbqkxkxpclmyfmd")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value the name of the alert rule.
     */
    @JvmName("fhiuekaglqmrqryq")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value the provisioning state.
     */
    @JvmName("uuspmtekeontjpww")
    public suspend fun provisioningState(`value`: Output) {
        this.provisioningState = value
    }

    /**
     * @param value The name of the resource group. The name is case insensitive.
     */
    @JvmName("maebuvnavftlgmwx")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value The name of the rule.
     */
    @JvmName("xmmacdrbqbrlgypw")
    public suspend fun ruleName(`value`: Output) {
        this.ruleName = value
    }

    /**
     * @param value Resource tags
     */
    @JvmName("oucugpkncqilvtyv")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value action that is performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("jwgekvwvblsqdfyn")
    public suspend fun action(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value action that is performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("vyrbykyhegsmynyt")
    public fun action(`value`: RuleEmailActionArgs) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value action that is performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("wduxkqrvwtuqmgbc")
    public fun action(`value`: RuleWebhookActionArgs) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.action = mapped
    }

    /**
     * @param value the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("ljgmmxayokxregst")
    public suspend fun actions(`value`: List>?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.actions = mapped
    }

    /**
     * @param values the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
     */
    @JvmName("pugrpbhhnrfkmmmv")
    public suspend fun actions(vararg values: Either) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.actions = mapped
    }

    /**
     * @param value the condition that results in the alert rule being activated.
     */
    @JvmName("lycrsrpvqjbcmbmr")
    public suspend fun condition(`value`: Any?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.condition = mapped
    }

    /**
     * @param value the description of the alert rule that will be included in the alert email.
     */
    @JvmName("djlnvqlkmeboekoe")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value the flag that indicates whether the alert rule is enabled.
     */
    @JvmName("tjtxvrmgjyqwggws")
    public suspend fun isEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.isEnabled = mapped
    }

    /**
     * @param value Resource location
     */
    @JvmName("eugfpslqdijlcxdi")
    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 alert rule.
     */
    @JvmName("cxjpkpfslvnprjcy")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value the provisioning state.
     */
    @JvmName("yoyfbuljfvxbbckj")
    public suspend fun provisioningState(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.provisioningState = mapped
    }

    /**
     * @param value The name of the resource group. The name is case insensitive.
     */
    @JvmName("ekonkqmlicoohjic")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

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

    /**
     * @param value Resource tags
     */
    @JvmName("esprtbdufxpsgrdw")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values Resource tags
     */
    @JvmName("qyokefhwsgudrfhj")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): AlertRuleArgs = AlertRuleArgs(
        action = action,
        actions = actions,
        condition = condition,
        description = description,
        isEnabled = isEnabled,
        location = location,
        name = name,
        provisioningState = provisioningState,
        resourceGroupName = resourceGroupName,
        ruleName = ruleName,
        tags = tags,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy