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

com.pulumi.azure.sentinel.kotlin.AlertRuleFusion.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.sentinel.kotlin

import com.pulumi.azure.sentinel.kotlin.outputs.AlertRuleFusionSource
import com.pulumi.azure.sentinel.kotlin.outputs.AlertRuleFusionSource.Companion.toKotlin
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

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

    public var args: AlertRuleFusionArgs = AlertRuleFusionArgs()

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

/**
 * Manages a Sentinel Fusion Alert Rule.
 * ## 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 exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
 *     name: "example-workspace",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "PerGB2018",
 * });
 * const exampleAnalyticsSolution = new azure.operationalinsights.AnalyticsSolution("example", {
 *     solutionName: "SecurityInsights",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     workspaceResourceId: exampleAnalyticsWorkspace.id,
 *     workspaceName: exampleAnalyticsWorkspace.name,
 *     plan: {
 *         publisher: "Microsoft",
 *         product: "OMSGallery/SecurityInsights",
 *     },
 * });
 * const exampleAlertRuleFusion = new azure.sentinel.AlertRuleFusion("example", {
 *     name: "example-fusion-alert-rule",
 *     logAnalyticsWorkspaceId: exampleAnalyticsSolution.workspaceResourceId,
 *     alertRuleTemplateGuid: "f71aba3d-28fb-450b-b192-4e76a83015c8",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
 *     name="example-workspace",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="PerGB2018")
 * example_analytics_solution = azure.operationalinsights.AnalyticsSolution("example",
 *     solution_name="SecurityInsights",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     workspace_resource_id=example_analytics_workspace.id,
 *     workspace_name=example_analytics_workspace.name,
 *     plan={
 *         "publisher": "Microsoft",
 *         "product": "OMSGallery/SecurityInsights",
 *     })
 * example_alert_rule_fusion = azure.sentinel.AlertRuleFusion("example",
 *     name="example-fusion-alert-rule",
 *     log_analytics_workspace_id=example_analytics_solution.workspace_resource_id,
 *     alert_rule_template_guid="f71aba3d-28fb-450b-b192-4e76a83015c8")
 * ```
 * ```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 exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("example", new()
 *     {
 *         Name = "example-workspace",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "PerGB2018",
 *     });
 *     var exampleAnalyticsSolution = new Azure.OperationalInsights.AnalyticsSolution("example", new()
 *     {
 *         SolutionName = "SecurityInsights",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         WorkspaceResourceId = exampleAnalyticsWorkspace.Id,
 *         WorkspaceName = exampleAnalyticsWorkspace.Name,
 *         Plan = new Azure.OperationalInsights.Inputs.AnalyticsSolutionPlanArgs
 *         {
 *             Publisher = "Microsoft",
 *             Product = "OMSGallery/SecurityInsights",
 *         },
 *     });
 *     var exampleAlertRuleFusion = new Azure.Sentinel.AlertRuleFusion("example", new()
 *     {
 *         Name = "example-fusion-alert-rule",
 *         LogAnalyticsWorkspaceId = exampleAnalyticsSolution.WorkspaceResourceId,
 *         AlertRuleTemplateGuid = "f71aba3d-28fb-450b-b192-4e76a83015c8",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/operationalinsights"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/sentinel"
 * 	"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
 * 		}
 * 		exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
 * 			Name:              pulumi.String("example-workspace"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("PerGB2018"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleAnalyticsSolution, err := operationalinsights.NewAnalyticsSolution(ctx, "example", &operationalinsights.AnalyticsSolutionArgs{
 * 			SolutionName:        pulumi.String("SecurityInsights"),
 * 			Location:            example.Location,
 * 			ResourceGroupName:   example.Name,
 * 			WorkspaceResourceId: exampleAnalyticsWorkspace.ID(),
 * 			WorkspaceName:       exampleAnalyticsWorkspace.Name,
 * 			Plan: &operationalinsights.AnalyticsSolutionPlanArgs{
 * 				Publisher: pulumi.String("Microsoft"),
 * 				Product:   pulumi.String("OMSGallery/SecurityInsights"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = sentinel.NewAlertRuleFusion(ctx, "example", &sentinel.AlertRuleFusionArgs{
 * 			Name:                    pulumi.String("example-fusion-alert-rule"),
 * 			LogAnalyticsWorkspaceId: exampleAnalyticsSolution.WorkspaceResourceId,
 * 			AlertRuleTemplateGuid:   pulumi.String("f71aba3d-28fb-450b-b192-4e76a83015c8"),
 * 		})
 * 		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.operationalinsights.AnalyticsWorkspace;
 * import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
 * import com.pulumi.azure.operationalinsights.AnalyticsSolution;
 * import com.pulumi.azure.operationalinsights.AnalyticsSolutionArgs;
 * import com.pulumi.azure.operationalinsights.inputs.AnalyticsSolutionPlanArgs;
 * import com.pulumi.azure.sentinel.AlertRuleFusion;
 * import com.pulumi.azure.sentinel.AlertRuleFusionArgs;
 * 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 exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
 *             .name("example-workspace")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("PerGB2018")
 *             .build());
 *         var exampleAnalyticsSolution = new AnalyticsSolution("exampleAnalyticsSolution", AnalyticsSolutionArgs.builder()
 *             .solutionName("SecurityInsights")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .workspaceResourceId(exampleAnalyticsWorkspace.id())
 *             .workspaceName(exampleAnalyticsWorkspace.name())
 *             .plan(AnalyticsSolutionPlanArgs.builder()
 *                 .publisher("Microsoft")
 *                 .product("OMSGallery/SecurityInsights")
 *                 .build())
 *             .build());
 *         var exampleAlertRuleFusion = new AlertRuleFusion("exampleAlertRuleFusion", AlertRuleFusionArgs.builder()
 *             .name("example-fusion-alert-rule")
 *             .logAnalyticsWorkspaceId(exampleAnalyticsSolution.workspaceResourceId())
 *             .alertRuleTemplateGuid("f71aba3d-28fb-450b-b192-4e76a83015c8")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAnalyticsWorkspace:
 *     type: azure:operationalinsights:AnalyticsWorkspace
 *     name: example
 *     properties:
 *       name: example-workspace
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: PerGB2018
 *   exampleAnalyticsSolution:
 *     type: azure:operationalinsights:AnalyticsSolution
 *     name: example
 *     properties:
 *       solutionName: SecurityInsights
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       workspaceResourceId: ${exampleAnalyticsWorkspace.id}
 *       workspaceName: ${exampleAnalyticsWorkspace.name}
 *       plan:
 *         publisher: Microsoft
 *         product: OMSGallery/SecurityInsights
 *   exampleAlertRuleFusion:
 *     type: azure:sentinel:AlertRuleFusion
 *     name: example
 *     properties:
 *       name: example-fusion-alert-rule
 *       logAnalyticsWorkspaceId: ${exampleAnalyticsSolution.workspaceResourceId}
 *       alertRuleTemplateGuid: f71aba3d-28fb-450b-b192-4e76a83015c8
 * ```
 * 
 * ## Import
 * Sentinel Fusion Alert Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:sentinel/alertRuleFusion:AlertRuleFusion example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.OperationalInsights/workspaces/workspace1/providers/Microsoft.SecurityInsights/alertRules/rule1
 * ```
 */
public class AlertRuleFusion internal constructor(
    override val javaResource: com.pulumi.azure.sentinel.AlertRuleFusion,
) : KotlinCustomResource(javaResource, AlertRuleFusionMapper) {
    /**
     * The GUID of the alert rule template which is used for this Sentinel Fusion Alert Rule. Changing this forces a new Sentinel Fusion Alert Rule to be created.
     */
    public val alertRuleTemplateGuid: Output
        get() = javaResource.alertRuleTemplateGuid().applyValue({ args0 -> args0 })

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

    /**
     * The ID of the Log Analytics Workspace this Sentinel Fusion Alert Rule belongs to. Changing this forces a new Sentinel Fusion Alert Rule to be created.
     */
    public val logAnalyticsWorkspaceId: Output
        get() = javaResource.logAnalyticsWorkspaceId().applyValue({ args0 -> args0 })

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

    /**
     * One or more `source` blocks as defined below.
     */
    public val sources: Output>
        get() = javaResource.sources().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            })
        })
}

public object AlertRuleFusionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.sentinel.AlertRuleFusion::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy