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

com.pulumi.azure.monitoring.kotlin.SmartDetectorAlertRuleArgs.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.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.monitoring.kotlin

import com.pulumi.azure.monitoring.SmartDetectorAlertRuleArgs.builder
import com.pulumi.azure.monitoring.kotlin.inputs.SmartDetectorAlertRuleActionGroupArgs
import com.pulumi.azure.monitoring.kotlin.inputs.SmartDetectorAlertRuleActionGroupArgsBuilder
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.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages an Monitor Smart Detector Alert Rule.
 * ## 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 exampleInsights = new azure.appinsights.Insights("example", {
 *     name: "example-appinsights",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     applicationType: "web",
 * });
 * const exampleActionGroup = new azure.monitoring.ActionGroup("example", {
 *     name: "example-action-group",
 *     resourceGroupName: example.name,
 *     shortName: "example",
 * });
 * const exampleSmartDetectorAlertRule = new azure.monitoring.SmartDetectorAlertRule("example", {
 *     name: "example-smart-detector-alert-rule",
 *     resourceGroupName: example.name,
 *     severity: "Sev0",
 *     scopeResourceIds: [exampleInsights.id],
 *     frequency: "PT1M",
 *     detectorType: "FailureAnomaliesDetector",
 *     actionGroup: {
 *         ids: [exampleActionGroup.id],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_insights = azure.appinsights.Insights("example",
 *     name="example-appinsights",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     application_type="web")
 * example_action_group = azure.monitoring.ActionGroup("example",
 *     name="example-action-group",
 *     resource_group_name=example.name,
 *     short_name="example")
 * example_smart_detector_alert_rule = azure.monitoring.SmartDetectorAlertRule("example",
 *     name="example-smart-detector-alert-rule",
 *     resource_group_name=example.name,
 *     severity="Sev0",
 *     scope_resource_ids=[example_insights.id],
 *     frequency="PT1M",
 *     detector_type="FailureAnomaliesDetector",
 *     action_group=azure.monitoring.SmartDetectorAlertRuleActionGroupArgs(
 *         ids=[example_action_group.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 exampleInsights = new Azure.AppInsights.Insights("example", new()
 *     {
 *         Name = "example-appinsights",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         ApplicationType = "web",
 *     });
 *     var exampleActionGroup = new Azure.Monitoring.ActionGroup("example", new()
 *     {
 *         Name = "example-action-group",
 *         ResourceGroupName = example.Name,
 *         ShortName = "example",
 *     });
 *     var exampleSmartDetectorAlertRule = new Azure.Monitoring.SmartDetectorAlertRule("example", new()
 *     {
 *         Name = "example-smart-detector-alert-rule",
 *         ResourceGroupName = example.Name,
 *         Severity = "Sev0",
 *         ScopeResourceIds = new[]
 *         {
 *             exampleInsights.Id,
 *         },
 *         Frequency = "PT1M",
 *         DetectorType = "FailureAnomaliesDetector",
 *         ActionGroup = new Azure.Monitoring.Inputs.SmartDetectorAlertRuleActionGroupArgs
 *         {
 *             Ids = new[]
 *             {
 *                 exampleActionGroup.Id,
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appinsights"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/monitoring"
 * 	"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
 * 		}
 * 		exampleInsights, err := appinsights.NewInsights(ctx, "example", &appinsights.InsightsArgs{
 * 			Name:              pulumi.String("example-appinsights"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			ApplicationType:   pulumi.String("web"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleActionGroup, err := monitoring.NewActionGroup(ctx, "example", &monitoring.ActionGroupArgs{
 * 			Name:              pulumi.String("example-action-group"),
 * 			ResourceGroupName: example.Name,
 * 			ShortName:         pulumi.String("example"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = monitoring.NewSmartDetectorAlertRule(ctx, "example", &monitoring.SmartDetectorAlertRuleArgs{
 * 			Name:              pulumi.String("example-smart-detector-alert-rule"),
 * 			ResourceGroupName: example.Name,
 * 			Severity:          pulumi.String("Sev0"),
 * 			ScopeResourceIds: pulumi.StringArray{
 * 				exampleInsights.ID(),
 * 			},
 * 			Frequency:    pulumi.String("PT1M"),
 * 			DetectorType: pulumi.String("FailureAnomaliesDetector"),
 * 			ActionGroup: &monitoring.SmartDetectorAlertRuleActionGroupArgs{
 * 				Ids: pulumi.StringArray{
 * 					exampleActionGroup.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.appinsights.Insights;
 * import com.pulumi.azure.appinsights.InsightsArgs;
 * import com.pulumi.azure.monitoring.ActionGroup;
 * import com.pulumi.azure.monitoring.ActionGroupArgs;
 * import com.pulumi.azure.monitoring.SmartDetectorAlertRule;
 * import com.pulumi.azure.monitoring.SmartDetectorAlertRuleArgs;
 * import com.pulumi.azure.monitoring.inputs.SmartDetectorAlertRuleActionGroupArgs;
 * 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 exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()
 *             .name("example-appinsights")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .applicationType("web")
 *             .build());
 *         var exampleActionGroup = new ActionGroup("exampleActionGroup", ActionGroupArgs.builder()
 *             .name("example-action-group")
 *             .resourceGroupName(example.name())
 *             .shortName("example")
 *             .build());
 *         var exampleSmartDetectorAlertRule = new SmartDetectorAlertRule("exampleSmartDetectorAlertRule", SmartDetectorAlertRuleArgs.builder()
 *             .name("example-smart-detector-alert-rule")
 *             .resourceGroupName(example.name())
 *             .severity("Sev0")
 *             .scopeResourceIds(exampleInsights.id())
 *             .frequency("PT1M")
 *             .detectorType("FailureAnomaliesDetector")
 *             .actionGroup(SmartDetectorAlertRuleActionGroupArgs.builder()
 *                 .ids(exampleActionGroup.id())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleInsights:
 *     type: azure:appinsights:Insights
 *     name: example
 *     properties:
 *       name: example-appinsights
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       applicationType: web
 *   exampleActionGroup:
 *     type: azure:monitoring:ActionGroup
 *     name: example
 *     properties:
 *       name: example-action-group
 *       resourceGroupName: ${example.name}
 *       shortName: example
 *   exampleSmartDetectorAlertRule:
 *     type: azure:monitoring:SmartDetectorAlertRule
 *     name: example
 *     properties:
 *       name: example-smart-detector-alert-rule
 *       resourceGroupName: ${example.name}
 *       severity: Sev0
 *       scopeResourceIds:
 *         - ${exampleInsights.id}
 *       frequency: PT1M
 *       detectorType: FailureAnomaliesDetector
 *       actionGroup:
 *         ids:
 *           - ${exampleActionGroup.id}
 * ```
 * 
 * ## Import
 * Monitor Smart Detector Alert Rule can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:monitoring/smartDetectorAlertRule:SmartDetectorAlertRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AlertsManagement/smartDetectorAlertRules/rule1
 * ```
 * @property actionGroup An `action_group` block as defined below.
 * @property description Specifies a description for the Smart Detector Alert Rule.
 * @property detectorType Specifies the Built-In Smart Detector type that this alert rule will use. Currently the only possible values are `FailureAnomaliesDetector`, `RequestPerformanceDegradationDetector`, `DependencyPerformanceDegradationDetector`, `ExceptionVolumeChangedDetector`, `TraceSeverityDetector`, `MemoryLeakDetector`.
 * @property enabled Is the Smart Detector Alert Rule enabled? Defaults to `true`.
 * @property frequency Specifies the frequency of this Smart Detector Alert Rule in ISO8601 format.
 * @property name Specifies the name of the Monitor Smart Detector Alert Rule. Changing this forces a new resource to be created.
 * @property resourceGroupName Specifies the name of the resource group in which the Monitor Smart Detector Alert Rule should exist. Changing this forces a new resource to be created.
 * @property scopeResourceIds Specifies the scopes of this Smart Detector Alert Rule.
 * @property severity Specifies the severity of this Smart Detector Alert Rule. Possible values are `Sev0`, `Sev1`, `Sev2`, `Sev3` or `Sev4`.
 * @property tags A mapping of tags to assign to the resource.
 * @property throttlingDuration Specifies the duration (in ISO8601 format) to wait before notifying on the alert rule again.
 */
public data class SmartDetectorAlertRuleArgs(
    public val actionGroup: Output? = null,
    public val description: Output? = null,
    public val detectorType: Output? = null,
    public val enabled: Output? = null,
    public val frequency: Output? = null,
    public val name: Output? = null,
    public val resourceGroupName: Output? = null,
    public val scopeResourceIds: Output>? = null,
    public val severity: Output? = null,
    public val tags: Output>? = null,
    public val throttlingDuration: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.monitoring.SmartDetectorAlertRuleArgs =
        com.pulumi.azure.monitoring.SmartDetectorAlertRuleArgs.builder()
            .actionGroup(actionGroup?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .description(description?.applyValue({ args0 -> args0 }))
            .detectorType(detectorType?.applyValue({ args0 -> args0 }))
            .enabled(enabled?.applyValue({ args0 -> args0 }))
            .frequency(frequency?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .scopeResourceIds(scopeResourceIds?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .severity(severity?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .throttlingDuration(throttlingDuration?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SmartDetectorAlertRuleArgs].
 */
@PulumiTagMarker
public class SmartDetectorAlertRuleArgsBuilder internal constructor() {
    private var actionGroup: Output? = null

    private var description: Output? = null

    private var detectorType: Output? = null

    private var enabled: Output? = null

    private var frequency: Output? = null

    private var name: Output? = null

    private var resourceGroupName: Output? = null

    private var scopeResourceIds: Output>? = null

    private var severity: Output? = null

    private var tags: Output>? = null

    private var throttlingDuration: Output? = null

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

    /**
     * @param value Specifies a description for the Smart Detector Alert Rule.
     */
    @JvmName("peedijuqyrdelxdu")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Specifies the Built-In Smart Detector type that this alert rule will use. Currently the only possible values are `FailureAnomaliesDetector`, `RequestPerformanceDegradationDetector`, `DependencyPerformanceDegradationDetector`, `ExceptionVolumeChangedDetector`, `TraceSeverityDetector`, `MemoryLeakDetector`.
     */
    @JvmName("ieafxpkegwhuuvwf")
    public suspend fun detectorType(`value`: Output) {
        this.detectorType = value
    }

    /**
     * @param value Is the Smart Detector Alert Rule enabled? Defaults to `true`.
     */
    @JvmName("qryiobgnnomnghdm")
    public suspend fun enabled(`value`: Output) {
        this.enabled = value
    }

    /**
     * @param value Specifies the frequency of this Smart Detector Alert Rule in ISO8601 format.
     */
    @JvmName("mddcfrhgqwxtudfw")
    public suspend fun frequency(`value`: Output) {
        this.frequency = value
    }

    /**
     * @param value Specifies the name of the Monitor Smart Detector Alert Rule. Changing this forces a new resource to be created.
     */
    @JvmName("hagjnpxthdlchhun")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Specifies the name of the resource group in which the Monitor Smart Detector Alert Rule should exist. Changing this forces a new resource to be created.
     */
    @JvmName("najndqoabnilkjfg")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Specifies the scopes of this Smart Detector Alert Rule.
     */
    @JvmName("kvprlnbblusiwwvy")
    public suspend fun scopeResourceIds(`value`: Output>) {
        this.scopeResourceIds = value
    }

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

    /**
     * @param values Specifies the scopes of this Smart Detector Alert Rule.
     */
    @JvmName("mpfhuofaiouohrel")
    public suspend fun scopeResourceIds(values: List>) {
        this.scopeResourceIds = Output.all(values)
    }

    /**
     * @param value Specifies the severity of this Smart Detector Alert Rule. Possible values are `Sev0`, `Sev1`, `Sev2`, `Sev3` or `Sev4`.
     */
    @JvmName("irqqnrqnjhqyiseo")
    public suspend fun severity(`value`: Output) {
        this.severity = value
    }

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

    /**
     * @param value Specifies the duration (in ISO8601 format) to wait before notifying on the alert rule again.
     */
    @JvmName("ceyjnywpjkyixvex")
    public suspend fun throttlingDuration(`value`: Output) {
        this.throttlingDuration = value
    }

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

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

    /**
     * @param value Specifies a description for the Smart Detector Alert Rule.
     */
    @JvmName("noyyyeslpnkmpshv")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Specifies the Built-In Smart Detector type that this alert rule will use. Currently the only possible values are `FailureAnomaliesDetector`, `RequestPerformanceDegradationDetector`, `DependencyPerformanceDegradationDetector`, `ExceptionVolumeChangedDetector`, `TraceSeverityDetector`, `MemoryLeakDetector`.
     */
    @JvmName("nwllyibcqdmqhatv")
    public suspend fun detectorType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.detectorType = mapped
    }

    /**
     * @param value Is the Smart Detector Alert Rule enabled? Defaults to `true`.
     */
    @JvmName("uswlyqlodcvqqmbg")
    public suspend fun enabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.enabled = mapped
    }

    /**
     * @param value Specifies the frequency of this Smart Detector Alert Rule in ISO8601 format.
     */
    @JvmName("xlrsacqxwveiggfl")
    public suspend fun frequency(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.frequency = mapped
    }

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

    /**
     * @param value Specifies the name of the resource group in which the Monitor Smart Detector Alert Rule should exist. Changing this forces a new resource to be created.
     */
    @JvmName("hqpcmuenporwyusf")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Specifies the scopes of this Smart Detector Alert Rule.
     */
    @JvmName("utustviunaablpwv")
    public suspend fun scopeResourceIds(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scopeResourceIds = mapped
    }

    /**
     * @param values Specifies the scopes of this Smart Detector Alert Rule.
     */
    @JvmName("ainnmwdmsxrmjvql")
    public suspend fun scopeResourceIds(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.scopeResourceIds = mapped
    }

    /**
     * @param value Specifies the severity of this Smart Detector Alert Rule. Possible values are `Sev0`, `Sev1`, `Sev2`, `Sev3` or `Sev4`.
     */
    @JvmName("pamsywskrpwummko")
    public suspend fun severity(`value`: String?) {
        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("bhtjvtldhwnvrdya")
    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("qjccotvjxovctveq")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Specifies the duration (in ISO8601 format) to wait before notifying on the alert rule again.
     */
    @JvmName("kqtjjwfluduwojfx")
    public suspend fun throttlingDuration(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.throttlingDuration = mapped
    }

    internal fun build(): SmartDetectorAlertRuleArgs = SmartDetectorAlertRuleArgs(
        actionGroup = actionGroup,
        description = description,
        detectorType = detectorType,
        enabled = enabled,
        frequency = frequency,
        name = name,
        resourceGroupName = resourceGroupName,
        scopeResourceIds = scopeResourceIds,
        severity = severity,
        tags = tags,
        throttlingDuration = throttlingDuration,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy