com.pulumi.azure.appinsights.kotlin.ApiKey.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@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
import kotlin.collections.List
/**
* Builder for [ApiKey].
*/
@PulumiTagMarker
public class ApiKeyResourceBuilder internal constructor() {
public var name: String? = null
public var args: ApiKeyArgs = ApiKeyArgs()
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 ApiKeyArgsBuilder.() -> Unit) {
val builder = ApiKeyArgsBuilder()
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(): ApiKey {
val builtJavaResource = com.pulumi.azure.appinsights.ApiKey(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return ApiKey(builtJavaResource)
}
}
/**
* Manages an Application Insights API key.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* export = async () => {
* 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 readTelemetry = new azure.appinsights.ApiKey("read_telemetry", {
* name: "tf-test-appinsights-read-telemetry-api-key",
* applicationInsightsId: exampleInsights.id,
* readPermissions: [
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search",
* ],
* });
* const writeAnnotations = new azure.appinsights.ApiKey("write_annotations", {
* name: "tf-test-appinsights-write-annotations-api-key",
* applicationInsightsId: exampleInsights.id,
* writePermissions: ["annotations"],
* });
* const authenticateSdkControlChannel = new azure.appinsights.ApiKey("authenticate_sdk_control_channel", {
* name: "tf-test-appinsights-authenticate-sdk-control-channel-api-key",
* applicationInsightsId: exampleInsights.id,
* readPermissions: ["agentconfig"],
* });
* const fullPermissions = new azure.appinsights.ApiKey("full_permissions", {
* name: "tf-test-appinsights-full-permissions-api-key",
* applicationInsightsId: exampleInsights.id,
* readPermissions: [
* "agentconfig",
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search",
* ],
* writePermissions: ["annotations"],
* });
* return {
* readTelemetryApiKey: readTelemetry.apiKey,
* writeAnnotationsApiKey: writeAnnotations.apiKey,
* authenticateSdkControlChannel: authenticateSdkControlChannel.apiKey,
* fullPermissionsApiKey: fullPermissions.apiKey,
* };
* }
* ```
* ```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")
* read_telemetry = azure.appinsights.ApiKey("read_telemetry",
* name="tf-test-appinsights-read-telemetry-api-key",
* application_insights_id=example_insights.id,
* read_permissions=[
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search",
* ])
* write_annotations = azure.appinsights.ApiKey("write_annotations",
* name="tf-test-appinsights-write-annotations-api-key",
* application_insights_id=example_insights.id,
* write_permissions=["annotations"])
* authenticate_sdk_control_channel = azure.appinsights.ApiKey("authenticate_sdk_control_channel",
* name="tf-test-appinsights-authenticate-sdk-control-channel-api-key",
* application_insights_id=example_insights.id,
* read_permissions=["agentconfig"])
* full_permissions = azure.appinsights.ApiKey("full_permissions",
* name="tf-test-appinsights-full-permissions-api-key",
* application_insights_id=example_insights.id,
* read_permissions=[
* "agentconfig",
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search",
* ],
* write_permissions=["annotations"])
* pulumi.export("readTelemetryApiKey", read_telemetry.api_key)
* pulumi.export("writeAnnotationsApiKey", write_annotations.api_key)
* pulumi.export("authenticateSdkControlChannel", authenticate_sdk_control_channel.api_key)
* pulumi.export("fullPermissionsApiKey", full_permissions.api_key)
* ```
* ```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 readTelemetry = new Azure.AppInsights.ApiKey("read_telemetry", new()
* {
* Name = "tf-test-appinsights-read-telemetry-api-key",
* ApplicationInsightsId = exampleInsights.Id,
* ReadPermissions = new[]
* {
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search",
* },
* });
* var writeAnnotations = new Azure.AppInsights.ApiKey("write_annotations", new()
* {
* Name = "tf-test-appinsights-write-annotations-api-key",
* ApplicationInsightsId = exampleInsights.Id,
* WritePermissions = new[]
* {
* "annotations",
* },
* });
* var authenticateSdkControlChannel = new Azure.AppInsights.ApiKey("authenticate_sdk_control_channel", new()
* {
* Name = "tf-test-appinsights-authenticate-sdk-control-channel-api-key",
* ApplicationInsightsId = exampleInsights.Id,
* ReadPermissions = new[]
* {
* "agentconfig",
* },
* });
* var fullPermissions = new Azure.AppInsights.ApiKey("full_permissions", new()
* {
* Name = "tf-test-appinsights-full-permissions-api-key",
* ApplicationInsightsId = exampleInsights.Id,
* ReadPermissions = new[]
* {
* "agentconfig",
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search",
* },
* WritePermissions = new[]
* {
* "annotations",
* },
* });
* return new Dictionary
* {
* ["readTelemetryApiKey"] = readTelemetry.ApiKey,
* ["writeAnnotationsApiKey"] = writeAnnotations.ApiKey,
* ["authenticateSdkControlChannel"] = authenticateSdkControlChannel.ApiKey,
* ["fullPermissionsApiKey"] = fullPermissions.ApiKey,
* };
* });
* ```
* ```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
* }
* readTelemetry, err := appinsights.NewApiKey(ctx, "read_telemetry", &appinsights.ApiKeyArgs{
* Name: pulumi.String("tf-test-appinsights-read-telemetry-api-key"),
* ApplicationInsightsId: exampleInsights.ID(),
* ReadPermissions: pulumi.StringArray{
* pulumi.String("aggregate"),
* pulumi.String("api"),
* pulumi.String("draft"),
* pulumi.String("extendqueries"),
* pulumi.String("search"),
* },
* })
* if err != nil {
* return err
* }
* writeAnnotations, err := appinsights.NewApiKey(ctx, "write_annotations", &appinsights.ApiKeyArgs{
* Name: pulumi.String("tf-test-appinsights-write-annotations-api-key"),
* ApplicationInsightsId: exampleInsights.ID(),
* WritePermissions: pulumi.StringArray{
* pulumi.String("annotations"),
* },
* })
* if err != nil {
* return err
* }
* authenticateSdkControlChannel, err := appinsights.NewApiKey(ctx, "authenticate_sdk_control_channel", &appinsights.ApiKeyArgs{
* Name: pulumi.String("tf-test-appinsights-authenticate-sdk-control-channel-api-key"),
* ApplicationInsightsId: exampleInsights.ID(),
* ReadPermissions: pulumi.StringArray{
* pulumi.String("agentconfig"),
* },
* })
* if err != nil {
* return err
* }
* fullPermissions, err := appinsights.NewApiKey(ctx, "full_permissions", &appinsights.ApiKeyArgs{
* Name: pulumi.String("tf-test-appinsights-full-permissions-api-key"),
* ApplicationInsightsId: exampleInsights.ID(),
* ReadPermissions: pulumi.StringArray{
* pulumi.String("agentconfig"),
* pulumi.String("aggregate"),
* pulumi.String("api"),
* pulumi.String("draft"),
* pulumi.String("extendqueries"),
* pulumi.String("search"),
* },
* WritePermissions: pulumi.StringArray{
* pulumi.String("annotations"),
* },
* })
* if err != nil {
* return err
* }
* ctx.Export("readTelemetryApiKey", readTelemetry.ApiKey)
* ctx.Export("writeAnnotationsApiKey", writeAnnotations.ApiKey)
* ctx.Export("authenticateSdkControlChannel", authenticateSdkControlChannel.ApiKey)
* ctx.Export("fullPermissionsApiKey", fullPermissions.ApiKey)
* 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.ApiKey;
* import com.pulumi.azure.appinsights.ApiKeyArgs;
* 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 readTelemetry = new ApiKey("readTelemetry", ApiKeyArgs.builder()
* .name("tf-test-appinsights-read-telemetry-api-key")
* .applicationInsightsId(exampleInsights.id())
* .readPermissions(
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search")
* .build());
* var writeAnnotations = new ApiKey("writeAnnotations", ApiKeyArgs.builder()
* .name("tf-test-appinsights-write-annotations-api-key")
* .applicationInsightsId(exampleInsights.id())
* .writePermissions("annotations")
* .build());
* var authenticateSdkControlChannel = new ApiKey("authenticateSdkControlChannel", ApiKeyArgs.builder()
* .name("tf-test-appinsights-authenticate-sdk-control-channel-api-key")
* .applicationInsightsId(exampleInsights.id())
* .readPermissions("agentconfig")
* .build());
* var fullPermissions = new ApiKey("fullPermissions", ApiKeyArgs.builder()
* .name("tf-test-appinsights-full-permissions-api-key")
* .applicationInsightsId(exampleInsights.id())
* .readPermissions(
* "agentconfig",
* "aggregate",
* "api",
* "draft",
* "extendqueries",
* "search")
* .writePermissions("annotations")
* .build());
* ctx.export("readTelemetryApiKey", readTelemetry.apiKey());
* ctx.export("writeAnnotationsApiKey", writeAnnotations.apiKey());
* ctx.export("authenticateSdkControlChannel", authenticateSdkControlChannel.apiKey());
* ctx.export("fullPermissionsApiKey", fullPermissions.apiKey());
* }
* }
* ```
* ```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
* readTelemetry:
* type: azure:appinsights:ApiKey
* name: read_telemetry
* properties:
* name: tf-test-appinsights-read-telemetry-api-key
* applicationInsightsId: ${exampleInsights.id}
* readPermissions:
* - aggregate
* - api
* - draft
* - extendqueries
* - search
* writeAnnotations:
* type: azure:appinsights:ApiKey
* name: write_annotations
* properties:
* name: tf-test-appinsights-write-annotations-api-key
* applicationInsightsId: ${exampleInsights.id}
* writePermissions:
* - annotations
* authenticateSdkControlChannel:
* type: azure:appinsights:ApiKey
* name: authenticate_sdk_control_channel
* properties:
* name: tf-test-appinsights-authenticate-sdk-control-channel-api-key
* applicationInsightsId: ${exampleInsights.id}
* readPermissions:
* - agentconfig
* fullPermissions:
* type: azure:appinsights:ApiKey
* name: full_permissions
* properties:
* name: tf-test-appinsights-full-permissions-api-key
* applicationInsightsId: ${exampleInsights.id}
* readPermissions:
* - agentconfig
* - aggregate
* - api
* - draft
* - extendqueries
* - search
* writePermissions:
* - annotations
* outputs:
* readTelemetryApiKey: ${readTelemetry.apiKey}
* writeAnnotationsApiKey: ${writeAnnotations.apiKey}
* authenticateSdkControlChannel: ${authenticateSdkControlChannel.apiKey}
* fullPermissionsApiKey: ${fullPermissions.apiKey}
* ```
*
* ## Import
* Application Insights API keys can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:appinsights/apiKey:ApiKey my_key /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/components/instance1/apiKeys/00000000-0000-0000-0000-000000000000
* ```
*/
public class ApiKey internal constructor(
override val javaResource: com.pulumi.azure.appinsights.ApiKey,
) : KotlinCustomResource(javaResource, ApiKeyMapper) {
/**
* The API Key secret (Sensitive).
*/
public val apiKey: Output
get() = javaResource.apiKey().applyValue({ args0 -> args0 })
/**
* The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.
*/
public val applicationInsightsId: Output
get() = javaResource.applicationInsightsId().applyValue({ args0 -> args0 })
/**
* Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Specifies the list of read permissions granted to the API key. Valid values are `agentconfig`, `aggregate`, `api`, `draft`, `extendqueries`, `search`. Please note these values are case sensitive. Changing this forces a new resource to be created.
*/
public val readPermissions: Output>?
get() = javaResource.readPermissions().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* Specifies the list of write permissions granted to the API key. Valid values are `annotations`. Please note these values are case sensitive. Changing this forces a new resource to be created.
* > **Note:** At least one read or write permission must be defined.
*/
public val writePermissions: Output>?
get() = javaResource.writePermissions().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
}
public object ApiKeyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.appinsights.ApiKey::class == javaResource::class
override fun map(javaResource: Resource): ApiKey = ApiKey(
javaResource as
com.pulumi.azure.appinsights.ApiKey,
)
}
/**
* @see [ApiKey].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [ApiKey].
*/
public suspend fun apiKey(name: String, block: suspend ApiKeyResourceBuilder.() -> Unit): ApiKey {
val builder = ApiKeyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [ApiKey].
* @param name The _unique_ name of the resulting resource.
*/
public fun apiKey(name: String): ApiKey {
val builder = ApiKeyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy