com.pulumi.azure.sentinel.AutomationRule 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.sentinel;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.sentinel.AutomationRuleArgs;
import com.pulumi.azure.sentinel.inputs.AutomationRuleState;
import com.pulumi.azure.sentinel.outputs.AutomationRuleActionIncident;
import com.pulumi.azure.sentinel.outputs.AutomationRuleActionPlaybook;
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.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Manages a Sentinel Automation Rule.
*
* ## 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.operationalinsights.AnalyticsWorkspace;
* import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
* import com.pulumi.azure.sentinel.LogAnalyticsWorkspaceOnboarding;
* import com.pulumi.azure.sentinel.LogAnalyticsWorkspaceOnboardingArgs;
* import com.pulumi.azure.sentinel.AutomationRule;
* import com.pulumi.azure.sentinel.AutomationRuleArgs;
* import com.pulumi.azure.sentinel.inputs.AutomationRuleActionIncidentArgs;
* 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-rg")
* .location("west europe")
* .build());
*
* var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
* .name("example-workspace")
* .location(example.location())
* .resourceGroupName(example.name())
* .sku("PerGB2018")
* .build());
*
* var exampleLogAnalyticsWorkspaceOnboarding = new LogAnalyticsWorkspaceOnboarding("exampleLogAnalyticsWorkspaceOnboarding", LogAnalyticsWorkspaceOnboardingArgs.builder()
* .workspaceId(exampleAnalyticsWorkspace.id())
* .build());
*
* var exampleAutomationRule = new AutomationRule("exampleAutomationRule", AutomationRuleArgs.builder()
* .name("56094f72-ac3f-40e7-a0c0-47bd95f70336")
* .logAnalyticsWorkspaceId(exampleLogAnalyticsWorkspaceOnboarding.workspaceId())
* .displayName("automation_rule1")
* .order(1)
* .actionIncidents(AutomationRuleActionIncidentArgs.builder()
* .order(1)
* .status("Active")
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Sentinel Automation Rules can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:sentinel/automationRule:AutomationRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.OperationalInsights/workspaces/workspace1/providers/Microsoft.SecurityInsights/automationRules/rule1
* ```
*
*/
@ResourceType(type="azure:sentinel/automationRule:AutomationRule")
public class AutomationRule extends com.pulumi.resources.CustomResource {
/**
* One or more `action_incident` blocks as defined below.
*
*/
@Export(name="actionIncidents", refs={List.class,AutomationRuleActionIncident.class}, tree="[0,1]")
private Output* @Nullable */ List> actionIncidents;
/**
* @return One or more `action_incident` blocks as defined below.
*
*/
public Output>> actionIncidents() {
return Codegen.optional(this.actionIncidents);
}
/**
* One or more `action_playbook` blocks as defined below.
*
* > **Note:** Either one `action_incident` block or `action_playbook` block has to be specified.
*
*/
@Export(name="actionPlaybooks", refs={List.class,AutomationRuleActionPlaybook.class}, tree="[0,1]")
private Output* @Nullable */ List> actionPlaybooks;
/**
* @return One or more `action_playbook` blocks as defined below.
*
* > **Note:** Either one `action_incident` block or `action_playbook` block has to be specified.
*
*/
public Output>> actionPlaybooks() {
return Codegen.optional(this.actionPlaybooks);
}
/**
* A JSON array of one or more condition JSON objects as is defined [here](https://learn.microsoft.com/en-us/rest/api/securityinsights/preview/automation-rules/create-or-update?tabs=HTTP#automationruletriggeringlogic).
*
*/
@Export(name="conditionJson", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> conditionJson;
/**
* @return A JSON array of one or more condition JSON objects as is defined [here](https://learn.microsoft.com/en-us/rest/api/securityinsights/preview/automation-rules/create-or-update?tabs=HTTP#automationruletriggeringlogic).
*
*/
public Output> conditionJson() {
return Codegen.optional(this.conditionJson);
}
/**
* The display name which should be used for this Sentinel Automation Rule.
*
*/
@Export(name="displayName", refs={String.class}, tree="[0]")
private Output displayName;
/**
* @return The display name which should be used for this Sentinel Automation Rule.
*
*/
public Output displayName() {
return this.displayName;
}
/**
* Whether this Sentinel Automation Rule is enabled? Defaults to `true`.
*
*/
@Export(name="enabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> enabled;
/**
* @return Whether this Sentinel Automation Rule is enabled? Defaults to `true`.
*
*/
public Output> enabled() {
return Codegen.optional(this.enabled);
}
/**
* The time in RFC3339 format of kind `UTC` that determines when this Automation Rule should expire and be disabled.
*
*/
@Export(name="expiration", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> expiration;
/**
* @return The time in RFC3339 format of kind `UTC` that determines when this Automation Rule should expire and be disabled.
*
*/
public Output> expiration() {
return Codegen.optional(this.expiration);
}
/**
* The ID of the Log Analytics Workspace where this Sentinel applies to. Changing this forces a new Sentinel Automation Rule to be created.
*
*/
@Export(name="logAnalyticsWorkspaceId", refs={String.class}, tree="[0]")
private Output logAnalyticsWorkspaceId;
/**
* @return The ID of the Log Analytics Workspace where this Sentinel applies to. Changing this forces a new Sentinel Automation Rule to be created.
*
*/
public Output logAnalyticsWorkspaceId() {
return this.logAnalyticsWorkspaceId;
}
/**
* The UUID which should be used for this Sentinel Automation Rule. Changing this forces a new Sentinel Automation Rule to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The UUID which should be used for this Sentinel Automation Rule. Changing this forces a new Sentinel Automation Rule to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The order of this Sentinel Automation Rule. Possible values varies between `1` and `1000`.
*
*/
@Export(name="order", refs={Integer.class}, tree="[0]")
private Output order;
/**
* @return The order of this Sentinel Automation Rule. Possible values varies between `1` and `1000`.
*
*/
public Output order() {
return this.order;
}
/**
* Specifies what triggers this automation rule. Possible values are `Alerts` and `Incidents`. Defaults to `Incidents`.
*
*/
@Export(name="triggersOn", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> triggersOn;
/**
* @return Specifies what triggers this automation rule. Possible values are `Alerts` and `Incidents`. Defaults to `Incidents`.
*
*/
public Output> triggersOn() {
return Codegen.optional(this.triggersOn);
}
/**
* Specifies when will this automation rule be triggered. Possible values are `Created` and `Updated`. Defaults to `Created`.
*
*/
@Export(name="triggersWhen", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> triggersWhen;
/**
* @return Specifies when will this automation rule be triggered. Possible values are `Created` and `Updated`. Defaults to `Created`.
*
*/
public Output> triggersWhen() {
return Codegen.optional(this.triggersWhen);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public AutomationRule(java.lang.String name) {
this(name, AutomationRuleArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public AutomationRule(java.lang.String name, AutomationRuleArgs 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 AutomationRule(java.lang.String name, AutomationRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:sentinel/automationRule:AutomationRule", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private AutomationRule(java.lang.String name, Output id, @Nullable AutomationRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:sentinel/automationRule:AutomationRule", name, state, makeResourceOptions(options, id), false);
}
private static AutomationRuleArgs makeArgs(AutomationRuleArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? AutomationRuleArgs.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:sentinel/authomationRule:AuthomationRule").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 state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static AutomationRule get(java.lang.String name, Output id, @Nullable AutomationRuleState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new AutomationRule(name, id, state, options);
}
}