com.pulumi.aws.glue.kotlin.Trigger.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.glue.kotlin
import com.pulumi.aws.glue.kotlin.outputs.TriggerAction
import com.pulumi.aws.glue.kotlin.outputs.TriggerEventBatchingCondition
import com.pulumi.aws.glue.kotlin.outputs.TriggerPredicate
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 kotlin.collections.Map
import com.pulumi.aws.glue.kotlin.outputs.TriggerAction.Companion.toKotlin as triggerActionToKotlin
import com.pulumi.aws.glue.kotlin.outputs.TriggerEventBatchingCondition.Companion.toKotlin as triggerEventBatchingConditionToKotlin
import com.pulumi.aws.glue.kotlin.outputs.TriggerPredicate.Companion.toKotlin as triggerPredicateToKotlin
/**
* Builder for [Trigger].
*/
@PulumiTagMarker
public class TriggerResourceBuilder internal constructor() {
public var name: String? = null
public var args: TriggerArgs = TriggerArgs()
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 TriggerArgsBuilder.() -> Unit) {
val builder = TriggerArgsBuilder()
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(): Trigger {
val builtJavaResource = com.pulumi.aws.glue.Trigger(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Trigger(builtJavaResource)
}
}
/**
* Manages a Glue Trigger resource.
* ## Example Usage
* ### Conditional Trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.glue.Trigger("example", {
* name: "example",
* type: "CONDITIONAL",
* actions: [{
* jobName: example1.name,
* }],
* predicate: {
* conditions: [{
* jobName: example2.name,
* state: "SUCCEEDED",
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.glue.Trigger("example",
* name="example",
* type="CONDITIONAL",
* actions=[{
* "job_name": example1["name"],
* }],
* predicate={
* "conditions": [{
* "job_name": example2["name"],
* "state": "SUCCEEDED",
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Glue.Trigger("example", new()
* {
* Name = "example",
* Type = "CONDITIONAL",
* Actions = new[]
* {
* new Aws.Glue.Inputs.TriggerActionArgs
* {
* JobName = example1.Name,
* },
* },
* Predicate = new Aws.Glue.Inputs.TriggerPredicateArgs
* {
* Conditions = new[]
* {
* new Aws.Glue.Inputs.TriggerPredicateConditionArgs
* {
* JobName = example2.Name,
* State = "SUCCEEDED",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := glue.NewTrigger(ctx, "example", &glue.TriggerArgs{
* Name: pulumi.String("example"),
* Type: pulumi.String("CONDITIONAL"),
* Actions: glue.TriggerActionArray{
* &glue.TriggerActionArgs{
* JobName: pulumi.Any(example1.Name),
* },
* },
* Predicate: &glue.TriggerPredicateArgs{
* Conditions: glue.TriggerPredicateConditionArray{
* &glue.TriggerPredicateConditionArgs{
* JobName: pulumi.Any(example2.Name),
* State: pulumi.String("SUCCEEDED"),
* },
* },
* },
* })
* 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.aws.glue.Trigger;
* import com.pulumi.aws.glue.TriggerArgs;
* import com.pulumi.aws.glue.inputs.TriggerActionArgs;
* import com.pulumi.aws.glue.inputs.TriggerPredicateArgs;
* 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 Trigger("example", TriggerArgs.builder()
* .name("example")
* .type("CONDITIONAL")
* .actions(TriggerActionArgs.builder()
* .jobName(example1.name())
* .build())
* .predicate(TriggerPredicateArgs.builder()
* .conditions(TriggerPredicateConditionArgs.builder()
* .jobName(example2.name())
* .state("SUCCEEDED")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:glue:Trigger
* properties:
* name: example
* type: CONDITIONAL
* actions:
* - jobName: ${example1.name}
* predicate:
* conditions:
* - jobName: ${example2.name}
* state: SUCCEEDED
* ```
*
* ### On-Demand Trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.glue.Trigger("example", {
* name: "example",
* type: "ON_DEMAND",
* actions: [{
* jobName: exampleAwsGlueJob.name,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.glue.Trigger("example",
* name="example",
* type="ON_DEMAND",
* actions=[{
* "job_name": example_aws_glue_job["name"],
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Glue.Trigger("example", new()
* {
* Name = "example",
* Type = "ON_DEMAND",
* Actions = new[]
* {
* new Aws.Glue.Inputs.TriggerActionArgs
* {
* JobName = exampleAwsGlueJob.Name,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := glue.NewTrigger(ctx, "example", &glue.TriggerArgs{
* Name: pulumi.String("example"),
* Type: pulumi.String("ON_DEMAND"),
* Actions: glue.TriggerActionArray{
* &glue.TriggerActionArgs{
* JobName: pulumi.Any(exampleAwsGlueJob.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.aws.glue.Trigger;
* import com.pulumi.aws.glue.TriggerArgs;
* import com.pulumi.aws.glue.inputs.TriggerActionArgs;
* 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 Trigger("example", TriggerArgs.builder()
* .name("example")
* .type("ON_DEMAND")
* .actions(TriggerActionArgs.builder()
* .jobName(exampleAwsGlueJob.name())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:glue:Trigger
* properties:
* name: example
* type: ON_DEMAND
* actions:
* - jobName: ${exampleAwsGlueJob.name}
* ```
*
* ### Scheduled Trigger
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.glue.Trigger("example", {
* name: "example",
* schedule: "cron(15 12 * * ? *)",
* type: "SCHEDULED",
* actions: [{
* jobName: exampleAwsGlueJob.name,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.glue.Trigger("example",
* name="example",
* schedule="cron(15 12 * * ? *)",
* type="SCHEDULED",
* actions=[{
* "job_name": example_aws_glue_job["name"],
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Glue.Trigger("example", new()
* {
* Name = "example",
* Schedule = "cron(15 12 * * ? *)",
* Type = "SCHEDULED",
* Actions = new[]
* {
* new Aws.Glue.Inputs.TriggerActionArgs
* {
* JobName = exampleAwsGlueJob.Name,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := glue.NewTrigger(ctx, "example", &glue.TriggerArgs{
* Name: pulumi.String("example"),
* Schedule: pulumi.String("cron(15 12 * * ? *)"),
* Type: pulumi.String("SCHEDULED"),
* Actions: glue.TriggerActionArray{
* &glue.TriggerActionArgs{
* JobName: pulumi.Any(exampleAwsGlueJob.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.aws.glue.Trigger;
* import com.pulumi.aws.glue.TriggerArgs;
* import com.pulumi.aws.glue.inputs.TriggerActionArgs;
* 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 Trigger("example", TriggerArgs.builder()
* .name("example")
* .schedule("cron(15 12 * * ? *)")
* .type("SCHEDULED")
* .actions(TriggerActionArgs.builder()
* .jobName(exampleAwsGlueJob.name())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:glue:Trigger
* properties:
* name: example
* schedule: cron(15 12 * * ? *)
* type: SCHEDULED
* actions:
* - jobName: ${exampleAwsGlueJob.name}
* ```
*
* ### Conditional Trigger with Crawler Action
* **Note:** Triggers can have both a crawler action and a crawler condition, just no example provided.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.glue.Trigger("example", {
* name: "example",
* type: "CONDITIONAL",
* actions: [{
* crawlerName: example1.name,
* }],
* predicate: {
* conditions: [{
* jobName: example2.name,
* state: "SUCCEEDED",
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.glue.Trigger("example",
* name="example",
* type="CONDITIONAL",
* actions=[{
* "crawler_name": example1["name"],
* }],
* predicate={
* "conditions": [{
* "job_name": example2["name"],
* "state": "SUCCEEDED",
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Glue.Trigger("example", new()
* {
* Name = "example",
* Type = "CONDITIONAL",
* Actions = new[]
* {
* new Aws.Glue.Inputs.TriggerActionArgs
* {
* CrawlerName = example1.Name,
* },
* },
* Predicate = new Aws.Glue.Inputs.TriggerPredicateArgs
* {
* Conditions = new[]
* {
* new Aws.Glue.Inputs.TriggerPredicateConditionArgs
* {
* JobName = example2.Name,
* State = "SUCCEEDED",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := glue.NewTrigger(ctx, "example", &glue.TriggerArgs{
* Name: pulumi.String("example"),
* Type: pulumi.String("CONDITIONAL"),
* Actions: glue.TriggerActionArray{
* &glue.TriggerActionArgs{
* CrawlerName: pulumi.Any(example1.Name),
* },
* },
* Predicate: &glue.TriggerPredicateArgs{
* Conditions: glue.TriggerPredicateConditionArray{
* &glue.TriggerPredicateConditionArgs{
* JobName: pulumi.Any(example2.Name),
* State: pulumi.String("SUCCEEDED"),
* },
* },
* },
* })
* 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.aws.glue.Trigger;
* import com.pulumi.aws.glue.TriggerArgs;
* import com.pulumi.aws.glue.inputs.TriggerActionArgs;
* import com.pulumi.aws.glue.inputs.TriggerPredicateArgs;
* 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 Trigger("example", TriggerArgs.builder()
* .name("example")
* .type("CONDITIONAL")
* .actions(TriggerActionArgs.builder()
* .crawlerName(example1.name())
* .build())
* .predicate(TriggerPredicateArgs.builder()
* .conditions(TriggerPredicateConditionArgs.builder()
* .jobName(example2.name())
* .state("SUCCEEDED")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:glue:Trigger
* properties:
* name: example
* type: CONDITIONAL
* actions:
* - crawlerName: ${example1.name}
* predicate:
* conditions:
* - jobName: ${example2.name}
* state: SUCCEEDED
* ```
*
* ### Conditional Trigger with Crawler Condition
* **Note:** Triggers can have both a crawler action and a crawler condition, just no example provided.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.glue.Trigger("example", {
* name: "example",
* type: "CONDITIONAL",
* actions: [{
* jobName: example1.name,
* }],
* predicate: {
* conditions: [{
* crawlerName: example2.name,
* crawlState: "SUCCEEDED",
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.glue.Trigger("example",
* name="example",
* type="CONDITIONAL",
* actions=[{
* "job_name": example1["name"],
* }],
* predicate={
* "conditions": [{
* "crawler_name": example2["name"],
* "crawl_state": "SUCCEEDED",
* }],
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Glue.Trigger("example", new()
* {
* Name = "example",
* Type = "CONDITIONAL",
* Actions = new[]
* {
* new Aws.Glue.Inputs.TriggerActionArgs
* {
* JobName = example1.Name,
* },
* },
* Predicate = new Aws.Glue.Inputs.TriggerPredicateArgs
* {
* Conditions = new[]
* {
* new Aws.Glue.Inputs.TriggerPredicateConditionArgs
* {
* CrawlerName = example2.Name,
* CrawlState = "SUCCEEDED",
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/glue"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := glue.NewTrigger(ctx, "example", &glue.TriggerArgs{
* Name: pulumi.String("example"),
* Type: pulumi.String("CONDITIONAL"),
* Actions: glue.TriggerActionArray{
* &glue.TriggerActionArgs{
* JobName: pulumi.Any(example1.Name),
* },
* },
* Predicate: &glue.TriggerPredicateArgs{
* Conditions: glue.TriggerPredicateConditionArray{
* &glue.TriggerPredicateConditionArgs{
* CrawlerName: pulumi.Any(example2.Name),
* CrawlState: pulumi.String("SUCCEEDED"),
* },
* },
* },
* })
* 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.aws.glue.Trigger;
* import com.pulumi.aws.glue.TriggerArgs;
* import com.pulumi.aws.glue.inputs.TriggerActionArgs;
* import com.pulumi.aws.glue.inputs.TriggerPredicateArgs;
* 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 Trigger("example", TriggerArgs.builder()
* .name("example")
* .type("CONDITIONAL")
* .actions(TriggerActionArgs.builder()
* .jobName(example1.name())
* .build())
* .predicate(TriggerPredicateArgs.builder()
* .conditions(TriggerPredicateConditionArgs.builder()
* .crawlerName(example2.name())
* .crawlState("SUCCEEDED")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:glue:Trigger
* properties:
* name: example
* type: CONDITIONAL
* actions:
* - jobName: ${example1.name}
* predicate:
* conditions:
* - crawlerName: ${example2.name}
* crawlState: SUCCEEDED
* ```
*
* ## Import
* Using `pulumi import`, import Glue Triggers using `name`. For example:
* ```sh
* $ pulumi import aws:glue/trigger:Trigger MyTrigger MyTrigger
* ```
*/
public class Trigger internal constructor(
override val javaResource: com.pulumi.aws.glue.Trigger,
) : KotlinCustomResource(javaResource, TriggerMapper) {
/**
* List of actions initiated by this trigger when it fires. See Actions Below.
*/
public val actions: Output>
get() = javaResource.actions().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
triggerActionToKotlin(args0)
})
})
})
/**
* Amazon Resource Name (ARN) of Glue Trigger
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* A description of the new trigger.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Start the trigger. Defaults to `true`.
*/
public val enabled: Output?
get() = javaResource.enabled().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires. See Event Batching Condition.
*/
public val eventBatchingConditions: Output>?
get() = javaResource.eventBatchingConditions().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
triggerEventBatchingConditionToKotlin(args0)
})
})
}).orElse(null)
})
/**
* The name of the trigger.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A predicate to specify when the new trigger should fire. Required when trigger type is `CONDITIONAL`. See Predicate Below.
*/
public val predicate: Output?
get() = javaResource.predicate().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
triggerPredicateToKotlin(args0)
})
}).orElse(null)
})
/**
* A cron expression used to specify the schedule. [Time-Based Schedules for Jobs and Crawlers](https://docs.aws.amazon.com/glue/latest/dg/monitor-data-warehouse-schedule.html)
*/
public val schedule: Output?
get() = javaResource.schedule().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Set to true to start `SCHEDULED` and `CONDITIONAL` triggers when created. True is not supported for `ON_DEMAND` triggers.
*/
public val startOnCreation: Output?
get() = javaResource.startOnCreation().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The current state of the trigger.
*/
public val state: Output
get() = javaResource.state().applyValue({ args0 -> args0 })
/**
* Key-value map of resource tags. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
public val tags: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy