All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.loganalytics.kotlin.DataSourceWindowsEvent.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.14.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.loganalytics.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

/**
 * Builder for [DataSourceWindowsEvent].
 */
@PulumiTagMarker
public class DataSourceWindowsEventResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: DataSourceWindowsEventArgs = DataSourceWindowsEventArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend DataSourceWindowsEventArgsBuilder.() -> Unit) {
        val builder = DataSourceWindowsEventArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): DataSourceWindowsEvent {
        val builtJavaResource =
            com.pulumi.azure.loganalytics.DataSourceWindowsEvent(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return DataSourceWindowsEvent(builtJavaResource)
    }
}

/**
 * Manages a Log Analytics Windows Event DataSource.
 * ## 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 exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
 *     name: "example-law",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "PerGB2018",
 * });
 * const exampleDataSourceWindowsEvent = new azure.loganalytics.DataSourceWindowsEvent("example", {
 *     name: "example-lad-wpc",
 *     resourceGroupName: example.name,
 *     workspaceName: exampleAnalyticsWorkspace.name,
 *     eventLogName: "Application",
 *     eventTypes: ["Error"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
 *     name="example-law",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="PerGB2018")
 * example_data_source_windows_event = azure.loganalytics.DataSourceWindowsEvent("example",
 *     name="example-lad-wpc",
 *     resource_group_name=example.name,
 *     workspace_name=example_analytics_workspace.name,
 *     event_log_name="Application",
 *     event_types=["Error"])
 * ```
 * ```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 exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("example", new()
 *     {
 *         Name = "example-law",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "PerGB2018",
 *     });
 *     var exampleDataSourceWindowsEvent = new Azure.LogAnalytics.DataSourceWindowsEvent("example", new()
 *     {
 *         Name = "example-lad-wpc",
 *         ResourceGroupName = example.Name,
 *         WorkspaceName = exampleAnalyticsWorkspace.Name,
 *         EventLogName = "Application",
 *         EventTypes = new[]
 *         {
 *             "Error",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/loganalytics"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/operationalinsights"
 * 	"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
 * 		}
 * 		exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
 * 			Name:              pulumi.String("example-law"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("PerGB2018"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = loganalytics.NewDataSourceWindowsEvent(ctx, "example", &loganalytics.DataSourceWindowsEventArgs{
 * 			Name:              pulumi.String("example-lad-wpc"),
 * 			ResourceGroupName: example.Name,
 * 			WorkspaceName:     exampleAnalyticsWorkspace.Name,
 * 			EventLogName:      pulumi.String("Application"),
 * 			EventTypes: pulumi.StringArray{
 * 				pulumi.String("Error"),
 * 			},
 * 		})
 * 		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.operationalinsights.AnalyticsWorkspace;
 * import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
 * import com.pulumi.azure.loganalytics.DataSourceWindowsEvent;
 * import com.pulumi.azure.loganalytics.DataSourceWindowsEventArgs;
 * 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 exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
 *             .name("example-law")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("PerGB2018")
 *             .build());
 *         var exampleDataSourceWindowsEvent = new DataSourceWindowsEvent("exampleDataSourceWindowsEvent", DataSourceWindowsEventArgs.builder()
 *             .name("example-lad-wpc")
 *             .resourceGroupName(example.name())
 *             .workspaceName(exampleAnalyticsWorkspace.name())
 *             .eventLogName("Application")
 *             .eventTypes("Error")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAnalyticsWorkspace:
 *     type: azure:operationalinsights:AnalyticsWorkspace
 *     name: example
 *     properties:
 *       name: example-law
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: PerGB2018
 *   exampleDataSourceWindowsEvent:
 *     type: azure:loganalytics:DataSourceWindowsEvent
 *     name: example
 *     properties:
 *       name: example-lad-wpc
 *       resourceGroupName: ${example.name}
 *       workspaceName: ${exampleAnalyticsWorkspace.name}
 *       eventLogName: Application
 *       eventTypes:
 *         - Error
 * ```
 * 
 * ## Import
 * Log Analytics Windows Event DataSources can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:loganalytics/dataSourceWindowsEvent:DataSourceWindowsEvent example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.OperationalInsights/workspaces/workspace1/dataSources/datasource1
 * ```
 */
public class DataSourceWindowsEvent internal constructor(
    override val javaResource: com.pulumi.azure.loganalytics.DataSourceWindowsEvent,
) : KotlinCustomResource(javaResource, DataSourceWindowsEventMapper) {
    /**
     * Specifies the name of the Windows Event Log to collect events from.
     */
    public val eventLogName: Output
        get() = javaResource.eventLogName().applyValue({ args0 -> args0 })

    /**
     * Specifies an array of event types applied to the specified event log. Possible values include `Error`, `Warning` and `Information`.
     */
    public val eventTypes: Output>
        get() = javaResource.eventTypes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The name which should be used for this Log Analytics Windows Event DataSource. Changing this forces a new Log Analytics Windows Event DataSource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the Resource Group where the Log Analytics Windows Event DataSource should exist. Changing this forces a new Log Analytics Windows Event DataSource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The name of the Log Analytics Workspace where the Log Analytics Windows Event DataSource should exist. Changing this forces a new Log Analytics Windows Event DataSource to be created.
     */
    public val workspaceName: Output
        get() = javaResource.workspaceName().applyValue({ args0 -> args0 })
}

public object DataSourceWindowsEventMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.loganalytics.DataSourceWindowsEvent::class == javaResource::class

    override fun map(javaResource: Resource): DataSourceWindowsEvent =
        DataSourceWindowsEvent(javaResource as com.pulumi.azure.loganalytics.DataSourceWindowsEvent)
}

/**
 * @see [DataSourceWindowsEvent].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [DataSourceWindowsEvent].
 */
public suspend fun dataSourceWindowsEvent(
    name: String,
    block: suspend DataSourceWindowsEventResourceBuilder.() -> Unit,
): DataSourceWindowsEvent {
    val builder = DataSourceWindowsEventResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [DataSourceWindowsEvent].
 * @param name The _unique_ name of the resulting resource.
 */
public fun dataSourceWindowsEvent(name: String): DataSourceWindowsEvent {
    val builder = DataSourceWindowsEventResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy