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

com.pulumi.azurenative.eventgrid.kotlin.TopicEventSubscription.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.eventgrid.kotlin

import com.pulumi.azurenative.eventgrid.kotlin.outputs.DeadLetterWithResourceIdentityResponse
import com.pulumi.azurenative.eventgrid.kotlin.outputs.DeliveryWithResourceIdentityResponse
import com.pulumi.azurenative.eventgrid.kotlin.outputs.EventSubscriptionFilterResponse
import com.pulumi.azurenative.eventgrid.kotlin.outputs.RetryPolicyResponse
import com.pulumi.azurenative.eventgrid.kotlin.outputs.StorageBlobDeadLetterDestinationResponse
import com.pulumi.azurenative.eventgrid.kotlin.outputs.SystemDataResponse
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.Any
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.azurenative.eventgrid.kotlin.outputs.DeadLetterWithResourceIdentityResponse.Companion.toKotlin as deadLetterWithResourceIdentityResponseToKotlin
import com.pulumi.azurenative.eventgrid.kotlin.outputs.DeliveryWithResourceIdentityResponse.Companion.toKotlin as deliveryWithResourceIdentityResponseToKotlin
import com.pulumi.azurenative.eventgrid.kotlin.outputs.EventSubscriptionFilterResponse.Companion.toKotlin as eventSubscriptionFilterResponseToKotlin
import com.pulumi.azurenative.eventgrid.kotlin.outputs.RetryPolicyResponse.Companion.toKotlin as retryPolicyResponseToKotlin
import com.pulumi.azurenative.eventgrid.kotlin.outputs.StorageBlobDeadLetterDestinationResponse.Companion.toKotlin as storageBlobDeadLetterDestinationResponseToKotlin
import com.pulumi.azurenative.eventgrid.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: TopicEventSubscriptionArgs = TopicEventSubscriptionArgs()

    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 TopicEventSubscriptionArgsBuilder.() -> Unit) {
        val builder = TopicEventSubscriptionArgsBuilder()
        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(): TopicEventSubscription {
        val builtJavaResource =
            com.pulumi.azurenative.eventgrid.TopicEventSubscription(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return TopicEventSubscription(builtJavaResource)
    }
}

/**
 * Event Subscription
 * Azure REST API version: 2022-06-15. Prior API version in Azure Native 1.x: 2021-10-15-preview.
 * Other available API versions: 2023-06-01-preview, 2023-12-15-preview, 2024-06-01-preview.
 * ## Example Usage
 * ### TopicEventSubscriptions_CreateOrUpdate
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var topicEventSubscription = new AzureNative.EventGrid.TopicEventSubscription("topicEventSubscription", new()
 *     {
 *         Destination = new AzureNative.EventGrid.Inputs.WebHookEventSubscriptionDestinationArgs
 *         {
 *             EndpointType = "WebHook",
 *             EndpointUrl = "https://requestb.in/15ksip71",
 *         },
 *         EventSubscriptionName = "exampleEventSubscriptionName1",
 *         Filter = new AzureNative.EventGrid.Inputs.EventSubscriptionFilterArgs
 *         {
 *             IsSubjectCaseSensitive = false,
 *             SubjectBeginsWith = "ExamplePrefix",
 *             SubjectEndsWith = "ExampleSuffix",
 *         },
 *         ResourceGroupName = "examplerg",
 *         TopicName = "exampleTopic1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	eventgrid "github.com/pulumi/pulumi-azure-native-sdk/eventgrid/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := eventgrid.NewTopicEventSubscription(ctx, "topicEventSubscription", &eventgrid.TopicEventSubscriptionArgs{
 * 			Destination: &eventgrid.WebHookEventSubscriptionDestinationArgs{
 * 				EndpointType: pulumi.String("WebHook"),
 * 				EndpointUrl:  pulumi.String("https://requestb.in/15ksip71"),
 * 			},
 * 			EventSubscriptionName: pulumi.String("exampleEventSubscriptionName1"),
 * 			Filter: &eventgrid.EventSubscriptionFilterArgs{
 * 				IsSubjectCaseSensitive: pulumi.Bool(false),
 * 				SubjectBeginsWith:      pulumi.String("ExamplePrefix"),
 * 				SubjectEndsWith:        pulumi.String("ExampleSuffix"),
 * 			},
 * 			ResourceGroupName: pulumi.String("examplerg"),
 * 			TopicName:         pulumi.String("exampleTopic1"),
 * 		})
 * 		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.eventgrid.TopicEventSubscription;
 * import com.pulumi.azurenative.eventgrid.TopicEventSubscriptionArgs;
 * import com.pulumi.azurenative.eventgrid.inputs.EventSubscriptionFilterArgs;
 * 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 topicEventSubscription = new TopicEventSubscription("topicEventSubscription", TopicEventSubscriptionArgs.builder()
 *             .destination(WebHookEventSubscriptionDestinationArgs.builder()
 *                 .endpointType("WebHook")
 *                 .endpointUrl("https://requestb.in/15ksip71")
 *                 .build())
 *             .eventSubscriptionName("exampleEventSubscriptionName1")
 *             .filter(EventSubscriptionFilterArgs.builder()
 *                 .isSubjectCaseSensitive(false)
 *                 .subjectBeginsWith("ExamplePrefix")
 *                 .subjectEndsWith("ExampleSuffix")
 *                 .build())
 *             .resourceGroupName("examplerg")
 *             .topicName("exampleTopic1")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:eventgrid:TopicEventSubscription exampleEventSubscriptionName1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}
 * ```
 */
public class TopicEventSubscription internal constructor(
    override val javaResource: com.pulumi.azurenative.eventgrid.TopicEventSubscription,
) : KotlinCustomResource(javaResource, TopicEventSubscriptionMapper) {
    /**
     * The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination.
     * Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering.
     */
    public val deadLetterDestination: Output?
        get() = javaResource.deadLetterDestination().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    storageBlobDeadLetterDestinationResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination.
     * Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering.
     */
    public val deadLetterWithResourceIdentity: Output?
        get() = javaResource.deadLetterWithResourceIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> deadLetterWithResourceIdentityResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Information about the destination where events have to be delivered for the event subscription.
     * Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering.
     */
    public val deliveryWithResourceIdentity: Output?
        get() = javaResource.deliveryWithResourceIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> deliveryWithResourceIdentityResponseToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Information about the destination where events have to be delivered for the event subscription.
     * Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering.
     */
    public val destination: Output?
        get() = javaResource.destination().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The event delivery schema for the event subscription.
     */
    public val eventDeliverySchema: Output?
        get() = javaResource.eventDeliverySchema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Expiration time of the event subscription.
     */
    public val expirationTimeUtc: Output?
        get() = javaResource.expirationTimeUtc().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Information about the filter for the event subscription.
     */
    public val filter: Output?
        get() = javaResource.filter().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventSubscriptionFilterResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * List of user defined labels.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Name of the resource.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Provisioning state of the event subscription.
     */
    public val provisioningState: Output
        get() = javaResource.provisioningState().applyValue({ args0 -> args0 })

    /**
     * The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events.
     */
    public val retryPolicy: Output?
        get() = javaResource.retryPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    retryPolicyResponseToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The system metadata relating to Event Subscription resource.
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Name of the topic of the event subscription.
     */
    public val topic: Output
        get() = javaResource.topic().applyValue({ args0 -> args0 })

    /**
     * Type of the resource.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object TopicEventSubscriptionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.eventgrid.TopicEventSubscription::class == javaResource::class

    override fun map(javaResource: Resource): TopicEventSubscription =
        TopicEventSubscription(
            javaResource as
                com.pulumi.azurenative.eventgrid.TopicEventSubscription,
        )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy