class Workflow (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Glue.Alpha.Workflow |
![]() | github.com/aws/aws-cdk-go/awscdkgluealpha/v2#Workflow |
![]() | software.amazon.awscdk.services.glue.alpha.Workflow |
![]() | aws_cdk.aws_glue_alpha.Workflow |
![]() | @aws-cdk/aws-glue-alpha ยป Workflow |
Implements
IConstruct
, IDependable
, IResource
, IWorkflow
This module defines a construct for creating and managing AWS Glue Workflows and Triggers.
AWS Glue Workflows are orchestration services that allow you to create, manage, and monitor complex extract, transform, and load (ETL) activities involving multiple crawlers, jobs, and triggers. Workflows are designed to allow you to manage interdependent jobs and crawlers as a single unit, making it easier to orchestrate and monitor complex ETL pipelines.
Triggers are used to initiate an AWS Glue Workflow. You can configure different types of triggers, such as on-demand, scheduled, event-based, or conditional triggers, to start your Workflow based on specific conditions or events.
See also: [https://docs.aws.amazon.com/glue/latest/dg/about-triggers.html
Usage Example
const app = new App();
const stack = new Stack(app, 'TestStack');
// Create a Glue Job
declare const role: iam.IRole;
declare const script: glue.Code;
const job = new glue.PySparkStreamingJob(stack, 'ImportedJob', { role, script });
// Create a Glue Workflow
const workflow = new glue.Workflow(stack, 'TestWorkflow');
// Add an on-demand trigger to the Workflow
workflow.addOnDemandTrigger('OnDemandTrigger', {
actions: [{ job: job }],
});
```](https://docs.aws.amazon.com/glue/latest/dg/about-triggers.html
## Usage Example
```ts
const app = new App();
const stack = new Stack(app, 'TestStack');
// Create a Glue Job
declare const role: iam.IRole;
declare const script: glue.Code;
const job = new glue.PySparkStreamingJob(stack, 'ImportedJob', { role, script });
// Create a Glue Workflow
const workflow = new glue.Workflow(stack, 'TestWorkflow');
// Add an on-demand trigger to the Workflow
workflow.addOnDemandTrigger('OnDemandTrigger', {
actions: [{ job: job }],
});
```)
## Example
```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as glue_alpha from '@aws-cdk/aws-glue-alpha';
const workflow = new glue_alpha.Workflow(this, 'MyWorkflow', /* all optional props */ {
defaultRunProperties: {
defaultRunPropertiesKey: 'defaultRunProperties',
},
description: 'description',
maxConcurrentRuns: 123,
workflowName: 'workflowName',
});
Initializer
new Workflow(scope: Construct, id: string, props?: WorkflowProps)
Parameters
- scope
Construct
- id
string
- props
Workflow
Props
Construct Props
Name | Type | Description |
---|---|---|
default | { [string]: string } | A map of properties to use when this workflow is executed. |
description? | string | A description of the workflow. |
max | number | The maximum number of concurrent runs allowed for the workflow. |
workflow | string | Name of the workflow. |
defaultRunProperties?
Type:
{ [string]: string }
(optional, default: no default run properties)
A map of properties to use when this workflow is executed.
description?
Type:
string
(optional, default: no description)
A description of the workflow.
maxConcurrentRuns?
Type:
number
(optional, default: no limit)
The maximum number of concurrent runs allowed for the workflow.
workflowName?
Type:
string
(optional, default: a name will be generated)
Name of the workflow.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
workflow | string | The ARN of the workflow. |
workflow | string | The name of the workflow. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
workflowArn
Type:
string
The ARN of the workflow.
workflowName
Type:
string
The name of the workflow.
Methods
Name | Description |
---|---|
add | Add a custom-scheduled trigger to the workflow. |
add | Add a daily-scheduled trigger to the workflow. |
add | Add an Event Bridge based trigger to the workflow. |
add | Add an on-demand trigger to the workflow. |
add | Add a weekly-scheduled trigger to the workflow. |
addconditional | Add a Condition (Predicate) based trigger to the workflow. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import an workflow from it's name. |
static from | Import an existing workflow. |
static from | Import a workflow from its name. |
addCustomScheduledTrigger(id, options)
public addCustomScheduledTrigger(id: string, options: CustomScheduledTriggerOptions): CfnTrigger
Parameters
- id
string
โ The id of the trigger. - options
Custom
โ Additional options for the trigger.Scheduled Trigger Options
Returns
Add a custom-scheduled trigger to the workflow.
addDailyScheduledTrigger(id, options)
public addDailyScheduledTrigger(id: string, options: DailyScheduleTriggerOptions): CfnTrigger
Parameters
- id
string
โ The id of the trigger. - options
Daily
โ Additional options for the trigger.Schedule Trigger Options
Returns
Add a daily-scheduled trigger to the workflow.
addNotifyEventTrigger(id, options)
public addNotifyEventTrigger(id: string, options: NotifyEventTriggerOptions): CfnTrigger
Parameters
- id
string
โ The id of the trigger. - options
Notify
โ Additional options for the trigger.Event Trigger Options
Returns
Add an Event Bridge based trigger to the workflow.
addOnDemandTrigger(id, options)
public addOnDemandTrigger(id: string, options: OnDemandTriggerOptions): CfnTrigger
Parameters
- id
string
โ The id of the trigger. - options
On
โ Additional options for the trigger.Demand Trigger Options
Returns
Add an on-demand trigger to the workflow.
addWeeklyScheduledTrigger(id, options)
public addWeeklyScheduledTrigger(id: string, options: WeeklyScheduleTriggerOptions): CfnTrigger
Parameters
- id
string
โ The id of the trigger. - options
Weekly
โ Additional options for the trigger.Schedule Trigger Options
Returns
Add a weekly-scheduled trigger to the workflow.
addconditionalTrigger(id, options)
public addconditionalTrigger(id: string, options: ConditionalTriggerOptions): CfnTrigger
Parameters
- id
string
โ The id of the trigger. - options
Conditional
โ Additional options for the trigger.Trigger Options
Returns
Add a Condition (Predicate) based trigger to the workflow.
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromWorkflowArn(scope, id, workflowArn)
public static fromWorkflowArn(scope: Construct, id: string, workflowArn: string): IWorkflow
Parameters
- scope
Construct
- id
string
- workflowArn
string
Returns
Import an workflow from it's name.
static fromWorkflowAttributes(scope, id, attrs)
public static fromWorkflowAttributes(scope: Construct, id: string, attrs: WorkflowAttributes): IWorkflow
Parameters
- scope
Construct
- id
string
- attrs
Workflow
Attributes
Returns
Import an existing workflow.
static fromWorkflowName(scope, id, workflowName)
public static fromWorkflowName(scope: Construct, id: string, workflowName: string): IWorkflow
Parameters
- scope
Construct
- id
string
- workflowName
string
Returns
Import a workflow from its name.