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

com.pulumi.azure.servicebus.kotlin.Topic.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.servicebus.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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: TopicArgs = TopicArgs()

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

/**
 * Manages a ServiceBus Topic.
 * **Note** Topics can only be created in Namespaces with an SKU of `standard` or higher.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "tfex-servicebus-topic",
 *     location: "West Europe",
 * });
 * const exampleNamespace = new azure.servicebus.Namespace("example", {
 *     name: "tfex-servicebus-namespace",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 *     tags: {
 *         source: "example",
 *     },
 * });
 * const exampleTopic = new azure.servicebus.Topic("example", {
 *     name: "tfex_servicebus_topic",
 *     namespaceId: exampleNamespace.id,
 *     enablePartitioning: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="tfex-servicebus-topic",
 *     location="West Europe")
 * example_namespace = azure.servicebus.Namespace("example",
 *     name="tfex-servicebus-namespace",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard",
 *     tags={
 *         "source": "example",
 *     })
 * example_topic = azure.servicebus.Topic("example",
 *     name="tfex_servicebus_topic",
 *     namespace_id=example_namespace.id,
 *     enable_partitioning=True)
 * ```
 * ```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 = "tfex-servicebus-topic",
 *         Location = "West Europe",
 *     });
 *     var exampleNamespace = new Azure.ServiceBus.Namespace("example", new()
 *     {
 *         Name = "tfex-servicebus-namespace",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *         Tags =
 *         {
 *             { "source", "example" },
 *         },
 *     });
 *     var exampleTopic = new Azure.ServiceBus.Topic("example", new()
 *     {
 *         Name = "tfex_servicebus_topic",
 *         NamespaceId = exampleNamespace.Id,
 *         EnablePartitioning = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/servicebus"
 * 	"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("tfex-servicebus-topic"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNamespace, err := servicebus.NewNamespace(ctx, "example", &servicebus.NamespaceArgs{
 * 			Name:              pulumi.String("tfex-servicebus-namespace"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 			Tags: pulumi.StringMap{
 * 				"source": pulumi.String("example"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = servicebus.NewTopic(ctx, "example", &servicebus.TopicArgs{
 * 			Name:               pulumi.String("tfex_servicebus_topic"),
 * 			NamespaceId:        exampleNamespace.ID(),
 * 			EnablePartitioning: pulumi.Bool(true),
 * 		})
 * 		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.servicebus.Namespace;
 * import com.pulumi.azure.servicebus.NamespaceArgs;
 * import com.pulumi.azure.servicebus.Topic;
 * import com.pulumi.azure.servicebus.TopicArgs;
 * 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("tfex-servicebus-topic")
 *             .location("West Europe")
 *             .build());
 *         var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
 *             .name("tfex-servicebus-namespace")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .tags(Map.of("source", "example"))
 *             .build());
 *         var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
 *             .name("tfex_servicebus_topic")
 *             .namespaceId(exampleNamespace.id())
 *             .enablePartitioning(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: tfex-servicebus-topic
 *       location: West Europe
 *   exampleNamespace:
 *     type: azure:servicebus:Namespace
 *     name: example
 *     properties:
 *       name: tfex-servicebus-namespace
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *       tags:
 *         source: example
 *   exampleTopic:
 *     type: azure:servicebus:Topic
 *     name: example
 *     properties:
 *       name: tfex_servicebus_topic
 *       namespaceId: ${exampleNamespace.id}
 *       enablePartitioning: true
 * ```
 * 
 * ## Import
 * Service Bus Topics can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:servicebus/topic:Topic example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ServiceBus/namespaces/sbns1/topics/sntopic1
 * ```
 */
