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

com.pulumi.azure.eventhub.kotlin.Namespace.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.eventhub.kotlin

import com.pulumi.azure.eventhub.kotlin.outputs.NamespaceCustomerManagedKey
import com.pulumi.azure.eventhub.kotlin.outputs.NamespaceIdentity
import com.pulumi.azure.eventhub.kotlin.outputs.NamespaceNetworkRuleSet
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
import kotlin.collections.Map
import com.pulumi.azure.eventhub.kotlin.outputs.NamespaceCustomerManagedKey.Companion.toKotlin as namespaceCustomerManagedKeyToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.NamespaceIdentity.Companion.toKotlin as namespaceIdentityToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.NamespaceNetworkRuleSet.Companion.toKotlin as namespaceNetworkRuleSetToKotlin

/**
 * Builder for [Namespace].
 */
@PulumiTagMarker
@Deprecated(
    message = """
azure.eventhub.Namespace has been deprecated in favor of azure.servicebus.Namespace
""",
)
public class NamespaceResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: NamespaceArgs = NamespaceArgs()

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

/**
 * Manages a ServiceBus Namespace.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "my-servicebus",
 *     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",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="my-servicebus",
 *     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",
 *     })
 * ```
 * ```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 = "my-servicebus",
 *         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" },
 *         },
 *     });
 * });
 * ```
 * ```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("my-servicebus"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, 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
 * 		}
 * 		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 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("my-servicebus")
 *             .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());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: my-servicebus
 *       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
 * ```
 * 
 * ## Import
 * Service Bus Namespace can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:eventhub/namespace:Namespace example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ServiceBus/namespaces/sbns1
 * ```
 */
@Deprecated(
    message = """
azure.eventhub.Namespace has been deprecated in favor of azure.servicebus.Namespace
""",
)
public class Namespace internal constructor(
    override val javaResource: com.pulumi.azure.eventhub.Namespace,
) : KotlinCustomResource(javaResource, NamespaceMapper) {
    /**
     * Specifies the capacity. When `sku` is `Premium`, capacity can be `1`, `2`, `4`, `8` or `16`. When `sku` is `Basic` or `Standard`, capacity can be `0` only.
     */
    public val capacity: Output?
        get() = javaResource.capacity().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * An `customer_managed_key` block as defined below.
     */
    public val customerManagedKey: Output?
        get() = javaResource.customerManagedKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> namespaceCustomerManagedKeyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The primary connection string for the authorization rule `RootManageSharedAccessKey`.
     */
    public val defaultPrimaryConnectionString: Output
        get() = javaResource.defaultPrimaryConnectionString().applyValue({ args0 -> args0 })

    /**
     * The primary access key for the authorization rule `RootManageSharedAccessKey`.
     */
    public val defaultPrimaryKey: Output
        get() = javaResource.defaultPrimaryKey().applyValue({ args0 -> args0 })

    /**
     * The secondary connection string for the authorization rule `RootManageSharedAccessKey`.
     */
    public val defaultSecondaryConnectionString: Output
        get() = javaResource.defaultSecondaryConnectionString().applyValue({ args0 -> args0 })

    /**
     * The secondary access key for the authorization rule `RootManageSharedAccessKey`.
     */
    public val defaultSecondaryKey: Output
        get() = javaResource.defaultSecondaryKey().applyValue({ args0 -> args0 })

    /**
     * The URL to access the ServiceBus Namespace.
     */
    public val endpoint: Output
        get() = javaResource.endpoint().applyValue({ args0 -> args0 })

    /**
     * An `identity` block as defined below.
     */
    public val identity: Output?
        get() = javaResource.identity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    namespaceIdentityToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Whether or not SAS authentication is enabled for the Service Bus namespace. Defaults to `true`.
     */
    public val localAuthEnabled: Output?
        get() = javaResource.localAuthEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The minimum supported TLS version for this Service Bus Namespace. Valid values are: `1.0`, `1.1` and `1.2`. The current default minimum TLS version is `1.2`.
     */
    public val minimumTlsVersion: Output
        get() = javaResource.minimumTlsVersion().applyValue({ args0 -> args0 })

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

    /**
     * An `network_rule_set` block as defined below.
     */
    public val networkRuleSet: Output
        get() = javaResource.networkRuleSet().applyValue({ args0 ->
            args0.let({ args0 ->
                namespaceNetworkRuleSetToKotlin(args0)
            })
        })

    /**
     * Specifies the number messaging partitions. Only valid when `sku` is `Premium` and the minimum number is `1`. Possible values include `0`, `1`, `2`, and `4`. Defaults to `0` for Standard, Basic namespace. Changing this forces a new resource to be created.
     * > **Note:** It's not possible to change the partitioning option on any existing namespace. The number of partitions can only be set during namespace creation. Please check the doc https://learn.microsoft.com/en-us/azure/service-bus-messaging/enable-partitions-premium for more feature restrictions.
     */
    public val premiumMessagingPartitions: Output?
        get() = javaResource.premiumMessagingPartitions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Is public network access enabled for the Service Bus Namespace? Defaults to `true`.
     */
    public val publicNetworkAccessEnabled: Output?
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The name of the resource group in which to Changing this forces a new resource to be created.
     * create the namespace.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * Defines which tier to use. Options are `Basic`, `Standard` or `Premium`. Please note that setting this field to `Premium` will force the creation of a new resource.
     */
    public val sku: Output
        get() = javaResource.sku().applyValue({ args0 -> args0 })

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

    /**
     * Whether or not this resource is zone redundant. `sku` needs to be `Premium`. Changing this forces a new resource to be created.
     * > **Note:** In Azure Regions where availability zones are present, the availability zone feature is enabled by default now, which diffs from the previous behavior that need to set the `zone_redundant` to `true` manually. Existing namespaces are being migrated to availability zones as well, and the property `zone_redundant` is being deprecated. The property `zone_redundant` might still show as false, even when availability zones has been enabled.
     */
    @Deprecated(
        message = """
  The `zone_redundant` property has been deprecated and will be removed in v4.0 of the provider.
  """,
    )
    public val zoneRedundant: Output
        get() = javaResource.zoneRedundant().applyValue({ args0 -> args0 })
}

public object NamespaceMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.eventhub.Namespace::class == javaResource::class

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

/**
 * @see [Namespace].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Namespace].
 */
@Deprecated(
    message = """
azure.eventhub.Namespace has been deprecated in favor of azure.servicebus.Namespace
""",
)
public suspend fun namespace(name: String, block: suspend NamespaceResourceBuilder.() -> Unit): Namespace {
    val builder = NamespaceResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Namespace].
 * @param name The _unique_ name of the resulting resource.
 */
@Deprecated(
    message = """
azure.eventhub.Namespace has been deprecated in favor of azure.servicebus.Namespace
""",
)
public fun namespace(name: String): Namespace {
    val builder = NamespaceResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy