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

com.pulumi.azure.webpubsub.kotlin.HubArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.webpubsub.kotlin

import com.pulumi.azure.webpubsub.HubArgs.builder
import com.pulumi.azure.webpubsub.kotlin.inputs.HubEventHandlerArgs
import com.pulumi.azure.webpubsub.kotlin.inputs.HubEventHandlerArgsBuilder
import com.pulumi.azure.webpubsub.kotlin.inputs.HubEventListenerArgs
import com.pulumi.azure.webpubsub.kotlin.inputs.HubEventListenerArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages the hub settings for a Web Pubsub.
 * ## 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.authorization.UserAssignedIdentity;
 * import com.pulumi.azure.authorization.UserAssignedIdentityArgs;
 * import com.pulumi.azure.webpubsub.Service;
 * import com.pulumi.azure.webpubsub.ServiceArgs;
 * import com.pulumi.azure.webpubsub.Hub;
 * import com.pulumi.azure.webpubsub.HubArgs;
 * import com.pulumi.azure.webpubsub.inputs.HubEventHandlerArgs;
 * import com.pulumi.azure.webpubsub.inputs.HubEventHandlerAuthArgs;
 * import com.pulumi.azure.webpubsub.inputs.HubEventListenerArgs;
 * import com.pulumi.resources.CustomResourceOptions;
 * 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("east us")
 *             .build());
 *         var exampleUserAssignedIdentity = new UserAssignedIdentity("exampleUserAssignedIdentity", UserAssignedIdentityArgs.builder()
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .build());
 *         var exampleService = new Service("exampleService", ServiceArgs.builder()
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .sku("Standard_S1")
 *             .capacity(1)
 *             .build());
 *         var exampleHub = new Hub("exampleHub", HubArgs.builder()
 *             .webPubsubId(exampleService.id())
 *             .eventHandlers(
 *                 HubEventHandlerArgs.builder()
 *                     .urlTemplate("https://test.com/api/{hub}/{event}")
 *                     .userEventPattern("*")
 *                     .systemEvents(
 *                         "connect",
 *                         "connected")
 *                     .build(),
 *                 HubEventHandlerArgs.builder()
 *                     .urlTemplate("https://test.com/api/{hub}/{event}")
 *                     .userEventPattern("event1, event2")
 *                     .systemEvents("connected")
 *                     .auth(HubEventHandlerAuthArgs.builder()
 *                         .managedIdentityId(exampleUserAssignedIdentity.id())
 *                         .build())
 *                     .build())
 *             .eventListeners(
 *                 HubEventListenerArgs.builder()
 *                     .systemEventNameFilters("connected")
 *                     .userEventNameFilters(
 *                         "event1",
 *                         "event2")
 *                     .eventhubNamespaceName(azurerm_eventhub_namespace.test().name())
 *                     .eventhubName(azurerm_eventhub.test1().name())
 *                     .build(),
 *                 HubEventListenerArgs.builder()
 *                     .systemEventNameFilters("connected")
 *                     .userEventNameFilters("*")
 *                     .eventhubNamespaceName(azurerm_eventhub_namespace.test().name())
 *                     .eventhubName(azurerm_eventhub.test1().name())
 *                     .build(),
 *                 HubEventListenerArgs.builder()
 *                     .systemEventNameFilters("connected")
 *                     .userEventNameFilters("event1")
 *                     .eventhubNamespaceName(azurerm_eventhub_namespace.test().name())
 *                     .eventhubName(azurerm_eventhub.test1().name())
 *                     .build())
 *             .anonymousConnectionsEnabled(true)
 *             .build(), CustomResourceOptions.builder()
 *                 .dependsOn(exampleService)
 *                 .build());
 *     }
 * }
 * ```
 * ## Import
 * Web Pubsub Hub can be imported using the `resource id`, e.g.
 * ```sh
 *  $ pulumi import azure:webpubsub/hub:Hub example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.SignalRService/webPubSub/webPubSub1/hubs/webPubSubhub1
 * ```
 * @property anonymousConnectionsEnabled Is anonymous connections are allowed for this hub? Defaults to `false`.
 * Possible values are `true`, `false`.
 * @property eventHandlers An `event_handler` block as defined below.
 * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
 * @property eventListeners An `event_listener` block as defined below.
 * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
 * @property name The name of the Web Pubsub hub service. Changing this forces a new resource to be created.
 * @property webPubsubId Specifies the id of the Web Pubsub. Changing this forces a new resource to be created.
 */
public data class HubArgs(
    public val anonymousConnectionsEnabled: Output? = null,
    public val eventHandlers: Output>? = null,
    public val eventListeners: Output>? = null,
    public val name: Output? = null,
    public val webPubsubId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.webpubsub.HubArgs =
        com.pulumi.azure.webpubsub.HubArgs.builder()
            .anonymousConnectionsEnabled(anonymousConnectionsEnabled?.applyValue({ args0 -> args0 }))
            .eventHandlers(
                eventHandlers?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .eventListeners(
                eventListeners?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .webPubsubId(webPubsubId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [HubArgs].
 */
@PulumiTagMarker
public class HubArgsBuilder internal constructor() {
    private var anonymousConnectionsEnabled: Output? = null

    private var eventHandlers: Output>? = null

    private var eventListeners: Output>? = null

    private var name: Output? = null

    private var webPubsubId: Output? = null

    /**
     * @param value Is anonymous connections are allowed for this hub? Defaults to `false`.
     * Possible values are `true`, `false`.
     */
    @JvmName("gwjujliadjqhtlbq")
    public suspend fun anonymousConnectionsEnabled(`value`: Output) {
        this.anonymousConnectionsEnabled = value
    }

    /**
     * @param value An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("jiietddjtvqrwbmi")
    public suspend fun eventHandlers(`value`: Output>) {
        this.eventHandlers = value
    }

    @JvmName("bvfotvwbkxyvsbpv")
    public suspend fun eventHandlers(vararg values: Output) {
        this.eventHandlers = Output.all(values.asList())
    }

    /**
     * @param values An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("nialahmveennlevt")
    public suspend fun eventHandlers(values: List>) {
        this.eventHandlers = Output.all(values)
    }

    /**
     * @param value An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("egawjkhllrpfgafq")
    public suspend fun eventListeners(`value`: Output>) {
        this.eventListeners = value
    }

    @JvmName("djyfpfujeywmfmdb")
    public suspend fun eventListeners(vararg values: Output) {
        this.eventListeners = Output.all(values.asList())
    }

    /**
     * @param values An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("fnyxghunkgutppmx")
    public suspend fun eventListeners(values: List>) {
        this.eventListeners = Output.all(values)
    }

    /**
     * @param value The name of the Web Pubsub hub service. Changing this forces a new resource to be created.
     */
    @JvmName("efqijcygembfptwk")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Specifies the id of the Web Pubsub. Changing this forces a new resource to be created.
     */
    @JvmName("vxviyuecbkkqgqhv")
    public suspend fun webPubsubId(`value`: Output) {
        this.webPubsubId = value
    }

    /**
     * @param value Is anonymous connections are allowed for this hub? Defaults to `false`.
     * Possible values are `true`, `false`.
     */
    @JvmName("vdxseepwsepgaijq")
    public suspend fun anonymousConnectionsEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.anonymousConnectionsEnabled = mapped
    }

    /**
     * @param value An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("tbvqhuwvbnmflpub")
    public suspend fun eventHandlers(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.eventHandlers = mapped
    }

    /**
     * @param argument An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("iiilrpqhmcgnduuh")
    public suspend fun eventHandlers(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            HubEventHandlerArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.eventHandlers = mapped
    }

    /**
     * @param argument An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("klrculxtgdeestua")
    public suspend fun eventHandlers(vararg argument: suspend HubEventHandlerArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            HubEventHandlerArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.eventHandlers = mapped
    }

    /**
     * @param argument An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("fdsqbuwhgbwweljy")
    public suspend fun eventHandlers(argument: suspend HubEventHandlerArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(HubEventHandlerArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.eventHandlers = mapped
    }

    /**
     * @param values An `event_handler` block as defined below.
     * > **NOTE:** User can change the order of `event_handler` to change the priority accordingly.
     */
    @JvmName("sodoshoihndxdfeo")
    public suspend fun eventHandlers(vararg values: HubEventHandlerArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.eventHandlers = mapped
    }

    /**
     * @param value An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("uonhrfropqhuqbhk")
    public suspend fun eventListeners(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.eventListeners = mapped
    }

    /**
     * @param argument An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("qmfixklogtkmxfwe")
    public suspend
    fun eventListeners(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            HubEventListenerArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.eventListeners = mapped
    }

    /**
     * @param argument An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("iuwvfbosejmdcixy")
    public suspend fun eventListeners(
        vararg
        argument: suspend HubEventListenerArgsBuilder.() -> Unit,
    ) {
        val toBeMapped = argument.toList().map {
            HubEventListenerArgsBuilder().applySuspend {
                it()
            }.build()
        }
        val mapped = of(toBeMapped)
        this.eventListeners = mapped
    }

    /**
     * @param argument An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("hlpkasqmmpjirbxi")
    public suspend fun eventListeners(argument: suspend HubEventListenerArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(HubEventListenerArgsBuilder().applySuspend { argument() }.build())
        val mapped = of(toBeMapped)
        this.eventListeners = mapped
    }

    /**
     * @param values An `event_listener` block as defined below.
     * > **NOTE:**  The managed identity of Web PubSub service must be enabled and the identity must have the "Azure Event Hubs Data sender" role to access the Event Hub.
     */
    @JvmName("atxlmdsqkiykqenh")
    public suspend fun eventListeners(vararg values: HubEventListenerArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.eventListeners = mapped
    }

    /**
     * @param value The name of the Web Pubsub hub service. Changing this forces a new resource to be created.
     */
    @JvmName("wmmuwuaxykipnsqe")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Specifies the id of the Web Pubsub. Changing this forces a new resource to be created.
     */
    @JvmName("vyyhqrlejjpedxef")
    public suspend fun webPubsubId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.webPubsubId = mapped
    }

    internal fun build(): HubArgs = HubArgs(
        anonymousConnectionsEnabled = anonymousConnectionsEnabled,
        eventHandlers = eventHandlers,
        eventListeners = eventListeners,
        name = name,
        webPubsubId = webPubsubId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy