Smart Detector Alert Rule Args
data class SmartDetectorAlertRuleArgs(val actionGroups: Output<ActionGroupsInformationArgs>? = null, val alertRuleName: Output<String>? = null, val description: Output<String>? = null, val detector: Output<DetectorArgs>? = null, val frequency: Output<String>? = null, val location: Output<String>? = null, val resourceGroupName: Output<String>? = null, val scope: Output<List<String>>? = null, val severity: Output<Either<String, Severity>>? = null, val state: Output<Either<String, AlertRuleState>>? = null, val tags: Output<Map<String, String>>? = null, val throttling: Output<ThrottlingInformationArgs>? = null) : ConvertibleToJava<SmartDetectorAlertRuleArgs>
The alert rule information Uses Azure REST API version 2021-04-01. In version 1.x of the Azure Native provider, it used API version 2019-06-01.
Example Usage
Create or update a Smart Detector alert rule
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var smartDetectorAlertRule = new AzureNative.AlertsManagement.SmartDetectorAlertRule("smartDetectorAlertRule", new()
{
ActionGroups = new AzureNative.AlertsManagement.Inputs.ActionGroupsInformationArgs
{
CustomEmailSubject = "My custom email subject",
CustomWebhookPayload = "{\"AlertRuleName\":\"#alertrulename\"}",
GroupIds = new[]
{
"/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup",
},
},
AlertRuleName = "MyAlertRule",
Description = "Sample smart detector alert rule description",
Detector = new AzureNative.AlertsManagement.Inputs.DetectorArgs
{
Id = "VMMemoryLeak",
},
Frequency = "PT5M",
ResourceGroupName = "MyAlertRules",
Scope = new[]
{
"/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1",
},
Severity = AzureNative.AlertsManagement.Severity.Sev3,
State = AzureNative.AlertsManagement.AlertRuleState.Enabled,
Throttling = new AzureNative.AlertsManagement.Inputs.ThrottlingInformationArgs
{
Duration = "PT20M",
},
});
});
Content copied to clipboard
package main
import (
alertsmanagement "github.com/pulumi/pulumi-azure-native-sdk/alertsmanagement/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := alertsmanagement.NewSmartDetectorAlertRule(ctx, "smartDetectorAlertRule", &alertsmanagement.SmartDetectorAlertRuleArgs{
ActionGroups: &alertsmanagement.ActionGroupsInformationArgs{
CustomEmailSubject: pulumi.String("My custom email subject"),
CustomWebhookPayload: pulumi.String("{\"AlertRuleName\":\"#alertrulename\"}"),
GroupIds: pulumi.StringArray{
pulumi.String("/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup"),
},
},
AlertRuleName: pulumi.String("MyAlertRule"),
Description: pulumi.String("Sample smart detector alert rule description"),
Detector: &alertsmanagement.DetectorArgs{
Id: pulumi.String("VMMemoryLeak"),
},
Frequency: pulumi.String("PT5M"),
ResourceGroupName: pulumi.String("MyAlertRules"),
Scope: pulumi.StringArray{
pulumi.String("/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1"),
},
Severity: pulumi.String(alertsmanagement.SeveritySev3),
State: pulumi.String(alertsmanagement.AlertRuleStateEnabled),
Throttling: &alertsmanagement.ThrottlingInformationArgs{
Duration: pulumi.String("PT20M"),
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.alertsmanagement.SmartDetectorAlertRule;
import com.pulumi.azurenative.alertsmanagement.SmartDetectorAlertRuleArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.ActionGroupsInformationArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.DetectorArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.ThrottlingInformationArgs;
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 smartDetectorAlertRule = new SmartDetectorAlertRule("smartDetectorAlertRule", SmartDetectorAlertRuleArgs.builder()
.actionGroups(ActionGroupsInformationArgs.builder()
.customEmailSubject("My custom email subject")
.customWebhookPayload("{\"AlertRuleName\":\"#alertrulename\"}")
.groupIds("/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup")
.build())
.alertRuleName("MyAlertRule")
.description("Sample smart detector alert rule description")
.detector(DetectorArgs.builder()
.id("VMMemoryLeak")
.build())
.frequency("PT5M")
.resourceGroupName("MyAlertRules")
.scope("/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1")
.severity("Sev3")
.state("Enabled")
.throttling(ThrottlingInformationArgs.builder()
.duration("PT20M")
.build())
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:alertsmanagement:SmartDetectorAlertRule MyAlertRule /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.alertsManagement/smartDetectorAlertRules/{alertRuleName}
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(actionGroups: Output<ActionGroupsInformationArgs>? = null, alertRuleName: Output<String>? = null, description: Output<String>? = null, detector: Output<DetectorArgs>? = null, frequency: Output<String>? = null, location: Output<String>? = null, resourceGroupName: Output<String>? = null, scope: Output<List<String>>? = null, severity: Output<Either<String, Severity>>? = null, state: Output<Either<String, AlertRuleState>>? = null, tags: Output<Map<String, String>>? = null, throttling: Output<ThrottlingInformationArgs>? = null)
Properties
Link copied to clipboard
The alert rule actions.
Link copied to clipboard
The name of the alert rule.
Link copied to clipboard
The alert rule description.
Link copied to clipboard
The alert rule's detector.
Link copied to clipboard
The name of the resource group.
Link copied to clipboard
The alert rule state.
Link copied to clipboard
The alert rule throttling information.