AlertRuleArgs

data class AlertRuleArgs(val action: Output<Either<RuleEmailActionArgs, RuleWebhookActionArgs>>? = null, val actions: Output<List<Either<RuleEmailActionArgs, RuleWebhookActionArgs>>>? = null, val condition: Output<Any>? = null, val description: Output<String>? = null, val isEnabled: Output<Boolean>? = null, val location: Output<String>? = null, val name: Output<String>? = null, val provisioningState: Output<String>? = null, val resourceGroupName: Output<String>? = null, val ruleName: Output<String>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<AlertRuleArgs>

The alert rule resource. API Version: 2016-03-01.

Example Usage

Create or update an alert rule

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,
});
});
package main
import (
insights "github.com/pulumi/pulumi-azure-native-sdk/insights"
"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.AnyArray{},
Condition: insights.ThresholdRuleCondition{
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: "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
Operator: insights.ConditionOperatorGreaterThan,
Threshold: 3,
TimeAggregation: insights.TimeAggregationOperatorTotal,
WindowSize: "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
})
}
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(Map.ofEntries(
Map.entry("dataSource", Map.ofEntries(
Map.entry("metricName", "Requests"),
Map.entry("odataType", "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"),
Map.entry("resourceUri", "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest")
)),
Map.entry("odataType", "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 3),
Map.entry("timeAggregation", "Total"),
Map.entry("windowSize", "PT5M")
))
.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.

$ pulumi import azure-native:insights:AlertRule chiricutin /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin

Constructors

Link copied to clipboard
constructor(action: Output<Either<RuleEmailActionArgs, RuleWebhookActionArgs>>? = null, actions: Output<List<Either<RuleEmailActionArgs, RuleWebhookActionArgs>>>? = null, condition: Output<Any>? = null, description: Output<String>? = null, isEnabled: Output<Boolean>? = null, location: Output<String>? = null, name: Output<String>? = null, provisioningState: Output<String>? = null, resourceGroupName: Output<String>? = null, ruleName: Output<String>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val action: Output<Either<RuleEmailActionArgs, RuleWebhookActionArgs>>? = null

action that is performed when the alert rule becomes active, and when an alert condition is resolved.

Link copied to clipboard
val actions: Output<List<Either<RuleEmailActionArgs, RuleWebhookActionArgs>>>? = null

the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

Link copied to clipboard
val condition: Output<Any>? = null

the condition that results in the alert rule being activated.

Link copied to clipboard
val description: Output<String>? = null

the description of the alert rule that will be included in the alert email.

Link copied to clipboard
val isEnabled: Output<Boolean>? = null

the flag that indicates whether the alert rule is enabled.

Link copied to clipboard
val location: Output<String>? = null

Resource location

Link copied to clipboard
val name: Output<String>? = null

the name of the alert rule.

Link copied to clipboard
val provisioningState: Output<String>? = null

the provisioning state.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group. The name is case insensitive.

Link copied to clipboard
val ruleName: Output<String>? = null

The name of the rule.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Resource tags

Functions

Link copied to clipboard
open override fun toJava(): AlertRuleArgs