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

com.pulumi.azure.datafactory.kotlin.TriggerCustomEvent.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.datafactory.kotlin

import com.pulumi.azure.datafactory.kotlin.outputs.TriggerCustomEventPipeline
import com.pulumi.azure.datafactory.kotlin.outputs.TriggerCustomEventPipeline.Companion.toKotlin
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: TriggerCustomEventArgs = TriggerCustomEventArgs()

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

/**
 * Manages a Custom Event Trigger inside an Azure Data Factory.
 * ## 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 exampleFactory = new azure.datafactory.Factory("example", {
 *     name: "example",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const examplePipeline = new azure.datafactory.Pipeline("example", {
 *     name: "example",
 *     dataFactoryId: exampleFactory.id,
 * });
 * const exampleTopic = new azure.eventgrid.Topic("example", {
 *     name: "example-topic",
 *     location: example.location,
 *     resourceGroupName: example.name,
 * });
 * const exampleTriggerCustomEvent = new azure.datafactory.TriggerCustomEvent("example", {
 *     name: "example",
 *     dataFactoryId: exampleFactory.id,
 *     eventgridTopicId: exampleTopic.id,
 *     events: [
 *         "event1",
 *         "event2",
 *     ],
 *     subjectBeginsWith: "abc",
 *     subjectEndsWith: "xyz",
 *     annotations: [
 *         "example1",
 *         "example2",
 *         "example3",
 *     ],
 *     description: "example description",
 *     pipelines: [{
 *         name: examplePipeline.name,
 *         parameters: {
 *             Env: "Prod",
 *         },
 *     }],
 *     additionalProperties: {
 *         foo: "foo1",
 *         bar: "bar2",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_factory = azure.datafactory.Factory("example",
 *     name="example",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_pipeline = azure.datafactory.Pipeline("example",
 *     name="example",
 *     data_factory_id=example_factory.id)
 * example_topic = azure.eventgrid.Topic("example",
 *     name="example-topic",
 *     location=example.location,
 *     resource_group_name=example.name)
 * example_trigger_custom_event = azure.datafactory.TriggerCustomEvent("example",
 *     name="example",
 *     data_factory_id=example_factory.id,
 *     eventgrid_topic_id=example_topic.id,
 *     events=[
 *         "event1",
 *         "event2",
 *     ],
 *     subject_begins_with="abc",
 *     subject_ends_with="xyz",
 *     annotations=[
 *         "example1",
 *         "example2",
 *         "example3",
 *     ],
 *     description="example description",
 *     pipelines=[azure.datafactory.TriggerCustomEventPipelineArgs(
 *         name=example_pipeline.name,
 *         parameters={
 *             "Env": "Prod",
 *         },
 *     )],
 *     additional_properties={
 *         "foo": "foo1",
 *         "bar": "bar2",
 *     })
 * ```
 * ```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 exampleFactory = new Azure.DataFactory.Factory("example", new()
 *     {
 *         Name = "example",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var examplePipeline = new Azure.DataFactory.Pipeline("example", new()
 *     {
 *         Name = "example",
 *         DataFactoryId = exampleFactory.Id,
 *     });
 *     var exampleTopic = new Azure.EventGrid.Topic("example", new()
 *     {
 *         Name = "example-topic",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *     });
 *     var exampleTriggerCustomEvent = new Azure.DataFactory.TriggerCustomEvent("example", new()
 *     {
 *         Name = "example",
 *         DataFactoryId = exampleFactory.Id,
 *         EventgridTopicId = exampleTopic.Id,
 *         Events = new[]
 *         {
 *             "event1",
 *             "event2",
 *         },
 *         SubjectBeginsWith = "abc",
 *         SubjectEndsWith = "xyz",
 *         Annotations = new[]
 *         {
 *             "example1",
 *             "example2",
 *             "example3",
 *         },
 *         Description = "example description",
 *         Pipelines = new[]
 *         {
 *             new Azure.DataFactory.Inputs.TriggerCustomEventPipelineArgs
 *             {
 *                 Name = examplePipeline.Name,
 *                 Parameters =
 *                 {
 *                     { "Env", "Prod" },
 *                 },
 *             },
 *         },
 *         AdditionalProperties =
 *         {
 *             { "foo", "foo1" },
 *             { "bar", "bar2" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/datafactory"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/eventgrid"
 * 	"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
 * 		}
 * 		exampleFactory, err := datafactory.NewFactory(ctx, "example", &datafactory.FactoryArgs{
 * 			Name:              pulumi.String("example"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePipeline, err := datafactory.NewPipeline(ctx, "example", &datafactory.PipelineArgs{
 * 			Name:          pulumi.String("example"),
 * 			DataFactoryId: exampleFactory.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleTopic, err := eventgrid.NewTopic(ctx, "example", &eventgrid.TopicArgs{
 * 			Name:              pulumi.String("example-topic"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = datafactory.NewTriggerCustomEvent(ctx, "example", &datafactory.TriggerCustomEventArgs{
 * 			Name:             pulumi.String("example"),
 * 			DataFactoryId:    exampleFactory.ID(),
 * 			EventgridTopicId: exampleTopic.ID(),
 * 			Events: pulumi.StringArray{
 * 				pulumi.String("event1"),
 * 				pulumi.String("event2"),
 * 			},
 * 			SubjectBeginsWith: pulumi.String("abc"),
 * 			SubjectEndsWith:   pulumi.String("xyz"),
 * 			Annotations: pulumi.StringArray{
 * 				pulumi.String("example1"),
 * 				pulumi.String("example2"),
 * 				pulumi.String("example3"),
 * 			},
 * 			Description: pulumi.String("example description"),
 * 			Pipelines: datafactory.TriggerCustomEventPipelineArray{
 * 				&datafactory.TriggerCustomEventPipelineArgs{
 * 					Name: examplePipeline.Name,
 * 					Parameters: pulumi.StringMap{
 * 						"Env": pulumi.String("Prod"),
 * 					},
 * 				},
 * 			},
 * 			AdditionalProperties: pulumi.StringMap{
 * 				"foo": pulumi.String("foo1"),
 * 				"bar": pulumi.String("bar2"),
 * 			},
 * 		})
 * 		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.datafactory.Factory;
 * import com.pulumi.azure.datafactory.FactoryArgs;
 * import com.pulumi.azure.datafactory.Pipeline;
 * import com.pulumi.azure.datafactory.PipelineArgs;
 * import com.pulumi.azure.eventgrid.Topic;
 * import com.pulumi.azure.eventgrid.TopicArgs;
 * import com.pulumi.azure.datafactory.TriggerCustomEvent;
 * import com.pulumi.azure.datafactory.TriggerCustomEventArgs;
 * import com.pulumi.azure.datafactory.inputs.TriggerCustomEventPipelineArgs;
 * 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 exampleFactory = new Factory("exampleFactory", FactoryArgs.builder()
 *             .name("example")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var examplePipeline = new Pipeline("examplePipeline", PipelineArgs.builder()
 *             .name("example")
 *             .dataFactoryId(exampleFactory.id())
 *             .build());
 *         var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
 *             .name("example-topic")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .build());
 *         var exampleTriggerCustomEvent = new TriggerCustomEvent("exampleTriggerCustomEvent", TriggerCustomEventArgs.builder()
 *             .name("example")
 *             .dataFactoryId(exampleFactory.id())
 *             .eventgridTopicId(exampleTopic.id())
 *             .events(
 *                 "event1",
 *                 "event2")
 *             .subjectBeginsWith("abc")
 *             .subjectEndsWith("xyz")
 *             .annotations(
 *                 "example1",
 *                 "example2",
 *                 "example3")
 *             .description("example description")
 *             .pipelines(TriggerCustomEventPipelineArgs.builder()
 *                 .name(examplePipeline.name())
 *                 .parameters(Map.of("Env", "Prod"))
 *                 .build())
 *             .additionalProperties(Map.ofEntries(
 *                 Map.entry("foo", "foo1"),
 *                 Map.entry("bar", "bar2")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleFactory:
 *     type: azure:datafactory:Factory
 *     name: example
 *     properties:
 *       name: example
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   examplePipeline:
 *     type: azure:datafactory:Pipeline
 *     name: example
 *     properties:
 *       name: example
 *       dataFactoryId: ${exampleFactory.id}
 *   exampleTopic:
 *     type: azure:eventgrid:Topic
 *     name: example
 *     properties:
 *       name: example-topic
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *   exampleTriggerCustomEvent:
 *     type: azure:datafactory:TriggerCustomEvent
 *     name: example
 *     properties:
 *       name: example
 *       dataFactoryId: ${exampleFactory.id}
 *       eventgridTopicId: ${exampleTopic.id}
 *       events:
 *         - event1
 *         - event2
 *       subjectBeginsWith: abc
 *       subjectEndsWith: xyz
 *       annotations:
 *         - example1
 *         - example2
 *         - example3
 *       description: example description
 *       pipelines:
 *         - name: ${examplePipeline.name}
 *           parameters:
 *             Env: Prod
 *       additionalProperties:
 *         foo: foo1
 *         bar: bar2
 * ```
 * 
 * ## Import
 * Data Factory Custom Event Trigger can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:datafactory/triggerCustomEvent:TriggerCustomEvent example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.DataFactory/factories/example/triggers/example
 * ```
 */
public class TriggerCustomEvent internal constructor(
    override val javaResource: com.pulumi.azure.datafactory.TriggerCustomEvent,
) : KotlinCustomResource(javaResource, TriggerCustomEventMapper) {
    /**
     * Specifies if the Data Factory Custom Event Trigger is activated. Defaults to `true`.
     */
    public val activated: Output?
        get() = javaResource.activated().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * A map of additional properties to associate with the Data Factory Custom Event Trigger.
     */
    public val additionalProperties: Output>?
        get() = javaResource.additionalProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })

    /**
     * List of tags that can be used for describing the Data Factory Custom Event Trigger.
     */
    public val annotations: Output>?
        get() = javaResource.annotations().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * The ID of Data Factory in which to associate the Trigger with. Changing this forces a new resource.
     */
    public val dataFactoryId: Output
        get() = javaResource.dataFactoryId().applyValue({ args0 -> args0 })

    /**
     * The description for the Data Factory Custom Event Trigger.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID of Event Grid Topic in which event will be listened. Changing this forces a new resource.
     */
    public val eventgridTopicId: Output
        get() = javaResource.eventgridTopicId().applyValue({ args0 -> args0 })

    /**
     * List of events that will fire this trigger. At least one event must be specified.
     */
    public val events: Output>
        get() = javaResource.events().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

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

    /**
     * One or more `pipeline` blocks as defined below.
     */
    public val pipelines: Output>
        get() = javaResource.pipelines().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            })
        })

    /**
     * The pattern that event subject starts with for trigger to fire.
     */
    public val subjectBeginsWith: Output?
        get() = javaResource.subjectBeginsWith().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The pattern that event subject ends with for trigger to fire.
     */
    public val subjectEndsWith: Output?
        get() = javaResource.subjectEndsWith().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object TriggerCustomEventMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.datafactory.TriggerCustomEvent::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy