// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.eventgrid;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.eventgrid.EventSubscriptionArgs;
import com.pulumi.azure.eventgrid.inputs.EventSubscriptionState;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionAdvancedFilter;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionAzureFunctionEndpoint;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionDeadLetterIdentity;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionDeliveryIdentity;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionDeliveryProperty;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionRetryPolicy;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionStorageBlobDeadLetterDestination;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionStorageQueueEndpoint;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionSubjectFilter;
import com.pulumi.azure.eventgrid.outputs.EventSubscriptionWebhookEndpoint;
import com.pulumi.core.Alias;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages an EventGrid Event Subscription
 * 
 * ## 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.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 exampleResourceGroup = new ResourceGroup(&#34;exampleResourceGroup&#34;, ResourceGroupArgs.builder()        
 *             .location(&#34;West Europe&#34;)
 *             .build());
 * 
 *         var exampleAccount = new Account(&#34;exampleAccount&#34;, AccountArgs.builder()        
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .accountTier(&#34;Standard&#34;)
 *             .accountReplicationType(&#34;LRS&#34;)
 *             .tags(Map.of(&#34;environment&#34;, &#34;staging&#34;))
 *             .build());
 * 
 *         var exampleQueue = new Queue(&#34;exampleQueue&#34;, QueueArgs.builder()        
 *             .storageAccountName(exampleAccount.name())
 *             .build());
 * 
 *         var exampleEventSubscription = new EventSubscription(&#34;exampleEventSubscription&#34;, EventSubscriptionArgs.builder()        
 *             .scope(exampleResourceGroup.id())
 *             .storageQueueEndpoint(EventSubscriptionStorageQueueEndpointArgs.builder()
 *                 .storageAccountId(exampleAccount.id())
 *                 .queueName(exampleQueue.name())
 *                 .build())
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * EventGrid Event Subscription&#39;s can be imported using the `resource id`, e.g.
 * 
 * ```sh
 *  $ pulumi import azure:eventgrid/eventSubscription:EventSubscription eventSubscription1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.EventGrid/topics/topic1/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscription1
 * ```
 * 
 */
@ResourceType(type="azure:eventgrid/eventSubscription:EventSubscription")
public class EventSubscription extends com.pulumi.resources.CustomResource {
    /**
     * A `advanced_filter` block as defined below.
     * 
     */
    @Export(name="advancedFilter", refs={EventSubscriptionAdvancedFilter.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionAdvancedFilter> advancedFilter;

    /**
     * @return A `advanced_filter` block as defined below.
     * 
     */
    public Output<Optional<EventSubscriptionAdvancedFilter>> advancedFilter() {
        return Codegen.optional(this.advancedFilter);
    }
    /**
     * Specifies whether advanced filters should be evaluated against an array of values instead of expecting a singular value. Defaults to `false`.
     * 
     */
    @Export(name="advancedFilteringOnArraysEnabled", refs={Boolean.class}, tree="[0]")
    private Output</* @Nullable */ Boolean> advancedFilteringOnArraysEnabled;

    /**
     * @return Specifies whether advanced filters should be evaluated against an array of values instead of expecting a singular value. Defaults to `false`.
     * 
     */
    public Output<Optional<Boolean>> advancedFilteringOnArraysEnabled() {
        return Codegen.optional(this.advancedFilteringOnArraysEnabled);
    }
    /**
     * An `azure_function_endpoint` block as defined below.
     * 
     */
    @Export(name="azureFunctionEndpoint", refs={EventSubscriptionAzureFunctionEndpoint.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionAzureFunctionEndpoint> azureFunctionEndpoint;

    /**
     * @return An `azure_function_endpoint` block as defined below.
     * 
     */
    public Output<Optional<EventSubscriptionAzureFunctionEndpoint>> azureFunctionEndpoint() {
        return Codegen.optional(this.azureFunctionEndpoint);
    }
    /**
     * A `dead_letter_identity` block as defined below.
     * 
     * &gt; **Note:** `storage_blob_dead_letter_destination` must be specified when a `dead_letter_identity` is specified
     * 
     */
    @Export(name="deadLetterIdentity", refs={EventSubscriptionDeadLetterIdentity.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionDeadLetterIdentity> deadLetterIdentity;

    /**
     * @return A `dead_letter_identity` block as defined below.
     * 
     * &gt; **Note:** `storage_blob_dead_letter_destination` must be specified when a `dead_letter_identity` is specified
     * 
     */
    public Output<Optional<EventSubscriptionDeadLetterIdentity>> deadLetterIdentity() {
        return Codegen.optional(this.deadLetterIdentity);
    }
    /**
     * A `delivery_identity` block as defined below.
     * 
     */
    @Export(name="deliveryIdentity", refs={EventSubscriptionDeliveryIdentity.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionDeliveryIdentity> deliveryIdentity;

    /**
     * @return A `delivery_identity` block as defined below.
     * 
     */
    public Output<Optional<EventSubscriptionDeliveryIdentity>> deliveryIdentity() {
        return Codegen.optional(this.deliveryIdentity);
    }
    /**
     * One or more `delivery_property` blocks as defined below.
     * 
     */
    @Export(name="deliveryProperties", refs={List.class,EventSubscriptionDeliveryProperty.class}, tree="[0,1]")
    private Output</* @Nullable */ List<EventSubscriptionDeliveryProperty>> deliveryProperties;

    /**
     * @return One or more `delivery_property` blocks as defined below.
     * 
     */
    public Output<Optional<List<EventSubscriptionDeliveryProperty>>> deliveryProperties() {
        return Codegen.optional(this.deliveryProperties);
    }
    /**
     * 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.
     * 
     */
    @Export(name="eventDeliverySchema", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> eventDeliverySchema;

    /**
     * @return 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 Output<Optional<String>> eventDeliverySchema() {
        return Codegen.optional(this.eventDeliverySchema);
    }
    /**
     * Specifies the id where the Event Hub is located.
     * 
     */
    @Export(name="eventhubEndpointId", refs={String.class}, tree="[0]")
    private Output<String> eventhubEndpointId;

    /**
     * @return Specifies the id where the Event Hub is located.
     * 
     */
    public Output<String> eventhubEndpointId() {
        return this.eventhubEndpointId;
    }
    /**
     * Specifies the expiration time of the event subscription (Datetime Format `RFC 3339`).
     * 
     */
    @Export(name="expirationTimeUtc", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> expirationTimeUtc;

    /**
     * @return Specifies the expiration time of the event subscription (Datetime Format `RFC 3339`).
     * 
     */
    public Output<Optional<String>> expirationTimeUtc() {
        return Codegen.optional(this.expirationTimeUtc);
    }
    /**
     * Specifies the id where the Hybrid Connection is located.
     * 
     */
    @Export(name="hybridConnectionEndpointId", refs={String.class}, tree="[0]")
    private Output<String> hybridConnectionEndpointId;

    /**
     * @return Specifies the id where the Hybrid Connection is located.
     * 
     */
    public Output<String> hybridConnectionEndpointId() {
        return this.hybridConnectionEndpointId;
    }
    /**
     * A list of applicable event types that need to be part of the event subscription.
     * 
     */
    @Export(name="includedEventTypes", refs={List.class,String.class}, tree="[0,1]")
    private Output<List<String>> includedEventTypes;

    /**
     * @return A list of applicable event types that need to be part of the event subscription.
     * 
     */
    public Output<List<String>> includedEventTypes() {
        return this.includedEventTypes;
    }
    /**
     * A list of labels to assign to the event subscription.
     * 
     */
    @Export(name="labels", refs={List.class,String.class}, tree="[0,1]")
    private Output</* @Nullable */ List<String>> labels;

    /**
     * @return A list of labels to assign to the event subscription.
     * 
     */
    public Output<Optional<List<String>>> labels() {
        return Codegen.optional(this.labels);
    }
    /**
     * Specifies the name of the EventGrid Event Subscription resource. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="name", refs={String.class}, tree="[0]")
    private Output<String> name;

    /**
     * @return Specifies the name of the EventGrid Event Subscription resource. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> name() {
        return this.name;
    }
    /**
     * A `retry_policy` block as defined below.
     * 
     */
    @Export(name="retryPolicy", refs={EventSubscriptionRetryPolicy.class}, tree="[0]")
    private Output<EventSubscriptionRetryPolicy> retryPolicy;

    /**
     * @return A `retry_policy` block as defined below.
     * 
     */
    public Output<EventSubscriptionRetryPolicy> retryPolicy() {
        return this.retryPolicy;
    }
    /**
     * Specifies the scope at which the EventGrid Event Subscription should be created. Changing this forces a new resource to be created.
     * 
     */
    @Export(name="scope", refs={String.class}, tree="[0]")
    private Output<String> scope;

    /**
     * @return Specifies the scope at which the EventGrid Event Subscription should be created. Changing this forces a new resource to be created.
     * 
     */
    public Output<String> scope() {
        return this.scope;
    }
    /**
     * Specifies the id where the Service Bus Queue is located.
     * 
     */
    @Export(name="serviceBusQueueEndpointId", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> serviceBusQueueEndpointId;

    /**
     * @return Specifies the id where the Service Bus Queue is located.
     * 
     */
    public Output<Optional<String>> serviceBusQueueEndpointId() {
        return Codegen.optional(this.serviceBusQueueEndpointId);
    }
    /**
     * Specifies the id where the Service Bus Topic is located.
     * 
     */
    @Export(name="serviceBusTopicEndpointId", refs={String.class}, tree="[0]")
    private Output</* @Nullable */ String> serviceBusTopicEndpointId;

    /**
     * @return Specifies the id where the Service Bus Topic is located.
     * 
     */
    public Output<Optional<String>> serviceBusTopicEndpointId() {
        return Codegen.optional(this.serviceBusTopicEndpointId);
    }
    /**
     * A `storage_blob_dead_letter_destination` block as defined below.
     * 
     */
    @Export(name="storageBlobDeadLetterDestination", refs={EventSubscriptionStorageBlobDeadLetterDestination.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionStorageBlobDeadLetterDestination> storageBlobDeadLetterDestination;

    /**
     * @return A `storage_blob_dead_letter_destination` block as defined below.
     * 
     */
    public Output<Optional<EventSubscriptionStorageBlobDeadLetterDestination>> storageBlobDeadLetterDestination() {
        return Codegen.optional(this.storageBlobDeadLetterDestination);
    }
    /**
     * A `storage_queue_endpoint` block as defined below.
     * 
     */
    @Export(name="storageQueueEndpoint", refs={EventSubscriptionStorageQueueEndpoint.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionStorageQueueEndpoint> storageQueueEndpoint;

    /**
     * @return A `storage_queue_endpoint` block as defined below.
     * 
     */
    public Output<Optional<EventSubscriptionStorageQueueEndpoint>> storageQueueEndpoint() {
        return Codegen.optional(this.storageQueueEndpoint);
    }
    /**
     * A `subject_filter` block as defined below.
     * 
     */
    @Export(name="subjectFilter", refs={EventSubscriptionSubjectFilter.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionSubjectFilter> subjectFilter;

    /**
     * @return A `subject_filter` block as defined below.
     * 
     */
    public Output<Optional<EventSubscriptionSubjectFilter>> subjectFilter() {
        return Codegen.optional(this.subjectFilter);
    }
    /**
     * A `webhook_endpoint` block as defined below.
     * 
     * &gt; **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.
     * 
     */
    @Export(name="webhookEndpoint", refs={EventSubscriptionWebhookEndpoint.class}, tree="[0]")
    private Output</* @Nullable */ EventSubscriptionWebhookEndpoint> webhookEndpoint;

    /**
     * @return A `webhook_endpoint` block as defined below.
     * 
     * &gt; **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 Output<Optional<EventSubscriptionWebhookEndpoint>> webhookEndpoint() {
        return Codegen.optional(this.webhookEndpoint);
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public EventSubscription(String name) {
        this(name, EventSubscriptionArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public EventSubscription(String name, EventSubscriptionArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public EventSubscription(String name, EventSubscriptionArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:eventgrid/eventSubscription:EventSubscription", name, args == null ? EventSubscriptionArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private EventSubscription(String name, Output<String> id, @Nullable EventSubscriptionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("azure:eventgrid/eventSubscription:EventSubscription", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .aliases(List.of(
                Output.of(Alias.builder().type("azure:eventhub/eventSubscription:EventSubscription").build())
            ))
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static EventSubscription get(String name, Output<String> id, @Nullable EventSubscriptionState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new EventSubscription(name, id, state, options);
    }
}
