com.pulumi.azure.monitoring.kotlin.ActivityLogAlert.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.monitoring.kotlin
import com.pulumi.azure.monitoring.kotlin.outputs.ActivityLogAlertAction
import com.pulumi.azure.monitoring.kotlin.outputs.ActivityLogAlertCriteria
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.ActivityLogAlertAction.Companion.toKotlin as activityLogAlertActionToKotlin
import com.pulumi.azure.monitoring.kotlin.outputs.ActivityLogAlertCriteria.Companion.toKotlin as activityLogAlertCriteriaToKotlin
/**
* Builder for [ActivityLogAlert].
*/
@PulumiTagMarker
public class ActivityLogAlertResourceBuilder internal constructor() {
public var name: String? = null
public var args: ActivityLogAlertArgs = ActivityLogAlertArgs()
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 ActivityLogAlertArgsBuilder.() -> Unit) {
val builder = ActivityLogAlertArgsBuilder()
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(): ActivityLogAlert {
val builtJavaResource = com.pulumi.azure.monitoring.ActivityLogAlert(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ActivityLogAlert(builtJavaResource)
}
}
/**
* Manages an Activity Log Alert within Azure Monitor.
* ## 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 main = new azure.monitoring.ActionGroup("main", {
* name: "example-actiongroup",
* resourceGroupName: example.name,
* shortName: "p0action",
* webhookReceivers: [{
* name: "callmyapi",
* serviceUri: "http://example.com/alert",
* }],
* });
* const toMonitor = new azure.storage.Account("to_monitor", {
* name: "examplesa",
* resourceGroupName: example.name,
* location: example.location,
* accountTier: "Standard",
* accountReplicationType: "GRS",
* });
* const mainActivityLogAlert = new azure.monitoring.ActivityLogAlert("main", {
* name: "example-activitylogalert",
* resourceGroupName: example.name,
* scopes: [example.id],
* description: "This alert will monitor a specific storage account updates.",
* criteria: {
* resourceId: toMonitor.id,
* operationName: "Microsoft.Storage/storageAccounts/write",
* category: "Recommendation",
* },
* actions: [{
* actionGroupId: main.id,
* webhookProperties: {
* from: "source",
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* main = azure.monitoring.ActionGroup("main",
* name="example-actiongroup",
* resource_group_name=example.name,
* short_name="p0action",
* webhook_receivers=[azure.monitoring.ActionGroupWebhookReceiverArgs(
* name="callmyapi",
* service_uri="http://example.com/alert",
* )])
* to_monitor = azure.storage.Account("to_monitor",
* name="examplesa",
* resource_group_name=example.name,
* location=example.location,
* account_tier="Standard",
* account_replication_type="GRS")
* main_activity_log_alert = azure.monitoring.ActivityLogAlert("main",
* name="example-activitylogalert",
* resource_group_name=example.name,
* scopes=[example.id],
* description="This alert will monitor a specific storage account updates.",
* criteria=azure.monitoring.ActivityLogAlertCriteriaArgs(
* resource_id=to_monitor.id,
* operation_name="Microsoft.Storage/storageAccounts/write",
* category="Recommendation",
* ),
* actions=[azure.monitoring.ActivityLogAlertActionArgs(
* action_group_id=main.id,
* webhook_properties={
* "from": "source",
* },
* )])
* ```
* ```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 main = new Azure.Monitoring.ActionGroup("main", new()
* {
* Name = "example-actiongroup",
* ResourceGroupName = example.Name,
* ShortName = "p0action",
* WebhookReceivers = new[]
* {
* new Azure.Monitoring.Inputs.ActionGroupWebhookReceiverArgs
* {
* Name = "callmyapi",
* ServiceUri = "http://example.com/alert",
* },
* },
* });
* var toMonitor = new Azure.Storage.Account("to_monitor", new()
* {
* Name = "examplesa",
* ResourceGroupName = example.Name,
* Location = example.Location,
* AccountTier = "Standard",
* AccountReplicationType = "GRS",
* });
* var mainActivityLogAlert = new Azure.Monitoring.ActivityLogAlert("main", new()
* {
* Name = "example-activitylogalert",
* ResourceGroupName = example.Name,
* Scopes = new[]
* {
* example.Id,
* },
* Description = "This alert will monitor a specific storage account updates.",
* Criteria = new Azure.Monitoring.Inputs.ActivityLogAlertCriteriaArgs
* {
* ResourceId = toMonitor.Id,
* OperationName = "Microsoft.Storage/storageAccounts/write",
* Category = "Recommendation",
* },
* Actions = new[]
* {
* new Azure.Monitoring.Inputs.ActivityLogAlertActionArgs
* {
* ActionGroupId = main.Id,
* WebhookProperties =
* {
* { "from", "source" },
* },
* },
* },
* });
* });
* ```
* ```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-azure/sdk/v5/go/azure/storage"
* "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
* }
* main, err := monitoring.NewActionGroup(ctx, "main", &monitoring.ActionGroupArgs{
* Name: pulumi.String("example-actiongroup"),
* ResourceGroupName: example.Name,
* ShortName: pulumi.String("p0action"),
* WebhookReceivers: monitoring.ActionGroupWebhookReceiverArray{
* &monitoring.ActionGroupWebhookReceiverArgs{
* Name: pulumi.String("callmyapi"),
* ServiceUri: pulumi.String("http://example.com/alert"),
* },
* },
* })
* if err != nil {
* return err
* }
* toMonitor, err := storage.NewAccount(ctx, "to_monitor", &storage.AccountArgs{
* Name: pulumi.String("examplesa"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("GRS"),
* })
* if err != nil {
* return err
* }
* _, err = monitoring.NewActivityLogAlert(ctx, "main", &monitoring.ActivityLogAlertArgs{
* Name: pulumi.String("example-activitylogalert"),
* ResourceGroupName: example.Name,
* Scopes: pulumi.StringArray{
* example.ID(),
* },
* Description: pulumi.String("This alert will monitor a specific storage account updates."),
* Criteria: &monitoring.ActivityLogAlertCriteriaArgs{
* ResourceId: toMonitor.ID(),
* OperationName: pulumi.String("Microsoft.Storage/storageAccounts/write"),
* Category: pulumi.String("Recommendation"),
* },
* Actions: monitoring.ActivityLogAlertActionArray{
* &monitoring.ActivityLogAlertActionArgs{
* ActionGroupId: main.ID(),
* WebhookProperties: pulumi.StringMap{
* "from": pulumi.String("source"),
* },
* },
* },
* })
* 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.ActionGroup;
* import com.pulumi.azure.monitoring.ActionGroupArgs;
* import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
* import com.pulumi.azure.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.monitoring.ActivityLogAlert;
* import com.pulumi.azure.monitoring.ActivityLogAlertArgs;
* import com.pulumi.azure.monitoring.inputs.ActivityLogAlertCriteriaArgs;
* import com.pulumi.azure.monitoring.inputs.ActivityLogAlertActionArgs;
* 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 main = new ActionGroup("main", ActionGroupArgs.builder()
* .name("example-actiongroup")
* .resourceGroupName(example.name())
* .shortName("p0action")
* .webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
* .name("callmyapi")
* .serviceUri("http://example.com/alert")
* .build())
* .build());
* var toMonitor = new Account("toMonitor", AccountArgs.builder()
* .name("examplesa")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountReplicationType("GRS")
* .build());
* var mainActivityLogAlert = new ActivityLogAlert("mainActivityLogAlert", ActivityLogAlertArgs.builder()
* .name("example-activitylogalert")
* .resourceGroupName(example.name())
* .scopes(example.id())
* .description("This alert will monitor a specific storage account updates.")
* .criteria(ActivityLogAlertCriteriaArgs.builder()
* .resourceId(toMonitor.id())
* .operationName("Microsoft.Storage/storageAccounts/write")
* .category("Recommendation")
* .build())
* .actions(ActivityLogAlertActionArgs.builder()
* .actionGroupId(main.id())
* .webhookProperties(Map.of("from", "source"))
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* main:
* type: azure:monitoring:ActionGroup
* properties:
* name: example-actiongroup
* resourceGroupName: ${example.name}
* shortName: p0action
* webhookReceivers:
* - name: callmyapi
* serviceUri: http://example.com/alert
* toMonitor:
* type: azure:storage:Account
* name: to_monitor
* properties:
* name: examplesa
* resourceGroupName: ${example.name}
* location: ${example.location}
* accountTier: Standard
* accountReplicationType: GRS
* mainActivityLogAlert:
* type: azure:monitoring:ActivityLogAlert
* name: main
* properties:
* name: example-activitylogalert
* resourceGroupName: ${example.name}
* scopes:
* - ${example.id}
* description: This alert will monitor a specific storage account updates.
* criteria:
* resourceId: ${toMonitor.id}
* operationName: Microsoft.Storage/storageAccounts/write
* category: Recommendation
* actions:
* - actionGroupId: ${main.id}
* webhookProperties:
* from: source
* ```
*
* ## Import
* Activity log alerts can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:monitoring/activityLogAlert:ActivityLogAlert example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/activityLogAlerts/myalertname
* ```
*/
public class ActivityLogAlert internal constructor(
override val javaResource: com.pulumi.azure.monitoring.ActivityLogAlert,
) : KotlinCustomResource(javaResource, ActivityLogAlertMapper) {
/**
* One or more `action` blocks as defined below.
*/
public val actions: Output>?
get() = javaResource.actions().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> activityLogAlertActionToKotlin(args0) })
})
}).orElse(null)
})
/**
* A `criteria` block as defined below.
*/
public val criteria: Output
get() = javaResource.criteria().applyValue({ args0 ->
args0.let({ args0 ->
activityLogAlertCriteriaToKotlin(args0)
})
})
/**
* The description of this activity log alert.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Should this Activity Log Alert be enabled? Defaults to `true`.
*/
public val enabled: Output?
get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The Azure Region where the activity log alert rule should exist. Changing this forces a new resource to be created. Defaults to `global`.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The name of the activity log alert. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which to create the activity log alert instance. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* The Scope at which the Activity Log should be applied. A list of strings which could be a resource group , or a subscription, or a resource ID (such as a Storage Account).
*/
public val scopes: Output>
get() = javaResource.scopes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output
© 2015 - 2025 Weber Informatics LLC | Privacy Policy