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

com.pulumi.azurenative.alertsmanagement.kotlin.AlertProcessingRuleByName.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.alertsmanagement.kotlin

import com.pulumi.azurenative.alertsmanagement.kotlin.outputs.AlertProcessingRulePropertiesResponse
import com.pulumi.azurenative.alertsmanagement.kotlin.outputs.SystemDataResponse
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import com.pulumi.azurenative.alertsmanagement.kotlin.outputs.AlertProcessingRulePropertiesResponse.Companion.toKotlin as alertProcessingRulePropertiesResponseToKotlin
import com.pulumi.azurenative.alertsmanagement.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

/**
 * Builder for [AlertProcessingRuleByName].
 */
@PulumiTagMarker
public class AlertProcessingRuleByNameResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: AlertProcessingRuleByNameArgs = AlertProcessingRuleByNameArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend AlertProcessingRuleByNameArgsBuilder.() -> Unit) {
        val builder = AlertProcessingRuleByNameArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): AlertProcessingRuleByName {
        val builtJavaResource =
            com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return AlertProcessingRuleByName(builtJavaResource)
    }
}

/**
 * Alert processing rule object containing target scopes, conditions and scheduling logic.
 * Azure REST API version: 2021-08-08.
 * Other available API versions: 2023-05-01-preview, 2024-03-01-preview.
 * ## Example Usage
 * ### Create or update a rule that adds an action group to all alerts in a subscription
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertProcessingRuleByName = new AzureNative.AlertsManagement.AlertProcessingRuleByName("alertProcessingRuleByName", new()
 *     {
 *         AlertProcessingRuleName = "AddActionGroupToSubscription",
 *         Location = "Global",
 *         Properties = new AzureNative.AlertsManagement.Inputs.AlertProcessingRulePropertiesArgs
 *         {
 *             Actions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.AddActionGroupsArgs
 *                 {
 *                     ActionGroupIds = new[]
 *                     {
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1",
 *                     },
 *                     ActionType = "AddActionGroups",
 *                 },
 *             },
 *             Description = "Add ActionGroup1 to all alerts in the subscription",
 *             Enabled = true,
 *             Scopes = new[]
 *             {
 *                 "/subscriptions/subId1",
 *             },
 *         },
 *         ResourceGroupName = "alertscorrelationrg",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * 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.NewAlertProcessingRuleByName(ctx, "alertProcessingRuleByName", &alertsmanagement.AlertProcessingRuleByNameArgs{
 * 			AlertProcessingRuleName: pulumi.String("AddActionGroupToSubscription"),
 * 			Location:                pulumi.String("Global"),
 * 			Properties: &alertsmanagement.AlertProcessingRulePropertiesArgs{
 * 				Actions: pulumi.Array{
 * 					alertsmanagement.AddActionGroups{
 * 						ActionGroupIds: []string{
 * 							"/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1",
 * 						},
 * 						ActionType: "AddActionGroups",
 * 					},
 * 				},
 * 				Description: pulumi.String("Add ActionGroup1 to all alerts in the subscription"),
 * 				Enabled:     pulumi.Bool(true),
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("/subscriptions/subId1"),
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("alertscorrelationrg"),
 * 			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.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("AddActionGroupToSubscription")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(AddActionGroupsArgs.builder()
 *                     .actionGroupIds("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1")
 *                     .actionType("AddActionGroups")
 *                     .build())
 *                 .description("Add ActionGroup1 to all alerts in the subscription")
 *                 .enabled(true)
 *                 .scopes("/subscriptions/subId1")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update a rule that adds two action groups to all Sev0 and Sev1 alerts in two resource groups
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertProcessingRuleByName = new AzureNative.AlertsManagement.AlertProcessingRuleByName("alertProcessingRuleByName", new()
 *     {
 *         AlertProcessingRuleName = "AddActionGroupsBySeverity",
 *         Location = "Global",
 *         Properties = new AzureNative.AlertsManagement.Inputs.AlertProcessingRulePropertiesArgs
 *         {
 *             Actions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.AddActionGroupsArgs
 *                 {
 *                     ActionGroupIds = new[]
 *                     {
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1",
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2",
 *                     },
 *                     ActionType = "AddActionGroups",
 *                 },
 *             },
 *             Conditions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.ConditionArgs
 *                 {
 *                     Field = AzureNative.AlertsManagement.Field.Severity,
 *                     Operator = AzureNative.AlertsManagement.Operator.EqualsValue,
 *                     Values = new[]
 *                     {
 *                         "sev0",
 *                         "sev1",
 *                     },
 *                 },
 *             },
 *             Description = "Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups",
 *             Enabled = true,
 *             Scopes = new[]
 *             {
 *                 "/subscriptions/subId1/resourceGroups/RGId1",
 *                 "/subscriptions/subId1/resourceGroups/RGId2",
 *             },
 *         },
 *         ResourceGroupName = "alertscorrelationrg",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * 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.NewAlertProcessingRuleByName(ctx, "alertProcessingRuleByName", &alertsmanagement.AlertProcessingRuleByNameArgs{
 * 			AlertProcessingRuleName: pulumi.String("AddActionGroupsBySeverity"),
 * 			Location:                pulumi.String("Global"),
 * 			Properties: &alertsmanagement.AlertProcessingRulePropertiesArgs{
 * 				Actions: pulumi.Array{
 * 					alertsmanagement.AddActionGroups{
 * 						ActionGroupIds: []string{
 * 							"/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1",
 * 							"/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2",
 * 						},
 * 						ActionType: "AddActionGroups",
 * 					},
 * 				},
 * 				Conditions: alertsmanagement.ConditionArray{
 * 					&alertsmanagement.ConditionArgs{
 * 						Field:    pulumi.String(alertsmanagement.FieldSeverity),
 * 						Operator: pulumi.String(alertsmanagement.OperatorEquals),
 * 						Values: pulumi.StringArray{
 * 							pulumi.String("sev0"),
 * 							pulumi.String("sev1"),
 * 						},
 * 					},
 * 				},
 * 				Description: pulumi.String("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups"),
 * 				Enabled:     pulumi.Bool(true),
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("/subscriptions/subId1/resourceGroups/RGId1"),
 * 					pulumi.String("/subscriptions/subId1/resourceGroups/RGId2"),
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("alertscorrelationrg"),
 * 			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.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("AddActionGroupsBySeverity")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(AddActionGroupsArgs.builder()
 *                     .actionGroupIds(
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1",
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2")
 *                     .actionType("AddActionGroups")
 *                     .build())
 *                 .conditions(ConditionArgs.builder()
 *                     .field("Severity")
 *                     .operator("Equals")
 *                     .values(
 *                         "sev0",
 *                         "sev1")
 *                     .build())
 *                 .description("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups")
 *                 .enabled(true)
 *                 .scopes(
 *                     "/subscriptions/subId1/resourceGroups/RGId1",
 *                     "/subscriptions/subId1/resourceGroups/RGId2")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update a rule that removes all action groups from alerts on a specific VM during a one-off maintenance window (1800-2000 at a specific date, Pacific Standard Time)
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertProcessingRuleByName = new AzureNative.AlertsManagement.AlertProcessingRuleByName("alertProcessingRuleByName", new()
 *     {
 *         AlertProcessingRuleName = "RemoveActionGroupsMaintenanceWindow",
 *         Location = "Global",
 *         Properties = new AzureNative.AlertsManagement.Inputs.AlertProcessingRulePropertiesArgs
 *         {
 *             Actions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.RemoveAllActionGroupsArgs
 *                 {
 *                     ActionType = "RemoveAllActionGroups",
 *                 },
 *             },
 *             Description = "Removes all ActionGroups from all Alerts on VMName during the maintenance window",
 *             Enabled = true,
 *             Schedule = new AzureNative.AlertsManagement.Inputs.ScheduleArgs
 *             {
 *                 EffectiveFrom = "2021-04-15T18:00:00",
 *                 EffectiveUntil = "2021-04-15T20:00:00",
 *                 TimeZone = "Pacific Standard Time",
 *             },
 *             Scopes = new[]
 *             {
 *                 "/subscriptions/subId1/resourceGroups/RGId1/providers/Microsoft.Compute/virtualMachines/VMName",
 *             },
 *         },
 *         ResourceGroupName = "alertscorrelationrg",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * 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.NewAlertProcessingRuleByName(ctx, "alertProcessingRuleByName", &alertsmanagement.AlertProcessingRuleByNameArgs{
 * 			AlertProcessingRuleName: pulumi.String("RemoveActionGroupsMaintenanceWindow"),
 * 			Location:                pulumi.String("Global"),
 * 			Properties: &alertsmanagement.AlertProcessingRulePropertiesArgs{
 * 				Actions: pulumi.Array{
 * 					alertsmanagement.RemoveAllActionGroups{
 * 						ActionType: "RemoveAllActionGroups",
 * 					},
 * 				},
 * 				Description: pulumi.String("Removes all ActionGroups from all Alerts on VMName during the maintenance window"),
 * 				Enabled:     pulumi.Bool(true),
 * 				Schedule: &alertsmanagement.ScheduleArgs{
 * 					EffectiveFrom:  pulumi.String("2021-04-15T18:00:00"),
 * 					EffectiveUntil: pulumi.String("2021-04-15T20:00:00"),
 * 					TimeZone:       pulumi.String("Pacific Standard Time"),
 * 				},
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("/subscriptions/subId1/resourceGroups/RGId1/providers/Microsoft.Compute/virtualMachines/VMName"),
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("alertscorrelationrg"),
 * 			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.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.ScheduleArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsMaintenanceWindow")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .description("Removes all ActionGroups from all Alerts on VMName during the maintenance window")
 *                 .enabled(true)
 *                 .schedule(ScheduleArgs.builder()
 *                     .effectiveFrom("2021-04-15T18:00:00")
 *                     .effectiveUntil("2021-04-15T20:00:00")
 *                     .timeZone("Pacific Standard Time")
 *                     .build())
 *                 .scopes("/subscriptions/subId1/resourceGroups/RGId1/providers/Microsoft.Compute/virtualMachines/VMName")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update a rule that removes all action groups from all alerts in a subscription coming from a specific alert rule
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertProcessingRuleByName = new AzureNative.AlertsManagement.AlertProcessingRuleByName("alertProcessingRuleByName", new()
 *     {
 *         AlertProcessingRuleName = "RemoveActionGroupsSpecificAlertRule",
 *         Location = "Global",
 *         Properties = new AzureNative.AlertsManagement.Inputs.AlertProcessingRulePropertiesArgs
 *         {
 *             Actions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.RemoveAllActionGroupsArgs
 *                 {
 *                     ActionType = "RemoveAllActionGroups",
 *                 },
 *             },
 *             Conditions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.ConditionArgs
 *                 {
 *                     Field = AzureNative.AlertsManagement.Field.AlertRuleId,
 *                     Operator = AzureNative.AlertsManagement.Operator.EqualsValue,
 *                     Values = new[]
 *                     {
 *                         "/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName",
 *                     },
 *                 },
 *             },
 *             Description = "Removes all ActionGroups from all Alerts that fire on above AlertRule",
 *             Enabled = true,
 *             Scopes = new[]
 *             {
 *                 "/subscriptions/subId1",
 *             },
 *         },
 *         ResourceGroupName = "alertscorrelationrg",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * 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.NewAlertProcessingRuleByName(ctx, "alertProcessingRuleByName", &alertsmanagement.AlertProcessingRuleByNameArgs{
 * 			AlertProcessingRuleName: pulumi.String("RemoveActionGroupsSpecificAlertRule"),
 * 			Location:                pulumi.String("Global"),
 * 			Properties: &alertsmanagement.AlertProcessingRulePropertiesArgs{
 * 				Actions: pulumi.Array{
 * 					alertsmanagement.RemoveAllActionGroups{
 * 						ActionType: "RemoveAllActionGroups",
 * 					},
 * 				},
 * 				Conditions: alertsmanagement.ConditionArray{
 * 					&alertsmanagement.ConditionArgs{
 * 						Field:    pulumi.String(alertsmanagement.FieldAlertRuleId),
 * 						Operator: pulumi.String(alertsmanagement.OperatorEquals),
 * 						Values: pulumi.StringArray{
 * 							pulumi.String("/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName"),
 * 						},
 * 					},
 * 				},
 * 				Description: pulumi.String("Removes all ActionGroups from all Alerts that fire on above AlertRule"),
 * 				Enabled:     pulumi.Bool(true),
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("/subscriptions/subId1"),
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("alertscorrelationrg"),
 * 			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.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsSpecificAlertRule")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .conditions(ConditionArgs.builder()
 *                     .field("AlertRuleId")
 *                     .operator("Equals")
 *                     .values("/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName")
 *                     .build())
 *                 .description("Removes all ActionGroups from all Alerts that fire on above AlertRule")
 *                 .enabled(true)
 *                 .scopes("/subscriptions/subId1")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update a rule that removes all action groups from all alerts on any VM in two resource groups during a recurring maintenance window (2200-0400 every Sat and Sun, India Standard Time)
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertProcessingRuleByName = new AzureNative.AlertsManagement.AlertProcessingRuleByName("alertProcessingRuleByName", new()
 *     {
 *         AlertProcessingRuleName = "RemoveActionGroupsRecurringMaintenance",
 *         Location = "Global",
 *         Properties = new AzureNative.AlertsManagement.Inputs.AlertProcessingRulePropertiesArgs
 *         {
 *             Actions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.RemoveAllActionGroupsArgs
 *                 {
 *                     ActionType = "RemoveAllActionGroups",
 *                 },
 *             },
 *             Conditions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.ConditionArgs
 *                 {
 *                     Field = AzureNative.AlertsManagement.Field.TargetResourceType,
 *                     Operator = AzureNative.AlertsManagement.Operator.EqualsValue,
 *                     Values = new[]
 *                     {
 *                         "microsoft.compute/virtualmachines",
 *                     },
 *                 },
 *             },
 *             Description = "Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance",
 *             Enabled = true,
 *             Schedule = new AzureNative.AlertsManagement.Inputs.ScheduleArgs
 *             {
 *                 Recurrences = new[]
 *                 {
 *                     new AzureNative.AlertsManagement.Inputs.WeeklyRecurrenceArgs
 *                     {
 *                         DaysOfWeek = new[]
 *                         {
 *                             AzureNative.AlertsManagement.DaysOfWeek.Saturday,
 *                             AzureNative.AlertsManagement.DaysOfWeek.Sunday,
 *                         },
 *                         EndTime = "04:00:00",
 *                         RecurrenceType = "Weekly",
 *                         StartTime = "22:00:00",
 *                     },
 *                 },
 *                 TimeZone = "India Standard Time",
 *             },
 *             Scopes = new[]
 *             {
 *                 "/subscriptions/subId1/resourceGroups/RGId1",
 *                 "/subscriptions/subId1/resourceGroups/RGId2",
 *             },
 *         },
 *         ResourceGroupName = "alertscorrelationrg",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * 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.NewAlertProcessingRuleByName(ctx, "alertProcessingRuleByName", &alertsmanagement.AlertProcessingRuleByNameArgs{
 * 			AlertProcessingRuleName: pulumi.String("RemoveActionGroupsRecurringMaintenance"),
 * 			Location:                pulumi.String("Global"),
 * 			Properties: &alertsmanagement.AlertProcessingRulePropertiesArgs{
 * 				Actions: pulumi.Array{
 * 					alertsmanagement.RemoveAllActionGroups{
 * 						ActionType: "RemoveAllActionGroups",
 * 					},
 * 				},
 * 				Conditions: alertsmanagement.ConditionArray{
 * 					&alertsmanagement.ConditionArgs{
 * 						Field:    pulumi.String(alertsmanagement.FieldTargetResourceType),
 * 						Operator: pulumi.String(alertsmanagement.OperatorEquals),
 * 						Values: pulumi.StringArray{
 * 							pulumi.String("microsoft.compute/virtualmachines"),
 * 						},
 * 					},
 * 				},
 * 				Description: pulumi.String("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance"),
 * 				Enabled:     pulumi.Bool(true),
 * 				Schedule: &alertsmanagement.ScheduleArgs{
 * 					Recurrences: pulumi.Array{
 * 						alertsmanagement.WeeklyRecurrence{
 * 							DaysOfWeek: []alertsmanagement.DaysOfWeek{
 * 								alertsmanagement.DaysOfWeekSaturday,
 * 								alertsmanagement.DaysOfWeekSunday,
 * 							},
 * 							EndTime:        "04:00:00",
 * 							RecurrenceType: "Weekly",
 * 							StartTime:      "22:00:00",
 * 						},
 * 					},
 * 					TimeZone: pulumi.String("India Standard Time"),
 * 				},
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("/subscriptions/subId1/resourceGroups/RGId1"),
 * 					pulumi.String("/subscriptions/subId1/resourceGroups/RGId2"),
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("alertscorrelationrg"),
 * 			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.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.ScheduleArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsRecurringMaintenance")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .conditions(ConditionArgs.builder()
 *                     .field("TargetResourceType")
 *                     .operator("Equals")
 *                     .values("microsoft.compute/virtualmachines")
 *                     .build())
 *                 .description("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance")
 *                 .enabled(true)
 *                 .schedule(ScheduleArgs.builder()
 *                     .recurrences(WeeklyRecurrenceArgs.builder()
 *                         .daysOfWeek(
 *                             "Saturday",
 *                             "Sunday")
 *                         .endTime("04:00:00")
 *                         .recurrenceType("Weekly")
 *                         .startTime("22:00:00")
 *                         .build())
 *                     .timeZone("India Standard Time")
 *                     .build())
 *                 .scopes(
 *                     "/subscriptions/subId1/resourceGroups/RGId1",
 *                     "/subscriptions/subId1/resourceGroups/RGId2")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update a rule that removes all action groups outside business hours (Mon-Fri 09:00-17:00, Eastern Standard Time)
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var alertProcessingRuleByName = new AzureNative.AlertsManagement.AlertProcessingRuleByName("alertProcessingRuleByName", new()
 *     {
 *         AlertProcessingRuleName = "RemoveActionGroupsOutsideBusinessHours",
 *         Location = "Global",
 *         Properties = new AzureNative.AlertsManagement.Inputs.AlertProcessingRulePropertiesArgs
 *         {
 *             Actions = new[]
 *             {
 *                 new AzureNative.AlertsManagement.Inputs.RemoveAllActionGroupsArgs
 *                 {
 *                     ActionType = "RemoveAllActionGroups",
 *                 },
 *             },
 *             Description = "Remove all ActionGroups outside business hours",
 *             Enabled = true,
 *             Schedule = new AzureNative.AlertsManagement.Inputs.ScheduleArgs
 *             {
 *                 Recurrences =
 *                 {
 *                     new AzureNative.AlertsManagement.Inputs.DailyRecurrenceArgs
 *                     {
 *                         EndTime = "09:00:00",
 *                         RecurrenceType = "Daily",
 *                         StartTime = "17:00:00",
 *                     },
 *                     new AzureNative.AlertsManagement.Inputs.WeeklyRecurrenceArgs
 *                     {
 *                         DaysOfWeek = new[]
 *                         {
 *                             AzureNative.AlertsManagement.DaysOfWeek.Saturday,
 *                             AzureNative.AlertsManagement.DaysOfWeek.Sunday,
 *                         },
 *                         RecurrenceType = "Weekly",
 *                     },
 *                 },
 *                 TimeZone = "Eastern Standard Time",
 *             },
 *             Scopes = new[]
 *             {
 *                 "/subscriptions/subId1",
 *             },
 *         },
 *         ResourceGroupName = "alertscorrelationrg",
 *         Tags = null,
 *     });
 * });
 * ```
 * ```go
 * 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.NewAlertProcessingRuleByName(ctx, "alertProcessingRuleByName", &alertsmanagement.AlertProcessingRuleByNameArgs{
 * 			AlertProcessingRuleName: pulumi.String("RemoveActionGroupsOutsideBusinessHours"),
 * 			Location:                pulumi.String("Global"),
 * 			Properties: &alertsmanagement.AlertProcessingRulePropertiesArgs{
 * 				Actions: pulumi.Array{
 * 					alertsmanagement.RemoveAllActionGroups{
 * 						ActionType: "RemoveAllActionGroups",
 * 					},
 * 				},
 * 				Description: pulumi.String("Remove all ActionGroups outside business hours"),
 * 				Enabled:     pulumi.Bool(true),
 * 				Schedule: &alertsmanagement.ScheduleArgs{
 * 					Recurrences: pulumi.Array{
 * 						alertsmanagement.DailyRecurrence{
 * 							EndTime:        "09:00:00",
 * 							RecurrenceType: "Daily",
 * 							StartTime:      "17:00:00",
 * 						},
 * 						alertsmanagement.WeeklyRecurrence{
 * 							DaysOfWeek: []alertsmanagement.DaysOfWeek{
 * 								alertsmanagement.DaysOfWeekSaturday,
 * 								alertsmanagement.DaysOfWeekSunday,
 * 							},
 * 							RecurrenceType: "Weekly",
 * 						},
 * 					},
 * 					TimeZone: pulumi.String("Eastern Standard Time"),
 * 				},
 * 				Scopes: pulumi.StringArray{
 * 					pulumi.String("/subscriptions/subId1"),
 * 				},
 * 			},
 * 			ResourceGroupName: pulumi.String("alertscorrelationrg"),
 * 			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.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.ScheduleArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsOutsideBusinessHours")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .description("Remove all ActionGroups outside business hours")
 *                 .enabled(true)
 *                 .schedule(ScheduleArgs.builder()
 *                     .recurrences(
 *                         DailyRecurrenceArgs.builder()
 *                             .endTime("09:00:00")
 *                             .recurrenceType("Daily")
 *                             .startTime("17:00:00")
 *                             .build(),
 *                         WeeklyRecurrenceArgs.builder()
 *                             .daysOfWeek(
 *                                 "Saturday",
 *                                 "Sunday")
 *                             .recurrenceType("Weekly")
 *                             .build())
 *                     .timeZone("Eastern Standard Time")
 *                     .build())
 *                 .scopes("/subscriptions/subId1")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:alertsmanagement:AlertProcessingRuleByName RemoveActionGroupsOutsideBusinessHours /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName}
 * ```
 */
public class AlertProcessingRuleByName internal constructor(
    override val javaResource: com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName,
) : KotlinCustomResource(javaResource, AlertProcessingRuleByNameMapper) {
    /**
     * Resource location
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Azure resource name
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Alert processing rule properties.
     */
    public val properties: Output
        get() = javaResource.properties().applyValue({ args0 ->
            args0.let({ args0 ->
                alertProcessingRulePropertiesResponseToKotlin(args0)
            })
        })

    /**
     * Alert processing rule system data.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Resource tags
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Azure resource type
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object AlertProcessingRuleByNameMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName::class == javaResource::class

    override fun map(javaResource: Resource): AlertProcessingRuleByName =
        AlertProcessingRuleByName(
            javaResource as
                com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName,
        )
}

/**
 * @see [AlertProcessingRuleByName].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [AlertProcessingRuleByName].
 */
public suspend fun alertProcessingRuleByName(
    name: String,
    block: suspend AlertProcessingRuleByNameResourceBuilder.() -> Unit,
): AlertProcessingRuleByName {
    val builder = AlertProcessingRuleByNameResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [AlertProcessingRuleByName].
 * @param name The _unique_ name of the resulting resource.
 */
public fun alertProcessingRuleByName(name: String): AlertProcessingRuleByName {
    val builder = AlertProcessingRuleByNameResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy