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

com.pulumi.azure.eventhub.kotlin.EventSubscription.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.eventhub.kotlin

import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionAdvancedFilter
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionAzureFunctionEndpoint
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionDeadLetterIdentity
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionDeliveryIdentity
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionDeliveryProperty
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionRetryPolicy
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionStorageBlobDeadLetterDestination
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionStorageQueueEndpoint
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionSubjectFilter
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionWebhookEndpoint
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
import kotlin.collections.List
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionAdvancedFilter.Companion.toKotlin as eventSubscriptionAdvancedFilterToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionAzureFunctionEndpoint.Companion.toKotlin as eventSubscriptionAzureFunctionEndpointToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionDeadLetterIdentity.Companion.toKotlin as eventSubscriptionDeadLetterIdentityToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionDeliveryIdentity.Companion.toKotlin as eventSubscriptionDeliveryIdentityToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionDeliveryProperty.Companion.toKotlin as eventSubscriptionDeliveryPropertyToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionRetryPolicy.Companion.toKotlin as eventSubscriptionRetryPolicyToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionStorageBlobDeadLetterDestination.Companion.toKotlin as eventSubscriptionStorageBlobDeadLetterDestinationToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionStorageQueueEndpoint.Companion.toKotlin as eventSubscriptionStorageQueueEndpointToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionSubjectFilter.Companion.toKotlin as eventSubscriptionSubjectFilterToKotlin
import com.pulumi.azure.eventhub.kotlin.outputs.EventSubscriptionWebhookEndpoint.Companion.toKotlin as eventSubscriptionWebhookEndpointToKotlin

/**
 * Builder for [EventSubscription].
 */
@PulumiTagMarker
@Deprecated(
    message = """
azure.eventhub.EventSubscription has been deprecated in favor of azure.eventgrid.EventSubscription
""",
)
public class EventSubscriptionResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: EventSubscriptionArgs = EventSubscriptionArgs()

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

/**
 * Manages an EventGrid Event Subscription
 * ## 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 exampleAccount = new azure.storage.Account("example", {
 *     name: "exampleasa",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 *     tags: {
 *         environment: "staging",
 *     },
 * });
 * const exampleQueue = new azure.storage.Queue("example", {
 *     name: "example-astq",
 *     storageAccountName: exampleAccount.name,
 * });
 * const exampleEventSubscription = new azure.eventgrid.EventSubscription("example", {
 *     name: "example-aees",
 *     scope: example.id,
 *     storageQueueEndpoint: {
 *         storageAccountId: exampleAccount.id,
 *         queueName: exampleQueue.name,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_account = azure.storage.Account("example",
 *     name="exampleasa",
 *     resource_group_name=example.name,
 *     location=example.location,
 *     account_tier="Standard",
 *     account_replication_type="LRS",
 *     tags={
 *         "environment": "staging",
 *     })
 * example_queue = azure.storage.Queue("example",
 *     name="example-astq",
 *     storage_account_name=example_account.name)
 * example_event_subscription = azure.eventgrid.EventSubscription("example",
 *     name="example-aees",
 *     scope=example.id,
 *     storage_queue_endpoint={
 *         "storage_account_id": example_account.id,
 *         "queue_name": example_queue.name,
 *     })
 * ```
 * ```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 exampleAccount = new Azure.Storage.Account("example", new()
 *     {
 *         Name = "exampleasa",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *         AccountTier = "Standard",
 *         AccountReplicationType = "LRS",
 *         Tags =
 *         {
 *             { "environment", "staging" },
 *         },
 *     });
 *     var exampleQueue = new Azure.Storage.Queue("example", new()
 *     {
 *         Name = "example-astq",
 *         StorageAccountName = exampleAccount.Name,
 *     });
 *     var exampleEventSubscription = new Azure.EventGrid.EventSubscription("example", new()
 *     {
 *         Name = "example-aees",
 *         Scope = example.Id,
 *         StorageQueueEndpoint = new Azure.EventGrid.Inputs.EventSubscriptionStorageQueueEndpointArgs
 *         {
 *             StorageAccountId = exampleAccount.Id,
 *             QueueName = exampleQueue.Name,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/eventgrid"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
 * 	"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
 * 		}
 * 		exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
 * 			Name:                   pulumi.String("exampleasa"),
 * 			ResourceGroupName:      example.Name,
 * 			Location:               example.Location,
 * 			AccountTier:            pulumi.String("Standard"),
 * 			AccountReplicationType: pulumi.String("LRS"),
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("staging"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleQueue, err := storage.NewQueue(ctx, "example", &storage.QueueArgs{
 * 			Name:               pulumi.String("example-astq"),
 * 			StorageAccountName: exampleAccount.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = eventgrid.NewEventSubscription(ctx, "example", &eventgrid.EventSubscriptionArgs{
 * 			Name:  pulumi.String("example-aees"),
 * 			Scope: example.ID(),
 * 			StorageQueueEndpoint: &eventgrid.EventSubscriptionStorageQueueEndpointArgs{
 * 				StorageAccountId: exampleAccount.ID(),
 * 				QueueName:        exampleQueue.Name,
 * 			},
 * 		})
 * 		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.storage.Account;
 * import com.pulumi.azure.storage.AccountArgs;
 * import com.pulumi.azure.storage.Queue;
 * import com.pulumi.azure.storage.QueueArgs;
 * import com.pulumi.azure.eventgrid.EventSubscription;
 * import com.pulumi.azure.eventgrid.EventSubscriptionArgs;
 * import com.pulumi.azure.eventgrid.inputs.EventSubscriptionStorageQueueEndpointArgs;
 * 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 exampleAccount = new Account("exampleAccount", AccountArgs.builder()
 *             .name("exampleasa")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .accountTier("Standard")
 *             .accountReplicationType("LRS")
 *             .tags(Map.of("environment", "staging"))
 *             .build());
 *         var exampleQueue = new Queue("exampleQueue", QueueArgs.builder()
 *             .name("example-astq")
 *             .storageAccountName(exampleAccount.name())
 *             .build());
 *         var exampleEventSubscription = new EventSubscription("exampleEventSubscription", EventSubscriptionArgs.builder()
 *             .name("example-aees")
 *             .scope(example.id())
 *             .storageQueueEndpoint(EventSubscriptionStorageQueueEndpointArgs.builder()
 *                 .storageAccountId(exampleAccount.id())
 *                 .queueName(exampleQueue.name())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleAccount:
 *     type: azure:storage:Account
 *     name: example
 *     properties:
 *       name: exampleasa
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *       accountTier: Standard
 *       accountReplicationType: LRS
 *       tags:
 *         environment: staging
 *   exampleQueue:
 *     type: azure:storage:Queue
 *     name: example
 *     properties:
 *       name: example-astq
 *       storageAccountName: ${exampleAccount.name}
 *   exampleEventSubscription:
 *     type: azure:eventgrid:EventSubscription
 *     name: example
 *     properties:
 *       name: example-aees
 *       scope: ${example.id}
 *       storageQueueEndpoint:
 *         storageAccountId: ${exampleAccount.id}
 *         queueName: ${exampleQueue.name}
 * ```
 * 
 * ## Import
 * EventGrid Event Subscription's can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:eventhub/eventSubscription:EventSubscription eventSubscription1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventGrid/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscription1
 * ```
 */
@Deprecated(
    message = """
azure.eventhub.EventSubscription has been deprecated in favor of azure.eventgrid.EventSubscription
""",
)
public class EventSubscription internal constructor(
    override val javaResource: com.pulumi.azure.eventhub.EventSubscription,
) : KotlinCustomResource(javaResource, EventSubscriptionMapper) {
    /**
     * A `advanced_filter` block as defined below.
     */
    public val advancedFilter: Output?
        get() = javaResource.advancedFilter().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionAdvancedFilterToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Specifies whether advanced filters should be evaluated against an array of values instead of expecting a singular value. Defaults to `false`.
     */
    public val advancedFilteringOnArraysEnabled: Output?
        get() = javaResource.advancedFilteringOnArraysEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An `azure_function_endpoint` block as defined below.
     */
    public val azureFunctionEndpoint: Output?
        get() = javaResource.azureFunctionEndpoint().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionAzureFunctionEndpointToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `dead_letter_identity` block as defined below.
     * > **Note:** `storage_blob_dead_letter_destination` must be specified when a `dead_letter_identity` is specified
     */
    public val deadLetterIdentity: Output?
        get() = javaResource.deadLetterIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionDeadLetterIdentityToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `delivery_identity` block as defined below.
     */
    public val deliveryIdentity: Output?
        get() = javaResource.deliveryIdentity().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionDeliveryIdentityToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * One or more `delivery_property` blocks as defined below.
     */
    public val deliveryProperties: Output>?
        get() = javaResource.deliveryProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        eventSubscriptionDeliveryPropertyToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Specifies the event delivery schema for the event subscription. Possible values include: `EventGridSchema`, `CloudEventSchemaV1_0`, `CustomInputSchema`. Defaults to `EventGridSchema`. Changing this forces a new resource to be created.
     */
    public val eventDeliverySchema: Output?
        get() = javaResource.eventDeliverySchema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the id where the Event Hub is located.
     */
    public val eventhubEndpointId: Output
        get() = javaResource.eventhubEndpointId().applyValue({ args0 -> args0 })

    /**
     * Specifies the expiration time of the event subscription (Datetime Format `RFC 3339`).
     */
    public val expirationTimeUtc: Output?
        get() = javaResource.expirationTimeUtc().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the id where the Hybrid Connection is located.
     */
    public val hybridConnectionEndpointId: Output
        get() = javaResource.hybridConnectionEndpointId().applyValue({ args0 -> args0 })

    /**
     * A list of applicable event types that need to be part of the event subscription.
     */
    public val includedEventTypes: Output>
        get() = javaResource.includedEventTypes().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A list of labels to assign to the event subscription.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

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

    /**
     * A `retry_policy` block as defined below.
     */
    public val retryPolicy: Output
        get() = javaResource.retryPolicy().applyValue({ args0 ->
            args0.let({ args0 ->
                eventSubscriptionRetryPolicyToKotlin(args0)
            })
        })

    /**
     * Specifies the scope at which the EventGrid Event Subscription should be created. Changing this forces a new resource to be created.
     */
    public val scope: Output
        get() = javaResource.scope().applyValue({ args0 -> args0 })

    /**
     * Specifies the id where the Service Bus Queue is located.
     */
    public val serviceBusQueueEndpointId: Output?
        get() = javaResource.serviceBusQueueEndpointId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies the id where the Service Bus Topic is located.
     */
    public val serviceBusTopicEndpointId: Output?
        get() = javaResource.serviceBusTopicEndpointId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A `storage_blob_dead_letter_destination` block as defined below.
     */
    public val storageBlobDeadLetterDestination:
        Output?
        get() = javaResource.storageBlobDeadLetterDestination().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    eventSubscriptionStorageBlobDeadLetterDestinationToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * A `storage_queue_endpoint` block as defined below.
     */
    public val storageQueueEndpoint: Output?
        get() = javaResource.storageQueueEndpoint().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionStorageQueueEndpointToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `subject_filter` block as defined below.
     */
    public val subjectFilter: Output?
        get() = javaResource.subjectFilter().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionSubjectFilterToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A `webhook_endpoint` block as defined below.
     * > **NOTE:** One of `eventhub_endpoint_id`, `hybrid_connection_endpoint_id`, `service_bus_queue_endpoint_id`, `service_bus_topic_endpoint_id`, `storage_queue_endpoint`, `webhook_endpoint` or `azure_function_endpoint` must be specified.
     */
    public val webhookEndpoint: Output?
        get() = javaResource.webhookEndpoint().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> eventSubscriptionWebhookEndpointToKotlin(args0) })
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy