com.pulumi.azure.securitycenter.Automation 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.securitycenter;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.securitycenter.AutomationArgs;
import com.pulumi.azure.securitycenter.inputs.AutomationState;
import com.pulumi.azure.securitycenter.outputs.AutomationAction;
import com.pulumi.azure.securitycenter.outputs.AutomationSource;
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;
/**
* Manages Security Center Automation and Continuous Export. This resource supports three types of destination in the `action`, Logic Apps, Log Analytics and Event Hubs
*
* ## 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.CoreFunctions;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.eventhub.EventHubNamespace;
* import com.pulumi.azure.eventhub.EventHubNamespaceArgs;
* import com.pulumi.azure.eventhub.EventHub;
* import com.pulumi.azure.eventhub.EventHubArgs;
* import com.pulumi.azure.eventhub.AuthorizationRule;
* import com.pulumi.azure.eventhub.AuthorizationRuleArgs;
* import com.pulumi.azure.securitycenter.Automation;
* import com.pulumi.azure.securitycenter.AutomationArgs;
* import com.pulumi.azure.securitycenter.inputs.AutomationActionArgs;
* import com.pulumi.azure.securitycenter.inputs.AutomationSourceArgs;
* 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) {
* final var current = CoreFunctions.getClientConfig();
*
* var example = new ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
*
* var exampleEventHubNamespace = new EventHubNamespace("exampleEventHubNamespace", EventHubNamespaceArgs.builder()
* .name("example-namespace")
* .location(example.location())
* .resourceGroupName(example.name())
* .sku("Standard")
* .capacity(2)
* .build());
*
* var exampleEventHub = new EventHub("exampleEventHub", EventHubArgs.builder()
* .name("acceptanceTestEventHub")
* .namespaceName(exampleEventHubNamespace.name())
* .resourceGroupName(example.name())
* .partitionCount(2)
* .messageRetention(2)
* .build());
*
* var exampleAuthorizationRule = new AuthorizationRule("exampleAuthorizationRule", AuthorizationRuleArgs.builder()
* .name("example-rule")
* .namespaceName(exampleEventHubNamespace.name())
* .eventhubName(exampleEventHub.name())
* .resourceGroupName(example.name())
* .listen(true)
* .send(false)
* .manage(false)
* .build());
*
* var exampleAutomation = new Automation("exampleAutomation", AutomationArgs.builder()
* .name("example-automation")
* .location(example.location())
* .resourceGroupName(example.name())
* .actions(AutomationActionArgs.builder()
* .type("eventhub")
* .resourceId(exampleEventHub.id())
* .connectionString(exampleAuthorizationRule.primaryConnectionString())
* .build())
* .sources(AutomationSourceArgs.builder()
* .eventSource("Alerts")
* .ruleSets(AutomationSourceRuleSetArgs.builder()
* .rules(AutomationSourceRuleSetRuleArgs.builder()
* .propertyPath("properties.metadata.severity")
* .operator("Equals")
* .expectedValue("High")
* .propertyType("String")
* .build())
* .build())
* .build())
* .scopes(String.format("/subscriptions/%s", current.applyValue(getClientConfigResult -> getClientConfigResult.subscriptionId())))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Security Center Automations can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:securitycenter/automation:Automation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Security/automations/automation1
* ```
*
*/
@ResourceType(type="azure:securitycenter/automation:Automation")
public class Automation extends com.pulumi.resources.CustomResource {
/**
* One or more `action` blocks as defined below. An `action` tells this automation where the data is to be sent to upon being evaluated by the rules in the `source`.
*
*/
@Export(name="actions", refs={List.class,AutomationAction.class}, tree="[0,1]")
private Output> actions;
/**
* @return One or more `action` blocks as defined below. An `action` tells this automation where the data is to be sent to upon being evaluated by the rules in the `source`.
*
*/
public Output> actions() {
return this.actions;
}
/**
* Specifies the description for the Security Center Automation.
*
*/
@Export(name="description", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> description;
/**
* @return Specifies the description for the Security Center Automation.
*
*/
public Output> description() {
return Codegen.optional(this.description);
}
/**
* Boolean to enable or disable this Security Center Automation. Defaults to `true`.
*
*/
@Export(name="enabled", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> enabled;
/**
* @return Boolean to enable or disable this Security Center Automation. Defaults to `true`.
*
*/
public Output> enabled() {
return Codegen.optional(this.enabled);
}
/**
* The Azure Region where the Security Center Automation should exist. Changing this forces a new Security Center Automation to be created.
*
*/
@Export(name="location", refs={String.class}, tree="[0]")
private Output location;
/**
* @return The Azure Region where the Security Center Automation should exist. Changing this forces a new Security Center Automation to be created.
*
*/
public Output location() {
return this.location;
}
/**
* The name which should be used for this Security Center Automation. Changing this forces a new Security Center Automation to be created.
*
* > **NOTE:** For the automation to appear in Azure Portal correctly under Microsoft Defender for Cloud > Environment Settings > Account > Continuous Export, either `ExportToWorkspace` or `ExportToEventHub` must be used.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name which should be used for this Security Center Automation. Changing this forces a new Security Center Automation to be created.
*
* > **NOTE:** For the automation to appear in Azure Portal correctly under Microsoft Defender for Cloud > Environment Settings > Account > Continuous Export, either `ExportToWorkspace` or `ExportToEventHub` must be used.
*
*/
public Output name() {
return this.name;
}
/**
* The name of the Resource Group where the Security Center Automation should exist. Changing this forces a new Security Center Automation to be created.
*
*/
@Export(name="resourceGroupName", refs={String.class}, tree="[0]")
private Output resourceGroupName;
/**
* @return The name of the Resource Group where the Security Center Automation should exist. Changing this forces a new Security Center Automation to be created.
*
*/
public Output resourceGroupName() {
return this.resourceGroupName;
}
/**
* A list of scopes on which the automation logic is applied, at least one is required. Supported scopes are a subscription (in this format `/subscriptions/00000000-0000-0000-0000-000000000000`) or a resource group under that subscription (in the format `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example`). The automation will only apply on defined scopes.
*
*/
@Export(name="scopes", refs={List.class,String.class}, tree="[0,1]")
private Output> scopes;
/**
* @return A list of scopes on which the automation logic is applied, at least one is required. Supported scopes are a subscription (in this format `/subscriptions/00000000-0000-0000-0000-000000000000`) or a resource group under that subscription (in the format `/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example`). The automation will only apply on defined scopes.
*
*/
public Output> scopes() {
return this.scopes;
}
/**
* One or more `source` blocks as defined below. A `source` defines what data types will be processed and a set of rules to filter that data.
*
*/
@Export(name="sources", refs={List.class,AutomationSource.class}, tree="[0,1]")
private Output> sources;
/**
* @return One or more `source` blocks as defined below. A `source` defines what data types will be processed and a set of rules to filter that data.
*
*/
public Output> sources() {
return this.sources;
}
/**
* A mapping of tags assigned to the resource.
*
*/
@Export(name="tags", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> tags;
/**
* @return A mapping of tags assigned to the resource.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Automation(java.lang.String name) {
this(name, AutomationArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Automation(java.lang.String name, AutomationArgs 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 Automation(java.lang.String name, AutomationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:securitycenter/automation:Automation", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Automation(java.lang.String name, Output id, @Nullable AutomationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:securitycenter/automation:Automation", name, state, makeResourceOptions(options, id), false);
}
private static AutomationArgs makeArgs(AutomationArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? AutomationArgs.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())
.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 Automation get(java.lang.String name, Output id, @Nullable AutomationState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Automation(name, id, state, options);
}
}