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

com.pulumi.azure.eventhub.kotlin.EventHubAuthorizationRule.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 [EventHubAuthorizationRule].
 */
@PulumiTagMarker
@Deprecated(
    message = """
azure.eventhub.EventHubAuthorizationRule has been deprecated in favor of
    azure.eventhub.AuthorizationRule
""",
)
public class EventHubAuthorizationRuleResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: EventHubAuthorizationRuleArgs = EventHubAuthorizationRuleArgs()

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

/**
 * Manages a Event Hubs authorization Rule within an Event Hub.
 * ## 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 exampleEventHubNamespace = new azure.eventhub.EventHubNamespace("example", {
 *     name: "acceptanceTestEventHubNamespace",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Basic",
 *     capacity: 2,
 *     tags: {
 *         environment: "Production",
 *     },
 * });
 * const exampleEventHub = new azure.eventhub.EventHub("example", {
 *     name: "acceptanceTestEventHub",
 *     namespaceName: exampleEventHubNamespace.name,
 *     resourceGroupName: example.name,
 *     partitionCount: 2,
 *     messageRetention: 2,
 * });
 * const exampleAuthorizationRule = new azure.eventhub.AuthorizationRule("example", {
 *     name: "navi",
 *     namespaceName: exampleEventHubNamespace.name,
 *     eventhubName: exampleEventHub.name,
 *     resourceGroupName: example.name,
 *     listen: true,
 *     send: false,
 *     manage: false,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_event_hub_namespace = azure.eventhub.EventHubNamespace("example",
 *     name="acceptanceTestEventHubNamespace",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Basic",
 *     capacity=2,
 *     tags={
 *         "environment": "Production",
 *     })
 * example_event_hub = azure.eventhub.EventHub("example",
 *     name="acceptanceTestEventHub",
 *     namespace_name=example_event_hub_namespace.name,
 *     resource_group_name=example.name,
 *     partition_count=2,
 *     message_retention=2)
 * example_authorization_rule = azure.eventhub.AuthorizationRule("example",
 *     name="navi",
 *     namespace_name=example_event_hub_namespace.name,
 *     eventhub_name=example_event_hub.name,
 *     resource_group_name=example.name,
 *     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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var exampleEventHubNamespace = new Azure.EventHub.EventHubNamespace("example", new()
 *     {
 *         Name = "acceptanceTestEventHubNamespace",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Basic",
 *         Capacity = 2,
 *         Tags =
 *         {
 *             { "environment", "Production" },
 *         },
 *     });
 *     var exampleEventHub = new Azure.EventHub.EventHub("example", new()
 *     {
 *         Name = "acceptanceTestEventHub",
 *         NamespaceName = exampleEventHubNamespace.Name,
 *         ResourceGroupName = example.Name,
 *         PartitionCount = 2,
 *         MessageRetention = 2,
 *     });
 *     var exampleAuthorizationRule = new Azure.EventHub.AuthorizationRule("example", new()
 *     {
 *         Name = "navi",
 *         NamespaceName = exampleEventHubNamespace.Name,
 *         EventhubName = exampleEventHub.Name,
 *         ResourceGroupName = example.Name,
 *         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/eventhub"
 * 	"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
 * 		}
 * 		exampleEventHubNamespace, err := eventhub.NewEventHubNamespace(ctx, "example", &eventhub.EventHubNamespaceArgs{
 * 			Name:              pulumi.String("acceptanceTestEventHubNamespace"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Basic"),
 * 			Capacity:          pulumi.Int(2),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("Production"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleEventHub, err := eventhub.NewEventHub(ctx, "example", &eventhub.EventHubArgs{
 * 			Name:              pulumi.String("acceptanceTestEventHub"),
 * 			NamespaceName:     exampleEventHubNamespace.Name,
 * 			ResourceGroupName: example.Name,
 * 			PartitionCount:    pulumi.Int(2),
 * 			MessageRetention:  pulumi.Int(2),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = eventhub.NewAuthorizationRule(ctx, "example", &eventhub.AuthorizationRuleArgs{
 * 			Name:              pulumi.String("navi"),
 * 			NamespaceName:     exampleEventHubNamespace.Name,
 * 			EventhubName:      exampleEventHub.Name,
 * 			ResourceGroupName: example.Name,
 * 			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.eventhub.EventHubNamespace;
 * import com.pulumi.azure.eventhub.EventHubNamespaceArgs;
 * import com.pulumi.azure.eventhub.EventHub;
 * import com.pulumi.azure.eventhub.EventHubArgs;
 * import com.pulumi.azure.eventhub.AuthorizationRule;
 * import com.pulumi.azure.eventhub.AuthorizationRuleArgs;
 * 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 exampleEventHubNamespace = new EventHubNamespace("exampleEventHubNamespace", EventHubNamespaceArgs.builder()
 *             .name("acceptanceTestEventHubNamespace")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Basic")
 *             .capacity(2)
 *             .tags(Map.of("environment", "Production"))
 *             .build());
 *         var exampleEventHub = new EventHub("exampleEventHub", EventHubArgs.builder()
 *             .name("acceptanceTestEventHub")
 *             .namespaceName(exampleEventHubNamespace.name())
 *             .resourceGroupName(example.name())
 *             .partitionCount(2)
 *             .messageRetention(2)
 *             .build());
 *         var exampleAuthorizationRule = new AuthorizationRule("exampleAuthorizationRule", AuthorizationRuleArgs.builder()
 *             .name("navi")
 *             .namespaceName(exampleEventHubNamespace.name())
 *             .eventhubName(exampleEventHub.name())
 *             .resourceGroupName(example.name())
 *             .listen(true)
 *             .send(false)
 *             .manage(false)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleEventHubNamespace:
 *     type: azure:eventhub:EventHubNamespace
 *     name: example
 *     properties:
 *       name: acceptanceTestEventHubNamespace
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Basic
 *       capacity: 2
 *       tags:
 *         environment: Production
 *   exampleEventHub:
 *     type: azure:eventhub:EventHub
 *     name: example
 *     properties:
 *       name: acceptanceTestEventHub
 *       namespaceName: ${exampleEventHubNamespace.name}
 *       resourceGroupName: ${example.name}
 *       partitionCount: 2
 *       messageRetention: 2
 *   exampleAuthorizationRule:
 *     type: azure:eventhub:AuthorizationRule
 *     name: example
 *     properties:
 *       name: navi
 *       namespaceName: ${exampleEventHubNamespace.name}
 *       eventhubName: ${exampleEventHub.name}
 *       resourceGroupName: ${example.name}
 *       listen: true
 *       send: false
 *       manage: false
 * ```
 * 
 * ## Import
 * EventHub Authorization Rules can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:eventhub/eventHubAuthorizationRule:EventHubAuthorizationRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventHub/namespaces/namespace1/eventhubs/eventhub1/authorizationRules/rule1
 * ```
 */
@Deprecated(
    message = """
azure.eventhub.EventHubAuthorizationRule has been deprecated in favor of
    azure.eventhub.AuthorizationRule
""",
)
public class EventHubAuthorizationRule internal constructor(
    override val javaResource: com.pulumi.azure.eventhub.EventHubAuthorizationRule,
) : KotlinCustomResource(javaResource, EventHubAuthorizationRuleMapper) {
    /**
     * Specifies the name of the EventHub. Changing this forces a new resource to be created.
     */
    public val eventhubName: Output
        get() = javaResource.eventhubName().applyValue({ args0 -> args0 })

    /**
     * Does this Authorization Rule have permissions to Listen to the Event Hub? Defaults to `false`.
     */
    public val listen: Output?
        get() = javaResource.listen().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Does this Authorization Rule have permissions to Manage to the Event Hub? 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 EventHub Authorization Rule resource. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

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

    /**
     * The alias of the Primary Connection String for the Event Hubs authorization Rule, which is generated when disaster recovery is enabled.
     */
    public val primaryConnectionStringAlias: Output
        get() = javaResource.primaryConnectionStringAlias().applyValue({ args0 -> args0 })

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

    /**
     * The name of the resource group in which the EventHub Namespace exists. Changing this forces a new resource to be created.
     * > **NOTE** At least one of the 3 permissions below needs to be set.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

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

    /**
     * The alias of the Secondary Connection String for the Event Hubs Authorization Rule, which is generated when disaster recovery is enabled.
     */
    public val secondaryConnectionStringAlias: Output
        get() = javaResource.secondaryConnectionStringAlias().applyValue({ args0 -> args0 })

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

    /**
     * Does this Authorization Rule have permissions to Send to the Event Hub? Defaults to `false`.
     */
    public val send: Output?
        get() = javaResource.send().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy