# HttpStepFunctionsIntegrationProps

Properties to initialize `HttpStepFunctionsIntegration`.

Used as props by: [HttpStepFunctionsIntegration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2_integrations.HttpStepFunctionsIntegration.html)

- Source: [`aws-apigatewayv2-integrations/lib/http/stepfunctions.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/stepfunctions.ts#L10)
- Type last changed: v2.131.0 · 1 Mar 2024

## Example

TypeScript:

```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:

```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:

```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());
```

C# / .NET:

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

Golang:

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

## Properties

- `parameterMapping`: [ParameterMapping](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.ParameterMapping.html) — Specifies how to transform HTTP requests before sending them to the backend.

  **Default:** specify only `StateMachineArn`

  When the subtype is either `START_EXECUTION` or `START_SYNC_EXECUTION`,
  it is necessary to specify the `StateMachineArn`.
  Conversely, when the subtype is `STOP_EXECUTION`, the `ExecutionArn` must be specified.

- `stateMachine`: [StateMachine](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachine.html) (required) — Statemachine that Integrates with API Gateway.

- `subtype`: [HttpIntegrationSubtype](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigatewayv2.HttpIntegrationSubtype.html) — The subtype of the HTTP integration.

  **Default:** HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION

  Only subtypes starting with STEPFUNCTIONS_ can be specified.
