Please wait. This can take some minutes ...
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.
com.pulumi.azure.appinsights.kotlin.AnalyticsItem.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.appinsights.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
/**
* Builder for [AnalyticsItem].
*/
@PulumiTagMarker
public class AnalyticsItemResourceBuilder internal constructor() {
public var name: String? = null
public var args: AnalyticsItemArgs = AnalyticsItemArgs()
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 AnalyticsItemArgsBuilder.() -> Unit) {
val builder = AnalyticsItemArgsBuilder()
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(): AnalyticsItem {
val builtJavaResource = com.pulumi.azure.appinsights.AnalyticsItem(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return AnalyticsItem(builtJavaResource)
}
}
/**
* Manages an Application Insights Analytics Item component.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "tf-test",
* location: "West Europe",
* });
* const exampleInsights = new azure.appinsights.Insights("example", {
* name: "tf-test-appinsights",
* location: example.location,
* resourceGroupName: example.name,
* applicationType: "web",
* });
* const exampleAnalyticsItem = new azure.appinsights.AnalyticsItem("example", {
* name: "testquery",
* applicationInsightsId: exampleInsights.id,
* content: "requests //simple example query",
* scope: "shared",
* type: "query",
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="tf-test",
* location="West Europe")
* example_insights = azure.appinsights.Insights("example",
* name="tf-test-appinsights",
* location=example.location,
* resource_group_name=example.name,
* application_type="web")
* example_analytics_item = azure.appinsights.AnalyticsItem("example",
* name="testquery",
* application_insights_id=example_insights.id,
* content="requests //simple example query",
* scope="shared",
* type="query")
* ```
* ```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 = "tf-test",
* Location = "West Europe",
* });
* var exampleInsights = new Azure.AppInsights.Insights("example", new()
* {
* Name = "tf-test-appinsights",
* Location = example.Location,
* ResourceGroupName = example.Name,
* ApplicationType = "web",
* });
* var exampleAnalyticsItem = new Azure.AppInsights.AnalyticsItem("example", new()
* {
* Name = "testquery",
* ApplicationInsightsId = exampleInsights.Id,
* Content = "requests //simple example query",
* Scope = "shared",
* Type = "query",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/appinsights"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "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("tf-test"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleInsights, err := appinsights.NewInsights(ctx, "example", &appinsights.InsightsArgs{
* Name: pulumi.String("tf-test-appinsights"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* ApplicationType: pulumi.String("web"),
* })
* if err != nil {
* return err
* }
* _, err = appinsights.NewAnalyticsItem(ctx, "example", &appinsights.AnalyticsItemArgs{
* Name: pulumi.String("testquery"),
* ApplicationInsightsId: exampleInsights.ID(),
* Content: pulumi.String("requests //simple example query"),
* Scope: pulumi.String("shared"),
* Type: pulumi.String("query"),
* })
* 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.appinsights.Insights;
* import com.pulumi.azure.appinsights.InsightsArgs;
* import com.pulumi.azure.appinsights.AnalyticsItem;
* import com.pulumi.azure.appinsights.AnalyticsItemArgs;
* 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("tf-test")
* .location("West Europe")
* .build());
* var exampleInsights = new Insights("exampleInsights", InsightsArgs.builder()
* .name("tf-test-appinsights")
* .location(example.location())
* .resourceGroupName(example.name())
* .applicationType("web")
* .build());
* var exampleAnalyticsItem = new AnalyticsItem("exampleAnalyticsItem", AnalyticsItemArgs.builder()
* .name("testquery")
* .applicationInsightsId(exampleInsights.id())
* .content("requests //simple example query")
* .scope("shared")
* .type("query")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: tf-test
* location: West Europe
* exampleInsights:
* type: azure:appinsights:Insights
* name: example
* properties:
* name: tf-test-appinsights
* location: ${example.location}
* resourceGroupName: ${example.name}
* applicationType: web
* exampleAnalyticsItem:
* type: azure:appinsights:AnalyticsItem
* name: example
* properties:
* name: testquery
* applicationInsightsId: ${exampleInsights.id}
* content: requests //simple example query
* scope: shared
* type: query
* ```
*
* ## Import
* Application Insights Analytics Items can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:appinsights/analyticsItem:AnalyticsItem example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/components/mycomponent1/analyticsItems/11111111-1111-1111-1111-111111111111
* ```
* To find the Analytics Item ID you can query the REST API using the [`az rest` CLI command](https://docs.microsoft.com/cli/azure/reference-index?view=azure-cli-latest#az-rest), e.g.
* az rest --method GET --uri "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.insights/components/appinsightstest/analyticsItems?api-version=2015-05-01"
*/
public class AnalyticsItem internal constructor(
override val javaResource: com.pulumi.azure.appinsights.AnalyticsItem,
) : KotlinCustomResource(javaResource, AnalyticsItemMapper) {
/**
* The ID of the Application Insights component on which the Analytics Item exists. Changing this forces a new resource to be created.
*/
public val applicationInsightsId: Output
get() = javaResource.applicationInsightsId().applyValue({ args0 -> args0 })
/**
* The content for the Analytics Item, for example the query text if `type` is `query`.
*/
public val content: Output
get() = javaResource.content().applyValue({ args0 -> args0 })
/**
* The alias to use for the function. Required when `type` is `function`.
*/
public val functionAlias: Output?
get() = javaResource.functionAlias().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Specifies the name of the Application Insights Analytics Item. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The scope for the Analytics Item. Can be `shared` or `user`. Changing this forces a new resource to be created. Must be `shared` for functions.
*/
public val scope: Output
get() = javaResource.scope().applyValue({ args0 -> args0 })
/**
* A string containing the time the Analytics Item was created.
*/
public val timeCreated: Output
get() = javaResource.timeCreated().applyValue({ args0 -> args0 })
/**
* A string containing the time the Analytics Item was last modified.
*/
public val timeModified: Output
get() = javaResource.timeModified().applyValue({ args0 -> args0 })
/**
* The type of Analytics Item to create. Can be one of `query`, `function`, `folder`, `recent`. Changing this forces a new resource to be created.
*/
public val type: Output
get() = javaResource.type().applyValue({ args0 -> args0 })
/**
* A string indicating the version of the query format
*/
public val version: Output
get() = javaResource.version().applyValue({ args0 -> args0 })
}
public object AnalyticsItemMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.appinsights.AnalyticsItem::class == javaResource::class
override fun map(javaResource: Resource): AnalyticsItem = AnalyticsItem(
javaResource as
com.pulumi.azure.appinsights.AnalyticsItem,
)
}
/**
* @see [AnalyticsItem].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [AnalyticsItem].
*/
public suspend fun analyticsItem(
name: String,
block: suspend AnalyticsItemResourceBuilder.() -> Unit,
): AnalyticsItem {
val builder = AnalyticsItemResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [AnalyticsItem].
* @param name The _unique_ name of the resulting resource.
*/
public fun analyticsItem(name: String): AnalyticsItem {
val builder = AnalyticsItemResourceBuilder()
builder.name(name)
return builder.build()
}