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

com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName Maven / Gradle / Ivy

There is a newer version: 2.72.0
Show newest version
// *** 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.alertsmanagement;

import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
import com.pulumi.azurenative.alertsmanagement.outputs.AlertProcessingRulePropertiesResponse;
import com.pulumi.azurenative.alertsmanagement.outputs.SystemDataResponse;
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.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Alert processing rule object containing target scopes, conditions and scheduling logic.
 * Azure REST API version: 2021-08-08.
 * 
 * Other available API versions: 2023-05-01-preview, 2024-03-01-preview.
 * 
 * ## Example Usage
 * ### Create or update a rule that adds an action group to all alerts in a subscription
 * 
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("AddActionGroupToSubscription")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(AddActionGroupsArgs.builder()
 *                     .actionGroupIds("/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/ActionGroup1")
 *                     .actionType("AddActionGroups")
 *                     .build())
 *                 .description("Add ActionGroup1 to all alerts in the subscription")
 *                 .enabled(true)
 *                 .scopes("/subscriptions/subId1")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* ### Create or update a rule that adds two action groups to all Sev0 and Sev1 alerts in two resource groups * *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("AddActionGroupsBySeverity")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(AddActionGroupsArgs.builder()
 *                     .actionGroupIds(                    
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId1",
 *                         "/subscriptions/subId1/resourcegroups/RGId1/providers/microsoft.insights/actiongroups/AGId2")
 *                     .actionType("AddActionGroups")
 *                     .build())
 *                 .conditions(ConditionArgs.builder()
 *                     .field("Severity")
 *                     .operator("Equals")
 *                     .values(                    
 *                         "sev0",
 *                         "sev1")
 *                     .build())
 *                 .description("Add AGId1 and AGId2 to all Sev0 and Sev1 alerts in these resourceGroups")
 *                 .enabled(true)
 *                 .scopes(                
 *                     "/subscriptions/subId1/resourceGroups/RGId1",
 *                     "/subscriptions/subId1/resourceGroups/RGId2")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* ### Create or update a rule that removes all action groups from alerts on a specific VM during a one-off maintenance window (1800-2000 at a specific date, Pacific Standard Time) * *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.ScheduleArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsMaintenanceWindow")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .description("Removes all ActionGroups from all Alerts on VMName during the maintenance window")
 *                 .enabled(true)
 *                 .schedule(ScheduleArgs.builder()
 *                     .effectiveFrom("2021-04-15T18:00:00")
 *                     .effectiveUntil("2021-04-15T20:00:00")
 *                     .timeZone("Pacific Standard Time")
 *                     .build())
 *                 .scopes("/subscriptions/subId1/resourceGroups/RGId1/providers/Microsoft.Compute/virtualMachines/VMName")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* ### Create or update a rule that removes all action groups from all alerts in a subscription coming from a specific alert rule * *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsSpecificAlertRule")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .conditions(ConditionArgs.builder()
 *                     .field("AlertRuleId")
 *                     .operator("Equals")
 *                     .values("/subscriptions/suubId1/resourceGroups/Rgid2/providers/microsoft.insights/activityLogAlerts/RuleName")
 *                     .build())
 *                 .description("Removes all ActionGroups from all Alerts that fire on above AlertRule")
 *                 .enabled(true)
 *                 .scopes("/subscriptions/subId1")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* ### Create or update a rule that removes all action groups from all alerts on any VM in two resource groups during a recurring maintenance window (2200-0400 every Sat and Sun, India Standard Time) * *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.ScheduleArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsRecurringMaintenance")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .conditions(ConditionArgs.builder()
 *                     .field("TargetResourceType")
 *                     .operator("Equals")
 *                     .values("microsoft.compute/virtualmachines")
 *                     .build())
 *                 .description("Remove all ActionGroups from all Vitual machine Alerts during the recurring maintenance")
 *                 .enabled(true)
 *                 .schedule(ScheduleArgs.builder()
 *                     .recurrences(WeeklyRecurrenceArgs.builder()
 *                         .daysOfWeek(                        
 *                             "Saturday",
 *                             "Sunday")
 *                         .endTime("04:00:00")
 *                         .recurrenceType("Weekly")
 *                         .startTime("22:00:00")
 *                         .build())
 *                     .timeZone("India Standard Time")
 *                     .build())
 *                 .scopes(                
 *                     "/subscriptions/subId1/resourceGroups/RGId1",
 *                     "/subscriptions/subId1/resourceGroups/RGId2")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* ### Create or update a rule that removes all action groups outside business hours (Mon-Fri 09:00-17:00, Eastern Standard Time) * *
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByName;
 * import com.pulumi.azurenative.alertsmanagement.AlertProcessingRuleByNameArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.AlertProcessingRulePropertiesArgs;
 * import com.pulumi.azurenative.alertsmanagement.inputs.ScheduleArgs;
 * 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 alertProcessingRuleByName = new AlertProcessingRuleByName("alertProcessingRuleByName", AlertProcessingRuleByNameArgs.builder()
 *             .alertProcessingRuleName("RemoveActionGroupsOutsideBusinessHours")
 *             .location("Global")
 *             .properties(AlertProcessingRulePropertiesArgs.builder()
 *                 .actions(RemoveAllActionGroupsArgs.builder()
 *                     .actionType("RemoveAllActionGroups")
 *                     .build())
 *                 .description("Remove all ActionGroups outside business hours")
 *                 .enabled(true)
 *                 .schedule(ScheduleArgs.builder()
 *                     .recurrences(                    
 *                         DailyRecurrenceArgs.builder()
 *                             .endTime("09:00:00")
 *                             .recurrenceType("Daily")
 *                             .startTime("17:00:00")
 *                             .build(),
 *                         WeeklyRecurrenceArgs.builder()
 *                             .daysOfWeek(                            
 *                                 "Saturday",
 *                                 "Sunday")
 *                             .recurrenceType("Weekly")
 *                             .build())
 *                     .timeZone("Eastern Standard Time")
 *                     .build())
 *                 .scopes("/subscriptions/subId1")
 *                 .build())
 *             .resourceGroupName("alertscorrelationrg")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* * ## Import * * An existing resource can be imported using its type token, name, and identifier, e.g. * * ```sh * $ pulumi import azure-native:alertsmanagement:AlertProcessingRuleByName RemoveActionGroupsOutsideBusinessHours /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/actionRules/{alertProcessingRuleName} * ``` * */ @ResourceType(type="azure-native:alertsmanagement:AlertProcessingRuleByName") public class AlertProcessingRuleByName extends com.pulumi.resources.CustomResource { /** * Resource location * */ @Export(name="location", refs={String.class}, tree="[0]") private Output location; /** * @return Resource location * */ public Output location() { return this.location; } /** * Azure resource name * */ @Export(name="name", refs={String.class}, tree="[0]") private Output name; /** * @return Azure resource name * */ public Output name() { return this.name; } /** * Alert processing rule properties. * */ @Export(name="properties", refs={AlertProcessingRulePropertiesResponse.class}, tree="[0]") private Output properties; /** * @return Alert processing rule properties. * */ public Output properties() { return this.properties; } /** * Alert processing rule system data. * */ @Export(name="systemData", refs={SystemDataResponse.class}, tree="[0]") private Output systemData; /** * @return Alert processing rule system data. * */ public Output systemData() { return this.systemData; } /** * Resource tags * */ @Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]") private Output> tags; /** * @return Resource tags * */ public Output>> tags() { return Codegen.optional(this.tags); } /** * Azure resource type * */ @Export(name="type", refs={String.class}, tree="[0]") private Output type; /** * @return Azure resource type * */ public Output type() { return this.type; } /** * * @param name The _unique_ name of the resulting resource. */ public AlertProcessingRuleByName(java.lang.String name) { this(name, AlertProcessingRuleByNameArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public AlertProcessingRuleByName(java.lang.String name, AlertProcessingRuleByNameArgs 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 AlertProcessingRuleByName(java.lang.String name, AlertProcessingRuleByNameArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:alertsmanagement:AlertProcessingRuleByName", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private AlertProcessingRuleByName(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:alertsmanagement:AlertProcessingRuleByName", name, null, makeResourceOptions(options, id), false); } private static AlertProcessingRuleByNameArgs makeArgs(AlertProcessingRuleByNameArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AlertProcessingRuleByNameArgs.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:alertsmanagement/v20181102privatepreview:AlertProcessingRuleByName").build()), Output.of(Alias.builder().type("azure-native:alertsmanagement/v20190505preview:AlertProcessingRuleByName").build()), Output.of(Alias.builder().type("azure-native:alertsmanagement/v20210808:AlertProcessingRuleByName").build()), Output.of(Alias.builder().type("azure-native:alertsmanagement/v20210808preview:AlertProcessingRuleByName").build()), Output.of(Alias.builder().type("azure-native:alertsmanagement/v20230501preview:AlertProcessingRuleByName").build()), Output.of(Alias.builder().type("azure-native:alertsmanagement/v20240301preview:AlertProcessingRuleByName").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 AlertProcessingRuleByName get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new AlertProcessingRuleByName(name, id, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy