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

com.pulumi.azure.monitoring.kotlin.AlertProcessingRuleSuppression.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.kotlin.outputs.AlertProcessingRuleSuppressionCondition
import com.pulumi.azure.monitoring.kotlin.outputs.AlertProcessingRuleSuppressionSchedule
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.List
import kotlin.collections.Map
import com.pulumi.azure.monitoring.kotlin.outputs.AlertProcessingRuleSuppressionCondition.Companion.toKotlin as alertProcessingRuleSuppressionConditionToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.AlertProcessingRuleSuppressionSchedule.Companion.toKotlin as alertProcessingRuleSuppressionScheduleToKotlin

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

    public var args: AlertProcessingRuleSuppressionArgs = AlertProcessingRuleSuppressionArgs()

    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 AlertProcessingRuleSuppressionArgsBuilder.() -> Unit) {
        val builder = AlertProcessingRuleSuppressionArgsBuilder()
        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(): AlertProcessingRuleSuppression {
        val builtJavaResource =
            com.pulumi.azure.monitoring.AlertProcessingRuleSuppression(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return AlertProcessingRuleSuppression(builtJavaResource)
    }
}

/**
 * Manages an Alert Processing Rule which suppress notifications.
 * ## 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 exampleAlertProcessingRuleSuppression = new azure.monitoring.AlertProcessingRuleSuppression("example", {
 *     name: "example",
 *     resourceGroupName: "example",
 *     scopes: [example.id],
 *     condition: {
 *         targetResourceType: {
 *             operator: "Equals",
 *             values: ["Microsoft.Compute/VirtualMachines"],
 *         },
 *         severity: {
 *             operator: "Equals",
 *             values: [
 *                 "Sev0",
 *                 "Sev1",
 *                 "Sev2",
 *             ],
 *         },
 *     },
 *     schedule: {
 *         effectiveFrom: "2022-01-01T01:02:03",
 *         effectiveUntil: "2022-02-02T01:02:03",
 *         timeZone: "Pacific Standard Time",
 *         recurrence: {
 *             dailies: [{
 *                 startTime: "17:00:00",
 *                 endTime: "09:00:00",
 *             }],
 *             weeklies: [{
 *                 daysOfWeeks: [
 *                     "Saturday",
 *                     "Sunday",
 *                 ],
 *             }],
 *         },
 *     },
 *     tags: {
 *         foo: "bar",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_alert_processing_rule_suppression = azure.monitoring.AlertProcessingRuleSuppression("example",
 *     name="example",
 *     resource_group_name="example",
 *     scopes=[example.id],
 *     condition=azure.monitoring.AlertProcessingRuleSuppressionConditionArgs(
 *         target_resource_type=azure.monitoring.AlertProcessingRuleSuppressionConditionTargetResourceTypeArgs(
 *             operator="Equals",
 *             values=["Microsoft.Compute/VirtualMachines"],
 *         ),
 *         severity=azure.monitoring.AlertProcessingRuleSuppressionConditionSeverityArgs(
 *             operator="Equals",
 *             values=[
 *                 "Sev0",
 *                 "Sev1",
 *                 "Sev2",
 *             ],
 *         ),
 *     ),
 *     schedule=azure.monitoring.AlertProcessingRuleSuppressionScheduleArgs(
 *         effective_from="2022-01-01T01:02:03",
 *         effective_until="2022-02-02T01:02:03",
 *         time_zone="Pacific Standard Time",
 *         recurrence=azure.monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceArgs(
 *             dailies=[azure.monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceDailyArgs(
 *                 start_time="17:00:00",
 *                 end_time="09:00:00",
 *             )],
 *             weeklies=[azure.monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceWeeklyArgs(
 *                 days_of_weeks=[
 *                     "Saturday",
 *                     "Sunday",
 *                 ],
 *             )],
 *         ),
 *     ),
 *     tags={
 *         "foo": "bar",
 *     })
 * ```
 * ```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 exampleAlertProcessingRuleSuppression = new Azure.Monitoring.AlertProcessingRuleSuppression("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = "example",
 *         Scopes = new[]
 *         {
 *             example.Id,
 *         },
 *         Condition = new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionConditionArgs
 *         {
 *             TargetResourceType = new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionConditionTargetResourceTypeArgs
 *             {
 *                 Operator = "Equals",
 *                 Values = new[]
 *                 {
 *                     "Microsoft.Compute/VirtualMachines",
 *                 },
 *             },
 *             Severity = new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionConditionSeverityArgs
 *             {
 *                 Operator = "Equals",
 *                 Values = new[]
 *                 {
 *                     "Sev0",
 *                     "Sev1",
 *                     "Sev2",
 *                 },
 *             },
 *         },
 *         Schedule = new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionScheduleArgs
 *         {
 *             EffectiveFrom = "2022-01-01T01:02:03",
 *             EffectiveUntil = "2022-02-02T01:02:03",
 *             TimeZone = "Pacific Standard Time",
 *             Recurrence = new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionScheduleRecurrenceArgs
 *             {
 *                 Dailies = new[]
 *                 {
 *                     new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionScheduleRecurrenceDailyArgs
 *                     {
 *                         StartTime = "17:00:00",
 *                         EndTime = "09:00:00",
 *                     },
 *                 },
 *                 Weeklies = new[]
 *                 {
 *                     new Azure.Monitoring.Inputs.AlertProcessingRuleSuppressionScheduleRecurrenceWeeklyArgs
 *                     {
 *                         DaysOfWeeks = new[]
 *                         {
 *                             "Saturday",
 *                             "Sunday",
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *         Tags =
 *         {
 *             { "foo", "bar" },
 *         },
 *     });
 * });
 * ```
 * ```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/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
 * 		}
 * 		_, err = monitoring.NewAlertProcessingRuleSuppression(ctx, "example", &monitoring.AlertProcessingRuleSuppressionArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: pulumi.String("example"),
 * 			Scopes: pulumi.StringArray{
 * 				example.ID(),
 * 			},
 * 			Condition: &monitoring.AlertProcessingRuleSuppressionConditionArgs{
 * 				TargetResourceType: &monitoring.AlertProcessingRuleSuppressionConditionTargetResourceTypeArgs{
 * 					Operator: pulumi.String("Equals"),
 * 					Values: pulumi.StringArray{
 * 						pulumi.String("Microsoft.Compute/VirtualMachines"),
 * 					},
 * 				},
 * 				Severity: &monitoring.AlertProcessingRuleSuppressionConditionSeverityArgs{
 * 					Operator: pulumi.String("Equals"),
 * 					Values: pulumi.StringArray{
 * 						pulumi.String("Sev0"),
 * 						pulumi.String("Sev1"),
 * 						pulumi.String("Sev2"),
 * 					},
 * 				},
 * 			},
 * 			Schedule: &monitoring.AlertProcessingRuleSuppressionScheduleArgs{
 * 				EffectiveFrom:  pulumi.String("2022-01-01T01:02:03"),
 * 				EffectiveUntil: pulumi.String("2022-02-02T01:02:03"),
 * 				TimeZone:       pulumi.String("Pacific Standard Time"),
 * 				Recurrence: &monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceArgs{
 * 					Dailies: monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceDailyArray{
 * 						&monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceDailyArgs{
 * 							StartTime: pulumi.String("17:00:00"),
 * 							EndTime:   pulumi.String("09:00:00"),
 * 						},
 * 					},
 * 					Weeklies: monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceWeeklyArray{
 * 						&monitoring.AlertProcessingRuleSuppressionScheduleRecurrenceWeeklyArgs{
 * 							DaysOfWeeks: pulumi.StringArray{
 * 								pulumi.String("Saturday"),
 * 								pulumi.String("Sunday"),
 * 							},
 * 						},
 * 					},
 * 				},
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 		})
 * 		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.monitoring.AlertProcessingRuleSuppression;
 * import com.pulumi.azure.monitoring.AlertProcessingRuleSuppressionArgs;
 * import com.pulumi.azure.monitoring.inputs.AlertProcessingRuleSuppressionConditionArgs;
 * import com.pulumi.azure.monitoring.inputs.AlertProcessingRuleSuppressionConditionTargetResourceTypeArgs;
 * import com.pulumi.azure.monitoring.inputs.AlertProcessingRuleSuppressionConditionSeverityArgs;
 * import com.pulumi.azure.monitoring.inputs.AlertProcessingRuleSuppressionScheduleArgs;
 * import com.pulumi.azure.monitoring.inputs.AlertProcessingRuleSuppressionScheduleRecurrenceArgs;
 * 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 exampleAlertProcessingRuleSuppression = new AlertProcessingRuleSuppression("exampleAlertProcessingRuleSuppression", AlertProcessingRuleSuppressionArgs.builder()
 *             .name("example")
 *             .resourceGroupName("example")
 *             .scopes(example.id())
 *             .condition(AlertProcessingRuleSuppressionConditionArgs.builder()
 *                 .targetResourceType(AlertProcessingRuleSuppressionConditionTargetResourceTypeArgs.builder()
 *                     .operator("Equals")
 *                     .values("Microsoft.Compute/VirtualMachines")
 *                     .build())
 *                 .severity(AlertProcessingRuleSuppressionConditionSeverityArgs.builder()
 *                     .operator("Equals")
 *                     .values(
 *                         "Sev0",
 *                         "Sev1",
 *                         "Sev2")
 *                     .build())
 *                 .build())
 *             .schedule(AlertProcessingRuleSuppressionScheduleArgs.builder()
 *                 .effectiveFrom("2022-01-01T01:02:03")
 *                 .effectiveUntil("2022-02-02T01:02:03")
 *                 .timeZone("Pacific Standard Time")
 *                 .recurrence(AlertProcessingRuleSuppressionScheduleRecurrenceArgs.builder()
 *                     .dailies(AlertProcessingRuleSuppressionScheduleRecurrenceDailyArgs.builder()
 *                         .startTime("17:00:00")
 *                         .endTime("09:00:00")
 *                         .build())
 *                     .weeklies(AlertProcessingRuleSuppressionScheduleRecurrenceWeeklyArgs.builder()
 *                         .daysOfWeeks(
 *                             "Saturday",
 *                             "Sunday")
 *                         .build())
 *                     .build())
 *                 .build())
 *             .tags(Map.of("foo", "bar"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAlertProcessingRuleSuppression:
 *     type: azure:monitoring:AlertProcessingRuleSuppression
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: example
 *       scopes:
 *         - ${example.id}
 *       condition:
 *         targetResourceType:
 *           operator: Equals
 *           values:
 *             - Microsoft.Compute/VirtualMachines
 *         severity:
 *           operator: Equals
 *           values:
 *             - Sev0
 *             - Sev1
 *             - Sev2
 *       schedule:
 *         effectiveFrom: 2022-01-01T01:02:03
 *         effectiveUntil: 2022-02-02T01:02:03
 *         timeZone: Pacific Standard Time
 *         recurrence:
 *           dailies:
 *             - startTime: 17:00:00
 *               endTime: 09:00:00
 *           weeklies:
 *             - daysOfWeeks:
 *                 - Saturday
 *                 - Sunday
 *       tags:
 *         foo: bar
 * ```
 * 
 * ## Import
 * Alert Processing Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:monitoring/alertProcessingRuleSuppression:AlertProcessingRuleSuppression example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AlertsManagement/actionRules/actionRule1
 * ```
 */
public class AlertProcessingRuleSuppression internal constructor(
    override val javaResource: com.pulumi.azure.monitoring.AlertProcessingRuleSuppression,
) : KotlinCustomResource(javaResource, AlertProcessingRuleSuppressionMapper) {
    /**
     * A `condition` block as defined below.
     */
    public val condition: Output?
        get() = javaResource.condition().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    alertProcessingRuleSuppressionConditionToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies a description for the Alert Processing Rule.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Should the Alert Processing Rule be enabled? Defaults to `true`.
     */
    public val enabled: Output?
        get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name which should be used for this Alert Processing Rule. Changing this forces a new Alert Processing Rule to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the Alert Processing Rule should exist. Changing this forces a new Alert Processing Rule to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `schedule` block as defined below.
     */
    public val schedule: Output?
        get() = javaResource.schedule().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    alertProcessingRuleSuppressionScheduleToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A list of resource IDs which will be the target of Alert Processing Rule.
     */
    public val scopes: Output>
        get() = javaResource.scopes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A mapping of tags which should be assigned to the Alert Processing Rule.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object AlertProcessingRuleSuppressionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.monitoring.AlertProcessingRuleSuppression::class == javaResource::class

    override fun map(javaResource: Resource): AlertProcessingRuleSuppression =
        AlertProcessingRuleSuppression(
            javaResource as
                com.pulumi.azure.monitoring.AlertProcessingRuleSuppression,
        )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy