# Condition

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.

- Source: [`aws-glue/lib/triggers/trigger-options.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-glue/lib/triggers/trigger-options.ts#L219)
- Type last changed: v2.270.0 · 17 Sep 2026

## 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,
});
```

## Initializer

```ts
new Condition()
```

## Methods

- `crawler(crawler: ICrawlerRef, crawlState: CrawlerState, options?: ConditionOptions): Condition // chainable` (static) — Create a condition on the state of a crawler.

  **Parameters**

  - `crawler` — the crawler to watch.
  - `crawlState` — the crawler state that satisfies the condition.
  - `options` — additional options for the condition.

- `job(job: IJobRef, state: JobState, options?: ConditionOptions): Condition // chainable` (static) — Create a condition on the state of a job.

  **Parameters**

  - `job` — the job to watch.
  - `state` — the job state that satisfies the condition.
  - `options` — additional options for the condition.