public class Topic internal constructor(
    override val javaResource: com.pulumi.azure.servicebus.Topic,
) : KotlinCustomResource(javaResource, TopicMapper) {
    /**
     * The ISO 8601 timespan duration of the idle interval after which the Topic is automatically deleted, minimum of 5 minutes.
     */
    public val autoDeleteOnIdle: Output
        get() = javaResource.autoDeleteOnIdle().applyValue({ args0 -> args0 })

    public val batchedOperationsEnabled: Output
        get() = javaResource.batchedOperationsEnabled().applyValue({ args0 -> args0 })

    /**
     * The ISO 8601 timespan duration of TTL of messages sent to this topic if no TTL value is set on the message itself.
     */
    public val defaultMessageTtl: Output
        get() = javaResource.defaultMessageTtl().applyValue({ args0 -> args0 })

    /**
     * The ISO 8601 timespan duration during which duplicates can be detected. Defaults to 10 minutes. (`PT10M`)
     */
    public val duplicateDetectionHistoryTimeWindow: Output
        get() = javaResource.duplicateDetectionHistoryTimeWindow().applyValue({ args0 -> args0 })

    /**
     * Boolean flag which controls if server-side batched operations are enabled.
     */
    @Deprecated(
        message = """
  The property `enable_batched_operations` has been superseded by `batched_operations_enabled` and
      will be removed in v4.0 of the AzureRM Provider.
  """,
    )
    public val enableBatchedOperations: Output
        get() = javaResource.enableBatchedOperations().applyValue({ args0 -> args0 })

    /**
     * Boolean flag which controls whether Express Entities are enabled. An express topic holds a message in memory temporarily before writing it to persistent storage.
     */
    @Deprecated(
        message = """
  The property `enable_express` has been superseded by `express_enabled` and will be removed in v4.0
      of the AzureRM Provider.
  """,
    )
    public val enableExpress: Output
        get() = javaResource.enableExpress().applyValue({ args0 -> args0 })

    /**
     * Boolean flag which controls whether to enable the topic to be partitioned across multiple message brokers. Changing this forces a new resource to be created.
     * > **NOTE:** Partitioning is available at entity creation for all queues and topics in Basic or Standard SKUs. It is not available for the Premium messaging SKU, but any previously existing partitioned entities in Premium namespaces continue to work as expected. Please [see the documentation](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-partitioning) for more information.
     */
    @Deprecated(
        message = """
  The property `enable_partitioning` has been superseded by `partitioning_enabled` and will be
      removed in v4.0 of the AzureRM Provider.
  """,
    )
    public val enablePartitioning: Output
        get() = javaResource.enablePartitioning().applyValue({ args0 -> args0 })

    public val expressEnabled: Output
        get() = javaResource.expressEnabled().applyValue({ args0 -> args0 })

    /**
     * Integer value which controls the maximum size of a message allowed on the topic for Premium SKU. For supported values see the "Large messages support" section of [this document](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-premium-messaging#large-messages-support-preview).
     */
    public val maxMessageSizeInKilobytes: Output
        get() = javaResource.maxMessageSizeInKilobytes().applyValue({ args0 -> args0 })

    /**
     * Integer value which controls the size of memory allocated for the topic. For supported values see the "Queue/topic size" section of [this document](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-quotas).
     */
    public val maxSizeInMegabytes: Output
        get() = javaResource.maxSizeInMegabytes().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the ServiceBus Topic resource. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The ID of the ServiceBus Namespace to create this topic in. Changing this forces a new resource to be created.
     */
    public val namespaceId: Output
        get() = javaResource.namespaceId().applyValue({ args0 -> args0 })

    public val namespaceName: Output
        get() = javaResource.namespaceName().applyValue({ args0 -> args0 })

    public val partitioningEnabled: Output
        get() = javaResource.partitioningEnabled().applyValue({ args0 -> args0 })

    /**
     * Boolean flag which controls whether the Topic requires duplicate detection. Defaults to `false`. Changing this forces a new resource to be created.
     */
    public val requiresDuplicateDetection: Output?
        get() = javaResource.requiresDuplicateDetection().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * The Status of the Service Bus Topic. Acceptable values are `Active` or `Disabled`. Defaults to `Active`.
     */
    public val status: Output?
        get() = javaResource.status().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Boolean flag which controls whether the Topic supports ordering.
     */
    public val supportOrdering: Output?
        get() = javaResource.supportOrdering().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object TopicMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.servicebus.Topic::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy