Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.monitoring.kotlin
import com.pulumi.azure.monitoring.DiagnosticSettingArgs.builder
import com.pulumi.azure.monitoring.kotlin.inputs.DiagnosticSettingEnabledLogArgs
import com.pulumi.azure.monitoring.kotlin.inputs.DiagnosticSettingEnabledLogArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.DiagnosticSettingLogArgs
import com.pulumi.azure.monitoring.kotlin.inputs.DiagnosticSettingLogArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.DiagnosticSettingMetricArgs
import com.pulumi.azure.monitoring.kotlin.inputs.DiagnosticSettingMetricArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Manages a Diagnostic Setting for an existing Resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "storageaccountname",
* resourceGroupName: example.name,
* location: example.location,
* accountTier: "Standard",
* accountReplicationType: "LRS",
* });
* const current = azure.core.getClientConfig({});
* const exampleKeyVault = new azure.keyvault.KeyVault("example", {
* name: "examplekeyvault",
* location: example.location,
* resourceGroupName: example.name,
* tenantId: current.then(current => current.tenantId),
* softDeleteRetentionDays: 7,
* purgeProtectionEnabled: false,
* skuName: "standard",
* });
* const exampleDiagnosticSetting = new azure.monitoring.DiagnosticSetting("example", {
* name: "example",
* targetResourceId: exampleKeyVault.id,
* storageAccountId: exampleAccount.id,
* enabledLogs: [{
* category: "AuditEvent",
* retentionPolicy: {
* enabled: false,
* },
* }],
* metrics: [{
* category: "AllMetrics",
* retentionPolicy: {
* enabled: false,
* },
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_account = azure.storage.Account("example",
* name="storageaccountname",
* resource_group_name=example.name,
* location=example.location,
* account_tier="Standard",
* account_replication_type="LRS")
* current = azure.core.get_client_config()
* example_key_vault = azure.keyvault.KeyVault("example",
* name="examplekeyvault",
* location=example.location,
* resource_group_name=example.name,
* tenant_id=current.tenant_id,
* soft_delete_retention_days=7,
* purge_protection_enabled=False,
* sku_name="standard")
* example_diagnostic_setting = azure.monitoring.DiagnosticSetting("example",
* name="example",
* target_resource_id=example_key_vault.id,
* storage_account_id=example_account.id,
* enabled_logs=[{
* "category": "AuditEvent",
* "retention_policy": {
* "enabled": False,
* },
* }],
* metrics=[{
* "category": "AllMetrics",
* "retention_policy": {
* "enabled": False,
* },
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "storageaccountname",
* ResourceGroupName = example.Name,
* Location = example.Location,
* AccountTier = "Standard",
* AccountReplicationType = "LRS",
* });
* var current = Azure.Core.GetClientConfig.Invoke();
* var exampleKeyVault = new Azure.KeyVault.KeyVault("example", new()
* {
* Name = "examplekeyvault",
* Location = example.Location,
* ResourceGroupName = example.Name,
* TenantId = current.Apply(getClientConfigResult => getClientConfigResult.TenantId),
* SoftDeleteRetentionDays = 7,
* PurgeProtectionEnabled = false,
* SkuName = "standard",
* });
* var exampleDiagnosticSetting = new Azure.Monitoring.DiagnosticSetting("example", new()
* {
* Name = "example",
* TargetResourceId = exampleKeyVault.Id,
* StorageAccountId = exampleAccount.Id,
* EnabledLogs = new[]
* {
* new Azure.Monitoring.Inputs.DiagnosticSettingEnabledLogArgs
* {
* Category = "AuditEvent",
* RetentionPolicy = new Azure.Monitoring.Inputs.DiagnosticSettingEnabledLogRetentionPolicyArgs
* {
* Enabled = false,
* },
* },
* },
* Metrics = new[]
* {
* new Azure.Monitoring.Inputs.DiagnosticSettingMetricArgs
* {
* Category = "AllMetrics",
* RetentionPolicy = new Azure.Monitoring.Inputs.DiagnosticSettingMetricRetentionPolicyArgs
* {
* Enabled = false,
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/keyvault"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/monitoring"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("storageaccountname"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* AccountTier: pulumi.String("Standard"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* current, err := core.GetClientConfig(ctx, nil, nil)
* if err != nil {
* return err
* }
* exampleKeyVault, err := keyvault.NewKeyVault(ctx, "example", &keyvault.KeyVaultArgs{
* Name: pulumi.String("examplekeyvault"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* TenantId: pulumi.String(current.TenantId),
* SoftDeleteRetentionDays: pulumi.Int(7),
* PurgeProtectionEnabled: pulumi.Bool(false),
* SkuName: pulumi.String("standard"),
* })
* if err != nil {
* return err
* }
* _, err = monitoring.NewDiagnosticSetting(ctx, "example", &monitoring.DiagnosticSettingArgs{
* Name: pulumi.String("example"),
* TargetResourceId: exampleKeyVault.ID(),
* StorageAccountId: exampleAccount.ID(),
* EnabledLogs: monitoring.DiagnosticSettingEnabledLogArray{
* &monitoring.DiagnosticSettingEnabledLogArgs{
* Category: pulumi.String("AuditEvent"),
* RetentionPolicy: &monitoring.DiagnosticSettingEnabledLogRetentionPolicyArgs{
* Enabled: pulumi.Bool(false),
* },
* },
* },
* Metrics: monitoring.DiagnosticSettingMetricArray{
* &monitoring.DiagnosticSettingMetricArgs{
* Category: pulumi.String("AllMetrics"),
* RetentionPolicy: &monitoring.DiagnosticSettingMetricRetentionPolicyArgs{
* Enabled: pulumi.Bool(false),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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.core.CoreFunctions;
* import com.pulumi.azure.keyvault.KeyVault;
* import com.pulumi.azure.keyvault.KeyVaultArgs;
* import com.pulumi.azure.monitoring.DiagnosticSetting;
* import com.pulumi.azure.monitoring.DiagnosticSettingArgs;
* import com.pulumi.azure.monitoring.inputs.DiagnosticSettingEnabledLogArgs;
* import com.pulumi.azure.monitoring.inputs.DiagnosticSettingEnabledLogRetentionPolicyArgs;
* import com.pulumi.azure.monitoring.inputs.DiagnosticSettingMetricArgs;
* import com.pulumi.azure.monitoring.inputs.DiagnosticSettingMetricRetentionPolicyArgs;
* 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-resources")
* .location("West Europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("storageaccountname")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountReplicationType("LRS")
* .build());
* final var current = CoreFunctions.getClientConfig();
* var exampleKeyVault = new KeyVault("exampleKeyVault", KeyVaultArgs.builder()
* .name("examplekeyvault")
* .location(example.location())
* .resourceGroupName(example.name())
* .tenantId(current.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
* .softDeleteRetentionDays(7)
* .purgeProtectionEnabled(false)
* .skuName("standard")
* .build());
* var exampleDiagnosticSetting = new DiagnosticSetting("exampleDiagnosticSetting", DiagnosticSettingArgs.builder()
* .name("example")
* .targetResourceId(exampleKeyVault.id())
* .storageAccountId(exampleAccount.id())
* .enabledLogs(DiagnosticSettingEnabledLogArgs.builder()
* .category("AuditEvent")
* .retentionPolicy(DiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(false)
* .build())
* .build())
* .metrics(DiagnosticSettingMetricArgs.builder()
* .category("AllMetrics")
* .retentionPolicy(DiagnosticSettingMetricRetentionPolicyArgs.builder()
* .enabled(false)
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: storageaccountname
* resourceGroupName: ${example.name}
* location: ${example.location}
* accountTier: Standard
* accountReplicationType: LRS
* exampleKeyVault:
* type: azure:keyvault:KeyVault
* name: example
* properties:
* name: examplekeyvault
* location: ${example.location}
* resourceGroupName: ${example.name}
* tenantId: ${current.tenantId}
* softDeleteRetentionDays: 7
* purgeProtectionEnabled: false
* skuName: standard
* exampleDiagnosticSetting:
* type: azure:monitoring:DiagnosticSetting
* name: example
* properties:
* name: example
* targetResourceId: ${exampleKeyVault.id}
* storageAccountId: ${exampleAccount.id}
* enabledLogs:
* - category: AuditEvent
* retentionPolicy:
* enabled: false
* metrics:
* - category: AllMetrics
* retentionPolicy:
* enabled: false
* variables:
* current:
* fn::invoke:
* Function: azure:core:getClientConfig
* Arguments: {}
* ```
*
* ## Import
* Diagnostic Settings can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:monitoring/diagnosticSetting:DiagnosticSetting example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.KeyVault/vaults/vault1|logMonitoring1"
* ```
* @property enabledLogs One or more `enabled_log` blocks as defined below.
* > **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified. At least one type of Log or Metric must be enabled.
* @property eventhubAuthorizationRuleId Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data.
* > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource.
* > **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified.
* @property eventhubName Specifies the name of the Event Hub where Diagnostics Data should be sent.
* > **NOTE:** If this isn't specified then the default Event Hub will be used.
* @property logAnalyticsDestinationType Possible values are `AzureDiagnostics` and `Dedicated`. When set to `Dedicated`, logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy `AzureDiagnostics` table.
* > **NOTE:** This setting will only have an effect if a `log_analytics_workspace_id` is provided. For some target resource type (e.g., Key Vault), this field is unconfigurable. Please see [resource types](https://learn.microsoft.com/en-us/azure/azure-monitor/reference/tables/azurediagnostics#resource-types) for services that use each method. Please [see the documentation](https://docs.microsoft.com/azure/azure-monitor/platform/diagnostic-logs-stream-log-store#azure-diagnostics-vs-resource-specific) for details on the differences between destination types.
* @property logAnalyticsWorkspaceId Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
* > **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified.
* @property logs One or more `log` blocks as defined below.
* > **NOTE:** `log` is deprecated in favour of the `enabled_log` property and will be removed in version 4.0 of the AzureRM Provider.
* @property metrics One or more `metric` blocks as defined below.
* > **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified.
* @property name Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
* > **NOTE:** If the name is set to 'service' it will not be possible to fully delete the diagnostic setting. This is due to legacy API support.
* @property partnerSolutionId The ID of the market partner solution where Diagnostics Data should be sent. For potential partner integrations, [click to learn more about partner integration](https://learn.microsoft.com/en-us/azure/partner-solutions/overview).
* > **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified.
* @property storageAccountId The ID of the Storage Account where logs should be sent.
* > **NOTE:** At least one of `eventhub_authorization_rule_id`, `log_analytics_workspace_id`, `partner_solution_id` and `storage_account_id` must be specified.
* @property targetResourceId The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
*/
public data class DiagnosticSettingArgs(
public val enabledLogs: Output>? = null,
public val eventhubAuthorizationRuleId: Output? = null,
public val eventhubName: Output? = null,
public val logAnalyticsDestinationType: Output? = null,
public val logAnalyticsWorkspaceId: Output? = null,
@Deprecated(
message = """
`log` has been superseded by `enabled_log` and will be removed in version 4.0 of the AzureRM
Provider.
""",
)
public val logs: Output>? = null,
public val metrics: Output>? = null,
public val name: Output? = null,
public val partnerSolutionId: Output? = null,
public val storageAccountId: Output? = null,
public val targetResourceId: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.monitoring.DiagnosticSettingArgs =
com.pulumi.azure.monitoring.DiagnosticSettingArgs.builder()
.enabledLogs(
enabledLogs?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.eventhubAuthorizationRuleId(eventhubAuthorizationRuleId?.applyValue({ args0 -> args0 }))
.eventhubName(eventhubName?.applyValue({ args0 -> args0 }))
.logAnalyticsDestinationType(logAnalyticsDestinationType?.applyValue({ args0 -> args0 }))
.logAnalyticsWorkspaceId(logAnalyticsWorkspaceId?.applyValue({ args0 -> args0 }))
.logs(logs?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
.metrics(
metrics?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.name(name?.applyValue({ args0 -> args0 }))
.partnerSolutionId(partnerSolutionId?.applyValue({ args0 -> args0 }))
.storageAccountId(storageAccountId?.applyValue({ args0 -> args0 }))
.targetResourceId(targetResourceId?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [DiagnosticSettingArgs].
*/
@PulumiTagMarker
public class DiagnosticSettingArgsBuilder internal constructor() {
private var enabledLogs: Output>? = null
private var eventhubAuthorizationRuleId: Output? = null
private var eventhubName: Output? = null
private var logAnalyticsDestinationType: Output? = null
private var logAnalyticsWorkspaceId: Output? = null
private var logs: Output>? = null
private var metrics: Output>? = null
private var name: Output? = null
private var partnerSolutionId: Output? = null
private var storageAccountId: Output? = null
private var targetResourceId: Output? = null
/**
* @param value One or more `enabled_log` blocks as defined below.
* > **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified. At least one type of Log or Metric must be enabled.
*/
@JvmName("jqhgdqqwhvtqarfa")
public suspend fun enabledLogs(`value`: Output>) {
this.enabledLogs = value
}
@JvmName("ptgapbjxoixouyxh")
public suspend fun enabledLogs(vararg values: Output) {
this.enabledLogs = Output.all(values.asList())
}
/**
* @param values One or more `enabled_log` blocks as defined below.
* > **NOTE:** At least one `log`, `enabled_log` or `metric` block must be specified. At least one type of Log or Metric must be enabled.
*/
@JvmName("gefpofpifbajrhlk")
public suspend fun enabledLogs(values: List