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

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

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

    public var args: QueueArgs = QueueArgs()

    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 QueueArgsBuilder.() -> Unit) {
        val builder = QueueArgsBuilder()
        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.opts(block)
    }

    internal fun build(): Queue {
        val builtJavaResource = com.pulumi.azure.servicebus.Queue(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Queue(builtJavaResource)
    }
}

/**
 * Manages a ServiceBus Queue.
 * ## Example Usage
 * ```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.Queue;
 * import com.pulumi.azure.servicebus.QueueArgs;
 * 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .location("West Europe")
 *             .build());
 *         var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .sku("Standard")
 *             .tags(Map.of("source", "example"))
 *             .build());
 *         var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()
 *             .namespaceId(exampleNamespace.id())
 *             .enablePartitioning(true)
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * Service Bus Queue can be imported using the `resource id`, e.g.
 * ```sh
 *  $ pulumi import azure:servicebus/queue:Queue example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ServiceBus/namespaces/sbns1/queues/snqueue1
 * ```
 *
 */
public class Queue internal constructor(
    override val javaResource: com.pulumi.azure.servicebus.Queue,
) : KotlinCustomResource(javaResource, QueueMapper) {
    /**
     * The ISO 8601 timespan duration of the idle interval after which the Queue is automatically deleted, minimum of 5 minutes.
     */
    public val autoDeleteOnIdle: Output
        get() = javaResource.autoDeleteOnIdle().applyValue({ args0 -> args0 })

    /**
     * Boolean flag which controls whether the Queue has dead letter support when a message expires. Defaults to `false`.
     */
    public val deadLetteringOnMessageExpiration: Output?
        get() = javaResource.deadLetteringOnMessageExpiration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ISO 8601 timespan duration of the TTL of messages sent to this queue. This is the default value used when TTL is not set on 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 whether server-side batched operations are enabled. Defaults to `true`.
     */
    public val enableBatchedOperations: Output?
        get() = javaResource.enableBatchedOperations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Boolean flag which controls whether Express Entities are enabled. An express queue holds a message in memory temporarily before writing it to persistent storage. Defaults to `false` for Basic and Standard. For Premium, it MUST be set to `false`.
     * > **NOTE:** Service Bus Premium namespaces do not support Express Entities, so `enable_express` MUST be set to `false`.
     */
    public val enableExpress: Output?
        get() = javaResource.enableExpress().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Boolean flag which controls whether to enable the queue to be partitioned across multiple message brokers. Changing this forces a new resource to be created. Defaults to `false` for Basic and Standard.
     * > **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.
     */
    public val enablePartitioning: Output?
        get() = javaResource.enablePartitioning().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of a Queue or Topic to automatically forward dead lettered messages to.
     */
    public val forwardDeadLetteredMessagesTo: Output?
        get() = javaResource.forwardDeadLetteredMessagesTo().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of a Queue or Topic to automatically forward messages to. Please [see the documentation](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-auto-forwarding) for more information.
     */
    public val forwardTo: Output?
        get() = javaResource.forwardTo().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The ISO 8601 timespan duration of a peek-lock; that is, the amount of time that the message is locked for other receivers. Maximum value is 5 minutes. Defaults to 1 minute (`PT1M`).
     */
    public val lockDuration: Output
        get() = javaResource.lockDuration().applyValue({ args0 -> args0 })

    /**
     * Integer value which controls when a message is automatically dead lettered. Defaults to `10`.
     */
    public val maxDeliveryCount: Output?
        get() = javaResource.maxDeliveryCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Integer value which controls the maximum size of a message allowed on the queue 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 queue. For supported values see the "Queue or topic size" section of [Service Bus Quotas](https://docs.microsoft.com/azure/service-bus-messaging/service-bus-quotas). Defaults to `1024`.
     */
    public val maxSizeInMegabytes: Output
        get() = javaResource.maxSizeInMegabytes().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the ServiceBus Queue 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 queue 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 })

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

    /**
     * Boolean flag which controls whether the Queue requires sessions. This will allow ordered handling of unbounded sequences of related messages. With sessions enabled a queue can guarantee first-in-first-out delivery of messages. Changing this forces a new resource to be created. Defaults to `false`.
     */
    public val requiresSession: Output?
        get() = javaResource.requiresSession().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The status of the Queue. Possible values are `Active`, `Creating`, `Deleting`, `Disabled`, `ReceiveDisabled`, `Renaming`, `SendDisabled`, `Unknown`. Note that `Restoring` is not accepted. Defaults to `Active`.
     */
    public val status: Output?
        get() = javaResource.status().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy