com.pulumi.azurenative.alertsmanagement.SmartDetectorAlertRule 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.alertsmanagement;
import com.pulumi.azurenative.Utilities;
import com.pulumi.azurenative.alertsmanagement.SmartDetectorAlertRuleArgs;
import com.pulumi.azurenative.alertsmanagement.outputs.ActionGroupsInformationResponse;
import com.pulumi.azurenative.alertsmanagement.outputs.DetectorResponse;
import com.pulumi.azurenative.alertsmanagement.outputs.ThrottlingInformationResponse;
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;
/**
* The alert rule information
* Azure REST API version: 2021-04-01. Prior API version in Azure Native 1.x: 2019-06-01.
*
* ## Example Usage
* ### Create or update a Smart Detector alert rule
*
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azurenative.alertsmanagement.SmartDetectorAlertRule;
* import com.pulumi.azurenative.alertsmanagement.SmartDetectorAlertRuleArgs;
* import com.pulumi.azurenative.alertsmanagement.inputs.ActionGroupsInformationArgs;
* import com.pulumi.azurenative.alertsmanagement.inputs.DetectorArgs;
* import com.pulumi.azurenative.alertsmanagement.inputs.ThrottlingInformationArgs;
* 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 smartDetectorAlertRule = new SmartDetectorAlertRule("smartDetectorAlertRule", SmartDetectorAlertRuleArgs.builder()
* .actionGroups(ActionGroupsInformationArgs.builder()
* .customEmailSubject("My custom email subject")
* .customWebhookPayload("{\"AlertRuleName\":\"#alertrulename\"}")
* .groupIds("/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourcegroups/actionGroups/providers/microsoft.insights/actiongroups/MyActionGroup")
* .build())
* .alertRuleName("MyAlertRule")
* .description("Sample smart detector alert rule description")
* .detector(DetectorArgs.builder()
* .id("VMMemoryLeak")
* .build())
* .frequency("PT5M")
* .resourceGroupName("MyAlertRules")
* .scope("/subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/MyVms/providers/Microsoft.Compute/virtualMachines/vm1")
* .severity("Sev3")
* .state("Enabled")
* .throttling(ThrottlingInformationArgs.builder()
* .duration("PT20M")
* .build())
* .build());
*
* }
* }
*
* }
*
*
* ## Import
*
* An existing resource can be imported using its type token, name, and identifier, e.g.
*
* ```sh
* $ pulumi import azure-native:alertsmanagement:SmartDetectorAlertRule MyAlertRule /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.alertsManagement/smartDetectorAlertRules/{alertRuleName}
* ```
*
*/
@ResourceType(type="azure-native:alertsmanagement:SmartDetectorAlertRule")
public class SmartDetectorAlertRule extends com.pulumi.resources.CustomResource {
/**
* The alert rule actions.
*
*/
@Export(name="actionGroups", refs={ActionGroupsInformationResponse.class}, tree="[0]")
private Output actionGroups;
/**
* @return The alert rule actions.
*
*/
public Output actionGroups() {
return this.actionGroups;
}
/**
* The alert rule description.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return The alert rule description.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* The alert rule's detector.
*
*/
@Export(name="detector", refs={DetectorResponse.class}, tree="[0]")
private Output detector;
/**
* @return The alert rule's detector.
*
*/
public Output detector() {
return this.detector;
}
/**
* The alert rule frequency in ISO8601 format. The time granularity must be in minutes and minimum value is 1 minute, depending on the detector.
*
*/
@Export(name="frequency", refs={String.class}, tree="[0]")
private Output frequency;
/**
* @return The alert rule frequency in ISO8601 format. The time granularity must be in minutes and minimum value is 1 minute, depending on the detector.
*
*/
public Output frequency() {
return this.frequency;
}
/**
* The resource location.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> location;
/**
* @return The resource location.
*
*/
public Output> location() {
return Codegen.optional(this.location);
}
/**
* The resource name.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The resource name.
*
*/
public Output name() {
return this.name;
}
/**
* The alert rule resources scope.
*
*/
@Export(name="scope", refs={List.class,String.class}, tree="[0,1]")
private Output> scope;
/**
* @return The alert rule resources scope.
*
*/
public Output> scope() {
return this.scope;
}
/**
* The alert rule severity.
*
*/
@Export(name="severity", refs={String.class}, tree="[0]")
private Output severity;
/**
* @return The alert rule severity.
*
*/
public Output severity() {
return this.severity;
}
/**
* The alert rule state.
*
*/
@Export(name="state", refs={String.class}, tree="[0]")
private Output state;
/**
* @return The alert rule state.
*
*/
public Output state() {
return this.state;
}
/**
* The resource tags.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return The resource tags.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
* The alert rule throttling information.
*
*/
@Export(name="throttling", refs={ThrottlingInformationResponse.class}, tree="[0]")
private Output* @Nullable */ ThrottlingInformationResponse> throttling;
/**
* @return The alert rule throttling information.
*
*/
public Output> throttling() {
return Codegen.optional(this.throttling);
}
/**
* The resource type.
*
*/
@Export(name="type", refs={String.class}, tree="[0]")
private Output type;
/**
* @return The resource type.
*
*/
public Output type() {
return this.type;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public SmartDetectorAlertRule(java.lang.String name) {
this(name, SmartDetectorAlertRuleArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public SmartDetectorAlertRule(java.lang.String name, SmartDetectorAlertRuleArgs 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 SmartDetectorAlertRule(java.lang.String name, SmartDetectorAlertRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:alertsmanagement:SmartDetectorAlertRule", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private SmartDetectorAlertRule(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure-native:alertsmanagement:SmartDetectorAlertRule", name, null, makeResourceOptions(options, id), false);
}
private static SmartDetectorAlertRuleArgs makeArgs(SmartDetectorAlertRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? SmartDetectorAlertRuleArgs.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/v20190301:SmartDetectorAlertRule").build()),
Output.of(Alias.builder().type("azure-native:alertsmanagement/v20190601:SmartDetectorAlertRule").build()),
Output.of(Alias.builder().type("azure-native:alertsmanagement/v20210401:SmartDetectorAlertRule").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 SmartDetectorAlertRule get(java.lang.String name, Output id, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new SmartDetectorAlertRule(name, id, options);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy