com.pulumi.azure.monitoring.ActivityLogAlert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure Show documentation
Show all versions of azure Show documentation
A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.azure.monitoring;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.monitoring.ActivityLogAlertArgs;
import com.pulumi.azure.monitoring.inputs.ActivityLogAlertState;
import com.pulumi.azure.monitoring.outputs.ActivityLogAlertAction;
import com.pulumi.azure.monitoring.outputs.ActivityLogAlertCriteria;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages an Activity Log Alert within Azure Monitor.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* 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())
* .location(example.location())
* .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());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## 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
* ```
*
*/
@ResourceType(type="azure:monitoring/activityLogAlert:ActivityLogAlert")
public class ActivityLogAlert extends com.pulumi.resources.CustomResource {
/**
* One or more `action` blocks as defined below.
*
*/
@Export(name="actions", refs={List.class,ActivityLogAlertAction.class}, tree="[0,1]")
private Output* @Nullable */ List> actions;
/**
* @return One or more `action` blocks as defined below.
*
*/
public Output>> actions() {
return Codegen.optional(this.actions);
}
/**
* A `criteria` block as defined below.
*
*/
@Export(name="criteria", refs={ActivityLogAlertCriteria.class}, tree="[0]")
private Output criteria;
/**
* @return A `criteria` block as defined below.
*
*/
public Output criteria() {
return this.criteria;
}
/**
* The description of this activity log alert.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return The description of this activity log alert.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* Should this Activity Log Alert be enabled? Defaults to `true`.
*
*/
@Export(name="enabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> enabled;
/**
* @return Should this Activity Log Alert be enabled? Defaults to `true`.
*
*/
public Output> enabled() {
return Codegen.optional(this.enabled);
}
/**
* The Azure Region where the activity log alert rule should exist. Changing this forces a new resource to be created.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return The Azure Region where the activity log alert rule should exist. Changing this forces a new resource to be created.
*
*/
public Output location() {
return this.location;
}
/**
* The name of the activity log alert. Changing this forces a new resource to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the activity log alert. Changing this forces a new resource to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The name of the resource group in which to create the activity log alert instance. Changing this forces a new resource to be created.
*
*/
@Export(name="resourceGroupName", refs={String.class}, tree="[0]")
private Output resourceGroupName;
/**
* @return 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 Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* 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).
*
*/
@Export(name="scopes", refs={List.class,String.class}, tree="[0,1]")
private Output> scopes;
/**
* @return 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 Output> scopes() {
return this.scopes;
}
/**
* A mapping of tags to assign to the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A mapping of tags to assign to the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public ActivityLogAlert(java.lang.String name) {
this(name, ActivityLogAlertArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public ActivityLogAlert(java.lang.String name, ActivityLogAlertArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public ActivityLogAlert(java.lang.String name, ActivityLogAlertArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:monitoring/activityLogAlert:ActivityLogAlert", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ActivityLogAlert(java.lang.String name, Output id, @Nullable ActivityLogAlertState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:monitoring/activityLogAlert:ActivityLogAlert", name, state, makeResourceOptions(options, id), false);
}
private static ActivityLogAlertArgs makeArgs(ActivityLogAlertArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? ActivityLogAlertArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static ActivityLogAlert get(java.lang.String name, Output id, @Nullable ActivityLogAlertState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ActivityLogAlert(name, id, state, options);
}
}