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

com.pulumi.azure.appinsights.kotlin.Workbook.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.appinsights.kotlin

import com.pulumi.azure.appinsights.kotlin.outputs.WorkbookIdentity
import com.pulumi.azure.appinsights.kotlin.outputs.WorkbookIdentity.Companion.toKotlin
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.Map

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

    public var args: WorkbookArgs = WorkbookArgs()

    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 WorkbookArgsBuilder.() -> Unit) {
        val builder = WorkbookArgsBuilder()
        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(): Workbook {
        val builtJavaResource = com.pulumi.azure.appinsights.Workbook(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Workbook(builtJavaResource)
    }
}

/**
 * Manages an Azure Workbook.
 * ## 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 exampleWorkbook = new azure.appinsights.Workbook("example", {
 *     name: "85b3e8bb-fc93-40be-83f2-98f6bec18ba0",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     displayName: "workbook1",
 *     dataJson: JSON.stringify({
 *         version: "Notebook/1.0",
 *         items: [{
 *             type: 1,
 *             content: {
 *                 json: "Test2022",
 *             },
 *             name: "text - 0",
 *         }],
 *         isLocked: false,
 *         fallbackResourceIds: ["Azure Monitor"],
 *     }),
 *     tags: {
 *         ENV: "Test",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import json
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_workbook = azure.appinsights.Workbook("example",
 *     name="85b3e8bb-fc93-40be-83f2-98f6bec18ba0",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     display_name="workbook1",
 *     data_json=json.dumps({
 *         "version": "Notebook/1.0",
 *         "items": [{
 *             "type": 1,
 *             "content": {
 *                 "json": "Test2022",
 *             },
 *             "name": "text - 0",
 *         }],
 *         "isLocked": False,
 *         "fallbackResourceIds": ["Azure Monitor"],
 *     }),
 *     tags={
 *         "ENV": "Test",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using System.Text.Json;
 * 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 exampleWorkbook = new Azure.AppInsights.Workbook("example", new()
 *     {
 *         Name = "85b3e8bb-fc93-40be-83f2-98f6bec18ba0",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         DisplayName = "workbook1",
 *         DataJson = JsonSerializer.Serialize(new Dictionary
 *         {
 *             ["version"] = "Notebook/1.0",
 *             ["items"] = new[]
 *             {
 *                 new Dictionary
 *                 {
 *                     ["type"] = 1,
 *                     ["content"] = new Dictionary
 *                     {
 *                         ["json"] = "Test2022",
 *                     },
 *                     ["name"] = "text - 0",
 *                 },
 *             },
 *             ["isLocked"] = false,
 *             ["fallbackResourceIds"] = new[]
 *             {
 *                 "Azure Monitor",
 *             },
 *         }),
 *         Tags =
 *         {
 *             { "ENV", "Test" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"encoding/json"
 * 	"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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		tmpJSON0, err := json.Marshal(map[string]interface{}{
 * 			"version": "Notebook/1.0",
 * 			"items": []map[string]interface{}{
 * 				map[string]interface{}{
 * 					"type": 1,
 * 					"content": map[string]interface{}{
 * 						"json": "Test2022",
 * 					},
 * 					"name": "text - 0",
 * 				},
 * 			},
 * 			"isLocked": false,
 * 			"fallbackResourceIds": []string{
 * 				"Azure Monitor",
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		json0 := string(tmpJSON0)
 * 		_, err = appinsights.NewWorkbook(ctx, "example", &appinsights.WorkbookArgs{
 * 			Name:              pulumi.String("85b3e8bb-fc93-40be-83f2-98f6bec18ba0"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			DisplayName:       pulumi.String("workbook1"),
 * 			DataJson:          pulumi.String(json0),
 * 			Tags: pulumi.StringMap{
 * 				"ENV": pulumi.String("Test"),
 * 			},
 * 		})
 * 		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.Workbook;
 * import com.pulumi.azure.appinsights.WorkbookArgs;
 * import static com.pulumi.codegen.internal.Serialization.*;
 * 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 exampleWorkbook = new Workbook("exampleWorkbook", WorkbookArgs.builder()
 *             .name("85b3e8bb-fc93-40be-83f2-98f6bec18ba0")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .displayName("workbook1")
 *             .dataJson(serializeJson(
 *                 jsonObject(
 *                     jsonProperty("version", "Notebook/1.0"),
 *                     jsonProperty("items", jsonArray(jsonObject(
 *                         jsonProperty("type", 1),
 *                         jsonProperty("content", jsonObject(
 *                             jsonProperty("json", "Test2022")
 *                         )),
 *                         jsonProperty("name", "text - 0")
 *                     ))),
 *                     jsonProperty("isLocked", false),
 *                     jsonProperty("fallbackResourceIds", jsonArray("Azure Monitor"))
 *                 )))
 *             .tags(Map.of("ENV", "Test"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleWorkbook:
 *     type: azure:appinsights:Workbook
 *     name: example
 *     properties:
 *       name: 85b3e8bb-fc93-40be-83f2-98f6bec18ba0
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       displayName: workbook1
 *       dataJson:
 *         fn::toJSON:
 *           version: Notebook/1.0
 *           items:
 *             - type: 1
 *               content:
 *                 json: Test2022
 *               name: text - 0
 *           isLocked: false
 *           fallbackResourceIds:
 *             - Azure Monitor
 *       tags:
 *         ENV: Test
 * ```
 * 
 * ## Import
 * Workbooks can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:appinsights/workbook:Workbook example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Insights/workbooks/resource1
 * ```
 */
public class Workbook internal constructor(
    override val javaResource: com.pulumi.azure.appinsights.Workbook,
) : KotlinCustomResource(javaResource, WorkbookMapper) {
    /**
     * Workbook category, as defined by the user at creation time. There may be additional category types beyond the following: `workbook`, `sentinel`. Defaults to `workbook`.
     */
    public val category: Output?
        get() = javaResource.category().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Configuration of this particular workbook. Configuration data is a string containing valid JSON.
     */
    public val dataJson: Output
        get() = javaResource.dataJson().applyValue({ args0 -> args0 })

    /**
     * Specifies the description of the workbook.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the user-defined name (display name) of the workbook.
     */
    public val displayName: Output
        get() = javaResource.displayName().applyValue({ args0 -> args0 })

    /**
     * An `identity` block as defined below. Changing this forces a new Workbook to be created.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies the Azure Region where the Workbook should exist. Changing this forces a new Workbook to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of this Workbook as a UUID/GUID. It should not contain any uppercase letters. Changing this forces a new Workbook to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

    /**
     * Resource ID for a source resource. It should not contain any uppercase letters. Defaults to `azure monitor`.
     */
    public val sourceId: Output?
        get() = javaResource.sourceId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the Resource Manager ID of the Storage Container when bring your own storage is used. Changing this forces a new Workbook to be created.
     * > **Note:** This is the Resource Manager ID of the Storage Container, rather than the regular ID - and can be accessed on the `azure.storage.Container` Data Source/Resource as `resource_manager_id`.
     */
    public val storageContainerId: Output?
        get() = javaResource.storageContainerId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A mapping of tags which should be assigned to the Workbook.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object WorkbookMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.appinsights.Workbook::class == javaResource::class

    override fun map(javaResource: Resource): Workbook = Workbook(
        javaResource as
            com.pulumi.azure.appinsights.Workbook,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy