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

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

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.loganalytics.kotlin

import com.pulumi.azure.loganalytics.SavedSearchArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Log Analytics (formally Operational Insights) Saved Search.
 * ## 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: "acctest-01",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "PerGB2018",
 *     retentionInDays: 30,
 * });
 * const exampleSavedSearch = new azure.loganalytics.SavedSearch("example", {
 *     name: "exampleSavedSearch",
 *     logAnalyticsWorkspaceId: exampleAnalyticsWorkspace.id,
 *     category: "exampleCategory",
 *     displayName: "exampleDisplayName",
 *     query: "exampleQuery",
 * });
 * ```
 * ```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="acctest-01",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="PerGB2018",
 *     retention_in_days=30)
 * example_saved_search = azure.loganalytics.SavedSearch("example",
 *     name="exampleSavedSearch",
 *     log_analytics_workspace_id=example_analytics_workspace.id,
 *     category="exampleCategory",
 *     display_name="exampleDisplayName",
 *     query="exampleQuery")
 * ```
 * ```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 = "acctest-01",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "PerGB2018",
 *         RetentionInDays = 30,
 *     });
 *     var exampleSavedSearch = new Azure.LogAnalytics.SavedSearch("example", new()
 *     {
 *         Name = "exampleSavedSearch",
 *         LogAnalyticsWorkspaceId = exampleAnalyticsWorkspace.Id,
 *         Category = "exampleCategory",
 *         DisplayName = "exampleDisplayName",
 *         Query = "exampleQuery",
 *     });
 * });
 * ```
 * ```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("acctest-01"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("PerGB2018"),
 * 			RetentionInDays:   pulumi.Int(30),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = loganalytics.NewSavedSearch(ctx, "example", &loganalytics.SavedSearchArgs{
 * 			Name:                    pulumi.String("exampleSavedSearch"),
 * 			LogAnalyticsWorkspaceId: exampleAnalyticsWorkspace.ID(),
 * 			Category:                pulumi.String("exampleCategory"),
 * 			DisplayName:             pulumi.String("exampleDisplayName"),
 * 			Query:                   pulumi.String("exampleQuery"),
 * 		})
 * 		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.SavedSearch;
 * import com.pulumi.azure.loganalytics.SavedSearchArgs;
 * 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("acctest-01")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("PerGB2018")
 *             .retentionInDays(30)
 *             .build());
 *         var exampleSavedSearch = new SavedSearch("exampleSavedSearch", SavedSearchArgs.builder()
 *             .name("exampleSavedSearch")
 *             .logAnalyticsWorkspaceId(exampleAnalyticsWorkspace.id())
 *             .category("exampleCategory")
 *             .displayName("exampleDisplayName")
 *             .query("exampleQuery")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAnalyticsWorkspace:
 *     type: azure:operationalinsights:AnalyticsWorkspace
 *     name: example
 *     properties:
 *       name: acctest-01
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: PerGB2018
 *       retentionInDays: 30
 *   exampleSavedSearch:
 *     type: azure:loganalytics:SavedSearch
 *     name: example
 *     properties:
 *       name: exampleSavedSearch
 *       logAnalyticsWorkspaceId: ${exampleAnalyticsWorkspace.id}
 *       category: exampleCategory
 *       displayName: exampleDisplayName
 *       query: exampleQuery
 * ```
 * 
 * ## Import
 * Log Analytics Saved Searches can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:loganalytics/savedSearch:SavedSearch search1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1/savedSearches/search1
 * ```
 * @property category The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
 * @property displayName The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
 * @property functionAlias The function alias if the query serves as a function. Changing this forces a new resource to be created.
 * @property functionParameters The function parameters if the query serves as a function. Changing this forces a new resource to be created. For more examples and proper syntax please refer to [this document](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/functions/user-defined-functions).
 * @property logAnalyticsWorkspaceId Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
 * @property name Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
 * @property query The query expression for the saved search. Changing this forces a new resource to be created.
 * @property tags A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
 */
public data class SavedSearchArgs(
    public val category: Output? = null,
    public val displayName: Output? = null,
    public val functionAlias: Output? = null,
    public val functionParameters: Output>? = null,
    public val logAnalyticsWorkspaceId: Output? = null,
    public val name: Output? = null,
    public val query: Output? = null,
    public val tags: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.loganalytics.SavedSearchArgs =
        com.pulumi.azure.loganalytics.SavedSearchArgs.builder()
            .category(category?.applyValue({ args0 -> args0 }))
            .displayName(displayName?.applyValue({ args0 -> args0 }))
            .functionAlias(functionAlias?.applyValue({ args0 -> args0 }))
            .functionParameters(functionParameters?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .logAnalyticsWorkspaceId(logAnalyticsWorkspaceId?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .query(query?.applyValue({ args0 -> args0 }))
            .tags(
                tags?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            ).build()
}

/**
 * Builder for [SavedSearchArgs].
 */
@PulumiTagMarker
public class SavedSearchArgsBuilder internal constructor() {
    private var category: Output? = null

    private var displayName: Output? = null

    private var functionAlias: Output? = null

    private var functionParameters: Output>? = null

    private var logAnalyticsWorkspaceId: Output? = null

    private var name: Output? = null

    private var query: Output? = null

    private var tags: Output>? = null

    /**
     * @param value The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
     */
    @JvmName("igkrpycuuogxlsyt")
    public suspend fun category(`value`: Output) {
        this.category = value
    }

    /**
     * @param value The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
     */
    @JvmName("gxweufusgqwqjaju")
    public suspend fun displayName(`value`: Output) {
        this.displayName = value
    }

    /**
     * @param value The function alias if the query serves as a function. Changing this forces a new resource to be created.
     */
    @JvmName("qxiyspurrqokvapp")
    public suspend fun functionAlias(`value`: Output) {
        this.functionAlias = value
    }

    /**
     * @param value The function parameters if the query serves as a function. Changing this forces a new resource to be created. For more examples and proper syntax please refer to [this document](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/functions/user-defined-functions).
     */
    @JvmName("oaqdtdflynfaqomp")
    public suspend fun functionParameters(`value`: Output>) {
        this.functionParameters = value
    }

    @JvmName("dteuremyobgirpsc")
    public suspend fun functionParameters(vararg values: Output) {
        this.functionParameters = Output.all(values.asList())
    }

    /**
     * @param values The function parameters if the query serves as a function. Changing this forces a new resource to be created. For more examples and proper syntax please refer to [this document](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/functions/user-defined-functions).
     */
    @JvmName("ytkfbtomxdarikqp")
    public suspend fun functionParameters(values: List>) {
        this.functionParameters = Output.all(values)
    }

    /**
     * @param value Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
     */
    @JvmName("osdjcxfwmlebqeme")
    public suspend fun logAnalyticsWorkspaceId(`value`: Output) {
        this.logAnalyticsWorkspaceId = value
    }

    /**
     * @param value Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
     */
    @JvmName("xeliwtyskmscgrit")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The query expression for the saved search. Changing this forces a new resource to be created.
     */
    @JvmName("ilaqwhhkoooljgca")
    public suspend fun query(`value`: Output) {
        this.query = value
    }

    /**
     * @param value A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
     */
    @JvmName("wvlqfjipmejwtjle")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
     */
    @JvmName("pwilahntlmotedip")
    public suspend fun category(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.category = mapped
    }

    /**
     * @param value The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
     */
    @JvmName("igttactnrsuhcwvj")
    public suspend fun displayName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.displayName = mapped
    }

    /**
     * @param value The function alias if the query serves as a function. Changing this forces a new resource to be created.
     */
    @JvmName("asndejuqwtgvyjwb")
    public suspend fun functionAlias(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.functionAlias = mapped
    }

    /**
     * @param value The function parameters if the query serves as a function. Changing this forces a new resource to be created. For more examples and proper syntax please refer to [this document](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/functions/user-defined-functions).
     */
    @JvmName("shhwkiwrvofbomhq")
    public suspend fun functionParameters(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.functionParameters = mapped
    }

    /**
     * @param values The function parameters if the query serves as a function. Changing this forces a new resource to be created. For more examples and proper syntax please refer to [this document](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/functions/user-defined-functions).
     */
    @JvmName("ycmxgasuhlcvltfy")
    public suspend fun functionParameters(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.functionParameters = mapped
    }

    /**
     * @param value Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
     */
    @JvmName("wfoexysjxvcgsvnk")
    public suspend fun logAnalyticsWorkspaceId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.logAnalyticsWorkspaceId = mapped
    }

    /**
     * @param value Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
     */
    @JvmName("ynimpqxorjxnmxms")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The query expression for the saved search. Changing this forces a new resource to be created.
     */
    @JvmName("noxjbyxfchlepptl")
    public suspend fun query(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.query = mapped
    }

    /**
     * @param value A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
     */
    @JvmName("dxigokckmtmqwhro")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
     */
    @JvmName("pwdmvxfbdcrvsfhc")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    internal fun build(): SavedSearchArgs = SavedSearchArgs(
        category = category,
        displayName = displayName,
        functionAlias = functionAlias,
        functionParameters = functionParameters,
        logAnalyticsWorkspaceId = logAnalyticsWorkspaceId,
        name = name,
        query = query,
        tags = tags,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy