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

com.pulumi.azure.eventgrid.kotlin.SystemTopic.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.eventgrid.kotlin

import com.pulumi.azure.eventgrid.kotlin.outputs.SystemTopicIdentity
import com.pulumi.azure.eventgrid.kotlin.outputs.SystemTopicIdentity.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 [SystemTopic].
 */
@PulumiTagMarker
public class SystemTopicResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SystemTopicArgs = SystemTopicArgs()

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

/**
 * Manages an Event Grid System Topic.
 * ## 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 exampleAccount = new azure.storage.Account("example", {
 *     name: "examplestoracct",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 *     tags: {
 *         environment: "staging",
 *     },
 * });
 * const exampleSystemTopic = new azure.eventgrid.SystemTopic("example", {
 *     name: "example-topic",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sourceArmResourceId: exampleAccount.id,
 *     topicType: "Microsoft.Storage.StorageAccounts",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="examplestoracct",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS",
 *     tags={
 *         "environment": "staging",
 *     })
 * example_system_topic = azure.eventgrid.SystemTopic("example",
 *     name="example-topic",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     source_arm_resource_id=example_account.id,
 *     topic_type="Microsoft.Storage.StorageAccounts")
 * ```
 * ```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 exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "examplestoracct",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *         Tags =
 *         {
 *             { "environment", "staging" },
 *         },
 *     });
 *     var exampleSystemTopic = new Azure.EventGrid.SystemTopic("example", new()
 *     {
 *         Name = "example-topic",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         SourceArmResourceId = exampleAccount.Id,
 *         TopicType = "Microsoft.Storage.StorageAccounts",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/eventgrid"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"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
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("examplestoracct"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("staging"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = eventgrid.NewSystemTopic(ctx, "example", &eventgrid.SystemTopicArgs{
 * 			Name:                pulumi.String("example-topic"),
 * 			ResourceGroupName:   example.Name,
 * 			Location:            example.Location,
 * 			SourceArmResourceId: exampleAccount.ID(),
 * 			TopicType:           pulumi.String("Microsoft.Storage.StorageAccounts"),
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.eventgrid.SystemTopic;
 * import com.pulumi.azure.eventgrid.SystemTopicArgs;
 * 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 exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("examplestoracct")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .tags(Map.of("environment", "staging"))
 *             .build());
 *         var exampleSystemTopic = new SystemTopic("exampleSystemTopic", SystemTopicArgs.builder()
 *             .name("example-topic")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sourceArmResourceId(exampleAccount.id())
 *             .topicType("Microsoft.Storage.StorageAccounts")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: examplestoracct
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *       tags:
 *         environment: staging
 *   exampleSystemTopic:
 *     type: azure:eventgrid:SystemTopic
 *     name: example
 *     properties:
 *       name: example-topic
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sourceArmResourceId: ${exampleAccount.id}
 *       topicType: Microsoft.Storage.StorageAccounts
 * ```
 * 
 * ## Import
 * Event Grid System Topic can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:eventgrid/systemTopic:SystemTopic example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventGrid/systemTopics/systemTopic1
 * ```
 */
public class SystemTopic internal constructor(
    override val javaResource: com.pulumi.azure.eventgrid.SystemTopic,
) : KotlinCustomResource(javaResource, SystemTopicMapper) {
    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            }).orElse(null)
        })

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

    /**
     * The Metric ARM Resource ID of the Event Grid System Topic.
     */
    public val metricArmResourceId: Output
        get() = javaResource.metricArmResourceId().applyValue({ args0 -> args0 })

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

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

    /**
     * The ID of the Event Grid System Topic ARM Source. Changing this forces a new Event Grid System Topic to be created.
     */
    public val sourceArmResourceId: Output
        get() = javaResource.sourceArmResourceId().applyValue({ args0 -> args0 })

    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * The Topic Type of the Event Grid System Topic. The topic type is validated by Azure and there may be additional topic types beyond the following: `Microsoft.AppConfiguration.ConfigurationStores`, `Microsoft.Communication.CommunicationServices`, `Microsoft.ContainerRegistry.Registries`, `Microsoft.Devices.IoTHubs`, `Microsoft.EventGrid.Domains`, `Microsoft.EventGrid.Topics`, `Microsoft.Eventhub.Namespaces`, `Microsoft.KeyVault.vaults`, `Microsoft.MachineLearningServices.Workspaces`, `Microsoft.Maps.Accounts`, `Microsoft.Media.MediaServices`, `Microsoft.Resources.ResourceGroups`, `Microsoft.Resources.Subscriptions`, `Microsoft.ServiceBus.Namespaces`, `Microsoft.SignalRService.SignalR`, `Microsoft.Storage.StorageAccounts`, `Microsoft.Web.ServerFarms` and `Microsoft.Web.Sites`. Changing this forces a new Event Grid System Topic to be created.
     * > **NOTE:** Some `topic_type`s (e.g. **Microsoft.Resources.Subscriptions**) requires location to be set to `Global` instead of a real location like `West US`.
     * > **NOTE:** You can use Azure CLI to get a full list of the available topic types: `az eventgrid topic-type  list --output json | grep -w id`
     */
    public val topicType: Output
        get() = javaResource.topicType().applyValue({ args0 -> args0 })
}

public object SystemTopicMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.eventgrid.SystemTopic::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy