HttpStepFunctionsIntegration Class
The StepFunctions integration resource for HTTP API.
Example
ts
import { HttpStepFunctionsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';
declare const stateMachine: sfn.StateMachine;
declare const httpApi: apigwv2.HttpApi;
httpApi.addRoutes({
path: '/start',
methods: [ apigwv2.HttpMethod.POST ],
integration: new HttpStepFunctionsIntegration('StartExecutionIntegration', {
stateMachine,
subtype: apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION,
}),
});
httpApi.addRoutes({
path: '/start-sync',
methods: [ apigwv2.HttpMethod.POST ],
integration: new HttpStepFunctionsIntegration('StartSyncExecutionIntegration', {
stateMachine,
subtype: apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION,
}),
});
httpApi.addRoutes({
path: '/stop',
methods: [ apigwv2.HttpMethod.POST ],
integration: new HttpStepFunctionsIntegration('StopExecutionIntegration', {
stateMachine,
subtype: apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION,
// For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
parameterMapping: new apigwv2.ParameterMapping()
.custom('ExecutionArn', '$request.querystring.executionArn'),
}),
});
python
from aws_cdk.aws_apigatewayv2_integrations import HttpStepFunctionsIntegration
import aws_cdk.aws_stepfunctions as sfn
# state_machine: sfn.StateMachine
# http_api: apigwv2.HttpApi
http_api.add_routes(
path="/start",
methods=[apigwv2.HttpMethod.POST],
integration=HttpStepFunctionsIntegration("StartExecutionIntegration",
state_machine=state_machine,
subtype=apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION
)
)
http_api.add_routes(
path="/start-sync",
methods=[apigwv2.HttpMethod.POST],
integration=HttpStepFunctionsIntegration("StartSyncExecutionIntegration",
state_machine=state_machine,
subtype=apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION
)
)
http_api.add_routes(
path="/stop",
methods=[apigwv2.HttpMethod.POST],
integration=HttpStepFunctionsIntegration("StopExecutionIntegration",
state_machine=state_machine,
subtype=apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION,
# For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
parameter_mapping=apigwv2.ParameterMapping().custom("ExecutionArn", "$request.querystring.executionArn")
)
)
java
import software.amazon.awscdk.aws_apigatewayv2_integrations.HttpStepFunctionsIntegration;
import software.amazon.awscdk.services.stepfunctions.*;
StateMachine stateMachine;
HttpApi httpApi;
httpApi.addRoutes(AddRoutesOptions.builder()
.path("/start")
.methods(List.of(HttpMethod.POST))
.integration(HttpStepFunctionsIntegration.Builder.create("StartExecutionIntegration")
.stateMachine(stateMachine)
.subtype(HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION)
.build())
.build());
httpApi.addRoutes(AddRoutesOptions.builder()
.path("/start-sync")
.methods(List.of(HttpMethod.POST))
.integration(HttpStepFunctionsIntegration.Builder.create("StartSyncExecutionIntegration")
.stateMachine(stateMachine)
.subtype(HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION)
.build())
.build());
httpApi.addRoutes(AddRoutesOptions.builder()
.path("/stop")
.methods(List.of(HttpMethod.POST))
.integration(HttpStepFunctionsIntegration.Builder.create("StopExecutionIntegration")
.stateMachine(stateMachine)
.subtype(HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION)
// For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
.parameterMapping(new ParameterMapping().custom("ExecutionArn", "$request.querystring.executionArn"))
.build())
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AwsApigatewayv2Integrations;
using Amazon.CDK.AWS.StepFunctions;
StateMachine stateMachine;
HttpApi httpApi;
httpApi.AddRoutes(new AddRoutesOptions {
Path = "/start",
Methods = new [] { HttpMethod.POST },
Integration = new HttpStepFunctionsIntegration("StartExecutionIntegration", new HttpStepFunctionsIntegrationProps {
StateMachine = stateMachine,
Subtype = HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION
})
});
httpApi.AddRoutes(new AddRoutesOptions {
Path = "/start-sync",
Methods = new [] { HttpMethod.POST },
Integration = new HttpStepFunctionsIntegration("StartSyncExecutionIntegration", new HttpStepFunctionsIntegrationProps {
StateMachine = stateMachine,
Subtype = HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION
})
});
httpApi.AddRoutes(new AddRoutesOptions {
Path = "/stop",
Methods = new [] { HttpMethod.POST },
Integration = new HttpStepFunctionsIntegration("StopExecutionIntegration", new HttpStepFunctionsIntegrationProps {
StateMachine = stateMachine,
Subtype = HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION,
// For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
ParameterMapping = new ParameterMapping().Custom("ExecutionArn", "$request.querystring.executionArn")
})
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"
import sfn "github.com/aws/aws-cdk-go/awscdk"
var stateMachine StateMachine
var httpApi HttpApi
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/start"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StartExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_START_EXECUTION,
}),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/start-sync"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StartSyncExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_START_SYNC_EXECUTION,
}),
})
httpApi.AddRoutes(&AddRoutesOptions{
Path: jsii.String("/stop"),
Methods: []HttpMethod{
apigwv2.HttpMethod_POST,
},
Integration: awscdk.NewHttpStepFunctionsIntegration(jsii.String("StopExecutionIntegration"), &HttpStepFunctionsIntegrationProps{
StateMachine: *StateMachine,
Subtype: apigwv2.HttpIntegrationSubtype_STEPFUNCTIONS_STOP_EXECUTION,
// For the `STOP_EXECUTION` subtype, it is necessary to specify the `executionArn`.
ParameterMapping: apigwv2.NewParameterMapping().Custom(jsii.String("ExecutionArn"), jsii.String("$request.querystring.executionArn")),
}),
})
Initializer
ts
new HttpStepFunctionsIntegration(id: string, props: HttpStepFunctionsIntegrationProps)
python
HttpStepFunctionsIntegration(id: str, props: HttpStepFunctionsIntegrationProps)
java
new HttpStepFunctionsIntegration(String id, HttpStepFunctionsIntegrationProps props)
csharp
new HttpStepFunctionsIntegration(string id, HttpStepFunctionsIntegrationProps props)
go
NewHttpStepFunctionsIntegration(Id *string, Props HttpStepFunctionsIntegrationProps)
Methods
bind(options: HttpRouteIntegrationBindOptions): HttpRouteIntegrationConfigdef bind(self, options: HttpRouteIntegrationBindOptions) -> HttpRouteIntegrationConfigpublic HttpRouteIntegrationConfig bind(HttpRouteIntegrationBindOptions options)public HttpRouteIntegrationConfig Bind(HttpRouteIntegrationBindOptions options)func Bind(Options HttpRouteIntegrationBindOptions) HttpRouteIntegrationConfig#Bind this integration to the route.