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

com.pulumi.azurenative.app.kotlin.DaprSubscriptionArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.app.kotlin

import com.pulumi.azurenative.app.DaprSubscriptionArgs.builder
import com.pulumi.azurenative.app.kotlin.inputs.DaprSubscriptionBulkSubscribeOptionsArgs
import com.pulumi.azurenative.app.kotlin.inputs.DaprSubscriptionBulkSubscribeOptionsArgsBuilder
import com.pulumi.azurenative.app.kotlin.inputs.DaprSubscriptionRoutesArgs
import com.pulumi.azurenative.app.kotlin.inputs.DaprSubscriptionRoutesArgsBuilder
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.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Dapr PubSub Event Subscription.
 * Azure REST API version: 2023-08-01-preview.
 * Other available API versions: 2023-11-02-preview, 2024-02-02-preview.
 * ## Example Usage
 * ### Create or update dapr subscription with bulk subscribe configuration and scopes
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var daprSubscription = new AzureNative.App.DaprSubscription("daprSubscription", new()
 *     {
 *         BulkSubscribe = new AzureNative.App.Inputs.DaprSubscriptionBulkSubscribeOptionsArgs
 *         {
 *             Enabled = true,
 *             MaxAwaitDurationMs = 500,
 *             MaxMessagesCount = 123,
 *         },
 *         EnvironmentName = "myenvironment",
 *         Name = "mysubscription",
 *         PubsubName = "mypubsubcomponent",
 *         ResourceGroupName = "examplerg",
 *         Routes = new AzureNative.App.Inputs.DaprSubscriptionRoutesArgs
 *         {
 *             Default = "/products",
 *         },
 *         Scopes = new[]
 *         {
 *             "warehouseapp",
 *             "customersupportapp",
 *         },
 *         Topic = "inventory",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := app.NewDaprSubscription(ctx, "daprSubscription", &app.DaprSubscriptionArgs{
 * 			BulkSubscribe: &app.DaprSubscriptionBulkSubscribeOptionsArgs{
 * 				Enabled:            pulumi.Bool(true),
 * 				MaxAwaitDurationMs: pulumi.Int(500),
 * 				MaxMessagesCount:   pulumi.Int(123),
 * 			},
 * 			EnvironmentName:   pulumi.String("myenvironment"),
 * 			Name:              pulumi.String("mysubscription"),
 * 			PubsubName:        pulumi.String("mypubsubcomponent"),
 * 			ResourceGroupName: pulumi.String("examplerg"),
 * 			Routes: &app.DaprSubscriptionRoutesArgs{
 * 				Default: pulumi.String("/products"),
 * 			},
 * 			Scopes: pulumi.StringArray{
 * 				pulumi.String("warehouseapp"),
 * 				pulumi.String("customersupportapp"),
 * 			},
 * 			Topic: pulumi.String("inventory"),
 * 		})
 * 		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.azurenative.app.DaprSubscription;
 * import com.pulumi.azurenative.app.DaprSubscriptionArgs;
 * import com.pulumi.azurenative.app.inputs.DaprSubscriptionBulkSubscribeOptionsArgs;
 * import com.pulumi.azurenative.app.inputs.DaprSubscriptionRoutesArgs;
 * 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 daprSubscription = new DaprSubscription("daprSubscription", DaprSubscriptionArgs.builder()
 *             .bulkSubscribe(DaprSubscriptionBulkSubscribeOptionsArgs.builder()
 *                 .enabled(true)
 *                 .maxAwaitDurationMs(500)
 *                 .maxMessagesCount(123)
 *                 .build())
 *             .environmentName("myenvironment")
 *             .name("mysubscription")
 *             .pubsubName("mypubsubcomponent")
 *             .resourceGroupName("examplerg")
 *             .routes(DaprSubscriptionRoutesArgs.builder()
 *                 .default_("/products")
 *                 .build())
 *             .scopes(
 *                 "warehouseapp",
 *                 "customersupportapp")
 *             .topic("inventory")
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update dapr subscription with default route only
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var daprSubscription = new AzureNative.App.DaprSubscription("daprSubscription", new()
 *     {
 *         EnvironmentName = "myenvironment",
 *         Name = "mysubscription",
 *         PubsubName = "mypubsubcomponent",
 *         ResourceGroupName = "examplerg",
 *         Routes = new AzureNative.App.Inputs.DaprSubscriptionRoutesArgs
 *         {
 *             Default = "/products",
 *         },
 *         Topic = "inventory",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := app.NewDaprSubscription(ctx, "daprSubscription", &app.DaprSubscriptionArgs{
 * 			EnvironmentName:   pulumi.String("myenvironment"),
 * 			Name:              pulumi.String("mysubscription"),
 * 			PubsubName:        pulumi.String("mypubsubcomponent"),
 * 			ResourceGroupName: pulumi.String("examplerg"),
 * 			Routes: &app.DaprSubscriptionRoutesArgs{
 * 				Default: pulumi.String("/products"),
 * 			},
 * 			Topic: pulumi.String("inventory"),
 * 		})
 * 		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.azurenative.app.DaprSubscription;
 * import com.pulumi.azurenative.app.DaprSubscriptionArgs;
 * import com.pulumi.azurenative.app.inputs.DaprSubscriptionRoutesArgs;
 * 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 daprSubscription = new DaprSubscription("daprSubscription", DaprSubscriptionArgs.builder()
 *             .environmentName("myenvironment")
 *             .name("mysubscription")
 *             .pubsubName("mypubsubcomponent")
 *             .resourceGroupName("examplerg")
 *             .routes(DaprSubscriptionRoutesArgs.builder()
 *                 .default_("/products")
 *                 .build())
 *             .topic("inventory")
 *             .build());
 *     }
 * }
 * ```
 * ### Create or update dapr subscription with route rules and metadata
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var daprSubscription = new AzureNative.App.DaprSubscription("daprSubscription", new()
 *     {
 *         EnvironmentName = "myenvironment",
 *         Metadata =
 *         {
 *             { "foo", "bar" },
 *             { "hello", "world" },
 *         },
 *         Name = "mysubscription",
 *         PubsubName = "mypubsubcomponent",
 *         ResourceGroupName = "examplerg",
 *         Routes = new AzureNative.App.Inputs.DaprSubscriptionRoutesArgs
 *         {
 *             Default = "/products",
 *             Rules = new[]
 *             {
 *                 new AzureNative.App.Inputs.DaprSubscriptionRouteRuleArgs
 *                 {
 *                     Match = "event.type == 'widget'",
 *                     Path = "/widgets",
 *                 },
 *                 new AzureNative.App.Inputs.DaprSubscriptionRouteRuleArgs
 *                 {
 *                     Match = "event.type == 'gadget'",
 *                     Path = "/gadgets",
 *                 },
 *             },
 *         },
 *         Topic = "inventory",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	app "github.com/pulumi/pulumi-azure-native-sdk/app/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := app.NewDaprSubscription(ctx, "daprSubscription", &app.DaprSubscriptionArgs{
 * 			EnvironmentName: pulumi.String("myenvironment"),
 * 			Metadata: pulumi.StringMap{
 * 				"foo":   pulumi.String("bar"),
 * 				"hello": pulumi.String("world"),
 * 			},
 * 			Name:              pulumi.String("mysubscription"),
 * 			PubsubName:        pulumi.String("mypubsubcomponent"),
 * 			ResourceGroupName: pulumi.String("examplerg"),
 * 			Routes: &app.DaprSubscriptionRoutesArgs{
 * 				Default: pulumi.String("/products"),
 * 				Rules: app.DaprSubscriptionRouteRuleArray{
 * 					&app.DaprSubscriptionRouteRuleArgs{
 * 						Match: pulumi.String("event.type == 'widget'"),
 * 						Path:  pulumi.String("/widgets"),
 * 					},
 * 					&app.DaprSubscriptionRouteRuleArgs{
 * 						Match: pulumi.String("event.type == 'gadget'"),
 * 						Path:  pulumi.String("/gadgets"),
 * 					},
 * 				},
 * 			},
 * 			Topic: pulumi.String("inventory"),
 * 		})
 * 		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.azurenative.app.DaprSubscription;
 * import com.pulumi.azurenative.app.DaprSubscriptionArgs;
 * import com.pulumi.azurenative.app.inputs.DaprSubscriptionRoutesArgs;
 * 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 daprSubscription = new DaprSubscription("daprSubscription", DaprSubscriptionArgs.builder()
 *             .environmentName("myenvironment")
 *             .metadata(Map.ofEntries(
 *                 Map.entry("foo", "bar"),
 *                 Map.entry("hello", "world")
 *             ))
 *             .name("mysubscription")
 *             .pubsubName("mypubsubcomponent")
 *             .resourceGroupName("examplerg")
 *             .routes(DaprSubscriptionRoutesArgs.builder()
 *                 .default_("/products")
 *                 .rules(
 *                     DaprSubscriptionRouteRuleArgs.builder()
 *                         .match("event.type == 'widget'")
 *                         .path("/widgets")
 *                         .build(),
 *                     DaprSubscriptionRouteRuleArgs.builder()
 *                         .match("event.type == 'gadget'")
 *                         .path("/gadgets")
 *                         .build())
 *                 .build())
 *             .topic("inventory")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:app:DaprSubscription mysubscription /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprSubscriptions/{name}
 * ```
 * @property bulkSubscribe Bulk subscription options
 * @property deadLetterTopic Deadletter topic name
 * @property environmentName Name of the Managed Environment.
 * @property metadata Subscription metadata
 * @property name Name of the Dapr subscription.
 * @property pubsubName Dapr PubSub component name
 * @property resourceGroupName The name of the resource group. The name is case insensitive.
 * @property routes Subscription routes
 * @property scopes Application scopes to restrict the subscription to specific apps.
 * @property topic Topic name
 */
public data class DaprSubscriptionArgs(
    public val bulkSubscribe: Output? = null,
    public val deadLetterTopic: Output? = null,
    public val environmentName: Output? = null,
    public val metadata: Output>? = null,
    public val name: Output? = null,
    public val pubsubName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val routes: Output? = null,
    public val scopes: Output>? = null,
    public val topic: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azurenative.app.DaprSubscriptionArgs =
        com.pulumi.azurenative.app.DaprSubscriptionArgs.builder()
            .bulkSubscribe(bulkSubscribe?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .deadLetterTopic(deadLetterTopic?.applyValue({ args0 -> args0 }))
            .environmentName(environmentName?.applyValue({ args0 -> args0 }))
            .metadata(
                metadata?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.key.to(args0.value)
                    }).toMap()
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .pubsubName(pubsubName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .routes(routes?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .scopes(scopes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .topic(topic?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [DaprSubscriptionArgs].
 */
@PulumiTagMarker
public class DaprSubscriptionArgsBuilder internal constructor() {
    private var bulkSubscribe: Output? = null

    private var deadLetterTopic: Output? = null

    private var environmentName: Output? = null

    private var metadata: Output>? = null

    private var name: Output? = null

    private var pubsubName: Output? = null

    private var resourceGroupName: Output? = null

    private var routes: Output? = null

    private var scopes: Output>? = null

    private var topic: Output? = null

    /**
     * @param value Bulk subscription options
     */
    @JvmName("lstdnmeevtpgmcvn")
    public suspend fun bulkSubscribe(`value`: Output) {
        this.bulkSubscribe = value
    }

    /**
     * @param value Deadletter topic name
     */
    @JvmName("pkqrurcjyyupldgh")
    public suspend fun deadLetterTopic(`value`: Output) {
        this.deadLetterTopic = value
    }

    /**
     * @param value Name of the Managed Environment.
     */
    @JvmName("edpxkxaljyyplfya")
    public suspend fun environmentName(`value`: Output) {
        this.environmentName = value
    }

    /**
     * @param value Subscription metadata
     */
    @JvmName("llqkalgdrbsronsr")
    public suspend fun metadata(`value`: Output>) {
        this.metadata = value
    }

    /**
     * @param value Name of the Dapr subscription.
     */
    @JvmName("cbmnaolalaststpb")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Dapr PubSub component name
     */
    @JvmName("ajcnjfqymiaxbwdr")
    public suspend fun pubsubName(`value`: Output) {
        this.pubsubName = value
    }

    /**
     * @param value The name of the resource group. The name is case insensitive.
     */
    @JvmName("tpbljmkcxwlbhbwx")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Subscription routes
     */
    @JvmName("mvuuufcxdyisopce")
    public suspend fun routes(`value`: Output) {
        this.routes = value
    }

    /**
     * @param value Application scopes to restrict the subscription to specific apps.
     */
    @JvmName("qqnlhjjwcruatejf")
    public suspend fun scopes(`value`: Output>) {
        this.scopes = value
    }

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

    /**
     * @param values Application scopes to restrict the subscription to specific apps.
     */
    @JvmName("gbcsqbgtwxroqeca")
    public suspend fun scopes(values: List>) {
        this.scopes = Output.all(values)
    }

    /**
     * @param value Topic name
     */
    @JvmName("krrmxafvjfhbbfhy")
    public suspend fun topic(`value`: Output) {
        this.topic = value
    }

    /**
     * @param value Bulk subscription options
     */
    @JvmName("qvfsdvertxlevmox")
    public suspend fun bulkSubscribe(`value`: DaprSubscriptionBulkSubscribeOptionsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.bulkSubscribe = mapped
    }

    /**
     * @param argument Bulk subscription options
     */
    @JvmName("ugforcshrehcvblg")
    public suspend fun bulkSubscribe(argument: suspend DaprSubscriptionBulkSubscribeOptionsArgsBuilder.() -> Unit) {
        val toBeMapped = DaprSubscriptionBulkSubscribeOptionsArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.bulkSubscribe = mapped
    }

    /**
     * @param value Deadletter topic name
     */
    @JvmName("gpkfkhxqjtdyjpxl")
    public suspend fun deadLetterTopic(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.deadLetterTopic = mapped
    }

    /**
     * @param value Name of the Managed Environment.
     */
    @JvmName("xpeelcdxgwrmcacs")
    public suspend fun environmentName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.environmentName = mapped
    }

    /**
     * @param value Subscription metadata
     */
    @JvmName("sirvqtnvcvfghkjf")
    public suspend fun metadata(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.metadata = mapped
    }

    /**
     * @param values Subscription metadata
     */
    @JvmName("dhlhptucbsypwfqt")
    public fun metadata(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.metadata = mapped
    }

    /**
     * @param value Name of the Dapr subscription.
     */
    @JvmName("ovhoywkmjnxlsatg")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Dapr PubSub component name
     */
    @JvmName("ldbkkwfqjgtphrfj")
    public suspend fun pubsubName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.pubsubName = mapped
    }

    /**
     * @param value The name of the resource group. The name is case insensitive.
     */
    @JvmName("udigwdklkknynfjl")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Subscription routes
     */
    @JvmName("fuqwujegvhwqdlxk")
    public suspend fun routes(`value`: DaprSubscriptionRoutesArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.routes = mapped
    }

    /**
     * @param argument Subscription routes
     */
    @JvmName("viajmhcxxvrxgcbk")
    public suspend fun routes(argument: suspend DaprSubscriptionRoutesArgsBuilder.() -> Unit) {
        val toBeMapped = DaprSubscriptionRoutesArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.routes = mapped
    }

    /**
     * @param value Application scopes to restrict the subscription to specific apps.
     */
    @JvmName("cudmqqcaemrenkmc")
    public suspend fun scopes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scopes = mapped
    }

    /**
     * @param values Application scopes to restrict the subscription to specific apps.
     */
    @JvmName("uplsnndthoyxutrj")
    public suspend fun scopes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.scopes = mapped
    }

    /**
     * @param value Topic name
     */
    @JvmName("mwwinkaoyxcicatw")
    public suspend fun topic(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.topic = mapped
    }

    internal fun build(): DaprSubscriptionArgs = DaprSubscriptionArgs(
        bulkSubscribe = bulkSubscribe,
        deadLetterTopic = deadLetterTopic,
        environmentName = environmentName,
        metadata = metadata,
        name = name,
        pubsubName = pubsubName,
        resourceGroupName = resourceGroupName,
        routes = routes,
        scopes = scopes,
        topic = topic,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy