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

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

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.monitoring.kotlin

import com.pulumi.azure.monitoring.MetricAlertArgs.builder
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertActionArgs
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertActionArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertCriteriaArgs
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertCriteriaArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertDynamicCriteriaArgs
import com.pulumi.azure.monitoring.kotlin.inputs.MetricAlertDynamicCriteriaArgsBuilder
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 a Metric Alert within Azure Monitor.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const toMonitor = new azure.storage.Account("to_monitor", {
 *     name: "examplestorageaccount",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const main = new azure.monitoring.ActionGroup("main", {
 *     name: "example-actiongroup",
 *     resourceGroupName: example.name,
 *     shortName: "exampleact",
 *     webhookReceivers: [{
 *         name: "callmyapi",
 *         serviceUri: "http://example.com/alert",
 *     }],
 * });
 * const exampleMetricAlert = new azure.monitoring.MetricAlert("example", {
 *     name: "example-metricalert",
 *     resourceGroupName: example.name,
 *     scopes: [toMonitor.id],
 *     description: "Action will be triggered when Transactions count is greater than 50.",
 *     criterias: [{
 *         metricNamespace: "Microsoft.Storage/storageAccounts",
 *         metricName: "Transactions",
 *         aggregation: "Total",
 *         operator: "GreaterThan",
 *         threshold: 50,
 *         dimensions: [{
 *             name: "ApiName",
 *             operator: "Include",
 *             values: ["*"],
 *         }],
 *     }],
 *     actions: [{
 *         actionGroupId: main.id,
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * to_monitor = azure.storage.Account("to_monitor",
 *     name="examplestorageaccount",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS")
 * main = azure.monitoring.ActionGroup("main",
 *     name="example-actiongroup",
 *     resource_group_name=example.name,
 *     short_name="exampleact",
 *     webhook_receivers=[azure.monitoring.ActionGroupWebhookReceiverArgs(
 *         name="callmyapi",
 *         service_uri="http://example.com/alert",
 *     )])
 * example_metric_alert = azure.monitoring.MetricAlert("example",
 *     name="example-metricalert",
 *     resource_group_name=example.name,
 *     scopes=[to_monitor.id],
 *     description="Action will be triggered when Transactions count is greater than 50.",
 *     criterias=[azure.monitoring.MetricAlertCriteriaArgs(
 *         metric_namespace="Microsoft.Storage/storageAccounts",
 *         metric_name="Transactions",
 *         aggregation="Total",
 *         operator="GreaterThan",
 *         threshold=50,
 *         dimensions=[azure.monitoring.MetricAlertCriteriaDimensionArgs(
 *             name="ApiName",
 *             operator="Include",
 *             values=["*"],
 *         )],
 *     )],
 *     actions=[azure.monitoring.MetricAlertActionArgs(
 *         action_group_id=main.id,
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var toMonitor = new Azure.Storage.Account("to_monitor", new()
 *     {
 *         Name = "examplestorageaccount",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *     });
 *     var main = new Azure.Monitoring.ActionGroup("main", new()
 *     {
 *         Name = "example-actiongroup",
 *         ResourceGroupName = example.Name,
 *         ShortName = "exampleact",
 *         WebhookReceivers = new[]
 *         {
 *             new Azure.Monitoring.Inputs.ActionGroupWebhookReceiverArgs
 *             {
 *                 Name = "callmyapi",
 *                 ServiceUri = "http://example.com/alert",
 *             },
 *         },
 *     });
 *     var exampleMetricAlert = new Azure.Monitoring.MetricAlert("example", new()
 *     {
 *         Name = "example-metricalert",
 *         ResourceGroupName = example.Name,
 *         Scopes = new[]
 *         {
 *             toMonitor.Id,
 *         },
 *         Description = "Action will be triggered when Transactions count is greater than 50.",
 *         Criterias = new[]
 *         {
 *             new Azure.Monitoring.Inputs.MetricAlertCriteriaArgs
 *             {
 *                 MetricNamespace = "Microsoft.Storage/storageAccounts",
 *                 MetricName = "Transactions",
 *                 Aggregation = "Total",
 *                 Operator = "GreaterThan",
 *                 Threshold = 50,
 *                 Dimensions = new[]
 *                 {
 *                     new Azure.Monitoring.Inputs.MetricAlertCriteriaDimensionArgs
 *                     {
 *                         Name = "ApiName",
 *                         Operator = "Include",
 *                         Values = new[]
 *                         {
 *                             "*",
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *         Actions = new[]
 *         {
 *             new Azure.Monitoring.Inputs.MetricAlertActionArgs
 *             {
 *                 ActionGroupId = main.Id,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/monitoring"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		toMonitor, err := storage.NewAccount(ctx, "to_monitor", &storage.AccountArgs{
 * 			Name:                   pulumi.String("examplestorageaccount"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		main, err := monitoring.NewActionGroup(ctx, "main", &monitoring.ActionGroupArgs{
 * 			Name:              pulumi.String("example-actiongroup"),
 * 			ResourceGroupName: example.Name,
 * 			ShortName:         pulumi.String("exampleact"),
 * 			WebhookReceivers: monitoring.ActionGroupWebhookReceiverArray{
 * 				&monitoring.ActionGroupWebhookReceiverArgs{
 * 					Name:       pulumi.String("callmyapi"),
 * 					ServiceUri: pulumi.String("http://example.com/alert"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = monitoring.NewMetricAlert(ctx, "example", &monitoring.MetricAlertArgs{
 * 			Name:              pulumi.String("example-metricalert"),
 * 			ResourceGroupName: example.Name,
 * 			Scopes: pulumi.StringArray{
 * 				toMonitor.ID(),
 * 			},
 * 			Description: pulumi.String("Action will be triggered when Transactions count is greater than 50."),
 * 			Criterias: monitoring.MetricAlertCriteriaArray{
 * 				&monitoring.MetricAlertCriteriaArgs{
 * 					MetricNamespace: pulumi.String("Microsoft.Storage/storageAccounts"),
 * 					MetricName:      pulumi.String("Transactions"),
 * 					Aggregation:     pulumi.String("Total"),
 * 					Operator:        pulumi.String("GreaterThan"),
 * 					Threshold:       pulumi.Float64(50),
 * 					Dimensions: monitoring.MetricAlertCriteriaDimensionArray{
 * 						&monitoring.MetricAlertCriteriaDimensionArgs{
 * 							Name:     pulumi.String("ApiName"),
 * 							Operator: pulumi.String("Include"),
 * 							Values: pulumi.StringArray{
 * 								pulumi.String("*"),
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 			Actions: monitoring.MetricAlertActionArray{
 * 				&monitoring.MetricAlertActionArgs{
 * 					ActionGroupId: main.ID(),
 * 				},
 * 			},
 * 		})
 * 		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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.monitoring.ActionGroup;
 * import com.pulumi.azure.monitoring.ActionGroupArgs;
 * import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
 * import com.pulumi.azure.monitoring.MetricAlert;
 * import com.pulumi.azure.monitoring.MetricAlertArgs;
 * import com.pulumi.azure.monitoring.inputs.MetricAlertCriteriaArgs;
 * import com.pulumi.azure.monitoring.inputs.MetricAlertActionArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-resources")
 *             .location("West Europe")
 *             .build());
 *         var toMonitor = new Account("toMonitor", AccountArgs.builder()
 *             .name("examplestorageaccount")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .build());
 *         var main = new ActionGroup("main", ActionGroupArgs.builder()
 *             .name("example-actiongroup")
 *             .resourceGroupName(example.name())
 *             .shortName("exampleact")
 *             .webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
 *                 .name("callmyapi")
 *                 .serviceUri("http://example.com/alert")
 *                 .build())
 *             .build());
 *         var exampleMetricAlert = new MetricAlert("exampleMetricAlert", MetricAlertArgs.builder()
 *             .name("example-metricalert")
 *             .resourceGroupName(example.name())
 *             .scopes(toMonitor.id())
 *             .description("Action will be triggered when Transactions count is greater than 50.")
 *             .criterias(MetricAlertCriteriaArgs.builder()
 *                 .metricNamespace("Microsoft.Storage/storageAccounts")
 *                 .metricName("Transactions")
 *                 .aggregation("Total")
 *                 .operator("GreaterThan")
 *                 .threshold(50)
 *                 .dimensions(MetricAlertCriteriaDimensionArgs.builder()
 *                     .name("ApiName")
 *                     .operator("Include")
 *                     .values("*")
 *                     .build())
 *                 .build())
 *             .actions(MetricAlertActionArgs.builder()
 *                 .actionGroupId(main.id())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   toMonitor:
 *     type: azure:storage:Account
 *     name: to_monitor
 *     properties:
 *       name: examplestorageaccount
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *   main:
 *     type: azure:monitoring:ActionGroup
 *     properties:
 *       name: example-actiongroup
 *       resourceGroupName: ${example.name}
 *       shortName: exampleact
 *       webhookReceivers:
 *         - name: callmyapi
 *           serviceUri: http://example.com/alert
 *   exampleMetricAlert:
 *     type: azure:monitoring:MetricAlert
 *     name: example
 *     properties:
 *       name: example-metricalert
 *       resourceGroupName: ${example.name}
 *       scopes:
 *         - ${toMonitor.id}
 *       description: Action will be triggered when Transactions count is greater than 50.
 *       criterias:
 *         - metricNamespace: Microsoft.Storage/storageAccounts
 *           metricName: Transactions
 *           aggregation: Total
 *           operator: GreaterThan
 *           threshold: 50
 *           dimensions:
 *             - name: ApiName
 *               operator: Include
 *               values:
 *                 - '*'
 *       actions:
 *         - actionGroupId: ${main.id}
 * ```
 * 
 * ## Import
 * Metric Alerts can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:monitoring/metricAlert:MetricAlert main /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.Insights/metricAlerts/example-metricalert
 * ```
 * @property actions One or more `action` blocks as defined below.
 * @property applicationInsightsWebTestLocationAvailabilityCriteria A `application_insights_web_test_location_availability_criteria` block as defined below.
 * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
 * @property autoMitigate Should the alerts in this Metric Alert be auto resolved? Defaults to `true`.
 * @property criterias One or more (static) `criteria` blocks as defined below.
 * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
 * @property description The description of this Metric Alert.
 * @property dynamicCriteria A `dynamic_criteria` block as defined below.
 * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
 * @property enabled Should this Metric Alert be enabled? Defaults to `true`.
 * @property frequency The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are `PT1M`, `PT5M`, `PT15M`, `PT30M` and `PT1H`. Defaults to `PT1M`.
 * @property name The name of the Metric Alert. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
 * @property scopes A set of strings of resource IDs at which the metric criteria should be applied.
 * @property severity The severity of this Metric Alert. Possible values are `0`, `1`, `2`, `3` and `4`. Defaults to `3`.
 * @property tags A mapping of tags to assign to the resource.
 * @property targetResourceLocation The location of the target resource.
 * > This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.
 * @property targetResourceType The resource type (e.g. `Microsoft.Compute/virtualMachines`) of the target resource.
 * > This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.
 * @property windowSize The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than `frequency`. Possible values are `PT1M`, `PT5M`, `PT15M`, `PT30M`, `PT1H`, `PT6H`, `PT12H` and `P1D`. Defaults to `PT5M`.
 */
public data class MetricAlertArgs(
    public val actions: Output>? = null,
    public val applicationInsightsWebTestLocationAvailabilityCriteria:
    Output? = null,
    public val autoMitigate: Output? = null,
    public val criterias: Output>? = null,
    public val description: Output? = null,
    public val dynamicCriteria: Output? = null,
    public val enabled: Output? = null,
    public val frequency: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val scopes: Output>? = null,
    public val severity: Output? = null,
    public val tags: Output>? = null,
    public val targetResourceLocation: Output? = null,
    public val targetResourceType: Output? = null,
    public val windowSize: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.monitoring.MetricAlertArgs =
        com.pulumi.azure.monitoring.MetricAlertArgs.builder()
            .actions(
                actions?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .applicationInsightsWebTestLocationAvailabilityCriteria(
                applicationInsightsWebTestLocationAvailabilityCriteria?.applyValue({ args0 ->
                    args0.let({ args0 -> args0.toJava() })
                }),
            )
            .autoMitigate(autoMitigate?.applyValue({ args0 -> args0 }))
            .criterias(
                criterias?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .description(description?.applyValue({ args0 -> args0 }))
            .dynamicCriteria(dynamicCriteria?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .enabled(enabled?.applyValue({ args0 -> args0 }))
            .frequency(frequency?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .scopes(scopes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .severity(severity?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .targetResourceLocation(targetResourceLocation?.applyValue({ args0 -> args0 }))
            .targetResourceType(targetResourceType?.applyValue({ args0 -> args0 }))
            .windowSize(windowSize?.applyValue({ args0 -> args0 })).build()
}

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

    private var applicationInsightsWebTestLocationAvailabilityCriteria:
        Output? = null

    private var autoMitigate: Output? = null

    private var criterias: Output>? = null

    private var description: Output? = null

    private var dynamicCriteria: Output? = null

    private var enabled: Output? = null

    private var frequency: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var scopes: Output>? = null

    private var severity: Output? = null

    private var tags: Output>? = null

    private var targetResourceLocation: Output? = null

    private var targetResourceType: Output? = null

    private var windowSize: Output? = null

    /**
     * @param value One or more `action` blocks as defined below.
     */
    @JvmName("sjobhcrpiycrunxb")
    public suspend fun actions(`value`: Output>) {
        this.actions = value
    }

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

    /**
     * @param values One or more `action` blocks as defined below.
     */
    @JvmName("nxtuaejrmmoalfei")
    public suspend fun actions(values: List>) {
        this.actions = Output.all(values)
    }

    /**
     * @param value A `application_insights_web_test_location_availability_criteria` block as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("kgdxwegmkrtnxyon")
    public suspend
    fun applicationInsightsWebTestLocationAvailabilityCriteria(`value`: Output) {
        this.applicationInsightsWebTestLocationAvailabilityCriteria = value
    }

    /**
     * @param value Should the alerts in this Metric Alert be auto resolved? Defaults to `true`.
     */
    @JvmName("qfhomogovhbmanal")
    public suspend fun autoMitigate(`value`: Output) {
        this.autoMitigate = value
    }

    /**
     * @param value One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("jpnbvmkjbnwcjmoi")
    public suspend fun criterias(`value`: Output>) {
        this.criterias = value
    }

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

    /**
     * @param values One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("hupvvjhboxgptbfd")
    public suspend fun criterias(values: List>) {
        this.criterias = Output.all(values)
    }

    /**
     * @param value The description of this Metric Alert.
     */
    @JvmName("cqmwrnocwwdmpbtt")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value A `dynamic_criteria` block as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("lcfniuvtjskyihua")
    public suspend fun dynamicCriteria(`value`: Output) {
        this.dynamicCriteria = value
    }

    /**
     * @param value Should this Metric Alert be enabled? Defaults to `true`.
     */
    @JvmName("vcrhjdhwtykdpxrc")
    public suspend fun enabled(`value`: Output) {
        this.enabled = value
    }

    /**
     * @param value The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are `PT1M`, `PT5M`, `PT15M`, `PT30M` and `PT1H`. Defaults to `PT1M`.
     */
    @JvmName("lfjbumumijmpeigf")
    public suspend fun frequency(`value`: Output) {
        this.frequency = value
    }

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

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

    /**
     * @param value A set of strings of resource IDs at which the metric criteria should be applied.
     */
    @JvmName("ayjaiakkyndoevsd")
    public suspend fun scopes(`value`: Output>) {
        this.scopes = value
    }

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

    /**
     * @param values A set of strings of resource IDs at which the metric criteria should be applied.
     */
    @JvmName("tusbfbxyptmxtald")
    public suspend fun scopes(values: List>) {
        this.scopes = Output.all(values)
    }

    /**
     * @param value The severity of this Metric Alert. Possible values are `0`, `1`, `2`, `3` and `4`. Defaults to `3`.
     */
    @JvmName("gvsbtfbqlqeaefqn")
    public suspend fun severity(`value`: Output) {
        this.severity = value
    }

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

    /**
     * @param value The location of the target resource.
     * > This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.
     */
    @JvmName("oqrhouflbllkpgql")
    public suspend fun targetResourceLocation(`value`: Output) {
        this.targetResourceLocation = value
    }

    /**
     * @param value The resource type (e.g. `Microsoft.Compute/virtualMachines`) of the target resource.
     * > This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.
     */
    @JvmName("hqwmsvpmxaltxest")
    public suspend fun targetResourceType(`value`: Output) {
        this.targetResourceType = value
    }

    /**
     * @param value The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than `frequency`. Possible values are `PT1M`, `PT5M`, `PT15M`, `PT30M`, `PT1H`, `PT6H`, `PT12H` and `P1D`. Defaults to `PT5M`.
     */
    @JvmName("bvsxqgprkmkrinkp")
    public suspend fun windowSize(`value`: Output) {
        this.windowSize = value
    }

    /**
     * @param value One or more `action` blocks as defined below.
     */
    @JvmName("jnjqjcqhfavbljcx")
    public suspend fun actions(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.actions = mapped
    }

    /**
     * @param argument One or more `action` blocks as defined below.
     */
    @JvmName("cvbjerodgcctjqyp")
    public suspend fun actions(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            MetricAlertActionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.actions = mapped
    }

    /**
     * @param argument One or more `action` blocks as defined below.
     */
    @JvmName("dwitamxajpjgfqha")
    public suspend fun actions(vararg argument: suspend MetricAlertActionArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            MetricAlertActionArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.actions = mapped
    }

    /**
     * @param argument One or more `action` blocks as defined below.
     */
    @JvmName("rfsgdetuxrxgakgt")
    public suspend fun actions(argument: suspend MetricAlertActionArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(MetricAlertActionArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.actions = mapped
    }

    /**
     * @param values One or more `action` blocks as defined below.
     */
    @JvmName("fingeumbjwrtwxkl")
    public suspend fun actions(vararg values: MetricAlertActionArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.actions = mapped
    }

    /**
     * @param value A `application_insights_web_test_location_availability_criteria` block as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("vkbeflakdhonukyy")
    public suspend
    fun applicationInsightsWebTestLocationAvailabilityCriteria(`value`: MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.applicationInsightsWebTestLocationAvailabilityCriteria = mapped
    }

    /**
     * @param argument A `application_insights_web_test_location_availability_criteria` block as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("vsufeytjhholwvbk")
    public suspend
    fun applicationInsightsWebTestLocationAvailabilityCriteria(argument: suspend MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgsBuilder.() -> Unit) {
        val toBeMapped =
            MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgsBuilder().applySuspend {
                argument()
            }.build()
        val mapped = of(toBeMapped)
        this.applicationInsightsWebTestLocationAvailabilityCriteria = mapped
    }

    /**
     * @param value Should the alerts in this Metric Alert be auto resolved? Defaults to `true`.
     */
    @JvmName("kuvgmvycvaoixolg")
    public suspend fun autoMitigate(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.autoMitigate = mapped
    }

    /**
     * @param value One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("rxuoplnaojqlsyjn")
    public suspend fun criterias(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.criterias = mapped
    }

    /**
     * @param argument One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("xjawlqirawtudcib")
    public suspend fun criterias(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            MetricAlertCriteriaArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.criterias = mapped
    }

    /**
     * @param argument One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("xiywhebdilbvigcr")
    public suspend fun criterias(vararg argument: suspend MetricAlertCriteriaArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            MetricAlertCriteriaArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.criterias = mapped
    }

    /**
     * @param argument One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("msimaackvaslnkvx")
    public suspend fun criterias(argument: suspend MetricAlertCriteriaArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(MetricAlertCriteriaArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.criterias = mapped
    }

    /**
     * @param values One or more (static) `criteria` blocks as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("newgcnkotkoixlad")
    public suspend fun criterias(vararg values: MetricAlertCriteriaArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.criterias = mapped
    }

    /**
     * @param value The description of this Metric Alert.
     */
    @JvmName("daiwonlamutftfcv")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value A `dynamic_criteria` block as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("ajsigxjycnrtqlvh")
    public suspend fun dynamicCriteria(`value`: MetricAlertDynamicCriteriaArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.dynamicCriteria = mapped
    }

    /**
     * @param argument A `dynamic_criteria` block as defined below.
     * > **NOTE** One of either `criteria`, `dynamic_criteria` or `application_insights_web_test_location_availability_criteria` must be specified.
     */
    @JvmName("jwrhnlxbpbenexme")
    public suspend
    fun dynamicCriteria(argument: suspend MetricAlertDynamicCriteriaArgsBuilder.() -> Unit) {
        val toBeMapped = MetricAlertDynamicCriteriaArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.dynamicCriteria = mapped
    }

    /**
     * @param value Should this Metric Alert be enabled? Defaults to `true`.
     */
    @JvmName("jhuamywgarolwepw")
    public suspend fun enabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabled = mapped
    }

    /**
     * @param value The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are `PT1M`, `PT5M`, `PT15M`, `PT30M` and `PT1H`. Defaults to `PT1M`.
     */
    @JvmName("mbmhkndhvlkkfxmf")
    public suspend fun frequency(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.frequency = mapped
    }

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

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

    /**
     * @param value A set of strings of resource IDs at which the metric criteria should be applied.
     */
    @JvmName("prqlfkxjelaupjsc")
    public suspend fun scopes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scopes = mapped
    }

    /**
     * @param values A set of strings of resource IDs at which the metric criteria should be applied.
     */
    @JvmName("qrrgmoncbrxmhxth")
    public suspend fun scopes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.scopes = mapped
    }

    /**
     * @param value The severity of this Metric Alert. Possible values are `0`, `1`, `2`, `3` and `4`. Defaults to `3`.
     */
    @JvmName("qmkkprihmstfnybs")
    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("rhauyqapnbwmeoho")
    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("sljnmcjgyefoemgq")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value The location of the target resource.
     * > This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.
     */
    @JvmName("ragibdcyfpocnjqj")
    public suspend fun targetResourceLocation(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetResourceLocation = mapped
    }

    /**
     * @param value The resource type (e.g. `Microsoft.Compute/virtualMachines`) of the target resource.
     * > This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.
     */
    @JvmName("rstakdjwjjwpgxhh")
    public suspend fun targetResourceType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.targetResourceType = mapped
    }

    /**
     * @param value The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than `frequency`. Possible values are `PT1M`, `PT5M`, `PT15M`, `PT30M`, `PT1H`, `PT6H`, `PT12H` and `P1D`. Defaults to `PT5M`.
     */
    @JvmName("biadrbejyhqmfymy")
    public suspend fun windowSize(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.windowSize = mapped
    }

    internal fun build(): MetricAlertArgs = MetricAlertArgs(
        actions = actions,
        applicationInsightsWebTestLocationAvailabilityCriteria = applicationInsightsWebTestLocationAvailabilityCriteria,
        autoMitigate = autoMitigate,
        criterias = criterias,
        description = description,
        dynamicCriteria = dynamicCriteria,
        enabled = enabled,
        frequency = frequency,
        name = name,
        resourceGroupName = resourceGroupName,
        scopes = scopes,
        severity = severity,
        tags = tags,
        targetResourceLocation = targetResourceLocation,
        targetResourceType = targetResourceType,
        windowSize = windowSize,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy