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

com.pulumi.azure.iot.kotlin.EndpointServicebusQueue.kt Maven / Gradle / Ivy

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

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

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

    public var args: EndpointServicebusQueueArgs = EndpointServicebusQueueArgs()

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

/**
 * Manages an IotHub ServiceBus Queue Endpoint
 * > **NOTE:** Endpoints can be defined either directly on the `azure.iot.IoTHub` resource, or using the `azurerm_iothub_endpoint_*` resources - but the two ways of defining the endpoints cannot be used together. If both are used against the same IoTHub, spurious changes will occur. Also, defining a `azurerm_iothub_endpoint_*` resource and another endpoint of a different type directly on the `azure.iot.IoTHub` resource is not supported.
 * ## 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 exampleNamespace = new azure.servicebus.Namespace("example", {
 *     name: "exampleNamespace",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 * });
 * const exampleQueue = new azure.servicebus.Queue("example", {
 *     name: "exampleQueue",
 *     namespaceId: exampleNamespace.id,
 *     enablePartitioning: true,
 * });
 * const exampleQueueAuthorizationRule = new azure.servicebus.QueueAuthorizationRule("example", {
 *     name: "exampleRule",
 *     queueId: exampleQueue.id,
 *     listen: false,
 *     send: true,
 *     manage: false,
 * });
 * const exampleIoTHub = new azure.iot.IoTHub("example", {
 *     name: "exampleIothub",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     sku: {
 *         name: "B1",
 *         capacity: 1,
 *     },
 *     tags: {
 *         purpose: "example",
 *     },
 * });
 * const exampleEndpointServicebusQueue = new azure.iot.EndpointServicebusQueue("example", {
 *     resourceGroupName: example.name,
 *     iothubId: exampleIoTHub.id,
 *     name: "example",
 *     connectionString: exampleQueueAuthorizationRule.primaryConnectionString,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_namespace = azure.servicebus.Namespace("example",
 *     name="exampleNamespace",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard")
 * example_queue = azure.servicebus.Queue("example",
 *     name="exampleQueue",
 *     namespace_id=example_namespace.id,
 *     enable_partitioning=True)
 * example_queue_authorization_rule = azure.servicebus.QueueAuthorizationRule("example",
 *     name="exampleRule",
 *     queue_id=example_queue.id,
 *     listen=False,
 *     send=True,
 *     manage=False)
 * example_io_t_hub = azure.iot.IoTHub("example",
 *     name="exampleIothub",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     sku={
 *         "name": "B1",
 *         "capacity": 1,
 *     },
 *     tags={
 *         "purpose": "example",
 *     })
 * example_endpoint_servicebus_queue = azure.iot.EndpointServicebusQueue("example",
 *     resource_group_name=example.name,
 *     iothub_id=example_io_t_hub.id,
 *     name="example",
 *     connection_string=example_queue_authorization_rule.primary_connection_string)
 * ```
 * ```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 exampleNamespace = new Azure.ServiceBus.Namespace("example", new()
 *     {
 *         Name = "exampleNamespace",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *     });
 *     var exampleQueue = new Azure.ServiceBus.Queue("example", new()
 *     {
 *         Name = "exampleQueue",
 *         NamespaceId = exampleNamespace.Id,
 *         EnablePartitioning = true,
 *     });
 *     var exampleQueueAuthorizationRule = new Azure.ServiceBus.QueueAuthorizationRule("example", new()
 *     {
 *         Name = "exampleRule",
 *         QueueId = exampleQueue.Id,
 *         Listen = false,
 *         Send = true,
 *         Manage = false,
 *     });
 *     var exampleIoTHub = new Azure.Iot.IoTHub("example", new()
 *     {
 *         Name = "exampleIothub",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
 *         {
 *             Name = "B1",
 *             Capacity = 1,
 *         },
 *         Tags =
 *         {
 *             { "purpose", "example" },
 *         },
 *     });
 *     var exampleEndpointServicebusQueue = new Azure.Iot.EndpointServicebusQueue("example", new()
 *     {
 *         ResourceGroupName = example.Name,
 *         IothubId = exampleIoTHub.Id,
 *         Name = "example",
 *         ConnectionString = exampleQueueAuthorizationRule.PrimaryConnectionString,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/iot"
 * 	"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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNamespace, err := servicebus.NewNamespace(ctx, "example", &servicebus.NamespaceArgs{
 * 			Name:              pulumi.String("exampleNamespace"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleQueue, err := servicebus.NewQueue(ctx, "example", &servicebus.QueueArgs{
 * 			Name:               pulumi.String("exampleQueue"),
 * 			NamespaceId:        exampleNamespace.ID(),
 * 			EnablePartitioning: pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleQueueAuthorizationRule, err := servicebus.NewQueueAuthorizationRule(ctx, "example", &servicebus.QueueAuthorizationRuleArgs{
 * 			Name:    pulumi.String("exampleRule"),
 * 			QueueId: exampleQueue.ID(),
 * 			Listen:  pulumi.Bool(false),
 * 			Send:    pulumi.Bool(true),
 * 			Manage:  pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleIoTHub, err := iot.NewIoTHub(ctx, "example", &iot.IoTHubArgs{
 * 			Name:              pulumi.String("exampleIothub"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 			Sku: &iot.IoTHubSkuArgs{
 * 				Name:     pulumi.String("B1"),
 * 				Capacity: pulumi.Int(1),
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"purpose": pulumi.String("example"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = iot.NewEndpointServicebusQueue(ctx, "example", &iot.EndpointServicebusQueueArgs{
 * 			ResourceGroupName: example.Name,
 * 			IothubId:          exampleIoTHub.ID(),
 * 			Name:              pulumi.String("example"),
 * 			ConnectionString:  exampleQueueAuthorizationRule.PrimaryConnectionString,
 * 		})
 * 		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.Queue;
 * import com.pulumi.azure.servicebus.QueueArgs;
 * import com.pulumi.azure.servicebus.QueueAuthorizationRule;
 * import com.pulumi.azure.servicebus.QueueAuthorizationRuleArgs;
 * import com.pulumi.azure.iot.IoTHub;
 * import com.pulumi.azure.iot.IoTHubArgs;
 * import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
 * import com.pulumi.azure.iot.EndpointServicebusQueue;
 * import com.pulumi.azure.iot.EndpointServicebusQueueArgs;
 * 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 exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
 *             .name("exampleNamespace")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .build());
 *         var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()
 *             .name("exampleQueue")
 *             .namespaceId(exampleNamespace.id())
 *             .enablePartitioning(true)
 *             .build());
 *         var exampleQueueAuthorizationRule = new QueueAuthorizationRule("exampleQueueAuthorizationRule", QueueAuthorizationRuleArgs.builder()
 *             .name("exampleRule")
 *             .queueId(exampleQueue.id())
 *             .listen(false)
 *             .send(true)
 *             .manage(false)
 *             .build());
 *         var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
 *             .name("exampleIothub")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .sku(IoTHubSkuArgs.builder()
 *                 .name("B1")
 *                 .capacity("1")
 *                 .build())
 *             .tags(Map.of("purpose", "example"))
 *             .build());
 *         var exampleEndpointServicebusQueue = new EndpointServicebusQueue("exampleEndpointServicebusQueue", EndpointServicebusQueueArgs.builder()
 *             .resourceGroupName(example.name())
 *             .iothubId(exampleIoTHub.id())
 *             .name("example")
 *             .connectionString(exampleQueueAuthorizationRule.primaryConnectionString())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleNamespace:
 *     type: azure:servicebus:Namespace
 *     name: example
 *     properties:
 *       name: exampleNamespace
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *   exampleQueue:
 *     type: azure:servicebus:Queue
 *     name: example
 *     properties:
 *       name: exampleQueue
 *       namespaceId: ${exampleNamespace.id}
 *       enablePartitioning: true
 *   exampleQueueAuthorizationRule:
 *     type: azure:servicebus:QueueAuthorizationRule
 *     name: example
 *     properties:
 *       name: exampleRule
 *       queueId: ${exampleQueue.id}
 *       listen: false
 *       send: true
 *       manage: false
 *   exampleIoTHub:
 *     type: azure:iot:IoTHub
 *     name: example
 *     properties:
 *       name: exampleIothub
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       sku:
 *         name: B1
 *         capacity: '1'
 *       tags:
 *         purpose: example
 *   exampleEndpointServicebusQueue:
 *     type: azure:iot:EndpointServicebusQueue
 *     name: example
 *     properties:
 *       resourceGroupName: ${example.name}
 *       iothubId: ${exampleIoTHub.id}
 *       name: example
 *       connectionString: ${exampleQueueAuthorizationRule.primaryConnectionString}
 * ```
 * 
 * ## Import
 * IoTHub ServiceBus Queue Endpoint can be imported using the `resource id`, e.g.
 * g
 * ```sh
 * $ pulumi import azure:iot/endpointServicebusQueue:EndpointServicebusQueue servicebus_queue1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/endpoints/servicebusqueue_endpoint1
 * ```
 */
public class EndpointServicebusQueue internal constructor(
    override val javaResource: com.pulumi.azure.iot.EndpointServicebusQueue,
) : KotlinCustomResource(javaResource, EndpointServicebusQueueMapper) {
    /**
     * Type used to authenticate against the Service Bus Queue endpoint. Possible values are `keyBased` and `identityBased`. Defaults to `keyBased`.
     */
    public val authenticationType: Output?
        get() = javaResource.authenticationType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The connection string for the endpoint. This attribute can only be specified and is mandatory when `authentication_type` is `keyBased`.
     */
    public val connectionString: Output?
        get() = javaResource.connectionString().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * URI of the Service Bus endpoint. This attribute can only be specified and is mandatory when `authentication_type` is `identityBased`.
     */
    public val endpointUri: Output?
        get() = javaResource.endpointUri().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Name of the Service Bus Queue. This attribute can only be specified and is mandatory when `authentication_type` is `identityBased`.
     */
    public val entityPath: Output?
        get() = javaResource.entityPath().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * ID of the User Managed Identity used to authenticate against the Service Bus Queue endpoint.
     * > **NOTE:** `identity_id` can only be specified when `authentication_type` is `identityBased`. It must be one of the `identity_ids` of the Iot Hub. If not specified when `authentication_type` is `identityBased`, System Assigned Managed Identity of the Iot Hub will be used.
     */
    public val identityId: Output?
        get() = javaResource.identityId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The IoTHub ID for the endpoint. Changing this forces a new resource to be created.
     */
    public val iothubId: Output
        get() = javaResource.iothubId().applyValue({ args0 -> args0 })

    /**
     * The name of the endpoint. The name must be unique across endpoint types. The following names are reserved: `events`, `operationsMonitoringEvents`, `fileNotifications` and `$default`. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group under which the Service Bus Queue has been created. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
}

public object EndpointServicebusQueueMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.iot.EndpointServicebusQueue::class == javaResource::class

    override fun map(javaResource: Resource): EndpointServicebusQueue =
        EndpointServicebusQueue(javaResource as com.pulumi.azure.iot.EndpointServicebusQueue)
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy