com.pulumi.azurenative.insights.ActivityLogAlert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-native Show documentation
Show all versions of azure-native Show documentation
A native Pulumi package for creating and managing Azure resources.
// *** 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.azurenative.insights;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.insights.ActivityLogAlertArgs;
import com.pulumi.azurenative.insights.outputs.ActionListResponse;
import com.pulumi.azurenative.insights.outputs.AlertRuleAllOfConditionResponse;
import com.pulumi.core.Alias;
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;
/**
* An Activity Log Alert rule resource.
* Azure REST API version: 2020-10-01. Prior API version in Azure Native 1.x: 2020-10-01.
*
* Other available API versions: 2017-04-01, 2023-01-01-preview.
*
* ## Example Usage
* ### Create or update an Activity Log Alert rule
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.insights.ActivityLogAlert;
* import com.pulumi.azurenative.insights.ActivityLogAlertArgs;
* import com.pulumi.azurenative.insights.inputs.ActionListArgs;
* import com.pulumi.azurenative.insights.inputs.AlertRuleAllOfConditionArgs;
* 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 activityLogAlert = new ActivityLogAlert("activityLogAlert", ActivityLogAlertArgs.builder()
* .actions(ActionListArgs.builder()
* .actionGroups(ActionGroupArgs.builder()
* .actionGroupId("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup")
* .webhookProperties(Map.of("sampleWebhookProperty", "SamplePropertyValue"))
* .build())
* .build())
* .activityLogAlertName("SampleActivityLogAlertRule")
* .condition(AlertRuleAllOfConditionArgs.builder()
* .allOf(
* AlertRuleAnyOfOrLeafConditionArgs.builder()
* .equals("Administrative")
* .field("category")
* .build(),
* AlertRuleAnyOfOrLeafConditionArgs.builder()
* .equals("Error")
* .field("level")
* .build())
* .build())
* .description("Description of sample Activity Log Alert rule.")
* .enabled(true)
* .location("Global")
* .resourceGroupName("MyResourceGroup")
* .scopes("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")
* .tags()
* .build());
*
* }
* }
*
* }
*
* ### Create or update an Activity Log Alert rule with 'anyOf' condition
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.insights.ActivityLogAlert;
* import com.pulumi.azurenative.insights.ActivityLogAlertArgs;
* import com.pulumi.azurenative.insights.inputs.ActionListArgs;
* import com.pulumi.azurenative.insights.inputs.AlertRuleAllOfConditionArgs;
* 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 activityLogAlert = new ActivityLogAlert("activityLogAlert", ActivityLogAlertArgs.builder()
* .actions(ActionListArgs.builder()
* .actionGroups(ActionGroupArgs.builder()
* .actionGroupId("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup")
* .webhookProperties(Map.of("sampleWebhookProperty", "SamplePropertyValue"))
* .build())
* .build())
* .activityLogAlertName("SampleActivityLogAlertRuleWithAnyOfCondition")
* .condition(AlertRuleAllOfConditionArgs.builder()
* .allOf(
* AlertRuleAnyOfOrLeafConditionArgs.builder()
* .equals("ServiceHealth")
* .field("category")
* .build(),
* AlertRuleAnyOfOrLeafConditionArgs.builder()
* .anyOf(
* AlertRuleLeafConditionArgs.builder()
* .equals("Incident")
* .field("properties.incidentType")
* .build(),
* AlertRuleLeafConditionArgs.builder()
* .equals("Maintenance")
* .field("properties.incidentType")
* .build())
* .build())
* .build())
* .description("Description of sample Activity Log Alert rule with 'anyOf' condition.")
* .enabled(true)
* .location("Global")
* .resourceGroupName("MyResourceGroup")
* .scopes("subscriptions/187f412d-1758-44d9-b052-169e2564721d")
* .tags()
* .build());
*
* }
* }
*
* }
*
* ### Create or update an Activity Log Alert rule with 'containsAny'
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.insights.ActivityLogAlert;
* import com.pulumi.azurenative.insights.ActivityLogAlertArgs;
* import com.pulumi.azurenative.insights.inputs.ActionListArgs;
* import com.pulumi.azurenative.insights.inputs.AlertRuleAllOfConditionArgs;
* 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 activityLogAlert = new ActivityLogAlert("activityLogAlert", ActivityLogAlertArgs.builder()
* .actions(ActionListArgs.builder()
* .actionGroups(ActionGroupArgs.builder()
* .actionGroupId("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup")
* .webhookProperties(Map.of("sampleWebhookProperty", "SamplePropertyValue"))
* .build())
* .build())
* .activityLogAlertName("SampleActivityLogAlertRuleWithContainsAny")
* .condition(AlertRuleAllOfConditionArgs.builder()
* .allOf(
* AlertRuleAnyOfOrLeafConditionArgs.builder()
* .equals("ServiceHealth")
* .field("category")
* .build(),
* AlertRuleAnyOfOrLeafConditionArgs.builder()
* .containsAny(
* "North Europe",
* "West Europe")
* .field("properties.impactedServices[*].ImpactedRegions[*].RegionName")
* .build())
* .build())
* .description("Description of sample Activity Log Alert rule with 'containsAny'.")
* .enabled(true)
* .location("Global")
* .resourceGroupName("MyResourceGroup")
* .scopes("subscriptions/187f412d-1758-44d9-b052-169e2564721d")
* .tags()
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:insights:ActivityLogAlert SampleActivityLogAlertRuleWithContainsAny /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}
* ```
*
*/
@ResourceType(type="azure-native:insights:ActivityLogAlert")
public class ActivityLogAlert extends com.pulumi.resources.CustomResource {
/**
* The actions that will activate when the condition is met.
*
*/
@Export(name="actions", refs={ActionListResponse.class}, tree="[0]")
private Output actions;
/**
* @return The actions that will activate when the condition is met.
*
*/
public Output actions() {
return this.actions;
}
/**
* The condition that will cause this alert to activate.
*
*/
@Export(name="condition", refs={AlertRuleAllOfConditionResponse.class}, tree="[0]")
private Output condition;
/**
* @return The condition that will cause this alert to activate.
*
*/
public Output condition() {
return this.condition;
}
/**
* A description of this Activity Log Alert rule.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return A description of this Activity Log Alert rule.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated.
*
*/
@Export(name="enabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> enabled;
/**
* @return Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its actions will be activated.
*
*/
public Output> enabled() {
return Codegen.optional(this.enabled);
}
/**
* The location of the resource. Azure Activity Log Alert rules are supported on Global, West Europe and North Europe regions.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> location;
/**
* @return The location of the resource. Azure Activity Log Alert rules are supported on Global, West Europe and North Europe regions.
*
*/
public Output> location() {
return Codegen.optional(this.location);
}
/**
* The name of the resource.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the resource.
*
*/
public Output name() {
return this.name;
}
/**
* A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one item.
*
*/
@Export(name="scopes", refs={List.class,String.class}, tree="[0,1]")
private Output> scopes;
/**
* @return A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one item.
*
*/
public Output> scopes() {
return this.scopes;
}
/**
* The tags of the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return The tags of the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* The type of the resource.
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return The type of the resource.
*
*/
public Output type() {
return this.type;
}
/**
*
* @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-native:insights:ActivityLogAlert", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private ActivityLogAlert(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:insights:ActivityLogAlert", name, null, 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())
.aliases(List.of(
Output.of(Alias.builder().type("azure-native:insights/v20170401:ActivityLogAlert").build()),
Output.of(Alias.builder().type("azure-native:insights/v20201001:ActivityLogAlert").build()),
Output.of(Alias.builder().type("azure-native:insights/v20230101preview:ActivityLogAlert").build())
))
.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 options Optional settings to control the behavior of the CustomResource.
*/
public static ActivityLogAlert get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new ActivityLogAlert(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy