com.pulumi.azure.monitoring.AadDiagnosticSetting 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.monitoring;
import com.pulumi.azure.Utilities;
import com.pulumi.azure.monitoring.AadDiagnosticSettingArgs;
import com.pulumi.azure.monitoring.inputs.AadDiagnosticSettingState;
import com.pulumi.azure.monitoring.outputs.AadDiagnosticSettingEnabledLog;
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.Optional;
import javax.annotation.Nullable;
/**
* Manages an Azure Active Directory Diagnostic Setting for Azure Monitor.
*
* !> **Authentication** The API for this resource does not support service principal authentication. This resource can only be used with Azure CLI authentication.
*
* ## 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.monitoring.AadDiagnosticSetting;
* import com.pulumi.azure.monitoring.AadDiagnosticSettingArgs;
* import com.pulumi.azure.monitoring.inputs.AadDiagnosticSettingEnabledLogArgs;
* import com.pulumi.azure.monitoring.inputs.AadDiagnosticSettingEnabledLogRetentionPolicyArgs;
* 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 exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("examplestorageaccount")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountKind("StorageV2")
* .accountReplicationType("LRS")
* .build());
*
* var exampleAadDiagnosticSetting = new AadDiagnosticSetting("exampleAadDiagnosticSetting", AadDiagnosticSettingArgs.builder()
* .name("setting1")
* .storageAccountId(exampleAccount.id())
* .enabledLogs(
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("SignInLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build(),
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("AuditLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build(),
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("NonInteractiveUserSignInLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build(),
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("ServicePrincipalSignInLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Monitor Azure Active Directory Diagnostic Settings can be imported using the `resource id`, e.g.
*
* ```sh
* $ pulumi import azure:monitoring/aadDiagnosticSetting:AadDiagnosticSetting example /providers/Microsoft.AADIAM/diagnosticSettings/setting1
* ```
*
*/
@ResourceType(type="azure:monitoring/aadDiagnosticSetting:AadDiagnosticSetting")
public class AadDiagnosticSetting extends com.pulumi.resources.CustomResource {
/**
* One or more `enabled_log` blocks as defined below.
*
*/
@Export(name="enabledLogs", refs={List.class,AadDiagnosticSettingEnabledLog.class}, tree="[0,1]")
private Output* @Nullable */ List> enabledLogs;
/**
* @return One or more `enabled_log` blocks as defined below.
*
*/
public Output>> enabledLogs() {
return Codegen.optional(this.enabledLogs);
}
/**
* Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
*
* > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource.
*
*/
@Export(name="eventhubAuthorizationRuleId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> eventhubAuthorizationRuleId;
/**
* @return Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
*
* > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource.
*
*/
public Output> eventhubAuthorizationRuleId() {
return Codegen.optional(this.eventhubAuthorizationRuleId);
}
/**
* Specifies the name of the Event Hub where Diagnostics Data should be sent. If not specified, the default Event Hub will be used. Changing this forces a new resource to be created.
*
*/
@Export(name="eventhubName", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> eventhubName;
/**
* @return Specifies the name of the Event Hub where Diagnostics Data should be sent. If not specified, the default Event Hub will be used. Changing this forces a new resource to be created.
*
*/
public Output> eventhubName() {
return Codegen.optional(this.eventhubName);
}
/**
* Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
*
*/
@Export(name="logAnalyticsWorkspaceId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> logAnalyticsWorkspaceId;
/**
* @return Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
*
*/
public Output> logAnalyticsWorkspaceId() {
return Codegen.optional(this.logAnalyticsWorkspaceId);
}
/**
* The name which should be used for this Monitor Azure Active Directory Diagnostic Setting. Changing this forces a new Monitor Azure Active Directory Diagnostic Setting to be created.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name which should be used for this Monitor Azure Active Directory Diagnostic Setting. Changing this forces a new Monitor Azure Active Directory Diagnostic Setting to be created.
*
*/
public Output name() {
return this.name;
}
/**
* The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
*
* > **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id` and `storage_account_id` must be specified.
*
*/
@Export(name="storageAccountId", refs={String.class}, tree="[0]")
private Output* @Nullable */ String> storageAccountId;
/**
* @return The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
*
* > **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id` and `storage_account_id` must be specified.
*
*/
public Output> storageAccountId() {
return Codegen.optional(this.storageAccountId);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public AadDiagnosticSetting(java.lang.String name) {
this(name, AadDiagnosticSettingArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public AadDiagnosticSetting(java.lang.String name, @Nullable AadDiagnosticSettingArgs 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 AadDiagnosticSetting(java.lang.String name, @Nullable AadDiagnosticSettingArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:monitoring/aadDiagnosticSetting:AadDiagnosticSetting", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private AadDiagnosticSetting(java.lang.String name, Output id, @Nullable AadDiagnosticSettingState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("azure:monitoring/aadDiagnosticSetting:AadDiagnosticSetting", name, state, makeResourceOptions(options, id), false);
}
private static AadDiagnosticSettingArgs makeArgs(@Nullable AadDiagnosticSettingArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? AadDiagnosticSettingArgs.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 AadDiagnosticSetting get(java.lang.String name, Output id, @Nullable AadDiagnosticSettingState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new AadDiagnosticSetting(name, id, state, options);
}
}