Skip to content

Latest commit

 

History

History
420 lines (251 loc) · 14.3 KB

API.md.md

File metadata and controls

420 lines (251 loc) · 14.3 KB

API Reference

Constructs

Semaphore

Generates a semaphore for a StepFunction job (or chained set of jobs) to limit parallelism across executions.

Initializers

import { Semaphore } from '@dontirun/state-machine-semaphore'

new Semaphore(scope: Construct, id: string, props: SemaphoreProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props SemaphoreProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.
next Continue normal execution with the given state.
prefixStates Prefix the IDs of all states in this state machine fragment.
toSingleState Wrap all states in this state machine fragment up into a single state.

toString
public toString(): string

Returns a string representation of this construct.

next
public next(next: IChainable): Chain

Continue normal execution with the given state.

nextRequired
  • Type: aws-cdk-lib.aws_stepfunctions.IChainable

prefixStates
public prefixStates(prefix?: string): StateMachineFragment

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.

prefixOptional
  • Type: string

The prefix to add.

Will use construct ID by default.


toSingleState
public toSingleState(options?: SingleStateOptions): Parallel

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]'.

optionsOptional
  • Type: aws-cdk-lib.aws_stepfunctions.SingleStateOptions

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { Semaphore } from '@dontirun/state-machine-semaphore'

Semaphore.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
endStates aws-cdk-lib.aws_stepfunctions.INextable[] The states to chain onto if this fragment is used.
id string Descriptive identifier for this chainable.
startState aws-cdk-lib.aws_stepfunctions.State The start state of this state machine fragment.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


endStatesRequired
public readonly endStates: INextable[];
  • Type: aws-cdk-lib.aws_stepfunctions.INextable[]

The states to chain onto if this fragment is used.


idRequired
public readonly id: string;
  • Type: string

Descriptive identifier for this chainable.


startStateRequired
public readonly startState: State;
  • Type: aws-cdk-lib.aws_stepfunctions.State

The start state of this state machine fragment.


Structs

SemaphoreProps

Interface for creating a Semaphore.

Initializer

import { SemaphoreProps } from '@dontirun/state-machine-semaphore'

const semaphoreProps: SemaphoreProps = { ... }

Properties

Name Type Description
job IChainNextable The job (or chained jobs) to be semaphored.
limit number The maximum number of concurrent executions for the given lock.
lockName string The name of the semaphore.
nextState aws-cdk-lib.aws_stepfunctions.State The State to go to after the semaphored job completes.
comments boolean Add detailed comments to lock related states.
reuseLock boolean Explicility allow the reuse of a named lock from a previously generated job.
tableReadWriteCapacity TableReadWriteCapacity Optionally set the DynamoDB table to have a specific read/write capacity with PROVISIONED billing.

jobRequired
public readonly job: IChainNextable;

The job (or chained jobs) to be semaphored.


limitRequired
public readonly limit: number;
  • Type: number

The maximum number of concurrent executions for the given lock.


lockNameRequired
public readonly lockName: string;
  • Type: string

The name of the semaphore.


nextStateRequired
public readonly nextState: State;
  • Type: aws-cdk-lib.aws_stepfunctions.State

The State to go to after the semaphored job completes.


commentsOptional
public readonly comments: boolean;
  • Type: boolean

Add detailed comments to lock related states.

Significantly increases CloudFormation template size. Default: false.


reuseLockOptional
public readonly reuseLock: boolean;
  • Type: boolean

Explicility allow the reuse of a named lock from a previously generated job.

Throws an error if a different limit is specified. Default: false.


tableReadWriteCapacityOptional
public readonly tableReadWriteCapacity: TableReadWriteCapacity;

Optionally set the DynamoDB table to have a specific read/write capacity with PROVISIONED billing.

Note: This property can only be set on the first instantiation of a Semaphore per stack


TableReadWriteCapacity

Read and write capacity for a PROVISIONED billing DynamoDB table.

Initializer

import { TableReadWriteCapacity } from '@dontirun/state-machine-semaphore'

const tableReadWriteCapacity: TableReadWriteCapacity = { ... }

Properties

Name Type Description
readCapacity number No description.
writeCapacity number No description.

readCapacityRequired
public readonly readCapacity: number;
  • Type: number

writeCapacityRequired
public readonly writeCapacity: number;
  • Type: number

Protocols

IChainNextable

  • Extends: aws-cdk-lib.aws_stepfunctions.IChainable, aws-cdk-lib.aws_stepfunctions.INextable

  • Implemented By: IChainNextable

Properties

Name Type Description
endStates aws-cdk-lib.aws_stepfunctions.INextable[] The chainable end state(s) of this chainable.
id string Descriptive identifier for this chainable.
startState aws-cdk-lib.aws_stepfunctions.State The start state of this chainable.

endStatesRequired
public readonly endStates: INextable[];
  • Type: aws-cdk-lib.aws_stepfunctions.INextable[]

The chainable end state(s) of this chainable.


idRequired
public readonly id: string;
  • Type: string

Descriptive identifier for this chainable.


startStateRequired
public readonly startState: State;
  • Type: aws-cdk-lib.aws_stepfunctions.State

The start state of this chainable.