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

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

package com.pulumi.azure.monitoring.kotlin

import com.pulumi.azure.monitoring.kotlin.outputs.ActionRuleSuppressionCondition
import com.pulumi.azure.monitoring.kotlin.outputs.ActionRuleSuppressionScope
import com.pulumi.azure.monitoring.kotlin.outputs.ActionRuleSuppressionSuppression
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.azure.monitoring.kotlin.outputs.ActionRuleSuppressionCondition.Companion.toKotlin as actionRuleSuppressionConditionToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.ActionRuleSuppressionScope.Companion.toKotlin as actionRuleSuppressionScopeToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.ActionRuleSuppressionSuppression.Companion.toKotlin as actionRuleSuppressionSuppressionToKotlin

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

    public var args: ActionRuleSuppressionArgs = ActionRuleSuppressionArgs()

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

/**
 * Manages a Monitor Action Rule which type is suppression.
 * !> **NOTE:** This resource has been deprecated in version 5.0 of the provider and will be removed in version 6.0. Please use `azure.monitoring.AlertProcessingRuleSuppression` resource instead.
 * ## 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 exampleActionRuleSuppression = new azure.monitoring.ActionRuleSuppression("example", {
 *     name: "example-amar",
 *     resourceGroupName: example.name,
 *     scope: {
 *         type: "ResourceGroup",
 *         resourceIds: [example.id],
 *     },
 *     suppression: {
 *         recurrenceType: "Weekly",
 *         schedule: {
 *             startDateUtc: "2019-01-01T01:02:03Z",
 *             endDateUtc: "2019-01-03T15:02:07Z",
 *             recurrenceWeeklies: [
 *                 "Sunday",
 *                 "Monday",
 *                 "Friday",
 *                 "Saturday",
 *             ],
 *         },
 *     },
 *     tags: {
 *         foo: "bar",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_action_rule_suppression = azure.monitoring.ActionRuleSuppression("example",
 *     name="example-amar",
 *     resource_group_name=example.name,
 *     scope=azure.monitoring.ActionRuleSuppressionScopeArgs(
 *         type="ResourceGroup",
 *         resource_ids=[example.id],
 *     ),
 *     suppression=azure.monitoring.ActionRuleSuppressionSuppressionArgs(
 *         recurrence_type="Weekly",
 *         schedule=azure.monitoring.ActionRuleSuppressionSuppressionScheduleArgs(
 *             start_date_utc="2019-01-01T01:02:03Z",
 *             end_date_utc="2019-01-03T15:02:07Z",
 *             recurrence_weeklies=[
 *                 "Sunday",
 *                 "Monday",
 *                 "Friday",
 *                 "Saturday",
 *             ],
 *         ),
 *     ),
 *     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 exampleActionRuleSuppression = new Azure.Monitoring.ActionRuleSuppression("example", new()
 *     {
 *         Name = "example-amar",
 *         ResourceGroupName = example.Name,
 *         Scope = new Azure.Monitoring.Inputs.ActionRuleSuppressionScopeArgs
 *         {
 *             Type = "ResourceGroup",
 *             ResourceIds = new[]
 *             {
 *                 example.Id,
 *             },
 *         },
 *         Suppression = new Azure.Monitoring.Inputs.ActionRuleSuppressionSuppressionArgs
 *         {
 *             RecurrenceType = "Weekly",
 *             Schedule = new Azure.Monitoring.Inputs.ActionRuleSuppressionSuppressionScheduleArgs
 *             {
 *                 StartDateUtc = "2019-01-01T01:02:03Z",
 *                 EndDateUtc = "2019-01-03T15:02:07Z",
 *                 RecurrenceWeeklies = new[]
 *                 {
 *                     "Sunday",
 *                     "Monday",
 *                     "Friday",
 *                     "Saturday",
 *                 },
 *             },
 *         },
 *         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.NewActionRuleSuppression(ctx, "example", &monitoring.ActionRuleSuppressionArgs{
 * 			Name:              pulumi.String("example-amar"),
 * 			ResourceGroupName: example.Name,
 * 			Scope: &monitoring.ActionRuleSuppressionScopeArgs{
 * 				Type: pulumi.String("ResourceGroup"),
 * 				ResourceIds: pulumi.StringArray{
 * 					example.ID(),
 * 				},
 * 			},
 * 			Suppression: &monitoring.ActionRuleSuppressionSuppressionArgs{
 * 				RecurrenceType: pulumi.String("Weekly"),
 * 				Schedule: &monitoring.ActionRuleSuppressionSuppressionScheduleArgs{
 * 					StartDateUtc: pulumi.String("2019-01-01T01:02:03Z"),
 * 					EndDateUtc:   pulumi.String("2019-01-03T15:02:07Z"),
 * 					RecurrenceWeeklies: pulumi.StringArray{
 * 						pulumi.String("Sunday"),
 * 						pulumi.String("Monday"),
 * 						pulumi.String("Friday"),
 * 						pulumi.String("Saturday"),
 * 					},
 * 				},
 * 			},
 * 			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.ActionRuleSuppression;
 * import com.pulumi.azure.monitoring.ActionRuleSuppressionArgs;
 * import com.pulumi.azure.monitoring.inputs.ActionRuleSuppressionScopeArgs;
 * import com.pulumi.azure.monitoring.inputs.ActionRuleSuppressionSuppressionArgs;
 * import com.pulumi.azure.monitoring.inputs.ActionRuleSuppressionSuppressionScheduleArgs;
 * 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 exampleActionRuleSuppression = new ActionRuleSuppression("exampleActionRuleSuppression", ActionRuleSuppressionArgs.builder()
 *             .name("example-amar")
 *             .resourceGroupName(example.name())
 *             .scope(ActionRuleSuppressionScopeArgs.builder()
 *                 .type("ResourceGroup")
 *                 .resourceIds(example.id())
 *                 .build())
 *             .suppression(ActionRuleSuppressionSuppressionArgs.builder()
 *                 .recurrenceType("Weekly")
 *                 .schedule(ActionRuleSuppressionSuppressionScheduleArgs.builder()
 *                     .startDateUtc("2019-01-01T01:02:03Z")
 *                     .endDateUtc("2019-01-03T15:02:07Z")
 *                     .recurrenceWeeklies(
 *                         "Sunday",
 *                         "Monday",
 *                         "Friday",
 *                         "Saturday")
 *                     .build())
 *                 .build())
 *             .tags(Map.of("foo", "bar"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleActionRuleSuppression:
 *     type: azure:monitoring:ActionRuleSuppression
 *     name: example
 *     properties:
 *       name: example-amar
 *       resourceGroupName: ${example.name}
 *       scope:
 *         type: ResourceGroup
 *         resourceIds:
 *           - ${example.id}
 *       suppression:
 *         recurrenceType: Weekly
 *         schedule:
 *           startDateUtc: 2019-01-01T01:02:03Z
 *           endDateUtc: 2019-01-03T15:02:07Z
 *           recurrenceWeeklies:
 *             - Sunday
 *             - Monday
 *             - Friday
 *             - Saturday
 *       tags:
 *         foo: bar
 * ```
 * 
 * ## Import
 * Monitor Action Rule can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:monitoring/actionRuleSuppression:ActionRuleSuppression example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AlertsManagement/actionRules/actionRule1
 * ```
 */
public class ActionRuleSuppression internal constructor(
    override val javaResource: com.pulumi.azure.monitoring.ActionRuleSuppression,
) : KotlinCustomResource(javaResource, ActionRuleSuppressionMapper) {
    /**
     * A `condition` block as defined below.
     */
    public val condition: Output?
        get() = javaResource.condition().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    actionRuleSuppressionConditionToKotlin(args0)
                })
            }).orElse(null)
        })

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

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

    /**
     * Specifies the name of the Monitor Action Rule. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the resource group in which the Monitor Action Rule should exist. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

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

    /**
     * A `suppression` block as defined below.
     */
    public val suppression: Output
        get() = javaResource.suppression().applyValue({ args0 ->
            args0.let({ args0 ->
                actionRuleSuppressionSuppressionToKotlin(args0)
            })
        })

    /**
     * A mapping of tags to assign to the resource.
     */
    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 ActionRuleSuppressionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.monitoring.ActionRuleSuppression::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy