awsstepfunctions

package
v1.168.0-devpreview Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 9 Imported by: 3

README

AWS Step Functions Construct Library

The @aws-cdk/aws-stepfunctions package contains constructs for building serverless workflows using objects. Use this in conjunction with the @aws-cdk/aws-stepfunctions-tasks package, which contains classes used to call other AWS services.

Defining a workflow looks like this (for the Step Functions Job Poller example):

Example

import lambda "github.com/aws/aws-cdk-go/awscdk"

var submitLambda function
var getStatusLambda function


submitJob := tasks.NewLambdaInvoke(this, jsii.String("Submit Job"), &lambdaInvokeProps{
	lambdaFunction: submitLambda,
	// Lambda's result is in the attribute `Payload`
	outputPath: jsii.String("$.Payload"),
})

waitX := sfn.NewWait(this, jsii.String("Wait X Seconds"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

getStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Pass just the field named "guid" into the Lambda, put the
	// Lambda's result in a field called "status" in the response
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

jobFailed := sfn.NewFail(this, jsii.String("Job Failed"), &failProps{
	cause: jsii.String("AWS Batch Job Failed"),
	error: jsii.String("DescribeJob returned FAILED"),
})

finalStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Final Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Use "guid" field as input
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

definition := submitJob.next(waitX).next(getStatus).next(sfn.NewChoice(this, jsii.String("Job Complete?")).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("FAILED")), jobFailed).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCEEDED")), finalStatus).otherwise(waitX))

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
	timeout: awscdk.Duration.minutes(jsii.Number(5)),
})

You can find more sample snippets and learn more about the service integrations in the @aws-cdk/aws-stepfunctions-tasks package.

State Machine

A stepfunctions.StateMachine is a resource that takes a state machine definition. The definition is specified by its start state, and encompasses all states reachable from the start state:

startState := sfn.NewPass(this, jsii.String("StartState"))

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: startState,
})

State machines execute using an IAM Role, which will automatically have all permissions added that are required to make all state machine tasks execute properly (for example, permissions to invoke any Lambda functions you add to your workflow). A role will be created by default, but you can supply an existing one as well.

Accessing State (the JsonPath class)

Every State Machine execution has State Machine Data: a JSON document containing keys and values that is fed into the state machine, gets modified as the state machine progresses, and finally is produced as output.

You can pass fragments of this State Machine Data into Tasks of the state machine. To do so, use the static methods on the JsonPath class. For example, to pass the value that's in the data key of OrderId to a Lambda function as you invoke it, use JsonPath.stringAt('$.OrderId'), like so:

import lambda "github.com/aws/aws-cdk-go/awscdk"

var orderFn function


submitJob := tasks.NewLambdaInvoke(this, jsii.String("InvokeOrderProcessor"), &lambdaInvokeProps{
	lambdaFunction: orderFn,
	payload: sfn.taskInput.fromObject(map[string]interface{}{
		"OrderId": sfn.JsonPath.stringAt(jsii.String("$.OrderId")),
	}),
})

The following methods are available:

Method Purpose
JsonPath.stringAt('$.Field') reference a field, return the type as a string.
JsonPath.listAt('$.Field') reference a field, return the type as a list of strings.
JsonPath.numberAt('$.Field') reference a field, return the type as a number. Use this for functions that expect a number argument.
JsonPath.objectAt('$.Field') reference a field, return the type as an IResolvable. Use this for functions that expect an object argument.
JsonPath.entirePayload reference the entire data object (equivalent to a path of $).
JsonPath.taskToken reference the Task Token, used for integration patterns that need to run for a long time.

You can also call intrinsic functions using the methods on JsonPath:

Method Purpose
JsonPath.array(JsonPath.stringAt('$.Field'), ...) make an array from other elements.
JsonPath.format('The value is {}.', JsonPath.stringAt('$.Value')) insert elements into a format string.
JsonPath.stringToJson(JsonPath.stringAt('$.ObjStr')) parse a JSON string to an object
JsonPath.jsonToString(JsonPath.objectAt('$.Obj')) stringify an object to a JSON string

Amazon States Language

This library comes with a set of classes that model the Amazon States Language. The following State classes are supported:

An arbitrary JSON object (specified at execution start) is passed from state to state and transformed during the execution of the workflow. For more information, see the States Language spec.

Task

A Task represents some work that needs to be done. The exact work to be done is determine by a class that implements IStepFunctionsTask, a collection of which can be found in the @aws-cdk/aws-stepfunctions-tasks module.

The tasks in the @aws-cdk/aws-stepfunctions-tasks module support the service integration pattern that integrates Step Functions with services directly in the Amazon States language.

Pass

A Pass state passes its input to its output, without performing work. Pass states are useful when constructing and debugging state machines.

The following example injects some fixed data into the state machine through the result field. The result field will be added to the input and the result will be passed as the state's output.

// Makes the current JSON state { ..., "subObject": { "hello": "world" } }
pass := sfn.NewPass(this, jsii.String("Add Hello World"), &passProps{
	result: sfn.result.fromObject(map[string]interface{}{
		"hello": jsii.String("world"),
	}),
	resultPath: jsii.String("$.subObject"),
})

// Set the next state
nextState := sfn.NewPass(this, jsii.String("NextState"))
pass.next(nextState)

The Pass state also supports passing key-value pairs as input. Values can be static, or selected from the input with a path.

The following example filters the greeting field from the state input and also injects a field called otherData.

pass := sfn.NewPass(this, jsii.String("Filter input and inject data"), &passProps{
	parameters: map[string]interface{}{
		 // input to the pass state
		"input": sfn.JsonPath.stringAt(jsii.String("$.input.greeting")),
		"otherData": jsii.String("some-extra-stuff"),
	},
})

The object specified in parameters will be the input of the Pass state. Since neither Result nor ResultPath are supplied, the Pass state copies its input through to its output.

Learn more about the Pass state

Wait

A Wait state waits for a given number of seconds, or until the current time hits a particular time. The time to wait may be taken from the execution's JSON state.

// Wait until it's the time mentioned in the the state object's "triggerTime"
// field.
wait := sfn.NewWait(this, jsii.String("Wait For Trigger Time"), &waitProps{
	time: sfn.waitTime.timestampPath(jsii.String("$.triggerTime")),
})

// Set the next state
startTheWork := sfn.NewPass(this, jsii.String("StartTheWork"))
wait.next(startTheWork)
Choice

A Choice state can take a different path through the workflow based on the values in the execution's JSON state:

choice := sfn.NewChoice(this, jsii.String("Did it work?"))

// Add conditions with .when()
successState := sfn.NewPass(this, jsii.String("SuccessState"))
failureState := sfn.NewPass(this, jsii.String("FailureState"))
choice.when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCESS")), successState)
choice.when(sfn.condition.numberGreaterThan(jsii.String("$.attempts"), jsii.Number(5)), failureState)

// Use .otherwise() to indicate what should be done if none of the conditions match
tryAgainState := sfn.NewPass(this, jsii.String("TryAgainState"))
choice.otherwise(tryAgainState)

If you want to temporarily branch your workflow based on a condition, but have all branches come together and continuing as one (similar to how an if ... then ... else works in a programming language), use the .afterwards() method:

choice := sfn.NewChoice(this, jsii.String("What color is it?"))
handleBlueItem := sfn.NewPass(this, jsii.String("HandleBlueItem"))
handleRedItem := sfn.NewPass(this, jsii.String("HandleRedItem"))
handleOtherItemColor := sfn.NewPass(this, jsii.String("HanldeOtherItemColor"))
choice.when(sfn.condition.stringEquals(jsii.String("$.color"), jsii.String("BLUE")), handleBlueItem)
choice.when(sfn.condition.stringEquals(jsii.String("$.color"), jsii.String("RED")), handleRedItem)
choice.otherwise(handleOtherItemColor)

// Use .afterwards() to join all possible paths back together and continue
shipTheItem := sfn.NewPass(this, jsii.String("ShipTheItem"))
choice.afterwards().next(shipTheItem)

If your Choice doesn't have an otherwise() and none of the conditions match the JSON state, a NoChoiceMatched error will be thrown. Wrap the state machine in a Parallel state if you want to catch and recover from this.

Available Conditions

see step function comparison operators

  • Condition.isPresent - matches if a json path is present
  • Condition.isNotPresent - matches if a json path is not present
  • Condition.isString - matches if a json path contains a string
  • Condition.isNotString - matches if a json path is not a string
  • Condition.isNumeric - matches if a json path is numeric
  • Condition.isNotNumeric - matches if a json path is not numeric
  • Condition.isBoolean - matches if a json path is boolean
  • Condition.isNotBoolean - matches if a json path is not boolean
  • Condition.isTimestamp - matches if a json path is a timestamp
  • Condition.isNotTimestamp - matches if a json path is not a timestamp
  • Condition.isNotNull - matches if a json path is not null
  • Condition.isNull - matches if a json path is null
  • Condition.booleanEquals - matches if a boolean field has a given value
  • Condition.booleanEqualsJsonPath - matches if a boolean field equals a value in a given mapping path
  • Condition.stringEqualsJsonPath - matches if a string field equals a given mapping path
  • Condition.stringEquals - matches if a field equals a string value
  • Condition.stringLessThan - matches if a string field sorts before a given value
  • Condition.stringLessThanJsonPath - matches if a string field sorts before a value at given mapping path
  • Condition.stringLessThanEquals - matches if a string field sorts equal to or before a given value
  • Condition.stringLessThanEqualsJsonPath - matches if a string field sorts equal to or before a given mapping
  • Condition.stringGreaterThan - matches if a string field sorts after a given value
  • Condition.stringGreaterThanJsonPath - matches if a string field sorts after a value at a given mapping path
  • Condition.stringGreaterThanEqualsJsonPath - matches if a string field sorts after or equal to value at a given mapping path
  • Condition.stringGreaterThanEquals - matches if a string field sorts after or equal to a given value
  • Condition.numberEquals - matches if a numeric field has the given value
  • Condition.numberEqualsJsonPath - matches if a numeric field has the value in a given mapping path
  • Condition.numberLessThan - matches if a numeric field is less than the given value
  • Condition.numberLessThanJsonPath - matches if a numeric field is less than the value at the given mapping path
  • Condition.numberLessThanEquals - matches if a numeric field is less than or equal to the given value
  • Condition.numberLessThanEqualsJsonPath - matches if a numeric field is less than or equal to the numeric value at given mapping path
  • Condition.numberGreaterThan - matches if a numeric field is greater than the given value
  • Condition.numberGreaterThanJsonPath - matches if a numeric field is greater than the value at a given mapping path
  • Condition.numberGreaterThanEquals - matches if a numeric field is greater than or equal to the given value
  • Condition.numberGreaterThanEqualsJsonPath - matches if a numeric field is greater than or equal to the value at a given mapping path
  • Condition.timestampEquals - matches if a timestamp field is the same time as the given timestamp
  • Condition.timestampEqualsJsonPath - matches if a timestamp field is the same time as the timestamp at a given mapping path
  • Condition.timestampLessThan - matches if a timestamp field is before the given timestamp
  • Condition.timestampLessThanJsonPath - matches if a timestamp field is before the timestamp at a given mapping path
  • Condition.timestampLessThanEquals - matches if a timestamp field is before or equal to the given timestamp
  • Condition.timestampLessThanEqualsJsonPath - matches if a timestamp field is before or equal to the timestamp at a given mapping path
  • Condition.timestampGreaterThan - matches if a timestamp field is after the timestamp at a given mapping path
  • Condition.timestampGreaterThanJsonPath - matches if a timestamp field is after the timestamp at a given mapping path
  • Condition.timestampGreaterThanEquals - matches if a timestamp field is after or equal to the given timestamp
  • Condition.timestampGreaterThanEqualsJsonPath - matches if a timestamp field is after or equal to the timestamp at a given mapping path
  • Condition.stringMatches - matches if a field matches a string pattern that can contain a wild card () e.g: log-.txt or LATEST. No other characters other than "" have any special meaning - * can be escaped: \
Parallel

A Parallel state executes one or more subworkflows in parallel. It can also be used to catch and recover from errors in subworkflows.

parallel := sfn.NewParallel(this, jsii.String("Do the work in parallel"))

// Add branches to be executed in parallel
shipItem := sfn.NewPass(this, jsii.String("ShipItem"))
sendInvoice := sfn.NewPass(this, jsii.String("SendInvoice"))
restock := sfn.NewPass(this, jsii.String("Restock"))
parallel.branch(shipItem)
parallel.branch(sendInvoice)
parallel.branch(restock)

// Retry the whole workflow if something goes wrong
parallel.addRetry(&retryProps{
	maxAttempts: jsii.Number(1),
})

// How to recover from errors
sendFailureNotification := sfn.NewPass(this, jsii.String("SendFailureNotification"))
parallel.addCatch(sendFailureNotification)

// What to do in case everything succeeded
closeOrder := sfn.NewPass(this, jsii.String("CloseOrder"))
parallel.next(closeOrder)
Succeed

Reaching a Succeed state terminates the state machine execution with a successful status.

success := sfn.NewSucceed(this, jsii.String("We did it!"))
Fail

Reaching a Fail state terminates the state machine execution with a failure status. The fail state should report the reason for the failure. Failures can be caught by encompassing Parallel states.

success := sfn.NewFail(this, jsii.String("Fail"), &failProps{
	error: jsii.String("WorkflowFailure"),
	cause: jsii.String("Something went wrong"),
})
Map

A Map state can be used to run a set of steps for each element of an input array. A Map state will execute the same steps for multiple entries of an array in the state input.

While the Parallel state executes multiple branches of steps using the same input, a Map state will execute the same steps for multiple entries of an array in the state input.

map := sfn.NewMap(this, jsii.String("Map State"), &mapProps{
	maxConcurrency: jsii.Number(1),
	itemsPath: sfn.jsonPath.stringAt(jsii.String("$.inputForMap")),
})
map.iterator(sfn.NewPass(this, jsii.String("Pass State")))
Custom State

It's possible that the high-level constructs for the states or stepfunctions-tasks do not have the states or service integrations you are looking for. The primary reasons for this lack of functionality are:

  • A service integration is available through Amazon States Langauge, but not available as construct classes in the CDK.
  • The state or state properties are available through Step Functions, but are not configurable through constructs

If a feature is not available, a CustomState can be used to supply any Amazon States Language JSON-based object as the state definition.

Code Snippets are available and can be plugged in as the state definition.

Custom states can be chained together with any of the other states to create your state machine definition. You will also need to provide any permissions that are required to the role that the State Machine uses.

The following example uses the DynamoDB service integration to insert data into a DynamoDB table.

import dynamodb "github.com/aws/aws-cdk-go/awscdk"


// create a table
table := dynamodb.NewTable(this, jsii.String("montable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

finalStatus := sfn.NewPass(this, jsii.String("final step"))

// States language JSON to put an item into DynamoDB
// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
stateJson := map[string]interface{}{
	"Type": jsii.String("Task"),
	"Resource": jsii.String("arn:aws:states:::dynamodb:putItem"),
	"Parameters": map[string]interface{}{
		"TableName": table.tableName,
		"Item": map[string]map[string]*string{
			"id": map[string]*string{
				"S": jsii.String("MyEntry"),
			},
		},
	},
	"ResultPath": nil,
}

// custom state which represents a task to insert data into DynamoDB
custom := sfn.NewCustomState(this, jsii.String("my custom task"), &customStateProps{
	stateJson: stateJson,
})

chain := sfn.chain.start(custom).next(finalStatus)

sm := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: chain,
	timeout: awscdk.Duration.seconds(jsii.Number(30)),
})

// don't forget permissions. You need to assign them
table.grantWriteData(sm)

Task Chaining

To make defining work flows as convenient (and readable in a top-to-bottom way) as writing regular programs, it is possible to chain most methods invocations. In particular, the .next() method can be repeated. The result of a series of .next() calls is called a Chain, and can be used when defining the jump targets of Choice.on or Parallel.branch:

step1 := sfn.NewPass(this, jsii.String("Step1"))
step2 := sfn.NewPass(this, jsii.String("Step2"))
step3 := sfn.NewPass(this, jsii.String("Step3"))
step4 := sfn.NewPass(this, jsii.String("Step4"))
step5 := sfn.NewPass(this, jsii.String("Step5"))
step6 := sfn.NewPass(this, jsii.String("Step6"))
step7 := sfn.NewPass(this, jsii.String("Step7"))
step8 := sfn.NewPass(this, jsii.String("Step8"))
step9 := sfn.NewPass(this, jsii.String("Step9"))
step10 := sfn.NewPass(this, jsii.String("Step10"))
choice := sfn.NewChoice(this, jsii.String("Choice"))
condition1 := sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCESS"))
parallel := sfn.NewParallel(this, jsii.String("Parallel"))
finish := sfn.NewPass(this, jsii.String("Finish"))

definition := step1.next(step2).next(choice.when(condition1, step3.next(step4).next(step5)).otherwise(step6).afterwards()).next(parallel.branch(step7.next(step8)).branch(step9.next(step10))).next(finish)

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
})

If you don't like the visual look of starting a chain directly off the first step, you can use Chain.start:

step1 := sfn.NewPass(this, jsii.String("Step1"))
step2 := sfn.NewPass(this, jsii.String("Step2"))
step3 := sfn.NewPass(this, jsii.String("Step3"))

definition := sfn.chain.start(step1).next(step2).next(step3)

State Machine Fragments

It is possible to define reusable (or abstracted) mini-state machines by defining a construct that implements IChainable, which requires you to define two fields:

  • startState: State, representing the entry point into this state machine.
  • endStates: INextable[], representing the (one or more) states that outgoing transitions will be added to if you chain onto the fragment.

Since states will be named after their construct IDs, you may need to prefix the IDs of states if you plan to instantiate the same state machine fragment multiples times (otherwise all states in every instantiation would have the same name).

The class StateMachineFragment contains some helper functions (like prefixStates()) to make it easier for you to do this. If you define your state machine as a subclass of this, it will be convenient to use:

import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/constructs-go/constructs"
import sfn "github.com/aws/aws-cdk-go/awscdk"

type myJobProps struct {
	jobFlavor *string
}

type myJob struct {
	stateMachineFragment
	startState state
	endStates []iNextable
}

func newMyJob(parent construct, id *string, props myJobProps) *myJob {
	this := &myJob{}
	sfn.NewStateMachineFragment_Override(this, parent, id)

	choice := sfn.NewChoice(this, jsii.String("Choice")).when(sfn.condition.stringEquals(jsii.String("$.branch"), jsii.String("left")), sfn.NewPass(this, jsii.String("Left Branch"))).when(sfn.condition.stringEquals(jsii.String("$.branch"), jsii.String("right")), sfn.NewPass(this, jsii.String("Right Branch")))

	// ...

	this.startState = choice
	this.endStates = choice.afterwards().endStates
	return this
}

type myStack struct {
	stack
}

func newMyStack(scope construct, id *string) *myStack {
	this := &myStack{}
	newStack_Override(this, scope, id)
	// Do 3 different variants of MyJob in parallel
	parallel := sfn.NewParallel(this, jsii.String("All jobs")).branch(NewMyJob(this, jsii.String("Quick"), &myJobProps{
		jobFlavor: jsii.String("quick"),
	}).prefixStates()).branch(NewMyJob(this, jsii.String("Medium"), &myJobProps{
		jobFlavor: jsii.String("medium"),
	}).prefixStates()).branch(NewMyJob(this, jsii.String("Slow"), &myJobProps{
		jobFlavor: jsii.String("slow"),
	}).prefixStates())

	sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
		definition: parallel,
	})
	return this
}

A few utility functions are available to parse state machine fragments.

  • State.findReachableStates: Retrieve the list of states reachable from a given state.
  • State.findReachableEndStates: Retrieve the list of end or terminal states reachable from a given state.

Activity

Activities represent work that is done on some non-Lambda worker pool. The Step Functions workflow will submit work to this Activity, and a worker pool that you run yourself, probably on EC2, will pull jobs from the Activity and submit the results of individual jobs back.

You need the ARN to do so, so if you use Activities be sure to pass the Activity ARN into your worker pool:

activity := sfn.NewActivity(this, jsii.String("Activity"))

// Read this CloudFormation Output from your application and use it to poll for work on
// the activity.
// Read this CloudFormation Output from your application and use it to poll for work on
// the activity.
awscdk.NewCfnOutput(this, jsii.String("ActivityArn"), &cfnOutputProps{
	value: activity.activityArn,
})
Activity-Level Permissions

Granting IAM permissions to an activity can be achieved by calling the grant(principal, actions) API:

activity := sfn.NewActivity(this, jsii.String("Activity"))

role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})

activity.grant(role, jsii.String("states:SendTaskSuccess"))

This will grant the IAM principal the specified actions onto the activity.

Metrics

Task object expose various metrics on the execution of that particular task. For example, to create an alarm on a particular task failing:

var task task

cloudwatch.NewAlarm(this, jsii.String("TaskAlarm"), &alarmProps{
	metric: task.metricFailed(),
	threshold: jsii.Number(1),
	evaluationPeriods: jsii.Number(1),
})

There are also metrics on the complete state machine:

var stateMachine stateMachine

cloudwatch.NewAlarm(this, jsii.String("StateMachineAlarm"), &alarmProps{
	metric: stateMachine.metricFailed(),
	threshold: jsii.Number(1),
	evaluationPeriods: jsii.Number(1),
})

And there are metrics on the capacity of all state machines in your account:

cloudwatch.NewAlarm(this, jsii.String("ThrottledAlarm"), &alarmProps{
	metric: sfn.stateTransitionMetric.metricThrottledEvents(),
	threshold: jsii.Number(10),
	evaluationPeriods: jsii.Number(2),
})

Error names

Step Functions identifies errors in the Amazon States Language using case-sensitive strings, known as error names. The Amazon States Language defines a set of built-in strings that name well-known errors, all beginning with the States. prefix.

  • States.ALL - A wildcard that matches any known error name.

  • States.Runtime - An execution failed due to some exception that could not be processed. Often these are caused by errors at runtime, such as attempting to apply InputPath or OutputPath on a null JSON payload. A States.Runtime error is not retriable, and will always cause the execution to fail. A retry or catch on States.ALL will NOT catch States.Runtime errors.

  • States.DataLimitExceeded - A States.DataLimitExceeded exception will be thrown for the following:

    • When the output of a connector is larger than payload size quota.
    • When the output of a state is larger than payload size quota.
    • When, after Parameters processing, the input of a state is larger than the payload size quota.
    • See the AWS documentation to learn more about AWS Step Functions Quotas.
  • States.HeartbeatTimeout - A Task state failed to send a heartbeat for a period longer than the HeartbeatSeconds value.

  • States.Timeout - A Task state either ran longer than the TimeoutSeconds value, or failed to send a heartbeat for a period longer than the HeartbeatSeconds value.

  • States.TaskFailed- A Task state failed during the execution. When used in a retry or catch, States.TaskFailed acts as a wildcard that matches any known error name except for States.Timeout.

Logging

Enable logging to CloudWatch by passing a logging configuration with a destination LogGroup:

import logs "github.com/aws/aws-cdk-go/awscdk"


logGroup := logs.NewLogGroup(this, jsii.String("MyLogGroup"))

sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
	definition: sfn.chain.start(sfn.NewPass(this, jsii.String("Pass"))),
	logs: &logOptions{
		destination: logGroup,
		level: sfn.logLevel_ALL,
	},
})

X-Ray tracing

Enable X-Ray tracing for StateMachine:

sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
	definition: sfn.chain.start(sfn.NewPass(this, jsii.String("Pass"))),
	tracingEnabled: jsii.Boolean(true),
})

See the AWS documentation to learn more about AWS Step Functions's X-Ray support.

State Machine Permission Grants

IAM roles, users, or groups which need to be able to work with a State Machine should be granted IAM permissions.

Any object that implements the IGrantable interface (has an associated principal) can be granted permissions by calling:

  • stateMachine.grantStartExecution(principal) - grants the principal the ability to execute the state machine
  • stateMachine.grantRead(principal) - grants the principal read access
  • stateMachine.grantTaskResponse(principal) - grants the principal the ability to send task tokens to the state machine
  • stateMachine.grantExecution(principal, actions) - grants the principal execution-level permissions for the IAM actions specified
  • stateMachine.grant(principal, actions) - grants the principal state-machine-level permissions for the IAM actions specified
Start Execution Permission

Grant permission to start an execution of a state machine by calling the grantStartExecution() API.

var definition iChainable
role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})
stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
})

// Give role permission to start execution of state machine
stateMachine.grantStartExecution(role)

The following permission is provided to a service principal by the grantStartExecution() API:

  • states:StartExecution - to state machine
Read Permissions

Grant read access to a state machine by calling the grantRead() API.

var definition iChainable
role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})
stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
})

// Give role read access to state machine
stateMachine.grantRead(role)

The following read permissions are provided to a service principal by the grantRead() API:

  • states:ListExecutions - to state machine
  • states:ListStateMachines - to state machine
  • states:DescribeExecution - to executions
  • states:DescribeStateMachineForExecution - to executions
  • states:GetExecutionHistory - to executions
  • states:ListActivities - to *
  • states:DescribeStateMachine - to *
  • states:DescribeActivity - to *
Task Response Permissions

Grant permission to allow task responses to a state machine by calling the grantTaskResponse() API:

var definition iChainable
role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})
stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
})

// Give role task response permissions to the state machine
stateMachine.grantTaskResponse(role)

The following read permissions are provided to a service principal by the grantRead() API:

  • states:SendTaskSuccess - to state machine
  • states:SendTaskFailure - to state machine
  • states:SendTaskHeartbeat - to state machine
Execution-level Permissions

Grant execution-level permissions to a state machine by calling the grantExecution() API:

var definition iChainable
role := iam.NewRole(this, jsii.String("Role"), &roleProps{
	assumedBy: iam.NewServicePrincipal(jsii.String("lambda.amazonaws.com")),
})
stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
})

// Give role permission to get execution history of ALL executions for the state machine
stateMachine.grantExecution(role, jsii.String("states:GetExecutionHistory"))
Custom Permissions

You can add any set of permissions to a state machine by calling the grant() API.

var definition iChainable
user := iam.NewUser(this, jsii.String("MyUser"))
stateMachine := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
})

//give user permission to send task success to the state machine
stateMachine.grant(user, jsii.String("states:SendTaskSuccess"))

Import

Any Step Functions state machine that has been created outside the stack can be imported into your CDK stack.

State machines can be imported by their ARN via the StateMachine.fromStateMachineArn() API

app := awscdk.NewApp()
stack := awscdk.Newstack(app, jsii.String("MyStack"))
sfn.stateMachine.fromStateMachineArn(stack, jsii.String("ImportedStateMachine"), jsii.String("arn:aws:states:us-east-1:123456789012:stateMachine:StateMachine2E01A3A5-N5TJppzoevKQ"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activity_IsConstruct

func Activity_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Activity_IsResource

func Activity_IsResource(construct awscdk.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func CfnActivity_CFN_RESOURCE_TYPE_NAME

func CfnActivity_CFN_RESOURCE_TYPE_NAME() *string

func CfnActivity_IsCfnElement

func CfnActivity_IsCfnElement(x interface{}) *bool

Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.

Returns: The construct as a stack element or undefined if it is not a stack element. Experimental.

func CfnActivity_IsCfnResource

func CfnActivity_IsCfnResource(construct constructs.IConstruct) *bool

Check whether the given construct is a CfnResource. Experimental.

func CfnActivity_IsConstruct

func CfnActivity_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func CfnStateMachine_CFN_RESOURCE_TYPE_NAME

func CfnStateMachine_CFN_RESOURCE_TYPE_NAME() *string

func CfnStateMachine_IsCfnElement

func CfnStateMachine_IsCfnElement(x interface{}) *bool

Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.

Returns: The construct as a stack element or undefined if it is not a stack element. Experimental.

func CfnStateMachine_IsCfnResource

func CfnStateMachine_IsCfnResource(construct constructs.IConstruct) *bool

Check whether the given construct is a CfnResource. Experimental.

func CfnStateMachine_IsConstruct

func CfnStateMachine_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Choice_FilterNextables

func Choice_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Choice_FindReachableEndStates

func Choice_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Choice_FindReachableStates

func Choice_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Choice_IsConstruct

func Choice_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Choice_PrefixStates

func Choice_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func Context_EntireContext

func Context_EntireContext() *string

func Context_NumberAt

func Context_NumberAt(path *string) *float64

Instead of using a literal number, get the value from a JSON path. Deprecated: replaced by `JsonPath`.

func Context_StringAt

func Context_StringAt(path *string) *string

Instead of using a literal string, get the value from a JSON path. Deprecated: replaced by `JsonPath`.

func Context_TaskToken

func Context_TaskToken() *string

func CustomState_FilterNextables

func CustomState_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func CustomState_FindReachableEndStates

func CustomState_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func CustomState_FindReachableStates

func CustomState_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func CustomState_IsConstruct

func CustomState_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func CustomState_PrefixStates

func CustomState_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func Data_EntirePayload

func Data_EntirePayload() *string

func Data_IsJsonPathString

func Data_IsJsonPathString(value *string) *bool

Determines if the indicated string is an encoded JSON path. Deprecated: replaced by `JsonPath`.

func Data_ListAt

func Data_ListAt(path *string) *[]*string

Instead of using a literal string list, get the value from a JSON path. Deprecated: replaced by `JsonPath`.

func Data_NumberAt

func Data_NumberAt(path *string) *float64

Instead of using a literal number, get the value from a JSON path. Deprecated: replaced by `JsonPath`.

func Data_StringAt

func Data_StringAt(path *string) *string

Instead of using a literal string, get the value from a JSON path. Deprecated: replaced by `JsonPath`.

func Errors_ALL

func Errors_ALL() *string

func Errors_BRANCH_FAILED

func Errors_BRANCH_FAILED() *string

func Errors_HEARTBEAT_TIMEOUT

func Errors_HEARTBEAT_TIMEOUT() *string

func Errors_NO_CHOICE_MATCHED

func Errors_NO_CHOICE_MATCHED() *string

func Errors_PARAMETER_PATH_FAILURE

func Errors_PARAMETER_PATH_FAILURE() *string

func Errors_PERMISSIONS

func Errors_PERMISSIONS() *string

func Errors_RESULT_PATH_MATCH_FAILURE

func Errors_RESULT_PATH_MATCH_FAILURE() *string

func Errors_TASKS_FAILED

func Errors_TASKS_FAILED() *string

func Errors_TIMEOUT

func Errors_TIMEOUT() *string

func Fail_FilterNextables

func Fail_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Fail_FindReachableEndStates

func Fail_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Fail_FindReachableStates

func Fail_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Fail_IsConstruct

func Fail_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Fail_PrefixStates

func Fail_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func FieldUtils_ContainsTaskToken

func FieldUtils_ContainsTaskToken(obj *map[string]interface{}) *bool

Returns whether the given task structure contains the TaskToken field anywhere.

The field is considered included if the field itself or one of its containing fields occurs anywhere in the payload. Experimental.

func FieldUtils_FindReferencedPaths

func FieldUtils_FindReferencedPaths(obj *map[string]interface{}) *[]*string

Return all JSON paths used in the given structure. Experimental.

func FieldUtils_RenderObject

func FieldUtils_RenderObject(obj *map[string]interface{}) *map[string]interface{}

Render a JSON structure containing fields to the right StepFunctions structure. Experimental.

func JsonPath_Array

func JsonPath_Array(values ...*string) *string

Make an intrinsic States.Array expression.

Combine any number of string literals or JsonPath expressions into an array.

Use this function if the value of an array element directly has to come from a JSON Path expression (either the State object or the Context object).

If the array contains object literals whose values come from a JSON path expression, you do not need to use this function. See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html

Experimental.

func JsonPath_DISCARD

func JsonPath_DISCARD() *string

func JsonPath_EntireContext

func JsonPath_EntireContext() *string

func JsonPath_EntirePayload

func JsonPath_EntirePayload() *string

func JsonPath_Format

func JsonPath_Format(formatString *string, values ...*string) *string

Make an intrinsic States.Format expression.

This can be used to embed JSON Path variables inside a format string.

For example:

```ts sfn.JsonPath.format('Hello, my name is {}.', sfn.JsonPath.stringAt('$.name')) ```. See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html

Experimental.

func JsonPath_IsEncodedJsonPath

func JsonPath_IsEncodedJsonPath(value *string) *bool

Determines if the indicated string is an encoded JSON path. Experimental.

func JsonPath_JsonToString

func JsonPath_JsonToString(value interface{}) *string

Make an intrinsic States.JsonToString expression.

During the execution of the Step Functions state machine, encode the given object into a JSON string.

For example:

```ts sfn.JsonPath.jsonToString(sfn.JsonPath.objectAt('$.someObject')) ```. See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html

Experimental.

func JsonPath_ListAt

func JsonPath_ListAt(path *string) *[]*string

Instead of using a literal string list, get the value from a JSON path. Experimental.

func JsonPath_NumberAt

func JsonPath_NumberAt(path *string) *float64

Instead of using a literal number, get the value from a JSON path. Experimental.

func JsonPath_ObjectAt

func JsonPath_ObjectAt(path *string) awscdk.IResolvable

Reference a complete (complex) object in a JSON path location. Experimental.

func JsonPath_StringAt

func JsonPath_StringAt(path *string) *string

Instead of using a literal string, get the value from a JSON path. Experimental.

func JsonPath_StringToJson

func JsonPath_StringToJson(jsonString *string) awscdk.IResolvable

Make an intrinsic States.StringToJson expression.

During the execution of the Step Functions state machine, parse the given argument as JSON into its object form.

For example:

```ts sfn.JsonPath.stringToJson(sfn.JsonPath.stringAt('$.someJsonBody')) ```. See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-intrinsic-functions.html

Experimental.

func JsonPath_TaskToken

func JsonPath_TaskToken() *string

func Map_FilterNextables

func Map_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Map_FindReachableEndStates

func Map_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Map_FindReachableStates

func Map_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Map_IsConstruct

func Map_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Map_PrefixStates

func Map_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func NewActivity_Override

func NewActivity_Override(a Activity, scope constructs.Construct, id *string, props *ActivityProps)

Experimental.

func NewCfnActivity_Override

func NewCfnActivity_Override(c CfnActivity, scope awscdk.Construct, id *string, props *CfnActivityProps)

Create a new `AWS::StepFunctions::Activity`.

func NewCfnStateMachine_Override

func NewCfnStateMachine_Override(c CfnStateMachine, scope awscdk.Construct, id *string, props *CfnStateMachineProps)

Create a new `AWS::StepFunctions::StateMachine`.

func NewChoice_Override

func NewChoice_Override(c Choice, scope constructs.Construct, id *string, props *ChoiceProps)

Experimental.

func NewCondition_Override

func NewCondition_Override(c Condition)

Experimental.

func NewCustomState_Override

func NewCustomState_Override(c CustomState, scope constructs.Construct, id *string, props *CustomStateProps)

Experimental.

func NewErrors_Override

func NewErrors_Override(e Errors)

Experimental.

func NewFail_Override

func NewFail_Override(f Fail, scope constructs.Construct, id *string, props *FailProps)

Experimental.

func NewMap_Override

func NewMap_Override(m Map, scope constructs.Construct, id *string, props *MapProps)

Experimental.

func NewParallel_Override

func NewParallel_Override(p Parallel, scope constructs.Construct, id *string, props *ParallelProps)

Experimental.

func NewPass_Override

func NewPass_Override(p Pass, scope constructs.Construct, id *string, props *PassProps)

Experimental.

func NewResult_Override

func NewResult_Override(r Result, value interface{})

Experimental.

func NewStateGraph_Override

func NewStateGraph_Override(s StateGraph, startState State, graphDescription *string)

Experimental.

func NewStateMachineFragment_Override

func NewStateMachineFragment_Override(s StateMachineFragment, scope constructs.Construct, id *string)

Experimental.

func NewStateMachine_Override

func NewStateMachine_Override(s StateMachine, scope constructs.Construct, id *string, props *StateMachineProps)

Experimental.

func NewStateTransitionMetric_Override

func NewStateTransitionMetric_Override(s StateTransitionMetric)

Experimental.

func NewState_Override

func NewState_Override(s State, scope constructs.Construct, id *string, props *StateProps)

Experimental.

func NewSucceed_Override

func NewSucceed_Override(s Succeed, scope constructs.Construct, id *string, props *SucceedProps)

Experimental.

func NewTaskStateBase_Override

func NewTaskStateBase_Override(t TaskStateBase, scope constructs.Construct, id *string, props *TaskStateBaseProps)

Experimental.

func NewTask_Override deprecated

func NewTask_Override(t Task, scope constructs.Construct, id *string, props *TaskProps)

Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func NewWait_Override

func NewWait_Override(w Wait, scope constructs.Construct, id *string, props *WaitProps)

Experimental.

func Parallel_FilterNextables

func Parallel_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Parallel_FindReachableEndStates

func Parallel_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Parallel_FindReachableStates

func Parallel_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Parallel_IsConstruct

func Parallel_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Parallel_PrefixStates

func Parallel_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func Pass_FilterNextables

func Pass_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Pass_FindReachableEndStates

func Pass_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Pass_FindReachableStates

func Pass_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Pass_IsConstruct

func Pass_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Pass_PrefixStates

func Pass_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func StateMachineFragment_IsConstruct

func StateMachineFragment_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func StateMachine_IsConstruct

func StateMachine_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func StateMachine_IsResource

func StateMachine_IsResource(construct awscdk.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func StateTransitionMetric_Metric

func StateTransitionMetric_Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Return the given named metric for the service's state transition metrics. Experimental.

func StateTransitionMetric_MetricConsumedCapacity

func StateTransitionMetric_MetricConsumedCapacity(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for the number of available state transitions per second. Experimental.

func StateTransitionMetric_MetricProvisionedBucketSize

func StateTransitionMetric_MetricProvisionedBucketSize(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for the number of available state transitions. Experimental.

func StateTransitionMetric_MetricProvisionedRefillRate

func StateTransitionMetric_MetricProvisionedRefillRate(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for the provisioned steady-state execution rate. Experimental.

func StateTransitionMetric_MetricThrottledEvents

func StateTransitionMetric_MetricThrottledEvents(props *awscloudwatch.MetricOptions) awscloudwatch.Metric

Metric for the number of throttled state transitions. Experimental.

func State_FilterNextables

func State_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func State_FindReachableEndStates

func State_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func State_FindReachableStates

func State_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func State_IsConstruct

func State_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func State_PrefixStates

func State_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func Succeed_FilterNextables

func Succeed_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Succeed_FindReachableEndStates

func Succeed_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Succeed_FindReachableStates

func Succeed_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Succeed_IsConstruct

func Succeed_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Succeed_PrefixStates

func Succeed_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func TaskStateBase_FilterNextables

func TaskStateBase_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func TaskStateBase_FindReachableEndStates

func TaskStateBase_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func TaskStateBase_FindReachableStates

func TaskStateBase_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func TaskStateBase_IsConstruct

func TaskStateBase_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func TaskStateBase_PrefixStates

func TaskStateBase_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

func Task_FilterNextables

func Task_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func Task_FindReachableEndStates

func Task_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func Task_FindReachableStates

func Task_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func Task_IsConstruct

func Task_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func Task_PrefixStates

func Task_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func Wait_FilterNextables

func Wait_FilterNextables(states *[]State) *[]INextable

Return only the states that allow chaining from an array of states. Experimental.

func Wait_FindReachableEndStates

func Wait_FindReachableEndStates(start State, options *FindStateOptions) *[]State

Find the set of end states states reachable through transitions from the given start state. Experimental.

func Wait_FindReachableStates

func Wait_FindReachableStates(start State, options *FindStateOptions) *[]State

Find the set of states reachable through transitions from the given start state.

This does not retrieve states from within sub-graphs, such as states within a Parallel state's branch. Experimental.

func Wait_IsConstruct

func Wait_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Wait_PrefixStates

func Wait_PrefixStates(root constructs.IConstruct, prefix *string)

Add a prefix to the stateId of all States found in a construct tree. Experimental.

Types

type Activity

type Activity interface {
	awscdk.Resource
	IActivity
	// The ARN of the activity.
	// Experimental.
	ActivityArn() *string
	// The name of the activity.
	// Experimental.
	ActivityName() *string
	// 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.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Grant the given identity permissions on this Activity.
	// Experimental.
	Grant(identity awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Return the given named metric for this Activity.
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity fails.
	// Experimental.
	MetricFailed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times the heartbeat times out for this activity.
	// Experimental.
	MetricHeartbeatTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, between the time the activity starts and the time it closes.
	// Experimental.
	MetricRunTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity is scheduled.
	// Experimental.
	MetricScheduled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, for which the activity stays in the schedule state.
	// Experimental.
	MetricScheduleTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity is started.
	// Experimental.
	MetricStarted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity succeeds.
	// Experimental.
	MetricSucceeded(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, between the time the activity is scheduled and the time it closes.
	// Experimental.
	MetricTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity times out.
	// Experimental.
	MetricTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

Define a new Step Functions Activity.

Example:

activity := sfn.NewActivity(this, jsii.String("Activity"))

// Read this CloudFormation Output from your application and use it to poll for work on
// the activity.
// Read this CloudFormation Output from your application and use it to poll for work on
// the activity.
awscdk.NewCfnOutput(this, jsii.String("ActivityArn"), &cfnOutputProps{
	value: activity.activityArn,
})

Experimental.

func NewActivity

func NewActivity(scope constructs.Construct, id *string, props *ActivityProps) Activity

Experimental.

type ActivityProps

type ActivityProps struct {
	// The name for this activity.
	// Experimental.
	ActivityName *string `field:"optional" json:"activityName" yaml:"activityName"`
}

Properties for defining a new Step Functions Activity.

Example:

// 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"

activityProps := &activityProps{
	activityName: jsii.String("activityName"),
}

Experimental.

type AfterwardsOptions

type AfterwardsOptions struct {
	// Whether to include error handling states.
	//
	// If this is true, all states which are error handlers (added through 'onError')
	// and states reachable via error handlers will be included as well.
	// Experimental.
	IncludeErrorHandlers *bool `field:"optional" json:"includeErrorHandlers" yaml:"includeErrorHandlers"`
	// Whether to include the default/otherwise transition for the current Choice state.
	//
	// If this is true and the current Choice does not have a default outgoing
	// transition, one will be added included when .next() is called on the chain.
	// Experimental.
	IncludeOtherwise *bool `field:"optional" json:"includeOtherwise" yaml:"includeOtherwise"`
}

Options for selecting the choice paths.

Example:

// 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"

afterwardsOptions := &afterwardsOptions{
	includeErrorHandlers: jsii.Boolean(false),
	includeOtherwise: jsii.Boolean(false),
}

Experimental.

type CatchProps

type CatchProps struct {
	// Errors to recover from by going to the given state.
	//
	// A list of error strings to retry, which can be either predefined errors
	// (for example Errors.NoChoiceMatched) or a self-defined error.
	// Experimental.
	Errors *[]*string `field:"optional" json:"errors" yaml:"errors"`
	// JSONPath expression to indicate where to inject the error data.
	//
	// May also be the special value DISCARD, which will cause the error
	// data to be discarded.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
}

Error handler details.

Example:

// 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"

catchProps := &catchProps{
	errors: []*string{
		jsii.String("errors"),
	},
	resultPath: jsii.String("resultPath"),
}

Experimental.

type CfnActivity

type CfnActivity interface {
	awscdk.CfnResource
	awscdk.IInspectable
	AttrArn() *string
	// Returns the name of the activity. For example:.
	//
	// `{ "Fn::GetAtt": ["MyActivity", "Name"] }`
	//
	// Returns a value similar to the following:
	//
	// `myActivity`
	//
	// For more information about using `Fn::GetAtt` , see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) .
	AttrName() *string
	// Options for this resource, such as condition, update policy etc.
	// Experimental.
	CfnOptions() awscdk.ICfnResourceOptions
	CfnProperties() *map[string]interface{}
	// AWS resource type.
	// Experimental.
	CfnResourceType() *string
	// Returns: the stack trace of the point where this Resource was created from, sourced
	// from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most
	// node +internal+ entries filtered.
	// Experimental.
	CreationStack() *[]*string
	// The logical ID for this CloudFormation stack element.
	//
	// The logical ID of the element
	// is calculated from the path of the resource node in the construct tree.
	//
	// To override this value, use `overrideLogicalId(newLogicalId)`.
	//
	// Returns: the logical ID as a stringified token. This value will only get
	// resolved during synthesis.
	// Experimental.
	LogicalId() *string
	// The name of the activity.
	//
	// A name must *not* contain:
	//
	// - white space
	// - brackets `< > { } [ ]`
	// - wildcard characters `? *`
	// - special characters `" # % \ ^ | ~ ` $ & , ; : /`
	// - control characters ( `U+0000-001F` , `U+007F-009F` )
	//
	// To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.
	Name() *string
	SetName(val *string)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.
	//
	// If, by any chance, the intrinsic reference of a resource is not a string, you could
	// coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.
	// Experimental.
	Ref() *string
	// The stack in which this element is defined.
	//
	// CfnElements must be defined within a stack scope (directly or indirectly).
	// Experimental.
	Stack() awscdk.Stack
	// The list of tags to add to a resource.
	//
	// Tags may only contain Unicode letters, digits, white space, or these symbols: `_ . : / = + - @` .
	Tags() awscdk.TagManager
	// Return properties modified after initiation.
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	// Experimental.
	UpdatedProperites() *map[string]interface{}
	// Syntactic sugar for `addOverride(path, undefined)`.
	// Experimental.
	AddDeletionOverride(path *string)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	//
	// This can be used for resources across stacks (or nested stack) boundaries
	// and the dependency will automatically be transferred to the relevant scope.
	// Experimental.
	AddDependsOn(target awscdk.CfnResource)
	// Add a value to the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	// Experimental.
	AddMetadata(key *string, value interface{})
	// Adds an override to the synthesized CloudFormation resource.
	//
	// To add a
	// property override, either use `addPropertyOverride` or prefix `path` with
	// "Properties." (i.e. `Properties.TopicName`).
	//
	// If the override is nested, separate each nested level using a dot (.) in the path parameter.
	// If there is an array as part of the nesting, specify the index in the path.
	//
	// To include a literal `.` in the property name, prefix with a `\`. In most
	// programming languages you will need to write this as `"\\."` because the
	// `\` itself will need to be escaped.
	//
	// For example,
	// “`typescript
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
	// “`
	// would add the overrides
	// “`json
	// "Properties": {
	//    "GlobalSecondaryIndexes": [
	//      {
	//        "Projection": {
	//          "NonKeyAttributes": [ "myattribute" ]
	//          ...
	//        }
	//        ...
	//      },
	//      {
	//        "ProjectionType": "INCLUDE"
	//        ...
	//      },
	//    ]
	//    ...
	// }
	// “`
	//
	// The `value` argument to `addOverride` will not be processed or translated
	// in any way. Pass raw JSON values in here with the correct capitalization
	// for CloudFormation. If you pass CDK classes or structs, they will be
	// rendered with lowercased key names, and CloudFormation will reject the
	// template.
	// Experimental.
	AddOverride(path *string, value interface{})
	// Adds an override that deletes the value of a property from the resource definition.
	// Experimental.
	AddPropertyDeletionOverride(propertyPath *string)
	// Adds an override to a resource property.
	//
	// Syntactic sugar for `addOverride("Properties.<...>", value)`.
	// Experimental.
	AddPropertyOverride(propertyPath *string, value interface{})
	// Sets the deletion policy of the resource based on the removal policy specified.
	//
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions)
	// Returns a token for an runtime attribute of this resource.
	//
	// Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
	// in case there is no generated attribute.
	// Experimental.
	GetAtt(attributeName *string) awscdk.Reference
	// Retrieve a value value from the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	// Experimental.
	GetMetadata(key *string) interface{}
	// Examines the CloudFormation resource and discloses attributes.
	Inspect(inspector awscdk.TreeInspector)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Overrides the auto-generated logical ID with a specific ID.
	// Experimental.
	OverrideLogicalId(newLogicalId *string)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	RenderProperties(props *map[string]interface{}) *map[string]interface{}
	// Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.
	//
	// Returns: `true` if the resource should be included or `false` is the resource
	// should be omitted.
	// Experimental.
	ShouldSynthesize() *bool
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	//
	// Returns: a string representation of this resource.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Experimental.
	ValidateProperties(_properties interface{})
}

A CloudFormation `AWS::StepFunctions::Activity`.

An activity is a task that you write in any programming language and host on any machine that has access to AWS Step Functions . Activities must poll Step Functions using the `GetActivityTask` API action and respond using `SendTask*` API actions. This function lets Step Functions know the existence of your activity and returns an identifier for use in a state machine and when polling from the activity.

For information about creating an activity, see [Creating an Activity State Machine](https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-creating-activity-state-machine.html) in the *AWS Step Functions Developer Guide* and [CreateActivity](https://docs.aws.amazon.com/step-functions/latest/apireference/API_CreateActivity.html) in the *AWS Step Functions API Reference* .

Example:

// 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"

cfnActivity := awscdk.Aws_stepfunctions.NewCfnActivity(this, jsii.String("MyCfnActivity"), &cfnActivityProps{
	name: jsii.String("name"),

	// the properties below are optional
	tags: []tagsEntryProperty{
		&tagsEntryProperty{
			key: jsii.String("key"),
			value: jsii.String("value"),
		},
	},
})

func NewCfnActivity

func NewCfnActivity(scope awscdk.Construct, id *string, props *CfnActivityProps) CfnActivity

Create a new `AWS::StepFunctions::Activity`.

type CfnActivityProps

type CfnActivityProps struct {
	// The name of the activity.
	//
	// A name must *not* contain:
	//
	// - white space
	// - brackets `< > { } [ ]`
	// - wildcard characters `? *`
	// - special characters `" # % \ ^ | ~ ` $ & , ; : /`
	// - control characters ( `U+0000-001F` , `U+007F-009F` )
	//
	// To enable logging with CloudWatch Logs, the name should only contain 0-9, A-Z, a-z, - and _.
	Name *string `field:"required" json:"name" yaml:"name"`
	// The list of tags to add to a resource.
	//
	// Tags may only contain Unicode letters, digits, white space, or these symbols: `_ . : / = + - @` .
	Tags *[]*CfnActivity_TagsEntryProperty `field:"optional" json:"tags" yaml:"tags"`
}

Properties for defining a `CfnActivity`.

Example:

// 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"

cfnActivityProps := &cfnActivityProps{
	name: jsii.String("name"),

	// the properties below are optional
	tags: []tagsEntryProperty{
		&tagsEntryProperty{
			key: jsii.String("key"),
			value: jsii.String("value"),
		},
	},
}

type CfnActivity_TagsEntryProperty

type CfnActivity_TagsEntryProperty struct {
	// The `key` for a key-value pair in a tag entry.
	Key *string `field:"required" json:"key" yaml:"key"`
	// The `value` for a key-value pair in a tag entry.
	Value *string `field:"required" json:"value" yaml:"value"`
}

The `TagsEntry` property specifies *tags* to identify an activity.

Example:

// 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"

tagsEntryProperty := &tagsEntryProperty{
	key: jsii.String("key"),
	value: jsii.String("value"),
}

type CfnStateMachine

type CfnStateMachine interface {
	awscdk.CfnResource
	awscdk.IInspectable
	AttrArn() *string
	// Returns the name of the state machine. For example:.
	//
	// `{ "Fn::GetAtt": ["MyStateMachine", "Name"] }`
	//
	// Returns the name of your state machine:
	//
	// `HelloWorld-StateMachine`
	//
	// If you did not specify the name it will be similar to the following:
	//
	// `MyStateMachine-1234abcdefgh`
	//
	// For more information about using `Fn::GetAtt` , see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) .
	AttrName() *string
	// Options for this resource, such as condition, update policy etc.
	// Experimental.
	CfnOptions() awscdk.ICfnResourceOptions
	CfnProperties() *map[string]interface{}
	// AWS resource type.
	// Experimental.
	CfnResourceType() *string
	// Returns: the stack trace of the point where this Resource was created from, sourced
	// from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most
	// node +internal+ entries filtered.
	// Experimental.
	CreationStack() *[]*string
	// The Amazon States Language definition of the state machine.
	//
	// The state machine definition must be in JSON or YAML, and the format of the object must match the format of your AWS Step Functions template file. See [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) .
	Definition() interface{}
	SetDefinition(val interface{})
	// The name of the S3 bucket where the state machine definition is stored.
	//
	// The state machine definition must be a JSON or YAML file.
	DefinitionS3Location() interface{}
	SetDefinitionS3Location(val interface{})
	// The Amazon States Language definition of the state machine.
	//
	// The state machine definition must be in JSON. See [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) .
	DefinitionString() *string
	SetDefinitionString(val *string)
	// A map (string to string) that specifies the mappings for placeholder variables in the state machine definition.
	//
	// This enables the customer to inject values obtained at runtime, for example from intrinsic functions, in the state machine definition. Variables can be template parameter names, resource logical IDs, resource attributes, or a variable in a key-value map.
	DefinitionSubstitutions() interface{}
	SetDefinitionSubstitutions(val interface{})
	// Defines what execution history events are logged and where they are logged.
	//
	// > By default, the `level` is set to `OFF` . For more information see [Log Levels](https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html) in the AWS Step Functions User Guide.
	LoggingConfiguration() interface{}
	SetLoggingConfiguration(val interface{})
	// The logical ID for this CloudFormation stack element.
	//
	// The logical ID of the element
	// is calculated from the path of the resource node in the construct tree.
	//
	// To override this value, use `overrideLogicalId(newLogicalId)`.
	//
	// Returns: the logical ID as a stringified token. This value will only get
	// resolved during synthesis.
	// Experimental.
	LogicalId() *string
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.
	//
	// If, by any chance, the intrinsic reference of a resource is not a string, you could
	// coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.
	// Experimental.
	Ref() *string
	// The Amazon Resource Name (ARN) of the IAM role to use for this state machine.
	RoleArn() *string
	SetRoleArn(val *string)
	// The stack in which this element is defined.
	//
	// CfnElements must be defined within a stack scope (directly or indirectly).
	// Experimental.
	Stack() awscdk.Stack
	// The name of the state machine.
	//
	// A name must *not* contain:
	//
	// - white space
	// - brackets `< > { } [ ]`
	// - wildcard characters `? *`
	// - special characters `" # % \ ^ | ~ ` $ & , ; : /`
	// - control characters ( `U+0000-001F` , `U+007F-009F` )
	//
	// > If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
	StateMachineName() *string
	SetStateMachineName(val *string)
	// Determines whether a `STANDARD` or `EXPRESS` state machine is created.
	//
	// The default is `STANDARD` . You cannot update the `type` of a state machine once it has been created. For more information on `STANDARD` and `EXPRESS` workflows, see [Standard Versus Express Workflows](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html) in the AWS Step Functions Developer Guide.
	StateMachineType() *string
	SetStateMachineType(val *string)
	// The list of tags to add to a resource.
	//
	// Tags may only contain Unicode letters, digits, white space, or these symbols: `_ . : / = + - @` .
	Tags() awscdk.TagManager
	// Selects whether or not the state machine's AWS X-Ray tracing is enabled.
	TracingConfiguration() interface{}
	SetTracingConfiguration(val interface{})
	// Return properties modified after initiation.
	//
	// Resources that expose mutable properties should override this function to
	// collect and return the properties object for this resource.
	// Experimental.
	UpdatedProperites() *map[string]interface{}
	// Syntactic sugar for `addOverride(path, undefined)`.
	// Experimental.
	AddDeletionOverride(path *string)
	// Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
	//
	// This can be used for resources across stacks (or nested stack) boundaries
	// and the dependency will automatically be transferred to the relevant scope.
	// Experimental.
	AddDependsOn(target awscdk.CfnResource)
	// Add a value to the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	// Experimental.
	AddMetadata(key *string, value interface{})
	// Adds an override to the synthesized CloudFormation resource.
	//
	// To add a
	// property override, either use `addPropertyOverride` or prefix `path` with
	// "Properties." (i.e. `Properties.TopicName`).
	//
	// If the override is nested, separate each nested level using a dot (.) in the path parameter.
	// If there is an array as part of the nesting, specify the index in the path.
	//
	// To include a literal `.` in the property name, prefix with a `\`. In most
	// programming languages you will need to write this as `"\\."` because the
	// `\` itself will need to be escaped.
	//
	// For example,
	// “`typescript
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
	// cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
	// “`
	// would add the overrides
	// “`json
	// "Properties": {
	//    "GlobalSecondaryIndexes": [
	//      {
	//        "Projection": {
	//          "NonKeyAttributes": [ "myattribute" ]
	//          ...
	//        }
	//        ...
	//      },
	//      {
	//        "ProjectionType": "INCLUDE"
	//        ...
	//      },
	//    ]
	//    ...
	// }
	// “`
	//
	// The `value` argument to `addOverride` will not be processed or translated
	// in any way. Pass raw JSON values in here with the correct capitalization
	// for CloudFormation. If you pass CDK classes or structs, they will be
	// rendered with lowercased key names, and CloudFormation will reject the
	// template.
	// Experimental.
	AddOverride(path *string, value interface{})
	// Adds an override that deletes the value of a property from the resource definition.
	// Experimental.
	AddPropertyDeletionOverride(propertyPath *string)
	// Adds an override to a resource property.
	//
	// Syntactic sugar for `addOverride("Properties.<...>", value)`.
	// Experimental.
	AddPropertyOverride(propertyPath *string, value interface{})
	// Sets the deletion policy of the resource based on the removal policy specified.
	//
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions)
	// Returns a token for an runtime attribute of this resource.
	//
	// Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
	// in case there is no generated attribute.
	// Experimental.
	GetAtt(attributeName *string) awscdk.Reference
	// Retrieve a value value from the CloudFormation Resource Metadata.
	// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
	//
	// Note that this is a different set of metadata from CDK node metadata; this
	// metadata ends up in the stack template under the resource, whereas CDK
	// node metadata ends up in the Cloud Assembly.
	//
	// Experimental.
	GetMetadata(key *string) interface{}
	// Examines the CloudFormation resource and discloses attributes.
	Inspect(inspector awscdk.TreeInspector)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Overrides the auto-generated logical ID with a specific ID.
	// Experimental.
	OverrideLogicalId(newLogicalId *string)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	RenderProperties(props *map[string]interface{}) *map[string]interface{}
	// Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.
	//
	// Returns: `true` if the resource should be included or `false` is the resource
	// should be omitted.
	// Experimental.
	ShouldSynthesize() *bool
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	//
	// Returns: a string representation of this resource.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Experimental.
	ValidateProperties(_properties interface{})
}

A CloudFormation `AWS::StepFunctions::StateMachine`.

Provisions a state machine. A state machine consists of a collection of states that can do work ( `Task` states), determine to which states to transition next ( `Choice` states), stop an execution with an error ( `Fail` states), and so on. State machines are specified using a JSON-based, structured language.

Example:

// 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"

var definition interface{}
var definitionSubstitutions interface{}

cfnStateMachine := awscdk.Aws_stepfunctions.NewCfnStateMachine(this, jsii.String("MyCfnStateMachine"), &cfnStateMachineProps{
	roleArn: jsii.String("roleArn"),

	// the properties below are optional
	definition: definition,
	definitionS3Location: &s3LocationProperty{
		bucket: jsii.String("bucket"),
		key: jsii.String("key"),

		// the properties below are optional
		version: jsii.String("version"),
	},
	definitionString: jsii.String("definitionString"),
	definitionSubstitutions: map[string]interface{}{
		"definitionSubstitutionsKey": definitionSubstitutions,
	},
	loggingConfiguration: &loggingConfigurationProperty{
		destinations: []interface{}{
			&logDestinationProperty{
				cloudWatchLogsLogGroup: &cloudWatchLogsLogGroupProperty{
					logGroupArn: jsii.String("logGroupArn"),
				},
			},
		},
		includeExecutionData: jsii.Boolean(false),
		level: jsii.String("level"),
	},
	stateMachineName: jsii.String("stateMachineName"),
	stateMachineType: jsii.String("stateMachineType"),
	tags: []tagsEntryProperty{
		&tagsEntryProperty{
			key: jsii.String("key"),
			value: jsii.String("value"),
		},
	},
	tracingConfiguration: &tracingConfigurationProperty{
		enabled: jsii.Boolean(false),
	},
})

func NewCfnStateMachine

func NewCfnStateMachine(scope awscdk.Construct, id *string, props *CfnStateMachineProps) CfnStateMachine

Create a new `AWS::StepFunctions::StateMachine`.

type CfnStateMachineProps

type CfnStateMachineProps struct {
	// The Amazon Resource Name (ARN) of the IAM role to use for this state machine.
	RoleArn *string `field:"required" json:"roleArn" yaml:"roleArn"`
	// The Amazon States Language definition of the state machine.
	//
	// The state machine definition must be in JSON or YAML, and the format of the object must match the format of your AWS Step Functions template file. See [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) .
	Definition interface{} `field:"optional" json:"definition" yaml:"definition"`
	// The name of the S3 bucket where the state machine definition is stored.
	//
	// The state machine definition must be a JSON or YAML file.
	DefinitionS3Location interface{} `field:"optional" json:"definitionS3Location" yaml:"definitionS3Location"`
	// The Amazon States Language definition of the state machine.
	//
	// The state machine definition must be in JSON. See [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) .
	DefinitionString *string `field:"optional" json:"definitionString" yaml:"definitionString"`
	// A map (string to string) that specifies the mappings for placeholder variables in the state machine definition.
	//
	// This enables the customer to inject values obtained at runtime, for example from intrinsic functions, in the state machine definition. Variables can be template parameter names, resource logical IDs, resource attributes, or a variable in a key-value map.
	DefinitionSubstitutions interface{} `field:"optional" json:"definitionSubstitutions" yaml:"definitionSubstitutions"`
	// Defines what execution history events are logged and where they are logged.
	//
	// > By default, the `level` is set to `OFF` . For more information see [Log Levels](https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html) in the AWS Step Functions User Guide.
	LoggingConfiguration interface{} `field:"optional" json:"loggingConfiguration" yaml:"loggingConfiguration"`
	// The name of the state machine.
	//
	// A name must *not* contain:
	//
	// - white space
	// - brackets `< > { } [ ]`
	// - wildcard characters `? *`
	// - special characters `" # % \ ^ | ~ ` $ & , ; : /`
	// - control characters ( `U+0000-001F` , `U+007F-009F` )
	//
	// > If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
	StateMachineName *string `field:"optional" json:"stateMachineName" yaml:"stateMachineName"`
	// Determines whether a `STANDARD` or `EXPRESS` state machine is created.
	//
	// The default is `STANDARD` . You cannot update the `type` of a state machine once it has been created. For more information on `STANDARD` and `EXPRESS` workflows, see [Standard Versus Express Workflows](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html) in the AWS Step Functions Developer Guide.
	StateMachineType *string `field:"optional" json:"stateMachineType" yaml:"stateMachineType"`
	// The list of tags to add to a resource.
	//
	// Tags may only contain Unicode letters, digits, white space, or these symbols: `_ . : / = + - @` .
	Tags *[]*CfnStateMachine_TagsEntryProperty `field:"optional" json:"tags" yaml:"tags"`
	// Selects whether or not the state machine's AWS X-Ray tracing is enabled.
	TracingConfiguration interface{} `field:"optional" json:"tracingConfiguration" yaml:"tracingConfiguration"`
}

Properties for defining a `CfnStateMachine`.

Example:

// 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"

var definition interface{}
var definitionSubstitutions interface{}

cfnStateMachineProps := &cfnStateMachineProps{
	roleArn: jsii.String("roleArn"),

	// the properties below are optional
	definition: definition,
	definitionS3Location: &s3LocationProperty{
		bucket: jsii.String("bucket"),
		key: jsii.String("key"),

		// the properties below are optional
		version: jsii.String("version"),
	},
	definitionString: jsii.String("definitionString"),
	definitionSubstitutions: map[string]interface{}{
		"definitionSubstitutionsKey": definitionSubstitutions,
	},
	loggingConfiguration: &loggingConfigurationProperty{
		destinations: []interface{}{
			&logDestinationProperty{
				cloudWatchLogsLogGroup: &cloudWatchLogsLogGroupProperty{
					logGroupArn: jsii.String("logGroupArn"),
				},
			},
		},
		includeExecutionData: jsii.Boolean(false),
		level: jsii.String("level"),
	},
	stateMachineName: jsii.String("stateMachineName"),
	stateMachineType: jsii.String("stateMachineType"),
	tags: []tagsEntryProperty{
		&tagsEntryProperty{
			key: jsii.String("key"),
			value: jsii.String("value"),
		},
	},
	tracingConfiguration: &tracingConfigurationProperty{
		enabled: jsii.Boolean(false),
	},
}

type CfnStateMachine_CloudWatchLogsLogGroupProperty

type CfnStateMachine_CloudWatchLogsLogGroupProperty struct {
	// The ARN of the the CloudWatch log group to which you want your logs emitted to.
	//
	// The ARN must end with `:*`.
	LogGroupArn *string `field:"optional" json:"logGroupArn" yaml:"logGroupArn"`
}

Defines a CloudWatch log group.

> For more information see [Standard Versus Express Workflows](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html) in the AWS Step Functions Developer Guide.

Example:

// 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"

cloudWatchLogsLogGroupProperty := &cloudWatchLogsLogGroupProperty{
	logGroupArn: jsii.String("logGroupArn"),
}

type CfnStateMachine_LogDestinationProperty

type CfnStateMachine_LogDestinationProperty struct {
	// An object describing a CloudWatch log group.
	//
	// For more information, see [AWS::Logs::LogGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html) in the AWS CloudFormation User Guide.
	CloudWatchLogsLogGroup interface{} `field:"optional" json:"cloudWatchLogsLogGroup" yaml:"cloudWatchLogsLogGroup"`
}

Defines a destination for `LoggingConfiguration` .

> For more information on logging with `EXPRESS` workflows, see [Logging Express Workflows Using CloudWatch Logs](https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html) .

Example:

// 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"

logDestinationProperty := &logDestinationProperty{
	cloudWatchLogsLogGroup: &cloudWatchLogsLogGroupProperty{
		logGroupArn: jsii.String("logGroupArn"),
	},
}

type CfnStateMachine_LoggingConfigurationProperty

type CfnStateMachine_LoggingConfigurationProperty struct {
	// An array of objects that describes where your execution history events will be logged.
	//
	// Limited to size 1. Required, if your log level is not set to `OFF` .
	Destinations interface{} `field:"optional" json:"destinations" yaml:"destinations"`
	// Determines whether execution data is included in your log.
	//
	// When set to `false` , data is excluded.
	IncludeExecutionData interface{} `field:"optional" json:"includeExecutionData" yaml:"includeExecutionData"`
	// Defines which category of execution history events are logged.
	Level *string `field:"optional" json:"level" yaml:"level"`
}

Defines what execution history events are logged and where they are logged.

> By default, the `level` is set to `OFF` . For more information see [Log Levels](https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html) in the AWS Step Functions User Guide.

Example:

// 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"

loggingConfigurationProperty := &loggingConfigurationProperty{
	destinations: []interface{}{
		&logDestinationProperty{
			cloudWatchLogsLogGroup: &cloudWatchLogsLogGroupProperty{
				logGroupArn: jsii.String("logGroupArn"),
			},
		},
	},
	includeExecutionData: jsii.Boolean(false),
	level: jsii.String("level"),
}

type CfnStateMachine_S3LocationProperty

type CfnStateMachine_S3LocationProperty struct {
	// The name of the S3 bucket where the state machine definition JSON or YAML file is stored.
	Bucket *string `field:"required" json:"bucket" yaml:"bucket"`
	// The name of the state machine definition file (Amazon S3 object name).
	Key *string `field:"required" json:"key" yaml:"key"`
	// For versioning-enabled buckets, a specific version of the state machine definition.
	Version *string `field:"optional" json:"version" yaml:"version"`
}

Defines the S3 bucket location where a state machine definition is stored.

The state machine definition must be a JSON or YAML file.

Example:

// 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"

s3LocationProperty := &s3LocationProperty{
	bucket: jsii.String("bucket"),
	key: jsii.String("key"),

	// the properties below are optional
	version: jsii.String("version"),
}

type CfnStateMachine_TagsEntryProperty

type CfnStateMachine_TagsEntryProperty struct {
	// The `key` for a key-value pair in a tag entry.
	Key *string `field:"required" json:"key" yaml:"key"`
	// The `value` for a key-value pair in a tag entry.
	Value *string `field:"required" json:"value" yaml:"value"`
}

The `TagsEntry` property specifies *tags* to identify a state machine.

Example:

// 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"

tagsEntryProperty := &tagsEntryProperty{
	key: jsii.String("key"),
	value: jsii.String("value"),
}

type CfnStateMachine_TracingConfigurationProperty

type CfnStateMachine_TracingConfigurationProperty struct {
	// When set to `true` , X-Ray tracing is enabled.
	Enabled interface{} `field:"optional" json:"enabled" yaml:"enabled"`
}

Selects whether or not the state machine's AWS X-Ray tracing is enabled.

To configure your state machine to send trace data to X-Ray, set `Enabled` to `true` .

Example:

// 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"

tracingConfigurationProperty := &tracingConfigurationProperty{
	enabled: jsii.Boolean(false),
}

type Chain

type Chain interface {
	IChainable
	// The chainable end state(s) of this chain.
	// Experimental.
	EndStates() *[]INextable
	// Identify this Chain.
	// Experimental.
	Id() *string
	// The start state of this chain.
	// Experimental.
	StartState() State
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Return a single state that encompasses all states in the chain.
	//
	// This can be used to add error handling to a sequence of states.
	//
	// Be aware that this changes the result of the inner state machine
	// to be an array with the result of the state machine in it. Adjust
	// your paths accordingly. For example, change 'outputPath' to
	// '$[0]'.
	// Experimental.
	ToSingleState(id *string, props *ParallelProps) Parallel
}

A collection of states to chain onto.

A Chain has a start and zero or more chainable ends. If there are zero ends, calling next() on the Chain will fail.

Example:

// Define a state machine with one Pass state
child := sfn.NewStateMachine(this, jsii.String("ChildStateMachine"), &stateMachineProps{
	definition: sfn.chain.start(sfn.NewPass(this, jsii.String("PassState"))),
})

// Include the state machine in a Task state with callback pattern
task := tasks.NewStepFunctionsStartExecution(this, jsii.String("ChildTask"), &stepFunctionsStartExecutionProps{
	stateMachine: child,
	integrationPattern: sfn.integrationPattern_WAIT_FOR_TASK_TOKEN,
	input: sfn.taskInput.fromObject(map[string]interface{}{
		"token": sfn.JsonPath.taskToken,
		"foo": jsii.String("bar"),
	}),
	name: jsii.String("MyExecutionName"),
})

// Define a second state machine with the Task state above
// Define a second state machine with the Task state above
sfn.NewStateMachine(this, jsii.String("ParentStateMachine"), &stateMachineProps{
	definition: task,
})

Experimental.

func Chain_Custom

func Chain_Custom(startState State, endStates *[]INextable, lastAdded IChainable) Chain

Make a Chain with specific start and end states, and a last-added Chainable. Experimental.

func Chain_Sequence

func Chain_Sequence(start IChainable, next IChainable) Chain

Make a Chain with the start from one chain and the ends from another. Experimental.

func Chain_Start

func Chain_Start(state IChainable) Chain

Begin a new Chain from one chainable. Experimental.

type Choice

type Choice interface {
	State
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Return a Chain that contains all reachable end states from this Choice.
	//
	// Use this to combine all possible choice paths back.
	// Experimental.
	Afterwards(options *AfterwardsOptions) Chain
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// If none of the given conditions match, continue execution with the given state.
	//
	// If no conditions match and no otherwise() has been given, an execution
	// error will be raised.
	// Experimental.
	Otherwise(def IChainable) Choice
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// If the given condition matches, continue execution with the given state.
	// Experimental.
	When(condition Condition, next IChainable) Choice
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Choice in the state machine.

A choice state can be used to make decisions based on the execution state.

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"

var submitLambda function
var getStatusLambda function

submitJob := tasks.NewLambdaInvoke(this, jsii.String("Submit Job"), &lambdaInvokeProps{
	lambdaFunction: submitLambda,
	// Lambda's result is in the attribute `Payload`
	outputPath: jsii.String("$.Payload"),
})

waitX := sfn.NewWait(this, jsii.String("Wait X Seconds"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

getStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Pass just the field named "guid" into the Lambda, put the
	// Lambda's result in a field called "status" in the response
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

jobFailed := sfn.NewFail(this, jsii.String("Job Failed"), &failProps{
	cause: jsii.String("AWS Batch Job Failed"),
	error: jsii.String("DescribeJob returned FAILED"),
})

finalStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Final Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Use "guid" field as input
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

definition := submitJob.next(waitX).next(getStatus).next(sfn.NewChoice(this, jsii.String("Job Complete?")).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("FAILED")), jobFailed).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCEEDED")), finalStatus).otherwise(waitX))

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
	timeout: awscdk.Duration.minutes(jsii.Number(5)),
})

Experimental.

func NewChoice

func NewChoice(scope constructs.Construct, id *string, props *ChoiceProps) Choice

Experimental.

type ChoiceProps

type ChoiceProps struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
}

Properties for defining a Choice state.

Example:

// 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"

choiceProps := &choiceProps{
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
}

Experimental.

type Condition

type Condition interface {
	// Render Amazon States Language JSON for the condition.
	// Experimental.
	RenderCondition() interface{}
}

A Condition for use in a Choice state branch.

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"

var submitLambda function
var getStatusLambda function

submitJob := tasks.NewLambdaInvoke(this, jsii.String("Submit Job"), &lambdaInvokeProps{
	lambdaFunction: submitLambda,
	// Lambda's result is in the attribute `Payload`
	outputPath: jsii.String("$.Payload"),
})

waitX := sfn.NewWait(this, jsii.String("Wait X Seconds"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

getStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Pass just the field named "guid" into the Lambda, put the
	// Lambda's result in a field called "status" in the response
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

jobFailed := sfn.NewFail(this, jsii.String("Job Failed"), &failProps{
	cause: jsii.String("AWS Batch Job Failed"),
	error: jsii.String("DescribeJob returned FAILED"),
})

finalStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Final Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Use "guid" field as input
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

definition := submitJob.next(waitX).next(getStatus).next(sfn.NewChoice(this, jsii.String("Job Complete?")).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("FAILED")), jobFailed).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCEEDED")), finalStatus).otherwise(waitX))

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
	timeout: awscdk.Duration.minutes(jsii.Number(5)),
})

Experimental.

func Condition_And

func Condition_And(conditions ...Condition) Condition

Combine two or more conditions with a logical AND. Experimental.

func Condition_BooleanEquals

func Condition_BooleanEquals(variable *string, value *bool) Condition

Matches if a boolean field has the given value. Experimental.

func Condition_BooleanEqualsJsonPath

func Condition_BooleanEqualsJsonPath(variable *string, value *string) Condition

Matches if a boolean field equals to a value at a given mapping path. Experimental.

func Condition_IsBoolean

func Condition_IsBoolean(variable *string) Condition

Matches if variable is boolean. Experimental.

func Condition_IsNotBoolean

func Condition_IsNotBoolean(variable *string) Condition

Matches if variable is not boolean. Experimental.

func Condition_IsNotNull

func Condition_IsNotNull(variable *string) Condition

Matches if variable is not null. Experimental.

func Condition_IsNotNumeric

func Condition_IsNotNumeric(variable *string) Condition

Matches if variable is not numeric. Experimental.

func Condition_IsNotPresent

func Condition_IsNotPresent(variable *string) Condition

Matches if variable is not present. Experimental.

func Condition_IsNotString

func Condition_IsNotString(variable *string) Condition

Matches if variable is not a string. Experimental.

func Condition_IsNotTimestamp

func Condition_IsNotTimestamp(variable *string) Condition

Matches if variable is not a timestamp. Experimental.

func Condition_IsNull

func Condition_IsNull(variable *string) Condition

Matches if variable is Null. Experimental.

func Condition_IsNumeric

func Condition_IsNumeric(variable *string) Condition

Matches if variable is numeric. Experimental.

func Condition_IsPresent

func Condition_IsPresent(variable *string) Condition

Matches if variable is present. Experimental.

func Condition_IsString

func Condition_IsString(variable *string) Condition

Matches if variable is a string. Experimental.

func Condition_IsTimestamp

func Condition_IsTimestamp(variable *string) Condition

Matches if variable is a timestamp. Experimental.

func Condition_Not

func Condition_Not(condition Condition) Condition

Negate a condition. Experimental.

func Condition_NumberEquals

func Condition_NumberEquals(variable *string, value *float64) Condition

Matches if a numeric field has the given value. Experimental.

func Condition_NumberEqualsJsonPath

func Condition_NumberEqualsJsonPath(variable *string, value *string) Condition

Matches if a numeric field has the value in a given mapping path. Experimental.

func Condition_NumberGreaterThan

func Condition_NumberGreaterThan(variable *string, value *float64) Condition

Matches if a numeric field is greater than the given value. Experimental.

func Condition_NumberGreaterThanEquals

func Condition_NumberGreaterThanEquals(variable *string, value *float64) Condition

Matches if a numeric field is greater than or equal to the given value. Experimental.

func Condition_NumberGreaterThanEqualsJsonPath

func Condition_NumberGreaterThanEqualsJsonPath(variable *string, value *string) Condition

Matches if a numeric field is greater than or equal to the value at a given mapping path. Experimental.

func Condition_NumberGreaterThanJsonPath

func Condition_NumberGreaterThanJsonPath(variable *string, value *string) Condition

Matches if a numeric field is greater than the value at a given mapping path. Experimental.

func Condition_NumberLessThan

func Condition_NumberLessThan(variable *string, value *float64) Condition

Matches if a numeric field is less than the given value. Experimental.

func Condition_NumberLessThanEquals

func Condition_NumberLessThanEquals(variable *string, value *float64) Condition

Matches if a numeric field is less than or equal to the given value. Experimental.

func Condition_NumberLessThanEqualsJsonPath

func Condition_NumberLessThanEqualsJsonPath(variable *string, value *string) Condition

Matches if a numeric field is less than or equal to the numeric value at given mapping path. Experimental.

func Condition_NumberLessThanJsonPath

func Condition_NumberLessThanJsonPath(variable *string, value *string) Condition

Matches if a numeric field is less than the value at the given mapping path. Experimental.

func Condition_Or

func Condition_Or(conditions ...Condition) Condition

Combine two or more conditions with a logical OR. Experimental.

func Condition_StringEquals

func Condition_StringEquals(variable *string, value *string) Condition

Matches if a string field has the given value. Experimental.

func Condition_StringEqualsJsonPath

func Condition_StringEqualsJsonPath(variable *string, value *string) Condition

Matches if a string field equals to a value at a given mapping path. Experimental.

func Condition_StringGreaterThan

func Condition_StringGreaterThan(variable *string, value *string) Condition

Matches if a string field sorts after a given value. Experimental.

func Condition_StringGreaterThanEquals

func Condition_StringGreaterThanEquals(variable *string, value *string) Condition

Matches if a string field sorts after or equal to a given value. Experimental.

func Condition_StringGreaterThanEqualsJsonPath

func Condition_StringGreaterThanEqualsJsonPath(variable *string, value *string) Condition

Matches if a string field sorts after or equal to value at a given mapping path. Experimental.

func Condition_StringGreaterThanJsonPath

func Condition_StringGreaterThanJsonPath(variable *string, value *string) Condition

Matches if a string field sorts after a value at a given mapping path. Experimental.

func Condition_StringLessThan

func Condition_StringLessThan(variable *string, value *string) Condition

Matches if a string field sorts before a given value. Experimental.

func Condition_StringLessThanEquals

func Condition_StringLessThanEquals(variable *string, value *string) Condition

Matches if a string field sorts equal to or before a given value. Experimental.

func Condition_StringLessThanEqualsJsonPath

func Condition_StringLessThanEqualsJsonPath(variable *string, value *string) Condition

Matches if a string field sorts equal to or before a given mapping. Experimental.

func Condition_StringLessThanJsonPath

func Condition_StringLessThanJsonPath(variable *string, value *string) Condition

Matches if a string field sorts before a given value at a particular mapping. Experimental.

func Condition_StringMatches

func Condition_StringMatches(variable *string, value *string) Condition

Matches if a field matches a string pattern that can contain a wild card (*) e.g: log-*.txt or *LATEST*. No other characters other than "*" have any special meaning - * can be escaped: \\*. Experimental.

func Condition_TimestampEquals

func Condition_TimestampEquals(variable *string, value *string) Condition

Matches if a timestamp field is the same time as the given timestamp. Experimental.

func Condition_TimestampEqualsJsonPath

func Condition_TimestampEqualsJsonPath(variable *string, value *string) Condition

Matches if a timestamp field is the same time as the timestamp at a given mapping path. Experimental.

func Condition_TimestampGreaterThan

func Condition_TimestampGreaterThan(variable *string, value *string) Condition

Matches if a timestamp field is after the given timestamp. Experimental.

func Condition_TimestampGreaterThanEquals

func Condition_TimestampGreaterThanEquals(variable *string, value *string) Condition

Matches if a timestamp field is after or equal to the given timestamp. Experimental.

func Condition_TimestampGreaterThanEqualsJsonPath

func Condition_TimestampGreaterThanEqualsJsonPath(variable *string, value *string) Condition

Matches if a timestamp field is after or equal to the timestamp at a given mapping path. Experimental.

func Condition_TimestampGreaterThanJsonPath

func Condition_TimestampGreaterThanJsonPath(variable *string, value *string) Condition

Matches if a timestamp field is after the timestamp at a given mapping path. Experimental.

func Condition_TimestampLessThan

func Condition_TimestampLessThan(variable *string, value *string) Condition

Matches if a timestamp field is before the given timestamp. Experimental.

func Condition_TimestampLessThanEquals

func Condition_TimestampLessThanEquals(variable *string, value *string) Condition

Matches if a timestamp field is before or equal to the given timestamp. Experimental.

func Condition_TimestampLessThanEqualsJsonPath

func Condition_TimestampLessThanEqualsJsonPath(variable *string, value *string) Condition

Matches if a timestamp field is before or equal to the timestamp at a given mapping path. Experimental.

func Condition_TimestampLessThanJsonPath

func Condition_TimestampLessThanJsonPath(variable *string, value *string) Condition

Matches if a timestamp field is before the timestamp at a given mapping path. Experimental.

type Context deprecated

type Context interface {
}

Extract a field from the State Machine Context data. See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#wait-token-contextobject

Deprecated: replaced by `JsonPath`.

type CustomState

type CustomState interface {
	State
	IChainable
	INextable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

State defined by supplying Amazon States Language (ASL) in the state machine.

Example:

import dynamodb "github.com/aws/aws-cdk-go/awscdk"

// create a table
table := dynamodb.NewTable(this, jsii.String("montable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

finalStatus := sfn.NewPass(this, jsii.String("final step"))

// States language JSON to put an item into DynamoDB
// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
stateJson := map[string]interface{}{
	"Type": jsii.String("Task"),
	"Resource": jsii.String("arn:aws:states:::dynamodb:putItem"),
	"Parameters": map[string]interface{}{
		"TableName": table.tableName,
		"Item": map[string]map[string]*string{
			"id": map[string]*string{
				"S": jsii.String("MyEntry"),
			},
		},
	},
	"ResultPath": nil,
}

// custom state which represents a task to insert data into DynamoDB
custom := sfn.NewCustomState(this, jsii.String("my custom task"), &customStateProps{
	stateJson: stateJson,
})

chain := sfn.chain.start(custom).next(finalStatus)

sm := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: chain,
	timeout: awscdk.Duration.seconds(jsii.Number(30)),
})

// don't forget permissions. You need to assign them
table.grantWriteData(sm)

Experimental.

func NewCustomState

func NewCustomState(scope constructs.Construct, id *string, props *CustomStateProps) CustomState

Experimental.

type CustomStateProps

type CustomStateProps struct {
	// Amazon States Language (JSON-based) definition of the state.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html
	//
	// Experimental.
	StateJson *map[string]interface{} `field:"required" json:"stateJson" yaml:"stateJson"`
}

Properties for defining a custom state definition.

Example:

import dynamodb "github.com/aws/aws-cdk-go/awscdk"

// create a table
table := dynamodb.NewTable(this, jsii.String("montable"), &tableProps{
	partitionKey: &attribute{
		name: jsii.String("id"),
		type: dynamodb.attributeType_STRING,
	},
})

finalStatus := sfn.NewPass(this, jsii.String("final step"))

// States language JSON to put an item into DynamoDB
// snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
stateJson := map[string]interface{}{
	"Type": jsii.String("Task"),
	"Resource": jsii.String("arn:aws:states:::dynamodb:putItem"),
	"Parameters": map[string]interface{}{
		"TableName": table.tableName,
		"Item": map[string]map[string]*string{
			"id": map[string]*string{
				"S": jsii.String("MyEntry"),
			},
		},
	},
	"ResultPath": nil,
}

// custom state which represents a task to insert data into DynamoDB
custom := sfn.NewCustomState(this, jsii.String("my custom task"), &customStateProps{
	stateJson: stateJson,
})

chain := sfn.chain.start(custom).next(finalStatus)

sm := sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: chain,
	timeout: awscdk.Duration.seconds(jsii.Number(30)),
})

// don't forget permissions. You need to assign them
table.grantWriteData(sm)

Experimental.

type Data

type Data interface {
}

Extract a field from the State Machine data that gets passed around between states. Deprecated: replaced by `JsonPath`.

type Errors

type Errors interface {
}

Predefined error strings Error names in Amazon States Language - https://states-language.net/spec.html#appendix-a Error handling in Step Functions - https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html.

Example:

// 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"

errors := awscdk.Aws_stepfunctions.NewErrors()

Experimental.

func NewErrors

func NewErrors() Errors

Experimental.

type Fail

type Fail interface {
	State
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Fail state in the state machine.

Reaching a Fail state terminates the state execution in failure.

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"

var submitLambda function
var getStatusLambda function

submitJob := tasks.NewLambdaInvoke(this, jsii.String("Submit Job"), &lambdaInvokeProps{
	lambdaFunction: submitLambda,
	// Lambda's result is in the attribute `Payload`
	outputPath: jsii.String("$.Payload"),
})

waitX := sfn.NewWait(this, jsii.String("Wait X Seconds"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

getStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Pass just the field named "guid" into the Lambda, put the
	// Lambda's result in a field called "status" in the response
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

jobFailed := sfn.NewFail(this, jsii.String("Job Failed"), &failProps{
	cause: jsii.String("AWS Batch Job Failed"),
	error: jsii.String("DescribeJob returned FAILED"),
})

finalStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Final Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Use "guid" field as input
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

definition := submitJob.next(waitX).next(getStatus).next(sfn.NewChoice(this, jsii.String("Job Complete?")).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("FAILED")), jobFailed).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCEEDED")), finalStatus).otherwise(waitX))

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
	timeout: awscdk.Duration.minutes(jsii.Number(5)),
})

Experimental.

func NewFail

func NewFail(scope constructs.Construct, id *string, props *FailProps) Fail

Experimental.

type FailProps

type FailProps struct {
	// A description for the cause of the failure.
	// Experimental.
	Cause *string `field:"optional" json:"cause" yaml:"cause"`
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// Error code used to represent this failure.
	// Experimental.
	Error *string `field:"optional" json:"error" yaml:"error"`
}

Properties for defining a Fail state.

Example:

import lambda "github.com/aws/aws-cdk-go/awscdk"

var submitLambda function
var getStatusLambda function

submitJob := tasks.NewLambdaInvoke(this, jsii.String("Submit Job"), &lambdaInvokeProps{
	lambdaFunction: submitLambda,
	// Lambda's result is in the attribute `Payload`
	outputPath: jsii.String("$.Payload"),
})

waitX := sfn.NewWait(this, jsii.String("Wait X Seconds"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

getStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Pass just the field named "guid" into the Lambda, put the
	// Lambda's result in a field called "status" in the response
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

jobFailed := sfn.NewFail(this, jsii.String("Job Failed"), &failProps{
	cause: jsii.String("AWS Batch Job Failed"),
	error: jsii.String("DescribeJob returned FAILED"),
})

finalStatus := tasks.NewLambdaInvoke(this, jsii.String("Get Final Job Status"), &lambdaInvokeProps{
	lambdaFunction: getStatusLambda,
	// Use "guid" field as input
	inputPath: jsii.String("$.guid"),
	outputPath: jsii.String("$.Payload"),
})

definition := submitJob.next(waitX).next(getStatus).next(sfn.NewChoice(this, jsii.String("Job Complete?")).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("FAILED")), jobFailed).when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCEEDED")), finalStatus).otherwise(waitX))

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: definition,
	timeout: awscdk.Duration.minutes(jsii.Number(5)),
})

Experimental.

type FieldUtils

type FieldUtils interface {
}

Helper functions to work with structures containing fields. Experimental.

type FindStateOptions

type FindStateOptions struct {
	// Whether or not to follow error-handling transitions.
	// Experimental.
	IncludeErrorHandlers *bool `field:"optional" json:"includeErrorHandlers" yaml:"includeErrorHandlers"`
}

Options for finding reachable states.

Example:

// 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"

findStateOptions := &findStateOptions{
	includeErrorHandlers: jsii.Boolean(false),
}

Experimental.

type IActivity

type IActivity interface {
	awscdk.IResource
	// The ARN of the activity.
	// Experimental.
	ActivityArn() *string
	// The name of the activity.
	// Experimental.
	ActivityName() *string
}

Represents a Step Functions Activity https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html. Experimental.

func Activity_FromActivityArn

func Activity_FromActivityArn(scope constructs.Construct, id *string, activityArn *string) IActivity

Construct an Activity from an existing Activity ARN. Experimental.

func Activity_FromActivityName

func Activity_FromActivityName(scope constructs.Construct, id *string, activityName *string) IActivity

Construct an Activity from an existing Activity Name. Experimental.

type IChainable

type IChainable interface {
	// The chainable end state(s) of this chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// The start state of this chainable.
	// Experimental.
	StartState() State
}

Interface for objects that can be used in a Chain. Experimental.

type INextable

type INextable interface {
	// Go to the indicated state after this state.
	//
	// Returns: The chain of states built up.
	// Experimental.
	Next(state IChainable) Chain
}

Interface for states that can have 'next' states. Experimental.

type IStateMachine

type IStateMachine interface {
	awsiam.IGrantable
	awscdk.IResource
	// Grant the given identity custom permissions.
	// Experimental.
	Grant(identity awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Grant the given identity permissions for all executions of a state machine.
	// Experimental.
	GrantExecution(identity awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Grant the given identity read permissions for this state machine.
	// Experimental.
	GrantRead(identity awsiam.IGrantable) awsiam.Grant
	// Grant the given identity permissions to start an execution of this state machine.
	// Experimental.
	GrantStartExecution(identity awsiam.IGrantable) awsiam.Grant
	// Grant the given identity permissions to start a synchronous execution of this state machine.
	// Experimental.
	GrantStartSyncExecution(identity awsiam.IGrantable) awsiam.Grant
	// Grant the given identity read permissions for this state machine.
	// Experimental.
	GrantTaskResponse(identity awsiam.IGrantable) awsiam.Grant
	// Return the given named metric for this State Machine's executions.
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that were aborted.
	// Experimental.
	MetricAborted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that failed.
	// Experimental.
	MetricFailed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that were started.
	// Experimental.
	MetricStarted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that succeeded.
	// Experimental.
	MetricSucceeded(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that were throttled.
	// Experimental.
	MetricThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.
	// Experimental.
	MetricTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that timed out.
	// Experimental.
	MetricTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The ARN of the state machine.
	// Experimental.
	StateMachineArn() *string
}

A State Machine. Experimental.

func StateMachine_FromStateMachineArn

func StateMachine_FromStateMachineArn(scope constructs.Construct, id *string, stateMachineArn *string) IStateMachine

Import a state machine. Experimental.

type IStepFunctionsTask

type IStepFunctionsTask interface {
	// Called when the task object is used in a workflow.
	// Deprecated: replaced by `TaskStateBase`.
	Bind(task Task) *StepFunctionsTaskConfig
}

Interface for resources that can be used as tasks. Deprecated: replaced by `TaskStateBase`.

type InputType

type InputType string

The type of task input. Experimental.

const (
	// Use a literal string This might be a JSON-encoded object, or just text.
	//
	// valid JSON text: standalone, quote-delimited strings; objects; arrays; numbers; Boolean values; and null.
	//
	// example: `literal string`
	// example: {"json": "encoded"}.
	// Experimental.
	InputType_TEXT InputType = "TEXT"
	// Use an object which may contain Data and Context fields as object values, if desired.
	//
	// example:
	// {
	//   literal: 'literal',
	//   SomeInput: sfn.JsonPath.stringAt('$.someField')
	// }.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html
	//
	// Experimental.
	InputType_OBJECT InputType = "OBJECT"
)

type IntegrationPattern

type IntegrationPattern string

AWS Step Functions integrates with services directly in the Amazon States Language.

You can control these AWS services using service integration patterns:.

Example:

// Define a state machine with one Pass state
child := sfn.NewStateMachine(this, jsii.String("ChildStateMachine"), &stateMachineProps{
	definition: sfn.chain.start(sfn.NewPass(this, jsii.String("PassState"))),
})

// Include the state machine in a Task state with callback pattern
task := tasks.NewStepFunctionsStartExecution(this, jsii.String("ChildTask"), &stepFunctionsStartExecutionProps{
	stateMachine: child,
	integrationPattern: sfn.integrationPattern_WAIT_FOR_TASK_TOKEN,
	input: sfn.taskInput.fromObject(map[string]interface{}{
		"token": sfn.JsonPath.taskToken,
		"foo": jsii.String("bar"),
	}),
	name: jsii.String("MyExecutionName"),
})

// Define a second state machine with the Task state above
// Define a second state machine with the Task state above
sfn.NewStateMachine(this, jsii.String("ParentStateMachine"), &stateMachineProps{
	definition: task,
})

See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html

Experimental.

const (
	// Step Functions will wait for an HTTP response and then progress to the next state.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-default
	//
	// Experimental.
	IntegrationPattern_REQUEST_RESPONSE IntegrationPattern = "REQUEST_RESPONSE"
	// Step Functions can wait for a request to complete before progressing to the next state.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-sync
	//
	// Experimental.
	IntegrationPattern_RUN_JOB IntegrationPattern = "RUN_JOB"
	// Callback tasks provide a way to pause a workflow until a task token is returned.
	//
	// You must set a task token when using the callback pattern.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token
	//
	// Experimental.
	IntegrationPattern_WAIT_FOR_TASK_TOKEN IntegrationPattern = "WAIT_FOR_TASK_TOKEN"
)

type JsonPath

type JsonPath interface {
}

Extract a field from the State Machine data or context that gets passed around between states.

Example:

var fn function

tasks.NewLambdaInvoke(this, jsii.String("Invoke Handler"), &lambdaInvokeProps{
	lambdaFunction: fn,
	resultSelector: map[string]interface{}{
		"lambdaOutput": sfn.JsonPath.stringAt(jsii.String("$.Payload")),
		"invokeRequestId": sfn.JsonPath.stringAt(jsii.String("$.SdkResponseMetadata.RequestId")),
		"staticValue": map[string]*string{
			"foo": jsii.String("bar"),
		},
		"stateName": sfn.JsonPath.stringAt(jsii.String("$.State.Name")),
	},
})

See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-paths.html

Experimental.

type LogLevel

type LogLevel string

Defines which category of execution history events are logged.

Example:

import logs "github.com/aws/aws-cdk-go/awscdk"

logGroup := logs.NewLogGroup(this, jsii.String("MyLogGroup"))

sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
	definition: sfn.chain.start(sfn.NewPass(this, jsii.String("Pass"))),
	logs: &logOptions{
		destination: logGroup,
		level: sfn.logLevel_ALL,
	},
})

See: https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html

Experimental.

const (
	// No Logging.
	// Experimental.
	LogLevel_OFF LogLevel = "OFF"
	// Log everything.
	// Experimental.
	LogLevel_ALL LogLevel = "ALL"
	// Log all errors.
	// Experimental.
	LogLevel_ERROR LogLevel = "ERROR"
	// Log fatal errors.
	// Experimental.
	LogLevel_FATAL LogLevel = "FATAL"
)

type LogOptions

type LogOptions struct {
	// The log group where the execution history events will be logged.
	// Experimental.
	Destination awslogs.ILogGroup `field:"required" json:"destination" yaml:"destination"`
	// Determines whether execution data is included in your log.
	// Experimental.
	IncludeExecutionData *bool `field:"optional" json:"includeExecutionData" yaml:"includeExecutionData"`
	// Defines which category of execution history events are logged.
	// Experimental.
	Level LogLevel `field:"optional" json:"level" yaml:"level"`
}

Defines what execution history events are logged and where they are logged.

Example:

import logs "github.com/aws/aws-cdk-go/awscdk"

logGroup := logs.NewLogGroup(this, jsii.String("MyLogGroup"))

sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
	definition: sfn.chain.start(sfn.NewPass(this, jsii.String("Pass"))),
	logs: &logOptions{
		destination: logGroup,
		level: sfn.logLevel_ALL,
	},
})

Experimental.

type Map

type Map interface {
	State
	INextable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a recovery handler for this state.
	//
	// When a particular error occurs, execution will continue at the error
	// handler instead of failing the state machine execution.
	// Experimental.
	AddCatch(handler IChainable, props *CatchProps) Map
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Add retry configuration for this state.
	//
	// This controls if and how the execution will be retried if a particular
	// error occurs.
	// Experimental.
	AddRetry(props *RetryProps) Map
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Define iterator state machine in Map.
	// Experimental.
	Iterator(iterator IChainable) Map
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate this state.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Map state in the state machine.

A `Map` state can be used to run a set of steps for each element of an input array. A Map state will execute the same steps for multiple entries of an array in the state input.

While the Parallel state executes multiple branches of steps using the same input, a Map state will execute the same steps for multiple entries of an array in the state input.

Example:

map := sfn.NewMap(this, jsii.String("Map State"), &mapProps{
	maxConcurrency: jsii.Number(1),
	itemsPath: sfn.jsonPath.stringAt(jsii.String("$.inputForMap")),
})
map.iterator(sfn.NewPass(this, jsii.String("Pass State")))

See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html

Experimental.

func NewMap

func NewMap(scope constructs.Construct, id *string, props *MapProps) Map

Experimental.

type MapProps

type MapProps struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select the array to iterate over.
	// Experimental.
	ItemsPath *string `field:"optional" json:"itemsPath" yaml:"itemsPath"`
	// MaxConcurrency.
	//
	// An upper bound on the number of iterations you want running at once.
	// Experimental.
	MaxConcurrency *float64 `field:"optional" json:"maxConcurrency" yaml:"maxConcurrency"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// The JSON that you want to override your default iteration input.
	// Experimental.
	Parameters *map[string]interface{} `field:"optional" json:"parameters" yaml:"parameters"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
	// The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
	//
	// You can use ResultSelector to create a payload with values that are static
	// or selected from the state's raw result.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector
	//
	// Experimental.
	ResultSelector *map[string]interface{} `field:"optional" json:"resultSelector" yaml:"resultSelector"`
}

Properties for defining a Map state.

Example:

map := sfn.NewMap(this, jsii.String("Map State"), &mapProps{
	maxConcurrency: jsii.Number(1),
	itemsPath: sfn.jsonPath.stringAt(jsii.String("$.inputForMap")),
})
map.iterator(sfn.NewPass(this, jsii.String("Pass State")))

Experimental.

type Parallel

type Parallel interface {
	State
	INextable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a recovery handler for this state.
	//
	// When a particular error occurs, execution will continue at the error
	// handler instead of failing the state machine execution.
	// Experimental.
	AddCatch(handler IChainable, props *CatchProps) Parallel
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Add retry configuration for this state.
	//
	// This controls if and how the execution will be retried if a particular
	// error occurs.
	// Experimental.
	AddRetry(props *RetryProps) Parallel
	// Overwrites State.bindToGraph. Adds branches to the Parallel state here so that any necessary prefixes are appended first.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Define one or more branches to run in parallel.
	// Experimental.
	Branch(branches ...IChainable) Parallel
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate this state.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Parallel state in the state machine.

A Parallel state can be used to run one or more state machines at the same time.

The Result of a Parallel state is an array of the results of its substatemachines.

Example:

import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/constructs-go/constructs"
import sfn "github.com/aws/aws-cdk-go/awscdk"

type myJobProps struct {
	jobFlavor *string
}

type myJob struct {
	stateMachineFragment
	startState state
	endStates []iNextable
}

func newMyJob(parent construct, id *string, props myJobProps) *myJob {
	this := &myJob{}
	sfn.NewStateMachineFragment_Override(this, parent, id)

	choice := sfn.NewChoice(this, jsii.String("Choice")).when(sfn.condition.stringEquals(jsii.String("$.branch"), jsii.String("left")), sfn.NewPass(this, jsii.String("Left Branch"))).when(sfn.condition.stringEquals(jsii.String("$.branch"), jsii.String("right")), sfn.NewPass(this, jsii.String("Right Branch")))

	// ...

	this.startState = choice
	this.endStates = choice.afterwards().endStates
	return this
}

type myStack struct {
	stack
}

func newMyStack(scope construct, id *string) *myStack {
	this := &myStack{}
	newStack_Override(this, scope, id)
	// Do 3 different variants of MyJob in parallel
	parallel := sfn.NewParallel(this, jsii.String("All jobs")).branch(NewMyJob(this, jsii.String("Quick"), &myJobProps{
		jobFlavor: jsii.String("quick"),
	}).prefixStates()).branch(NewMyJob(this, jsii.String("Medium"), &myJobProps{
		jobFlavor: jsii.String("medium"),
	}).prefixStates()).branch(NewMyJob(this, jsii.String("Slow"), &myJobProps{
		jobFlavor: jsii.String("slow"),
	}).prefixStates())

	sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
		definition: parallel,
	})
	return this
}

Experimental.

func NewParallel

func NewParallel(scope constructs.Construct, id *string, props *ParallelProps) Parallel

Experimental.

type ParallelProps

type ParallelProps struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
	// The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
	//
	// You can use ResultSelector to create a payload with values that are static
	// or selected from the state's raw result.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector
	//
	// Experimental.
	ResultSelector *map[string]interface{} `field:"optional" json:"resultSelector" yaml:"resultSelector"`
}

Properties for defining a Parallel state.

Example:

// 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"

var resultSelector interface{}

parallelProps := &parallelProps{
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
	resultPath: jsii.String("resultPath"),
	resultSelector: map[string]interface{}{
		"resultSelectorKey": resultSelector,
	},
}

Experimental.

type Pass

type Pass interface {
	State
	INextable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Pass in the state machine.

A Pass state can be used to transform the current execution's state.

Example:

choice := sfn.NewChoice(this, jsii.String("Did it work?"))

// Add conditions with .when()
successState := sfn.NewPass(this, jsii.String("SuccessState"))
failureState := sfn.NewPass(this, jsii.String("FailureState"))
choice.when(sfn.condition.stringEquals(jsii.String("$.status"), jsii.String("SUCCESS")), successState)
choice.when(sfn.condition.numberGreaterThan(jsii.String("$.attempts"), jsii.Number(5)), failureState)

// Use .otherwise() to indicate what should be done if none of the conditions match
tryAgainState := sfn.NewPass(this, jsii.String("TryAgainState"))
choice.otherwise(tryAgainState)

Experimental.

func NewPass

func NewPass(scope constructs.Construct, id *string, props *PassProps) Pass

Experimental.

type PassProps

type PassProps struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
	//
	// Experimental.
	Parameters *map[string]interface{} `field:"optional" json:"parameters" yaml:"parameters"`
	// If given, treat as the result of this operation.
	//
	// Can be used to inject or replace the current execution state.
	// Experimental.
	Result Result `field:"optional" json:"result" yaml:"result"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
}

Properties for defining a Pass state.

Example:

// Makes the current JSON state { ..., "subObject": { "hello": "world" } }
pass := sfn.NewPass(this, jsii.String("Add Hello World"), &passProps{
	result: sfn.result.fromObject(map[string]interface{}{
		"hello": jsii.String("world"),
	}),
	resultPath: jsii.String("$.subObject"),
})

// Set the next state
nextState := sfn.NewPass(this, jsii.String("NextState"))
pass.next(nextState)

Experimental.

type Result

type Result interface {
	// result of the Pass operation.
	// Experimental.
	Value() interface{}
}

The result of a Pass operation.

Example:

// Makes the current JSON state { ..., "subObject": { "hello": "world" } }
pass := sfn.NewPass(this, jsii.String("Add Hello World"), &passProps{
	result: sfn.result.fromObject(map[string]interface{}{
		"hello": jsii.String("world"),
	}),
	resultPath: jsii.String("$.subObject"),
})

// Set the next state
nextState := sfn.NewPass(this, jsii.String("NextState"))
pass.next(nextState)

Experimental.

func NewResult

func NewResult(value interface{}) Result

Experimental.

func Result_FromArray

func Result_FromArray(value *[]interface{}) Result

The result of the operation is an array. Experimental.

func Result_FromBoolean

func Result_FromBoolean(value *bool) Result

The result of the operation is a boolean. Experimental.

func Result_FromNumber

func Result_FromNumber(value *float64) Result

The result of the operation is a number. Experimental.

func Result_FromObject

func Result_FromObject(value *map[string]interface{}) Result

The result of the operation is an object. Experimental.

func Result_FromString

func Result_FromString(value *string) Result

The result of the operation is a string. Experimental.

type RetryProps

type RetryProps struct {
	// Multiplication for how much longer the wait interval gets on every retry.
	// Experimental.
	BackoffRate *float64 `field:"optional" json:"backoffRate" yaml:"backoffRate"`
	// Errors to retry.
	//
	// A list of error strings to retry, which can be either predefined errors
	// (for example Errors.NoChoiceMatched) or a self-defined error.
	// Experimental.
	Errors *[]*string `field:"optional" json:"errors" yaml:"errors"`
	// How many seconds to wait initially before retrying.
	// Experimental.
	Interval awscdk.Duration `field:"optional" json:"interval" yaml:"interval"`
	// How many times to retry this particular error.
	//
	// May be 0 to disable retry for specific errors (in case you have
	// a catch-all retry policy).
	// Experimental.
	MaxAttempts *float64 `field:"optional" json:"maxAttempts" yaml:"maxAttempts"`
}

Retry details.

Example:

parallel := sfn.NewParallel(this, jsii.String("Do the work in parallel"))

// Add branches to be executed in parallel
shipItem := sfn.NewPass(this, jsii.String("ShipItem"))
sendInvoice := sfn.NewPass(this, jsii.String("SendInvoice"))
restock := sfn.NewPass(this, jsii.String("Restock"))
parallel.branch(shipItem)
parallel.branch(sendInvoice)
parallel.branch(restock)

// Retry the whole workflow if something goes wrong
parallel.addRetry(&retryProps{
	maxAttempts: jsii.Number(1),
})

// How to recover from errors
sendFailureNotification := sfn.NewPass(this, jsii.String("SendFailureNotification"))
parallel.addCatch(sendFailureNotification)

// What to do in case everything succeeded
closeOrder := sfn.NewPass(this, jsii.String("CloseOrder"))
parallel.next(closeOrder)

Experimental.

type ServiceIntegrationPattern

type ServiceIntegrationPattern string

Three ways to call an integrated service: Request Response, Run a Job and Wait for a Callback with Task Token. See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html

Here, they are named as FIRE_AND_FORGET, SYNC and WAIT_FOR_TASK_TOKEN respectfully.

Experimental.

const (
	// Call a service and progress to the next state immediately after the API call completes.
	// Experimental.
	ServiceIntegrationPattern_FIRE_AND_FORGET ServiceIntegrationPattern = "FIRE_AND_FORGET"
	// Call a service and wait for a job to complete.
	// Experimental.
	ServiceIntegrationPattern_SYNC ServiceIntegrationPattern = "SYNC"
	// Call a service with a task token and wait until that token is returned by SendTaskSuccess/SendTaskFailure with payload.
	// Experimental.
	ServiceIntegrationPattern_WAIT_FOR_TASK_TOKEN ServiceIntegrationPattern = "WAIT_FOR_TASK_TOKEN"
)

type SingleStateOptions

type SingleStateOptions struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
	// The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
	//
	// You can use ResultSelector to create a payload with values that are static
	// or selected from the state's raw result.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector
	//
	// Experimental.
	ResultSelector *map[string]interface{} `field:"optional" json:"resultSelector" yaml:"resultSelector"`
	// String to prefix all stateIds in the state machine with.
	// Experimental.
	PrefixStates *string `field:"optional" json:"prefixStates" yaml:"prefixStates"`
	// ID of newly created containing state.
	// Experimental.
	StateId *string `field:"optional" json:"stateId" yaml:"stateId"`
}

Options for creating a single state.

Example:

// 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"

var resultSelector interface{}

singleStateOptions := &singleStateOptions{
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
	prefixStates: jsii.String("prefixStates"),
	resultPath: jsii.String("resultPath"),
	resultSelector: map[string]interface{}{
		"resultSelectorKey": resultSelector,
	},
	stateId: jsii.String("stateId"),
}

Experimental.

type State

type State interface {
	awscdk.Construct
	IChainable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Render the state as JSON.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Base class for all other state classes. Experimental.

type StateGraph

type StateGraph interface {
	// The accumulated policy statements.
	// Experimental.
	PolicyStatements() *[]awsiam.PolicyStatement
	// state that gets executed when the state machine is launched.
	// Experimental.
	StartState() State
	// Set a timeout to render into the graph JSON.
	//
	// Read/write. Only makes sense on the top-level graph, subgraphs
	// do not support this feature.
	// Experimental.
	Timeout() awscdk.Duration
	// Experimental.
	SetTimeout(val awscdk.Duration)
	// Register a Policy Statement used by states in this graph.
	// Experimental.
	RegisterPolicyStatement(statement awsiam.PolicyStatement)
	// Register a state as part of this graph.
	//
	// Called by State.bindToGraph().
	// Experimental.
	RegisterState(state State)
	// Register this graph as a child of the given graph.
	//
	// Resource changes will be bubbled up to the given graph.
	// Experimental.
	RegisterSuperGraph(graph StateGraph)
	// Return the Amazon States Language JSON for this graph.
	// Experimental.
	ToGraphJson() *map[string]interface{}
	// Return a string description of this graph.
	// Experimental.
	ToString() *string
}

A collection of connected states.

A StateGraph is used to keep track of all states that are connected (have transitions between them). It does not include the substatemachines in a Parallel's branches: those are their own StateGraphs, but the graphs themselves have a hierarchical relationship as well.

By assigning states to a definitive StateGraph, we verify that no state machines are constructed. In particular:

  • Every state object can only ever be in 1 StateGraph, and not inadvertently be used in two graphs.
  • Every stateId must be unique across all states in the entire state machine.

All policy statements in all states in all substatemachines are bubbled so that the top-level StateMachine instantiation can read them all and add them to the IAM Role.

You do not need to instantiate this class; it is used internally.

Example:

// 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"

var state state

stateGraph := awscdk.Aws_stepfunctions.NewStateGraph(state, jsii.String("graphDescription"))

Experimental.

func NewStateGraph

func NewStateGraph(startState State, graphDescription *string) StateGraph

Experimental.

type StateMachine

type StateMachine interface {
	awscdk.Resource
	IStateMachine
	// 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.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The principal this state machine is running as.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// Execution role of this state machine.
	// Experimental.
	Role() awsiam.IRole
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// The ARN of the state machine.
	// Experimental.
	StateMachineArn() *string
	// The name of the state machine.
	// Experimental.
	StateMachineName() *string
	// Type of the state machine.
	// Experimental.
	StateMachineType() StateMachineType
	// Add the given statement to the role's policy.
	// Experimental.
	AddToRolePolicy(statement awsiam.PolicyStatement)
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Grant the given identity custom permissions.
	// Experimental.
	Grant(identity awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Grant the given identity permissions on all executions of the state machine.
	// Experimental.
	GrantExecution(identity awsiam.IGrantable, actions ...*string) awsiam.Grant
	// Grant the given identity permissions to read results from state machine.
	// Experimental.
	GrantRead(identity awsiam.IGrantable) awsiam.Grant
	// Grant the given identity permissions to start an execution of this state machine.
	// Experimental.
	GrantStartExecution(identity awsiam.IGrantable) awsiam.Grant
	// Grant the given identity permissions to start a synchronous execution of this state machine.
	// Experimental.
	GrantStartSyncExecution(identity awsiam.IGrantable) awsiam.Grant
	// Grant the given identity task response permissions on a state machine.
	// Experimental.
	GrantTaskResponse(identity awsiam.IGrantable) awsiam.Grant
	// Return the given named metric for this State Machine's executions.
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that were aborted.
	// Experimental.
	MetricAborted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that failed.
	// Experimental.
	MetricFailed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that were started.
	// Experimental.
	MetricStarted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that succeeded.
	// Experimental.
	MetricSucceeded(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that were throttled.
	// Experimental.
	MetricThrottled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.
	// Experimental.
	MetricTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of executions that timed out.
	// Experimental.
	MetricTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

Define a StepFunctions State Machine.

Example:

import stepfunctions "github.com/aws/aws-cdk-go/awscdk"

pipeline := codepipeline.NewPipeline(this, jsii.String("MyPipeline"))
inputArtifact := codepipeline.NewArtifact()
startState := stepfunctions.NewPass(this, jsii.String("StartState"))
simpleStateMachine := stepfunctions.NewStateMachine(this, jsii.String("SimpleStateMachine"), &stateMachineProps{
	definition: startState,
})
stepFunctionAction := codepipeline_actions.NewStepFunctionInvokeAction(&stepFunctionsInvokeActionProps{
	actionName: jsii.String("Invoke"),
	stateMachine: simpleStateMachine,
	stateMachineInput: codepipeline_actions.stateMachineInput.filePath(inputArtifact.atPath(jsii.String("assets/input.json"))),
})
pipeline.addStage(&stageOptions{
	stageName: jsii.String("StepFunctions"),
	actions: []iAction{
		stepFunctionAction,
	},
})

Experimental.

func NewStateMachine

func NewStateMachine(scope constructs.Construct, id *string, props *StateMachineProps) StateMachine

Experimental.

type StateMachineFragment

type StateMachineFragment interface {
	awscdk.Construct
	IChainable
	// The states to chain onto if this fragment is used.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// The start state of this state machine fragment.
	// Experimental.
	StartState() State
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Prefix the IDs of all states in this state machine fragment.
	//
	// Use this to avoid multiple copies of the state machine all having the
	// same state IDs.
	// Experimental.
	PrefixStates(prefix *string) StateMachineFragment
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Wrap all states in this state machine fragment up into a single state.
	//
	// This can be used to add retry or error handling onto this state
	// machine fragment.
	//
	// Be aware that this changes the result of the inner state machine
	// to be an array with the result of the state machine in it. Adjust
	// your paths accordingly. For example, change 'outputPath' to
	// '$[0]'.
	// Experimental.
	ToSingleState(options *SingleStateOptions) Parallel
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

Base class for reusable state machine fragments.

Example:

import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/constructs-go/constructs"
import sfn "github.com/aws/aws-cdk-go/awscdk"

type myJobProps struct {
	jobFlavor *string
}

type myJob struct {
	stateMachineFragment
	startState state
	endStates []iNextable
}

func newMyJob(parent construct, id *string, props myJobProps) *myJob {
	this := &myJob{}
	sfn.NewStateMachineFragment_Override(this, parent, id)

	choice := sfn.NewChoice(this, jsii.String("Choice")).when(sfn.condition.stringEquals(jsii.String("$.branch"), jsii.String("left")), sfn.NewPass(this, jsii.String("Left Branch"))).when(sfn.condition.stringEquals(jsii.String("$.branch"), jsii.String("right")), sfn.NewPass(this, jsii.String("Right Branch")))

	// ...

	this.startState = choice
	this.endStates = choice.afterwards().endStates
	return this
}

type myStack struct {
	stack
}

func newMyStack(scope construct, id *string) *myStack {
	this := &myStack{}
	newStack_Override(this, scope, id)
	// Do 3 different variants of MyJob in parallel
	parallel := sfn.NewParallel(this, jsii.String("All jobs")).branch(NewMyJob(this, jsii.String("Quick"), &myJobProps{
		jobFlavor: jsii.String("quick"),
	}).prefixStates()).branch(NewMyJob(this, jsii.String("Medium"), &myJobProps{
		jobFlavor: jsii.String("medium"),
	}).prefixStates()).branch(NewMyJob(this, jsii.String("Slow"), &myJobProps{
		jobFlavor: jsii.String("slow"),
	}).prefixStates())

	sfn.NewStateMachine(this, jsii.String("MyStateMachine"), &stateMachineProps{
		definition: parallel,
	})
	return this
}

Experimental.

type StateMachineProps

type StateMachineProps struct {
	// Definition for this state machine.
	// Experimental.
	Definition IChainable `field:"required" json:"definition" yaml:"definition"`
	// Defines what execution history events are logged and where they are logged.
	// Experimental.
	Logs *LogOptions `field:"optional" json:"logs" yaml:"logs"`
	// The execution role for the state machine service.
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// A name for the state machine.
	// Experimental.
	StateMachineName *string `field:"optional" json:"stateMachineName" yaml:"stateMachineName"`
	// Type of the state machine.
	// Experimental.
	StateMachineType StateMachineType `field:"optional" json:"stateMachineType" yaml:"stateMachineType"`
	// Maximum run time for this state machine.
	// Experimental.
	Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
	// Specifies whether Amazon X-Ray tracing is enabled for this state machine.
	// Experimental.
	TracingEnabled *bool `field:"optional" json:"tracingEnabled" yaml:"tracingEnabled"`
}

Properties for defining a State Machine.

Example:

import stepfunctions "github.com/aws/aws-cdk-go/awscdk"

pipeline := codepipeline.NewPipeline(this, jsii.String("MyPipeline"))
inputArtifact := codepipeline.NewArtifact()
startState := stepfunctions.NewPass(this, jsii.String("StartState"))
simpleStateMachine := stepfunctions.NewStateMachine(this, jsii.String("SimpleStateMachine"), &stateMachineProps{
	definition: startState,
})
stepFunctionAction := codepipeline_actions.NewStepFunctionInvokeAction(&stepFunctionsInvokeActionProps{
	actionName: jsii.String("Invoke"),
	stateMachine: simpleStateMachine,
	stateMachineInput: codepipeline_actions.stateMachineInput.filePath(inputArtifact.atPath(jsii.String("assets/input.json"))),
})
pipeline.addStage(&stageOptions{
	stageName: jsii.String("StepFunctions"),
	actions: []iAction{
		stepFunctionAction,
	},
})

Experimental.

type StateMachineType

type StateMachineType string

Two types of state machines are available in AWS Step Functions: EXPRESS AND STANDARD.

Example:

stateMachineDefinition := stepfunctions.NewPass(this, jsii.String("PassState"))

stateMachine := stepfunctions.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: stateMachineDefinition,
	stateMachineType: stepfunctions.stateMachineType_EXPRESS,
})

apigateway.NewStepFunctionsRestApi(this, jsii.String("StepFunctionsRestApi"), &stepFunctionsRestApiProps{
	deploy: jsii.Boolean(true),
	stateMachine: stateMachine,
})

See: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html

Experimental.

const (
	// Express Workflows are ideal for high-volume, event processing workloads.
	// Experimental.
	StateMachineType_EXPRESS StateMachineType = "EXPRESS"
	// Standard Workflows are ideal for long-running, durable, and auditable workflows.
	// Experimental.
	StateMachineType_STANDARD StateMachineType = "STANDARD"
)

type StateProps

type StateProps struct {
	// A comment describing this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
	//
	// Experimental.
	Parameters *map[string]interface{} `field:"optional" json:"parameters" yaml:"parameters"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
	// The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
	//
	// You can use ResultSelector to create a payload with values that are static
	// or selected from the state's raw result.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector
	//
	// Experimental.
	ResultSelector *map[string]interface{} `field:"optional" json:"resultSelector" yaml:"resultSelector"`
}

Properties shared by all states.

Example:

// 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"

var parameters interface{}
var resultSelector interface{}

stateProps := &stateProps{
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
	parameters: map[string]interface{}{
		"parametersKey": parameters,
	},
	resultPath: jsii.String("resultPath"),
	resultSelector: map[string]interface{}{
		"resultSelectorKey": resultSelector,
	},
}

Experimental.

type StateTransitionMetric

type StateTransitionMetric interface {
}

Metrics on the rate limiting performed on state machine execution.

These rate limits are shared across all state machines.

Example:

cloudwatch.NewAlarm(this, jsii.String("ThrottledAlarm"), &alarmProps{
	metric: sfn.stateTransitionMetric.metricThrottledEvents(),
	threshold: jsii.Number(10),
	evaluationPeriods: jsii.Number(2),
})

Experimental.

func NewStateTransitionMetric

func NewStateTransitionMetric() StateTransitionMetric

Experimental.

type StepFunctionsTaskConfig deprecated

type StepFunctionsTaskConfig struct {
	// The resource that represents the work to be executed.
	//
	// Either the ARN of a Lambda Function or Activity, or a special
	// ARN.
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	ResourceArn *string `field:"required" json:"resourceArn" yaml:"resourceArn"`
	// Maximum time between heart beats.
	//
	// If the time between heart beats takes longer than this, a 'Timeout' error is raised.
	//
	// This is only relevant when using an Activity type as resource.
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	Heartbeat awscdk.Duration `field:"optional" json:"heartbeat" yaml:"heartbeat"`
	// The dimensions to attach to metrics.
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	MetricDimensions *map[string]interface{} `field:"optional" json:"metricDimensions" yaml:"metricDimensions"`
	// Prefix for plural metric names of activity actions.
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	MetricPrefixPlural *string `field:"optional" json:"metricPrefixPlural" yaml:"metricPrefixPlural"`
	// Prefix for singular metric names of activity actions.
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	MetricPrefixSingular *string `field:"optional" json:"metricPrefixSingular" yaml:"metricPrefixSingular"`
	// Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
	//
	// The meaning of these parameters is task-dependent.
	//
	// Its values will be merged with the `parameters` property which is configured directly
	// on the Task state.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
	//
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	Parameters *map[string]interface{} `field:"optional" json:"parameters" yaml:"parameters"`
	// Additional policy statements to add to the execution role.
	// Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.
	PolicyStatements *[]awsiam.PolicyStatement `field:"optional" json:"policyStatements" yaml:"policyStatements"`
}

Properties that define what kind of task should be created.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import monocdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var duration duration
var metricDimensions interface{}
var parameters interface{}
var policyStatement policyStatement

stepFunctionsTaskConfig := &stepFunctionsTaskConfig{
	resourceArn: jsii.String("resourceArn"),

	// the properties below are optional
	heartbeat: duration,
	metricDimensions: map[string]interface{}{
		"metricDimensionsKey": metricDimensions,
	},
	metricPrefixPlural: jsii.String("metricPrefixPlural"),
	metricPrefixSingular: jsii.String("metricPrefixSingular"),
	parameters: map[string]interface{}{
		"parametersKey": parameters,
	},
	policyStatements: []*policyStatement{
		policyStatement,
	},
}

Deprecated: used by `IStepFunctionsTask`. `IStepFunctionsTask` is deprecated and replaced by `TaskStateBase`.

type Succeed

type Succeed interface {
	State
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Succeed state in the state machine.

Reaching a Succeed state terminates the state execution in success.

Example:

success := sfn.NewSucceed(this, jsii.String("We did it!"))

Experimental.

func NewSucceed

func NewSucceed(scope constructs.Construct, id *string, props *SucceedProps) Succeed

Experimental.

type SucceedProps

type SucceedProps struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
}

Properties for defining a Succeed state.

Example:

// 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"

succeedProps := &succeedProps{
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
}

Experimental.

type Task deprecated

type Task interface {
	State
	INextable
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Branches() *[]StateGraph
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Comment() *string
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	DefaultChoice() State
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Id() *string
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	InputPath() *string
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Iteration() StateGraph
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Node() awscdk.ConstructNode
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	OutputPath() *string
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Parameters() *map[string]interface{}
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	ResultPath() *string
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	StateId() *string
	// Add a paralle branch to this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	AddBranch(branch StateGraph)
	// Add a recovery handler for this state.
	//
	// When a particular error occurs, execution will continue at the error
	// handler instead of failing the state machine execution.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	AddCatch(handler IChainable, props *CatchProps) Task
	// Add a choice branch to this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	AddPrefix(x *string)
	// Add retry configuration for this state.
	//
	// This controls if and how the execution will be retried if a particular
	// error occurs.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	AddRetry(props *RetryProps) Task
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MakeNext(next State)
	// Return the given named metric for this Task.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity fails.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricFailed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times the heartbeat times out for this activity.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricHeartbeatTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, between the time the Task starts and the time it closes.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricRunTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity is scheduled.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricScheduled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, for which the activity stays in the schedule state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricScheduleTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity is started.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricStarted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity succeeds.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricSucceeded(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, between the time the activity is scheduled and the time it closes.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity times out.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	MetricTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Continue normal execution with the given state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	WhenBoundToGraph(graph StateGraph)
}

Define a Task state in the state machine.

Reaching a Task state causes some work to be executed, represented by the Task's resource property. Task constructs represent a generic Amazon States Language Task.

For some resource types, more specific subclasses of Task may be available which are more convenient to use.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import monocdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var duration duration
var parameters interface{}
var stepFunctionsTask iStepFunctionsTask

task := awscdk.Aws_stepfunctions.NewTask(this, jsii.String("MyTask"), &taskProps{
	task: stepFunctionsTask,

	// the properties below are optional
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
	parameters: map[string]interface{}{
		"parametersKey": parameters,
	},
	resultPath: jsii.String("resultPath"),
	timeout: duration,
})

Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

func NewTask deprecated

func NewTask(scope constructs.Construct, id *string, props *TaskProps) Task

Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

type TaskInput

type TaskInput interface {
	// type of task input.
	// Experimental.
	Type() InputType
	// payload for the corresponding input type.
	//
	// It can be a JSON-encoded object, context, data, etc.
	// Experimental.
	Value() interface{}
}

Type union for task classes that accept multiple types of payload.

Example:

var fn function

tasks.NewLambdaInvoke(this, jsii.String("Invoke with callback"), &lambdaInvokeProps{
	lambdaFunction: fn,
	integrationPattern: sfn.integrationPattern_WAIT_FOR_TASK_TOKEN,
	payload: sfn.taskInput.fromObject(map[string]interface{}{
		"token": sfn.JsonPath.taskToken,
		"input": sfn.JsonPath.stringAt(jsii.String("$.someField")),
	}),
})

Experimental.

func TaskInput_FromContextAt

func TaskInput_FromContextAt(path *string) TaskInput

Use a part of the task context as task input.

Use this when you want to use a subobject or string from the current task context as complete payload to a task. Deprecated: Use `fromJsonPathAt`.

func TaskInput_FromDataAt

func TaskInput_FromDataAt(path *string) TaskInput

Use a part of the execution data as task input.

Use this when you want to use a subobject or string from the current state machine execution as complete payload to a task. Deprecated: Use `fromJsonPathAt`.

func TaskInput_FromJsonPathAt

func TaskInput_FromJsonPathAt(path *string) TaskInput

Use a part of the execution data or task context as task input.

Use this when you want to use a subobject or string from the current state machine execution or the current task context as complete payload to a task. Experimental.

func TaskInput_FromObject

func TaskInput_FromObject(obj *map[string]interface{}) TaskInput

Use an object as task input.

This object may contain JSON path fields as object values, if desired. Experimental.

func TaskInput_FromText

func TaskInput_FromText(text *string) TaskInput

Use a literal string as task input.

This might be a JSON-encoded object, or just a text. Experimental.

type TaskMetricsConfig

type TaskMetricsConfig struct {
	// The dimensions to attach to metrics.
	// Experimental.
	MetricDimensions *map[string]interface{} `field:"optional" json:"metricDimensions" yaml:"metricDimensions"`
	// Prefix for plural metric names of activity actions.
	// Experimental.
	MetricPrefixPlural *string `field:"optional" json:"metricPrefixPlural" yaml:"metricPrefixPlural"`
	// Prefix for singular metric names of activity actions.
	// Experimental.
	MetricPrefixSingular *string `field:"optional" json:"metricPrefixSingular" yaml:"metricPrefixSingular"`
}

Task Metrics.

Example:

// 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"

var metricDimensions interface{}

taskMetricsConfig := &taskMetricsConfig{
	metricDimensions: map[string]interface{}{
		"metricDimensionsKey": metricDimensions,
	},
	metricPrefixPlural: jsii.String("metricPrefixPlural"),
	metricPrefixSingular: jsii.String("metricPrefixSingular"),
}

Experimental.

type TaskProps deprecated

type TaskProps struct {
	// Actual task to be invoked in this workflow.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Task IStepFunctionsTask `field:"required" json:"task" yaml:"task"`
	// An optional description for this state.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// JSONPath expression to select part of the state to be the output to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// Parameters to invoke the task with.
	//
	// It is not recommended to use this field. The object that is passed in
	// the `task` property will take care of returning the right values for the
	// `Parameters` field in the Step Functions definition.
	//
	// The various classes that implement `IStepFunctionsTask` will take a
	// properties which make sense for the task type. For example, for
	// `InvokeFunction` the field that populates the `parameters` field will be
	// called `payload`, and for the `PublishToTopic` the `parameters` field
	// will be populated via a combination of the referenced topic, subject and
	// message.
	//
	// If passed anyway, the keys in this map will override the parameters
	// returned by the task object.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
	//
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Parameters *map[string]interface{} `field:"optional" json:"parameters" yaml:"parameters"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
	// Maximum run time of this state.
	//
	// If the state takes longer than this amount of time to complete, a 'Timeout' error is raised.
	// Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)
	Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}

Props that are common to all tasks.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import monocdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var duration duration
var parameters interface{}
var stepFunctionsTask iStepFunctionsTask

taskProps := &taskProps{
	task: stepFunctionsTask,

	// the properties below are optional
	comment: jsii.String("comment"),
	inputPath: jsii.String("inputPath"),
	outputPath: jsii.String("outputPath"),
	parameters: map[string]interface{}{
		"parametersKey": parameters,
	},
	resultPath: jsii.String("resultPath"),
	timeout: duration,
}

Deprecated: - replaced by service integration specific classes (i.e. LambdaInvoke, SnsPublish)

type TaskStateBase

type TaskStateBase interface {
	State
	INextable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Experimental.
	TaskMetrics() *TaskMetricsConfig
	// Experimental.
	TaskPolicies() *[]awsiam.PolicyStatement
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a recovery handler for this state.
	//
	// When a particular error occurs, execution will continue at the error
	// handler instead of failing the state machine execution.
	// Experimental.
	AddCatch(handler IChainable, props *CatchProps) TaskStateBase
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Add retry configuration for this state.
	//
	// This controls if and how the execution will be retried if a particular
	// error occurs.
	// Experimental.
	AddRetry(props *RetryProps) TaskStateBase
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Return the given named metric for this Task.
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity fails.
	// Experimental.
	MetricFailed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times the heartbeat times out for this activity.
	// Experimental.
	MetricHeartbeatTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, between the time the Task starts and the time it closes.
	// Experimental.
	MetricRunTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity is scheduled.
	// Experimental.
	MetricScheduled(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, for which the activity stays in the schedule state.
	// Experimental.
	MetricScheduleTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity is started.
	// Experimental.
	MetricStarted(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity succeeds.
	// Experimental.
	MetricSucceeded(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The interval, in milliseconds, between the time the activity is scheduled and the time it closes.
	// Experimental.
	MetricTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Metric for the number of times this activity times out.
	// Experimental.
	MetricTimedOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Task state in the state machine.

Reaching a Task state causes some work to be executed, represented by the Task's resource property. Task constructs represent a generic Amazon States Language Task.

For some resource types, more specific subclasses of Task may be available which are more convenient to use. Experimental.

type TaskStateBaseProps

type TaskStateBaseProps struct {
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
	// Timeout for the heartbeat.
	// Experimental.
	Heartbeat awscdk.Duration `field:"optional" json:"heartbeat" yaml:"heartbeat"`
	// JSONPath expression to select part of the state to be the input to this state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// input to be the empty object {}.
	// Experimental.
	InputPath *string `field:"optional" json:"inputPath" yaml:"inputPath"`
	// AWS Step Functions integrates with services directly in the Amazon States Language.
	//
	// You can control these AWS services using service integration patterns.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token
	//
	// Experimental.
	IntegrationPattern IntegrationPattern `field:"optional" json:"integrationPattern" yaml:"integrationPattern"`
	// JSONPath expression to select select a portion of the state output to pass to the next state.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the effective
	// output to be the empty object {}.
	// Experimental.
	OutputPath *string `field:"optional" json:"outputPath" yaml:"outputPath"`
	// JSONPath expression to indicate where to inject the state's output.
	//
	// May also be the special value JsonPath.DISCARD, which will cause the state's
	// input to become its output.
	// Experimental.
	ResultPath *string `field:"optional" json:"resultPath" yaml:"resultPath"`
	// The JSON that will replace the state's raw result and become the effective result before ResultPath is applied.
	//
	// You can use ResultSelector to create a payload with values that are static
	// or selected from the state's raw result.
	// See: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-resultselector
	//
	// Experimental.
	ResultSelector *map[string]interface{} `field:"optional" json:"resultSelector" yaml:"resultSelector"`
	// Timeout for the state machine.
	// Experimental.
	Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}

Props that are common to all tasks.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import monocdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var duration duration
var resultSelector interface{}

taskStateBaseProps := &taskStateBaseProps{
	comment: jsii.String("comment"),
	heartbeat: duration,
	inputPath: jsii.String("inputPath"),
	integrationPattern: awscdk.Aws_stepfunctions.integrationPattern_REQUEST_RESPONSE,
	outputPath: jsii.String("outputPath"),
	resultPath: jsii.String("resultPath"),
	resultSelector: map[string]interface{}{
		"resultSelectorKey": resultSelector,
	},
	timeout: duration,
}

Experimental.

type Wait

type Wait interface {
	State
	INextable
	// Experimental.
	Branches() *[]StateGraph
	// Experimental.
	Comment() *string
	// Experimental.
	DefaultChoice() State
	// Experimental.
	SetDefaultChoice(val State)
	// Continuable states of this Chainable.
	// Experimental.
	EndStates() *[]INextable
	// Descriptive identifier for this chainable.
	// Experimental.
	Id() *string
	// Experimental.
	InputPath() *string
	// Experimental.
	Iteration() StateGraph
	// Experimental.
	SetIteration(val StateGraph)
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Experimental.
	OutputPath() *string
	// Experimental.
	Parameters() *map[string]interface{}
	// Experimental.
	ResultPath() *string
	// Experimental.
	ResultSelector() *map[string]interface{}
	// First state of this Chainable.
	// Experimental.
	StartState() State
	// Tokenized string that evaluates to the state's ID.
	// Experimental.
	StateId() *string
	// Add a paralle branch to this state.
	// Experimental.
	AddBranch(branch StateGraph)
	// Add a choice branch to this state.
	// Experimental.
	AddChoice(condition Condition, next State)
	// Add a map iterator to this state.
	// Experimental.
	AddIterator(iteration StateGraph)
	// Add a prefix to the stateId of this state.
	// Experimental.
	AddPrefix(x *string)
	// Register this state as part of the given graph.
	//
	// Don't call this. It will be called automatically when you work
	// with states normally.
	// Experimental.
	BindToGraph(graph StateGraph)
	// Make the indicated state the default choice transition of this state.
	// Experimental.
	MakeDefault(def State)
	// Make the indicated state the default transition of this state.
	// Experimental.
	MakeNext(next State)
	// Continue normal execution with the given state.
	// Experimental.
	Next(next IChainable) Chain
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Render parallel branches in ASL JSON format.
	// Experimental.
	RenderBranches() interface{}
	// Render the choices in ASL JSON format.
	// Experimental.
	RenderChoices() interface{}
	// Render InputPath/Parameters/OutputPath in ASL JSON format.
	// Experimental.
	RenderInputOutput() interface{}
	// Render map iterator in ASL JSON format.
	// Experimental.
	RenderIterator() interface{}
	// Render the default next state in ASL JSON format.
	// Experimental.
	RenderNextEnd() interface{}
	// Render ResultSelector in ASL JSON format.
	// Experimental.
	RenderResultSelector() interface{}
	// Render error recovery options in ASL JSON format.
	// Experimental.
	RenderRetryCatch() interface{}
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Return the Amazon States Language object for this state.
	// Experimental.
	ToStateJson() *map[string]interface{}
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
	// Called whenever this state is bound to a graph.
	//
	// Can be overridden by subclasses.
	// Experimental.
	WhenBoundToGraph(graph StateGraph)
}

Define a Wait state in the state machine.

A Wait state can be used to delay execution of the state machine for a while.

Example:

convertToSeconds := tasks.NewEvaluateExpression(this, jsii.String("Convert to seconds"), &evaluateExpressionProps{
	expression: jsii.String("$.waitMilliseconds / 1000"),
	resultPath: jsii.String("$.waitSeconds"),
})

createMessage := tasks.NewEvaluateExpression(this, jsii.String("Create message"), &evaluateExpressionProps{
	// Note: this is a string inside a string.
	expression: jsii.String("`Now waiting ${$.waitSeconds} seconds...`"),
	runtime: lambda.runtime_NODEJS_14_X(),
	resultPath: jsii.String("$.message"),
})

publishMessage := tasks.NewSnsPublish(this, jsii.String("Publish message"), &snsPublishProps{
	topic: sns.NewTopic(this, jsii.String("cool-topic")),
	message: sfn.taskInput.fromJsonPathAt(jsii.String("$.message")),
	resultPath: jsii.String("$.sns"),
})

wait := sfn.NewWait(this, jsii.String("Wait"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: convertToSeconds.next(createMessage).next(publishMessage).next(wait),
})

Experimental.

func NewWait

func NewWait(scope constructs.Construct, id *string, props *WaitProps) Wait

Experimental.

type WaitProps

type WaitProps struct {
	// Wait duration.
	// Experimental.
	Time WaitTime `field:"required" json:"time" yaml:"time"`
	// An optional description for this state.
	// Experimental.
	Comment *string `field:"optional" json:"comment" yaml:"comment"`
}

Properties for defining a Wait state.

Example:

convertToSeconds := tasks.NewEvaluateExpression(this, jsii.String("Convert to seconds"), &evaluateExpressionProps{
	expression: jsii.String("$.waitMilliseconds / 1000"),
	resultPath: jsii.String("$.waitSeconds"),
})

createMessage := tasks.NewEvaluateExpression(this, jsii.String("Create message"), &evaluateExpressionProps{
	// Note: this is a string inside a string.
	expression: jsii.String("`Now waiting ${$.waitSeconds} seconds...`"),
	runtime: lambda.runtime_NODEJS_14_X(),
	resultPath: jsii.String("$.message"),
})

publishMessage := tasks.NewSnsPublish(this, jsii.String("Publish message"), &snsPublishProps{
	topic: sns.NewTopic(this, jsii.String("cool-topic")),
	message: sfn.taskInput.fromJsonPathAt(jsii.String("$.message")),
	resultPath: jsii.String("$.sns"),
})

wait := sfn.NewWait(this, jsii.String("Wait"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: convertToSeconds.next(createMessage).next(publishMessage).next(wait),
})

Experimental.

type WaitTime

type WaitTime interface {
}

Represents the Wait state which delays a state machine from continuing for a specified time.

Example:

convertToSeconds := tasks.NewEvaluateExpression(this, jsii.String("Convert to seconds"), &evaluateExpressionProps{
	expression: jsii.String("$.waitMilliseconds / 1000"),
	resultPath: jsii.String("$.waitSeconds"),
})

createMessage := tasks.NewEvaluateExpression(this, jsii.String("Create message"), &evaluateExpressionProps{
	// Note: this is a string inside a string.
	expression: jsii.String("`Now waiting ${$.waitSeconds} seconds...`"),
	runtime: lambda.runtime_NODEJS_14_X(),
	resultPath: jsii.String("$.message"),
})

publishMessage := tasks.NewSnsPublish(this, jsii.String("Publish message"), &snsPublishProps{
	topic: sns.NewTopic(this, jsii.String("cool-topic")),
	message: sfn.taskInput.fromJsonPathAt(jsii.String("$.message")),
	resultPath: jsii.String("$.sns"),
})

wait := sfn.NewWait(this, jsii.String("Wait"), &waitProps{
	time: sfn.waitTime.secondsPath(jsii.String("$.waitSeconds")),
})

sfn.NewStateMachine(this, jsii.String("StateMachine"), &stateMachineProps{
	definition: convertToSeconds.next(createMessage).next(publishMessage).next(wait),
})

See: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html

Experimental.

func WaitTime_Duration

func WaitTime_Duration(duration awscdk.Duration) WaitTime

Wait a fixed amount of time. Experimental.

func WaitTime_SecondsPath

func WaitTime_SecondsPath(path *string) WaitTime

Wait for a number of seconds stored in the state object.

Example value: `$.waitSeconds` Experimental.

func WaitTime_Timestamp

func WaitTime_Timestamp(timestamp *string) WaitTime

Wait until the given ISO8601 timestamp.

Example value: `2016-03-14T01:59:00Z`. Experimental.

func WaitTime_TimestampPath

func WaitTime_TimestampPath(path *string) WaitTime

Wait until a timestamp found in the state object.

Example value: `$.waitTimestamp` Experimental.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL