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

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

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

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

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

    public var args: TopicAuthorizationRuleArgs = TopicAuthorizationRuleArgs()

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

/**
 * Manages a ServiceBus Topic authorization Rule within a ServiceBus Topic.
 * ## 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",
 *     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,
 * });
 * const exampleTopicAuthorizationRule = new azure.servicebus.TopicAuthorizationRule("example", {
 *     name: "tfex_servicebus_topic_sasPolicy",
 *     topicId: exampleTopic.id,
 *     listen: true,
 *     send: false,
 *     manage: false,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="tfex-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",
 *     })
 * example_topic = azure.servicebus.Topic("example",
 *     name="tfex_servicebus_topic",
 *     namespace_id=example_namespace.id)
 * example_topic_authorization_rule = azure.servicebus.TopicAuthorizationRule("example",
 *     name="tfex_servicebus_topic_sasPolicy",
 *     topic_id=example_topic.id,
 *     listen=True,
 *     send=False,
 *     manage=False)
 * ```
 * ```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",
 *         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,
 *     });
 *     var exampleTopicAuthorizationRule = new Azure.ServiceBus.TopicAuthorizationRule("example", new()
 *     {
 *         Name = "tfex_servicebus_topic_sasPolicy",
 *         TopicId = exampleTopic.Id,
 *         Listen = true,
 *         Send = false,
 *         Manage = false,
 *     });
 * });
 * ```
 * ```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"),
 * 			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
 * 		}
 * 		exampleTopic, err := servicebus.NewTopic(ctx, "example", &servicebus.TopicArgs{
 * 			Name:        pulumi.String("tfex_servicebus_topic"),
 * 			NamespaceId: exampleNamespace.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = servicebus.NewTopicAuthorizationRule(ctx, "example", &servicebus.TopicAuthorizationRuleArgs{
 * 			Name:    pulumi.String("tfex_servicebus_topic_sasPolicy"),
 * 			TopicId: exampleTopic.ID(),
 * 			Listen:  pulumi.Bool(true),
 * 			Send:    pulumi.Bool(false),
 * 			Manage:  pulumi.Bool(false),
 * 		})
 * 		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 com.pulumi.azure.servicebus.TopicAuthorizationRule;
 * import com.pulumi.azure.servicebus.TopicAuthorizationRuleArgs;
 * 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")
 *             .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())
 *             .build());
 *         var exampleTopicAuthorizationRule = new TopicAuthorizationRule("exampleTopicAuthorizationRule", TopicAuthorizationRuleArgs.builder()
 *             .name("tfex_servicebus_topic_sasPolicy")
 *             .topicId(exampleTopic.id())
 *             .listen(true)
 *             .send(false)
 *             .manage(false)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: tfex-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
 *   exampleTopic:
 *     type: azure:servicebus:Topic
 *     name: example
 *     properties:
 *       name: tfex_servicebus_topic
 *       namespaceId: ${exampleNamespace.id}
 *   exampleTopicAuthorizationRule:
 *     type: azure:servicebus:TopicAuthorizationRule
 *     name: example
 *     properties:
 *       name: tfex_servicebus_topic_sasPolicy
 *       topicId: ${exampleTopic.id}
 *       listen: true
 *       send: false
 *       manage: false
 * ```
 * 
 * ## Import
 * ServiceBus Topic authorization rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:eventhub/topicAuthorizationRule:TopicAuthorizationRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceBus/namespaces/namespace1/topics/topic1/authorizationRules/rule1
 * ```
 */
@Deprecated(
    message = """
azure.eventhub.TopicAuthorizationRule has been deprecated in favor of
    azure.servicebus.TopicAuthorizationRule
""",
)
public class TopicAuthorizationRule internal constructor(
    override val javaResource: com.pulumi.azure.eventhub.TopicAuthorizationRule,
) : KotlinCustomResource(javaResource, TopicAuthorizationRuleMapper) {
    /**
     * Grants listen access to this this Authorization Rule. Defaults to `false`.
     */
    public val listen: Output?
        get() = javaResource.listen().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
     */
    public val manage: Output?
        get() = javaResource.manage().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

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

    /**
     * The Primary Connection String for the ServiceBus Topic authorization Rule.
     */
    public val primaryConnectionString: Output
        get() = javaResource.primaryConnectionString().applyValue({ args0 -> args0 })

    /**
     * The alias Primary Connection String for the ServiceBus Namespace, if the namespace is Geo DR paired.
     */
    public val primaryConnectionStringAlias: Output
        get() = javaResource.primaryConnectionStringAlias().applyValue({ args0 -> args0 })

    /**
     * The Primary Key for the ServiceBus Topic authorization Rule.
     */
    public val primaryKey: Output
        get() = javaResource.primaryKey().applyValue({ args0 -> args0 })

    /**
     * The Secondary Connection String for the ServiceBus Topic authorization Rule.
     */
    public val secondaryConnectionString: Output
        get() = javaResource.secondaryConnectionString().applyValue({ args0 -> args0 })

    /**
     * The alias Secondary Connection String for the ServiceBus Namespace
     */
    public val secondaryConnectionStringAlias: Output
        get() = javaResource.secondaryConnectionStringAlias().applyValue({ args0 -> args0 })

    /**
     * The Secondary Key for the ServiceBus Topic authorization Rule.
     */
    public val secondaryKey: Output
        get() = javaResource.secondaryKey().applyValue({ args0 -> args0 })

    /**
     * Grants send access to this this Authorization Rule. Defaults to `false`.
     */
    public val send: Output?
        get() = javaResource.send().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
     * > **NOTE** At least one of the 3 permissions below needs to be set.
     */
    public val topicId: Output
        get() = javaResource.topicId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy