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

com.pulumi.azurenative.insights.AlertRule Maven / Gradle / Ivy

There is a newer version: 2.78.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.insights;

import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.insights.AlertRuleArgs;
import com.pulumi.azurenative.insights.outputs.LocationThresholdRuleConditionResponse;
import com.pulumi.azurenative.insights.outputs.ManagementEventRuleConditionResponse;
import com.pulumi.azurenative.insights.outputs.RuleEmailActionResponse;
import com.pulumi.azurenative.insights.outputs.RuleWebhookActionResponse;
import com.pulumi.azurenative.insights.outputs.ThresholdRuleConditionResponse;
import com.pulumi.core.Alias;
import com.pulumi.core.Either;
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.Object;
import java.lang.String;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * The alert rule resource.
 * Azure REST API version: 2016-03-01. Prior API version in Azure Native 1.x: 2016-03-01.
 * 
 * ## Example Usage
 * ### Create or update an alert rule
 * 
 * 
 * {@code
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azurenative.insights.AlertRule;
 * import com.pulumi.azurenative.insights.AlertRuleArgs;
 * 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 alertRule = new AlertRule("alertRule", AlertRuleArgs.builder()
 *             .actions()
 *             .condition(LocationThresholdRuleConditionArgs.builder()
 *                 .dataSource(RuleManagementEventDataSourceArgs.builder()
 *                     .metricName("Requests")
 *                     .odataType("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource")
 *                     .resourceUri("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest")
 *                     .build())
 *                 .odataType("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition")
 *                 .operator("GreaterThan")
 *                 .threshold(3)
 *                 .timeAggregation("Total")
 *                 .windowSize("PT5M")
 *                 .build())
 *             .description("Pura Vida")
 *             .isEnabled(true)
 *             .location("West US")
 *             .name("chiricutin")
 *             .resourceGroupName("Rac46PostSwapRG")
 *             .ruleName("chiricutin")
 *             .tags()
 *             .build());
 * 
 *     }
 * }
 * 
 * }
 * 
* * ## Import * * An existing resource can be imported using its type token, name, and identifier, e.g. * * ```sh * $ pulumi import azure-native:insights:AlertRule chiricutin /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName} * ``` * */ @ResourceType(type="azure-native:insights:AlertRule") public class AlertRule extends com.pulumi.resources.CustomResource { /** * action that is performed when the alert rule becomes active, and when an alert condition is resolved. * */ @Export(name="action", refs={Either.class,RuleEmailActionResponse.class,RuleWebhookActionResponse.class}, tree="[0,1,2]") private Output> action; /** * @return action that is performed when the alert rule becomes active, and when an alert condition is resolved. * */ public Output>> action() { return Codegen.optional(this.action); } /** * the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. * */ @Export(name="actions", refs={List.class,Either.class,RuleEmailActionResponse.class,RuleWebhookActionResponse.class}, tree="[0,[1,2,3]]") private Output>> actions; /** * @return the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. * */ public Output>>> actions() { return Codegen.optional(this.actions); } /** * the condition that results in the alert rule being activated. * */ @Export(name="condition", refs={Object.class}, tree="[0]") private Output condition; /** * @return the condition that results in the alert rule being activated. * */ public Output condition() { return this.condition; } /** * the description of the alert rule that will be included in the alert email. * */ @Export(name="description", refs={String.class}, tree="[0]") private Output description; /** * @return the description of the alert rule that will be included in the alert email. * */ public Output> description() { return Codegen.optional(this.description); } /** * the flag that indicates whether the alert rule is enabled. * */ @Export(name="isEnabled", refs={Boolean.class}, tree="[0]") private Output isEnabled; /** * @return the flag that indicates whether the alert rule is enabled. * */ public Output isEnabled() { return this.isEnabled; } /** * Last time the rule was updated in ISO8601 format. * */ @Export(name="lastUpdatedTime", refs={String.class}, tree="[0]") private Output lastUpdatedTime; /** * @return Last time the rule was updated in ISO8601 format. * */ public Output lastUpdatedTime() { return this.lastUpdatedTime; } /** * 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; } /** * the provisioning state. * */ @Export(name="provisioningState", refs={String.class}, tree="[0]") private Output provisioningState; /** * @return the provisioning state. * */ public Output> provisioningState() { return Codegen.optional(this.provisioningState); } /** * 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 AlertRule(java.lang.String name) { this(name, AlertRuleArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public AlertRule(java.lang.String name, AlertRuleArgs 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 AlertRule(java.lang.String name, AlertRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:insights:AlertRule", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private AlertRule(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure-native:insights:AlertRule", name, null, makeResourceOptions(options, id), false); } private static AlertRuleArgs makeArgs(AlertRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? AlertRuleArgs.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/v20140401:AlertRule").build()), Output.of(Alias.builder().type("azure-native:insights/v20160301:AlertRule").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 AlertRule get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new AlertRule(name, id, options); } }