Skip to content
v2.276.0

Condition Class ​

A condition that determines when a conditional trigger fires.

A condition watches exactly one target in exactly one state: use {@link Condition.job} to watch a job or {@link Condition.crawler} to watch a crawler. Because the state is a required argument of each factory, a condition can never reference a target without its state, or both a job and a crawler.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_glue as glue } from 'aws-cdk-lib';
import { aws_glue as interfaces_glue } from 'aws-cdk-lib/interfaces';

declare const crawlerRef: interfaces_glue.ICrawlerRef;
const condition = glue.Condition.crawler(crawlerRef, glue.CrawlerState.RUNNING, /* all optional props */ {
  logicalOperator: glue.ConditionLogicalOperator.EQUALS,
});
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_glue as glue
from aws_cdk.interfaces import aws_glue as interfaces_glue

# crawler_ref: interfaces_glue.ICrawlerRef

condition = glue.Condition.crawler(crawler_ref, glue.CrawlerState.RUNNING,
    logical_operator=glue.ConditionLogicalOperator.EQUALS
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.glue.*;
import software.amazon.awscdk.interfaces.glue.*;

ICrawlerRef crawlerRef;

Condition condition = Condition.crawler(crawlerRef, CrawlerState.RUNNING, ConditionOptions.builder()
        .logicalOperator(ConditionLogicalOperator.EQUALS)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Glue;
using Amazon.CDK.Interfaces.Glue;

ICrawlerRef crawlerRef;

var condition = Condition.Crawler(crawlerRef, CrawlerState.RUNNING, new ConditionOptions {
    LogicalOperator = ConditionLogicalOperator.EQUALS
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var crawlerRef ICrawlerRef

condition := awscdk.Aws_glue.Condition_Crawler(crawlerRef, awscdk.Aws_glue.CrawlerState_RUNNING, &ConditionOptions{
	LogicalOperator: awscdk.*Aws_glue.ConditionLogicalOperator_EQUALS,
})

Initializer ​

ts
new Condition()
python
Condition()
java
new Condition()
csharp
new Condition()
go
NewCondition()

Methods ​

crawler(crawler: ICrawlerRef, crawlState: CrawlerState, options?: ConditionOptions): Condition // chainable@staticmethod def crawler(crawler: ICrawlerRef, crawl_state: CrawlerState, options: typing.Optional[ConditionOptions] = None) -> Conditionpublic static Condition crawler(ICrawlerRef crawler, CrawlerState crawlState, ConditionOptions options)public static Condition Crawler(ICrawlerRef crawler, CrawlerState crawlState, ConditionOptions? options = null)func Crawler(Crawler ICrawlerRef, CrawlState CrawlerState, Options ConditionOptions) Conditionstatic#
Create a condition on the state of a crawler.
3 parameters

Parameters

  • crawlercrawlercrawlercrawlerCrawler — the crawler to watch.
  • crawlStatecrawl_statecrawlStatecrawlStateCrawlState — the crawler state that satisfies the condition.
  • optionsoptionsoptionsoptionsOptions — additional options for the condition.
job(job: IJobRef, state: JobState, options?: ConditionOptions): Condition // chainable@staticmethod def job(job: IJobRef, state: JobState, options: typing.Optional[ConditionOptions] = None) -> Conditionpublic static Condition job(IJobRef job, JobState state, ConditionOptions options)public static Condition Job(IJobRef job, JobState state, ConditionOptions? options = null)func Job(Job IJobRef, State JobState, Options ConditionOptions) Conditionstatic#
Create a condition on the state of a job.
3 parameters

Parameters

  • jobjobjobjobJob — the job to watch.
  • statestatestatestateState — the job state that satisfies the condition.
  • optionsoptionsoptionsoptionsOptions — additional options for the condition.