diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/integ.json new file mode 100644 index 0000000000000..e16d5a28f77c1 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "stepfunctions-integration-integ-test/DefaultTest": { + "stacks": [ + "stepfunctions-integration" + ], + "assertionStack": "stepfunctions-integration-integ-test/DefaultTest/DeployAssert", + "assertionStackName": "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/manifest.json new file mode 100644 index 0000000000000..9169101ee2313 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/manifest.json @@ -0,0 +1,239 @@ +{ + "version": "36.0.0", + "artifacts": { + "stepfunctions-integration.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "stepfunctions-integration.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "stepfunctions-integration": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "stepfunctions-integration.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/19e42465a3a7d7c94541f96a140ab7bdb71eb54da666c1b3c1bc9f3a03c310a2.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "stepfunctions-integration.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "stepfunctions-integration.assets" + ], + "metadata": { + "/stepfunctions-integration/RouteStateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "RouteStateMachineRoleF32EE107" + } + ], + "/stepfunctions-integration/RouteStateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "RouteStateMachineC11CAF3B" + } + ], + "/stepfunctions-integration/ExpressStateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ExpressStateMachineRole4C3738D2" + } + ], + "/stepfunctions-integration/ExpressStateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ExpressStateMachineE90FFF22" + } + ], + "/stepfunctions-integration/Api/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiF70053CD" + } + ], + "/stepfunctions-integration/Api/DefaultStage/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiDefaultStage189A7074" + } + ], + "/stepfunctions-integration/Api/POST--default/InvokeRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTdefaultInvokeRole9137E4F5" + } + ], + "/stepfunctions-integration/Api/POST--default/InvokeRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTdefaultInvokeRoleDefaultPolicy603C0AF3" + } + ], + "/stepfunctions-integration/Api/POST--default/Integration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTdefaultIntegration15333EAA" + } + ], + "/stepfunctions-integration/Api/POST--default/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTdefault1EEA0D1D" + } + ], + "/stepfunctions-integration/Api/POST--start/InvokeRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartInvokeRoleA9D6BD6A" + } + ], + "/stepfunctions-integration/Api/POST--start/InvokeRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartInvokeRoleDefaultPolicy495BCE0C" + } + ], + "/stepfunctions-integration/Api/POST--start/Integration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartIntegration373B2B85" + } + ], + "/stepfunctions-integration/Api/POST--start/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartB39FD25E" + } + ], + "/stepfunctions-integration/Api/POST--start-sync/InvokeRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartsyncInvokeRoleC429A7AB" + } + ], + "/stepfunctions-integration/Api/POST--start-sync/InvokeRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartsyncInvokeRoleDefaultPolicy244CA8B0" + } + ], + "/stepfunctions-integration/Api/POST--start-sync/Integration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartsyncIntegrationB86BBC38" + } + ], + "/stepfunctions-integration/Api/POST--start-sync/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstartsync3659F9A0" + } + ], + "/stepfunctions-integration/Api/POST--stop/InvokeRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstopInvokeRoleB9DFDAA9" + } + ], + "/stepfunctions-integration/Api/POST--stop/InvokeRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstopInvokeRoleDefaultPolicy4B17C921" + } + ], + "/stepfunctions-integration/Api/POST--stop/Integration/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstopIntegrationDA24B606" + } + ], + "/stepfunctions-integration/Api/POST--stop/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ApiPOSTstopBDBE4015" + } + ], + "/stepfunctions-integration/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/stepfunctions-integration/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "stepfunctions-integration" + }, + "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets" + ], + "metadata": { + "/stepfunctions-integration-integ-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/stepfunctions-integration-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "stepfunctions-integration-integ-test/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctions-integration.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctions-integration.assets.json new file mode 100644 index 0000000000000..b778a7d47b763 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctions-integration.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "19e42465a3a7d7c94541f96a140ab7bdb71eb54da666c1b3c1bc9f3a03c310a2": { + "source": { + "path": "stepfunctions-integration.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "19e42465a3a7d7c94541f96a140ab7bdb71eb54da666c1b3c1bc9f3a03c310a2.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctions-integration.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctions-integration.template.json new file mode 100644 index 0000000000000..9e1cc70fa86b0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctions-integration.template.json @@ -0,0 +1,486 @@ +{ + "Resources": { + "RouteStateMachineRoleF32EE107": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "RouteStateMachineC11CAF3B": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": "{\"StartAt\":\"Pass1\",\"States\":{\"Pass1\":{\"Type\":\"Pass\",\"End\":true}}}", + "RoleArn": { + "Fn::GetAtt": [ + "RouteStateMachineRoleF32EE107", + "Arn" + ] + } + }, + "DependsOn": [ + "RouteStateMachineRoleF32EE107" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ExpressStateMachineRole4C3738D2": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "ExpressStateMachineE90FFF22": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": "{\"StartAt\":\"Pass2\",\"States\":{\"Pass2\":{\"Type\":\"Pass\",\"End\":true}}}", + "RoleArn": { + "Fn::GetAtt": [ + "ExpressStateMachineRole4C3738D2", + "Arn" + ] + }, + "StateMachineType": "EXPRESS" + }, + "DependsOn": [ + "ExpressStateMachineRole4C3738D2" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ApiF70053CD": { + "Type": "AWS::ApiGatewayV2::Api", + "Properties": { + "Name": "Api", + "ProtocolType": "HTTP" + } + }, + "ApiDefaultStage189A7074": { + "Type": "AWS::ApiGatewayV2::Stage", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "AutoDeploy": true, + "StageName": "$default" + } + }, + "ApiPOSTdefaultInvokeRole9137E4F5": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "ApiPOSTdefaultInvokeRoleDefaultPolicy603C0AF3": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "RouteStateMachineC11CAF3B" + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "ApiPOSTdefaultInvokeRoleDefaultPolicy603C0AF3", + "Roles": [ + { + "Ref": "ApiPOSTdefaultInvokeRole9137E4F5" + } + ] + } + }, + "ApiPOSTdefaultIntegration15333EAA": { + "Type": "AWS::ApiGatewayV2::Integration", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "ConnectionType": "INTERNET", + "CredentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTdefaultInvokeRole9137E4F5", + "Arn" + ] + }, + "IntegrationSubtype": "StepFunctions-StartExecution", + "IntegrationType": "AWS_PROXY", + "PayloadFormatVersion": "1.0", + "RequestParameters": { + "StateMachineArn": { + "Ref": "RouteStateMachineC11CAF3B" + } + } + } + }, + "ApiPOSTdefault1EEA0D1D": { + "Type": "AWS::ApiGatewayV2::Route", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "AuthorizationType": "NONE", + "RouteKey": "POST /default", + "Target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTdefaultIntegration15333EAA" + } + ] + ] + } + } + }, + "ApiPOSTstartInvokeRoleA9D6BD6A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "ApiPOSTstartInvokeRoleDefaultPolicy495BCE0C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "RouteStateMachineC11CAF3B" + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "ApiPOSTstartInvokeRoleDefaultPolicy495BCE0C", + "Roles": [ + { + "Ref": "ApiPOSTstartInvokeRoleA9D6BD6A" + } + ] + } + }, + "ApiPOSTstartIntegration373B2B85": { + "Type": "AWS::ApiGatewayV2::Integration", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "ConnectionType": "INTERNET", + "CredentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTstartInvokeRoleA9D6BD6A", + "Arn" + ] + }, + "IntegrationSubtype": "StepFunctions-StartExecution", + "IntegrationType": "AWS_PROXY", + "PayloadFormatVersion": "1.0", + "RequestParameters": { + "StateMachineArn": { + "Ref": "RouteStateMachineC11CAF3B" + } + } + } + }, + "ApiPOSTstartB39FD25E": { + "Type": "AWS::ApiGatewayV2::Route", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "AuthorizationType": "NONE", + "RouteKey": "POST /start", + "Target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTstartIntegration373B2B85" + } + ] + ] + } + } + }, + "ApiPOSTstartsyncInvokeRoleC429A7AB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "ApiPOSTstartsyncInvokeRoleDefaultPolicy244CA8B0": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "ExpressStateMachineE90FFF22" + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "ApiPOSTstartsyncInvokeRoleDefaultPolicy244CA8B0", + "Roles": [ + { + "Ref": "ApiPOSTstartsyncInvokeRoleC429A7AB" + } + ] + } + }, + "ApiPOSTstartsyncIntegrationB86BBC38": { + "Type": "AWS::ApiGatewayV2::Integration", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "ConnectionType": "INTERNET", + "CredentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTstartsyncInvokeRoleC429A7AB", + "Arn" + ] + }, + "IntegrationSubtype": "StepFunctions-StartSyncExecution", + "IntegrationType": "AWS_PROXY", + "PayloadFormatVersion": "1.0", + "RequestParameters": { + "StateMachineArn": { + "Ref": "ExpressStateMachineE90FFF22" + } + } + } + }, + "ApiPOSTstartsync3659F9A0": { + "Type": "AWS::ApiGatewayV2::Route", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "AuthorizationType": "NONE", + "RouteKey": "POST /start-sync", + "Target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTstartsyncIntegrationB86BBC38" + } + ] + ] + } + } + }, + "ApiPOSTstopInvokeRoleB9DFDAA9": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "ApiPOSTstopInvokeRoleDefaultPolicy4B17C921": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StopExecution", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":states:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":execution:", + { + "Fn::GetAtt": [ + "RouteStateMachineC11CAF3B", + "Name" + ] + }, + ":*" + ] + ] + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "ApiPOSTstopInvokeRoleDefaultPolicy4B17C921", + "Roles": [ + { + "Ref": "ApiPOSTstopInvokeRoleB9DFDAA9" + } + ] + } + }, + "ApiPOSTstopIntegrationDA24B606": { + "Type": "AWS::ApiGatewayV2::Integration", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "ConnectionType": "INTERNET", + "CredentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTstopInvokeRoleB9DFDAA9", + "Arn" + ] + }, + "IntegrationSubtype": "StepFunctions-StopExecution", + "IntegrationType": "AWS_PROXY", + "PayloadFormatVersion": "1.0", + "RequestParameters": { + "ExecutionArn": "$request.querystring.executionArn" + } + } + }, + "ApiPOSTstopBDBE4015": { + "Type": "AWS::ApiGatewayV2::Route", + "Properties": { + "ApiId": { + "Ref": "ApiF70053CD" + }, + "AuthorizationType": "NONE", + "RouteKey": "POST /stop", + "Target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTstopIntegrationDA24B606" + } + ] + ] + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets.json new file mode 100644 index 0000000000000..002ef777e5465 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/stepfunctionsintegrationintegtestDefaultTestDeployAssert09AC4C77.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/tree.json new file mode 100644 index 0000000000000..c8ede561fccac --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.js.snapshot/tree.json @@ -0,0 +1,999 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "stepfunctions-integration": { + "id": "stepfunctions-integration", + "path": "stepfunctions-integration", + "children": { + "Pass1": { + "id": "Pass1", + "path": "stepfunctions-integration/Pass1", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.Pass", + "version": "0.0.0" + } + }, + "RouteStateMachine": { + "id": "RouteStateMachine", + "path": "stepfunctions-integration/RouteStateMachine", + "children": { + "Role": { + "id": "Role", + "path": "stepfunctions-integration/RouteStateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "stepfunctions-integration/RouteStateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/RouteStateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/RouteStateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": "{\"StartAt\":\"Pass1\",\"States\":{\"Pass1\":{\"Type\":\"Pass\",\"End\":true}}}", + "roleArn": { + "Fn::GetAtt": [ + "RouteStateMachineRoleF32EE107", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "0.0.0" + } + }, + "Pass2": { + "id": "Pass2", + "path": "stepfunctions-integration/Pass2", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.Pass", + "version": "0.0.0" + } + }, + "ExpressStateMachine": { + "id": "ExpressStateMachine", + "path": "stepfunctions-integration/ExpressStateMachine", + "children": { + "Role": { + "id": "Role", + "path": "stepfunctions-integration/ExpressStateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "stepfunctions-integration/ExpressStateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/ExpressStateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/ExpressStateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": "{\"StartAt\":\"Pass2\",\"States\":{\"Pass2\":{\"Type\":\"Pass\",\"End\":true}}}", + "roleArn": { + "Fn::GetAtt": [ + "ExpressStateMachineRole4C3738D2", + "Arn" + ] + }, + "stateMachineType": "EXPRESS" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "0.0.0" + } + }, + "Api": { + "id": "Api", + "path": "stepfunctions-integration/Api", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Api", + "aws:cdk:cloudformation:props": { + "name": "Api", + "protocolType": "HTTP" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnApi", + "version": "0.0.0" + } + }, + "DefaultStage": { + "id": "DefaultStage", + "path": "stepfunctions-integration/Api/DefaultStage", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/DefaultStage/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Stage", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "autoDeploy": true, + "stageName": "$default" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpStage", + "version": "0.0.0" + } + }, + "POST--default": { + "id": "POST--default", + "path": "stepfunctions-integration/Api/POST--default", + "children": { + "InvokeRole": { + "id": "InvokeRole", + "path": "stepfunctions-integration/Api/POST--default/InvokeRole", + "children": { + "ImportInvokeRole": { + "id": "ImportInvokeRole", + "path": "stepfunctions-integration/Api/POST--default/InvokeRole/ImportInvokeRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--default/InvokeRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stepfunctions-integration/Api/POST--default/InvokeRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--default/InvokeRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "RouteStateMachineC11CAF3B" + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "policyName": "ApiPOSTdefaultInvokeRoleDefaultPolicy603C0AF3", + "roles": [ + { + "Ref": "ApiPOSTdefaultInvokeRole9137E4F5" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Integration": { + "id": "Integration", + "path": "stepfunctions-integration/Api/POST--default/Integration", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--default/Integration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Integration", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "connectionType": "INTERNET", + "credentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTdefaultInvokeRole9137E4F5", + "Arn" + ] + }, + "integrationSubtype": "StepFunctions-StartExecution", + "integrationType": "AWS_PROXY", + "payloadFormatVersion": "1.0", + "requestParameters": { + "StateMachineArn": { + "Ref": "RouteStateMachineC11CAF3B" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnIntegration", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpIntegration", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--default/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Route", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "authorizationType": "NONE", + "routeKey": "POST /default", + "target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTdefaultIntegration15333EAA" + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpRoute", + "version": "0.0.0" + } + }, + "POST--start": { + "id": "POST--start", + "path": "stepfunctions-integration/Api/POST--start", + "children": { + "InvokeRole": { + "id": "InvokeRole", + "path": "stepfunctions-integration/Api/POST--start/InvokeRole", + "children": { + "ImportInvokeRole": { + "id": "ImportInvokeRole", + "path": "stepfunctions-integration/Api/POST--start/InvokeRole/ImportInvokeRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start/InvokeRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stepfunctions-integration/Api/POST--start/InvokeRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start/InvokeRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "RouteStateMachineC11CAF3B" + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "policyName": "ApiPOSTstartInvokeRoleDefaultPolicy495BCE0C", + "roles": [ + { + "Ref": "ApiPOSTstartInvokeRoleA9D6BD6A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Integration": { + "id": "Integration", + "path": "stepfunctions-integration/Api/POST--start/Integration", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start/Integration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Integration", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "connectionType": "INTERNET", + "credentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTstartInvokeRoleA9D6BD6A", + "Arn" + ] + }, + "integrationSubtype": "StepFunctions-StartExecution", + "integrationType": "AWS_PROXY", + "payloadFormatVersion": "1.0", + "requestParameters": { + "StateMachineArn": { + "Ref": "RouteStateMachineC11CAF3B" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnIntegration", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpIntegration", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Route", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "authorizationType": "NONE", + "routeKey": "POST /start", + "target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTstartIntegration373B2B85" + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpRoute", + "version": "0.0.0" + } + }, + "POST--start-sync": { + "id": "POST--start-sync", + "path": "stepfunctions-integration/Api/POST--start-sync", + "children": { + "InvokeRole": { + "id": "InvokeRole", + "path": "stepfunctions-integration/Api/POST--start-sync/InvokeRole", + "children": { + "ImportInvokeRole": { + "id": "ImportInvokeRole", + "path": "stepfunctions-integration/Api/POST--start-sync/InvokeRole/ImportInvokeRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start-sync/InvokeRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stepfunctions-integration/Api/POST--start-sync/InvokeRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start-sync/InvokeRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "ExpressStateMachineE90FFF22" + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "policyName": "ApiPOSTstartsyncInvokeRoleDefaultPolicy244CA8B0", + "roles": [ + { + "Ref": "ApiPOSTstartsyncInvokeRoleC429A7AB" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Integration": { + "id": "Integration", + "path": "stepfunctions-integration/Api/POST--start-sync/Integration", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start-sync/Integration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Integration", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "connectionType": "INTERNET", + "credentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTstartsyncInvokeRoleC429A7AB", + "Arn" + ] + }, + "integrationSubtype": "StepFunctions-StartSyncExecution", + "integrationType": "AWS_PROXY", + "payloadFormatVersion": "1.0", + "requestParameters": { + "StateMachineArn": { + "Ref": "ExpressStateMachineE90FFF22" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnIntegration", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpIntegration", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--start-sync/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Route", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "authorizationType": "NONE", + "routeKey": "POST /start-sync", + "target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTstartsyncIntegrationB86BBC38" + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpRoute", + "version": "0.0.0" + } + }, + "POST--stop": { + "id": "POST--stop", + "path": "stepfunctions-integration/Api/POST--stop", + "children": { + "InvokeRole": { + "id": "InvokeRole", + "path": "stepfunctions-integration/Api/POST--stop/InvokeRole", + "children": { + "ImportInvokeRole": { + "id": "ImportInvokeRole", + "path": "stepfunctions-integration/Api/POST--stop/InvokeRole/ImportInvokeRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--stop/InvokeRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stepfunctions-integration/Api/POST--stop/InvokeRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--stop/InvokeRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StopExecution", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":states:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":execution:", + { + "Fn::GetAtt": [ + "RouteStateMachineC11CAF3B", + "Name" + ] + }, + ":*" + ] + ] + }, + "Sid": "AllowStepFunctionsExecution" + } + ], + "Version": "2012-10-17" + }, + "policyName": "ApiPOSTstopInvokeRoleDefaultPolicy4B17C921", + "roles": [ + { + "Ref": "ApiPOSTstopInvokeRoleB9DFDAA9" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Integration": { + "id": "Integration", + "path": "stepfunctions-integration/Api/POST--stop/Integration", + "children": { + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--stop/Integration/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Integration", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "connectionType": "INTERNET", + "credentialsArn": { + "Fn::GetAtt": [ + "ApiPOSTstopInvokeRoleB9DFDAA9", + "Arn" + ] + }, + "integrationSubtype": "StepFunctions-StopExecution", + "integrationType": "AWS_PROXY", + "payloadFormatVersion": "1.0", + "requestParameters": { + "ExecutionArn": "$request.querystring.executionArn" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnIntegration", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpIntegration", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stepfunctions-integration/Api/POST--stop/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::Route", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "ApiF70053CD" + }, + "authorizationType": "NONE", + "routeKey": "POST /stop", + "target": { + "Fn::Join": [ + "", + [ + "integrations/", + { + "Ref": "ApiPOSTstopIntegrationDA24B606" + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigatewayv2.HttpApi", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "stepfunctions-integration/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "stepfunctions-integration/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "stepfunctions-integration-integ-test": { + "id": "stepfunctions-integration-integ-test", + "path": "stepfunctions-integration-integ-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "stepfunctions-integration-integ-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "stepfunctions-integration-integ-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "stepfunctions-integration-integ-test/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "stepfunctions-integration-integ-test/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "stepfunctions-integration-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.ts new file mode 100644 index 0000000000000..b2a816a21639b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigatewayv2-integrations/test/http/integ.stepfunctions.ts @@ -0,0 +1,56 @@ +import { HttpApi, HttpIntegrationSubtype, HttpMethod, ParameterMapping } from 'aws-cdk-lib/aws-apigatewayv2'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { App, Stack } from 'aws-cdk-lib'; +import { HttpStepFunctionsIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations'; +import * as integ from '@aws-cdk/integ-tests-alpha'; + +const app = new App(); +const stack = new Stack(app, 'stepfunctions-integration'); + +const stateMachine = new sfn.StateMachine(stack, 'RouteStateMachine', { + definition: new sfn.Pass(stack, 'Pass1'), +}); +const expressStateMachine = new sfn.StateMachine(stack, 'ExpressStateMachine', { + definition: new sfn.Pass(stack, 'Pass2'), + stateMachineType: sfn.StateMachineType.EXPRESS, +}); + +const httpApi = new HttpApi(stack, 'Api'); +httpApi.addRoutes({ + path: '/default', + methods: [HttpMethod.POST], + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine, + }), +}); +httpApi.addRoutes({ + path: '/start', + methods: [HttpMethod.POST], + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine, + subtype: HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION, + }), +}); +httpApi.addRoutes({ + path: '/start-sync', + methods: [HttpMethod.POST], + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine: expressStateMachine, + subtype: HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION, + }), +}); +httpApi.addRoutes({ + path: '/stop', + methods: [HttpMethod.POST], + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine, + subtype: HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION, + parameterMapping: new ParameterMapping() + .custom('ExecutionArn', '$request.querystring.executionArn'), + }), +}); + +new integ.IntegTest(app, 'stepfunctions-integration-integ-test', { + testCases: [stack], +}); +app.synth(); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigatewayv2-integrations/README.md b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/README.md index ba8d08d880d55..82a9ea2cd6341 100644 --- a/packages/aws-cdk-lib/aws-apigatewayv2-integrations/README.md +++ b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/README.md @@ -65,6 +65,58 @@ httpApi.addRoutes({ }); ``` +### StepFunctions Integration + +Step Functions integrations enable integrating an HTTP API route with AWS Step Functions. +This allows the HTTP API to start state machine executions synchronously or asynchronously, or to stop executions. + +When a client invokes the route configured with a Step Functions integration, the API Gateway service interacts with the specified state machine according to the integration subtype (e.g., starts a new execution, synchronously starts an execution, or stops an execution) and returns the response to the client. + +The following code configures a Step Functions integrations: + +```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'), + }), +}); +``` + +**Note**: + +- The `executionArn` parameter is required for the `STOP_EXECUTION` subtype. It is necessary to specify the `executionArn` in the `parameterMapping` property of the `HttpStepFunctionsIntegration` object. +- `START_SYNC_EXECUTION` subtype is only supported for EXPRESS type state machine. + ### Private Integration Private integrations enable integrating an HTTP API route with private resources in a VPC, such as Application Load Balancers or diff --git a/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/index.ts b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/index.ts index 8e0598975f8cb..8162b443fc122 100644 --- a/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/index.ts +++ b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/index.ts @@ -4,3 +4,4 @@ export * from './nlb'; export * from './service-discovery'; export * from './http-proxy'; export * from './lambda'; +export * from './stepfunctions'; \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/stepfunctions.ts b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/stepfunctions.ts new file mode 100644 index 0000000000000..4229bda171232 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/lib/http/stepfunctions.ts @@ -0,0 +1,110 @@ +import * as apigwv2 from '../../../aws-apigatewayv2'; +import * as iam from '../../../aws-iam'; +import * as sfn from '../../../aws-stepfunctions'; + +/** + * Properties to initialize `HttpStepFunctionsIntegration`. + */ +export interface HttpStepFunctionsIntegrationProps { + /** + * Specifies how to transform HTTP requests before sending them to the backend. + * + * 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. + * + * @see https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html + * + * @default - specify only `StateMachineArn` + */ + readonly parameterMapping?: apigwv2.ParameterMapping; + + /** + * The subtype of the HTTP integration. + * + * Only subtypes starting with STEPFUNCTIONS_ can be specified. + * + * @default HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION + */ + readonly subtype?: apigwv2.HttpIntegrationSubtype; + + /** + * Statemachine that Integrates with API Gateway + */ + readonly stateMachine: sfn.StateMachine; +} + +/** + * The StepFunctions integration resource for HTTP API + */ +export class HttpStepFunctionsIntegration extends apigwv2.HttpRouteIntegration { + /** + * @param id id of the underlying integration construct + * @param props properties to configure the integration + */ + constructor( + id: string, + private readonly props: HttpStepFunctionsIntegrationProps, + ) { + super(id); + } + + public bind(options: apigwv2.HttpRouteIntegrationBindOptions): apigwv2.HttpRouteIntegrationConfig { + if (this.props.subtype && !this.props.subtype.startsWith('StepFunctions-')) { + throw new Error('Subtype must start with `STEPFUNCTIONS_`'); + } + if ( + this.props.subtype === apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION + && this.props.stateMachine.stateMachineType === sfn.StateMachineType.STANDARD + ) { + throw new Error('Cannot use subtype `STEPFUNCTIONS_START_SYNC_EXECUTION` with a standard type state machine'); + } + + const invokeRole = new iam.Role(options.scope, 'InvokeRole', { + assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'), + }); + + invokeRole.addToPolicy( + new iam.PolicyStatement({ + effect: iam.Effect.ALLOW, + sid: 'AllowStepFunctionsExecution', + actions: [this.determineActionBySubtype(this.props.subtype)], + resources: [this.determineResourceArn(options)], + }), + ); + + return { + payloadFormatVersion: apigwv2.PayloadFormatVersion.VERSION_1_0, + type: apigwv2.HttpIntegrationType.AWS_PROXY, + subtype: this.props.subtype ?? apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION, + credentials: apigwv2.IntegrationCredentials.fromRole(invokeRole), + connectionType: apigwv2.HttpConnectionType.INTERNET, + parameterMapping: this.props.parameterMapping ?? new apigwv2.ParameterMapping() + .custom('StateMachineArn', this.props.stateMachine.stateMachineArn), + }; + } + + private determineActionBySubtype(subtype?: apigwv2.HttpIntegrationSubtype): string { + switch (subtype) { + case apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION: + return 'states:StopExecution'; + case apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION: + return 'states:StartSyncExecution'; + default: + return 'states:StartExecution'; + } + } + + private determineResourceArn(options: apigwv2.HttpRouteIntegrationBindOptions): string { + switch (this.props.subtype) { + case apigwv2.HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION: + return options.route.stack.formatArn({ + service: 'states', + resource: `execution:${this.props.stateMachine.stateMachineName}:*`, + }); + // Both START_EXECUTION and START_SYNC_EXECUTION return the state machine arn + default: + return this.props.stateMachine.stateMachineArn; + } + } +} diff --git a/packages/aws-cdk-lib/aws-apigatewayv2-integrations/test/http/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/test/http/stepfunctions.test.ts new file mode 100644 index 0000000000000..1ce6359a26398 --- /dev/null +++ b/packages/aws-cdk-lib/aws-apigatewayv2-integrations/test/http/stepfunctions.test.ts @@ -0,0 +1,228 @@ +import { Match, Template } from '../../../assertions'; +import { HttpApi, HttpIntegrationSubtype, HttpRoute, HttpRouteKey, ParameterMapping } from '../../../aws-apigatewayv2'; +import * as sfn from '../../../aws-stepfunctions'; +import { App, Stack } from '../../../core'; +import { HttpStepFunctionsIntegration } from '../../lib/http/stepfunctions'; + +describe('StepFunctionsIntegration', () => { + test('default', () => { + const app = new App(); + const stack = new Stack(app, 'stack'); + const api = new HttpApi(stack, 'HttpApi'); + const targetStateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: new sfn.Pass(stack, 'Pass'), + }); + + new HttpRoute(stack, 'StepFunctionsRoute', { + httpApi: api, + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine: targetStateMachine, + }), + routeKey: HttpRouteKey.with('/tests'), + }); + + const template = Template.fromStack(stack); + template.hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: Match.arrayWith([ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'apigateway.amazonaws.com', + }, + }, + ]), + }, + }); + template.hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: 'states:StartExecution', + Effect: 'Allow', + Resource: stack.resolve(targetStateMachine.stateMachineArn), + }, + ], + }, + Roles: [ + { + Ref: 'StepFunctionsRouteInvokeRole5E3B5519', + }, + ], + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::Integration', { + ConnectionType: 'INTERNET', + CredentialsArn: { + 'Fn::GetAtt': [ + 'StepFunctionsRouteInvokeRole5E3B5519', + 'Arn', + ], + }, + IntegrationType: 'AWS_PROXY', + IntegrationSubtype: 'StepFunctions-StartExecution', + PayloadFormatVersion: '1.0', + RequestParameters: { + StateMachineArn: stack.resolve(targetStateMachine.stateMachineArn), + }, + }); + }); + + test('with parameterMapping', () => { + const app = new App(); + const stack = new Stack(app, 'stack'); + const api = new HttpApi(stack, 'HttpApi'); + const targetStateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: new sfn.Pass(stack, 'Pass'), + }); + + new HttpRoute(stack, 'StepFunctionsRoute', { + httpApi: api, + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine: targetStateMachine, + parameterMapping: new ParameterMapping() + .custom('Input', '$request.body') + .custom('StateMachineArn', targetStateMachine.stateMachineArn), + }), + routeKey: HttpRouteKey.with('/tests'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::Integration', { + ConnectionType: 'INTERNET', + CredentialsArn: { + 'Fn::GetAtt': [ + 'StepFunctionsRouteInvokeRole5E3B5519', + 'Arn', + ], + }, + IntegrationType: 'AWS_PROXY', + IntegrationSubtype: 'StepFunctions-StartExecution', + PayloadFormatVersion: '1.0', + RequestParameters: { + Input: '$request.body', + StateMachineArn: stack.resolve(targetStateMachine.stateMachineArn), + }, + }); + }); + + test.each([ + [HttpIntegrationSubtype.STEPFUNCTIONS_START_EXECUTION, 'states:StartExecution', undefined], + [HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION, 'states:StartSyncExecution', undefined], + [ + HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION, + 'states:StopExecution', + new ParameterMapping().custom('ExecutionArn', '$request.querystring.executionArn'), + ], + ])('with subtype %s', (subtype, action, parameterMapping) => { + const app = new App(); + const stack = new Stack(app, 'stack'); + const api = new HttpApi(stack, 'HttpApi'); + const stateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: new sfn.Pass(stack, 'Pass'), + stateMachineType: sfn.StateMachineType.EXPRESS, + }); + + new HttpRoute(stack, 'StepFunctionsRoute', { + httpApi: api, + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine, + subtype, + parameterMapping, + }), + routeKey: HttpRouteKey.with('/tests'), + }); + + Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: action, + Effect: 'Allow', + Resource: subtype === HttpIntegrationSubtype.STEPFUNCTIONS_STOP_EXECUTION ? { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition', + }, + ':states:', + { + Ref: 'AWS::Region', + }, + ':', + { + Ref: 'AWS::AccountId', + }, + ':execution:', + { 'Fn::GetAtt': [stack.resolve(stateMachine.stateMachineArn).Ref, 'Name'] }, + ':*', + ], + ], + } : stack.resolve(stateMachine.stateMachineArn), + }, + ], + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::Integration', { + ConnectionType: 'INTERNET', + CredentialsArn: { + 'Fn::GetAtt': [ + 'StepFunctionsRouteInvokeRole5E3B5519', + 'Arn', + ], + }, + IntegrationType: 'AWS_PROXY', + IntegrationSubtype: subtype, + PayloadFormatVersion: '1.0', + RequestParameters: { + ...(parameterMapping ? + parameterMapping.mappings : + { StateMachineArn: stack.resolve(stateMachine.stateMachineArn) } + ), + }, + }); + }); + + test('throw error when subtype does not start with STEPFUNCTIONS_', () => { + const app = new App(); + const stack = new Stack(app, 'stack'); + const api = new HttpApi(stack, 'HttpApi'); + const stateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: new sfn.Pass(stack, 'Pass'), + }); + + expect(() => { + new HttpRoute(stack, 'StepFunctionsRoute', { + httpApi: api, + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine, + subtype: HttpIntegrationSubtype.SQS_DELETE_MESSAGE, + }), + routeKey: HttpRouteKey.with('/tests'), + }); + }).toThrow(/Subtype must start with `STEPFUNCTIONS_`/); + }); + + test('throw error when subtype is STEPFUNCTIONS_START_SYNC_EXECUTION with standard state machine', () => { + const app = new App(); + const stack = new Stack(app, 'stack'); + const api = new HttpApi(stack, 'HttpApi'); + const stateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definition: new sfn.Pass(stack, 'Pass'), + stateMachineType: sfn.StateMachineType.STANDARD, + }); + + expect(() => { + new HttpRoute(stack, 'StepFunctionsRoute', { + httpApi: api, + integration: new HttpStepFunctionsIntegration('Integration', { + stateMachine, + subtype: HttpIntegrationSubtype.STEPFUNCTIONS_START_SYNC_EXECUTION, + }), + routeKey: HttpRouteKey.with('/tests'), + }); + }).toThrow(/Cannot use subtype `STEPFUNCTIONS_START_SYNC_EXECUTION` with a standard type state machine/); + }); +}); + diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/amazon.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/amazon.ts index d0bb5e432e9a3..0d166985995bf 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/amazon.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/amazon.ts @@ -8,12 +8,12 @@ import { CfnUserPoolIdentityProvider } from '../cognito.generated'; */ export interface UserPoolIdentityProviderAmazonProps extends UserPoolIdentityProviderProps { /** - * The client id recognized by 'Login with Amazon' APIs. + * The client id recognized by Login with Amazon APIs. * @see https://developer.amazon.com/docs/login-with-amazon/security-profile.html#client-identifier */ readonly clientId: string; /** - * The client secret to be accompanied with clientId for 'Login with Amazon' APIs to authenticate the client. + * The client secret to be accompanied with clientId for Login with Amazon APIs to authenticate the client. * @see https://developer.amazon.com/docs/login-with-amazon/security-profile.html#client-identifier */ readonly clientSecret: string; @@ -26,7 +26,7 @@ export interface UserPoolIdentityProviderAmazonProps extends UserPoolIdentityPro } /** - * Represents a identity provider that integrates with 'Login with Amazon' + * Represents an identity provider that integrates with Login with Amazon * @resource AWS::Cognito::UserPoolIdentityProvider */ export class UserPoolIdentityProviderAmazon extends UserPoolIdentityProviderBase { diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/apple.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/apple.ts index d4514d8865d48..fff4981a39131 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/apple.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/apple.ts @@ -33,7 +33,7 @@ export interface UserPoolIdentityProviderAppleProps extends UserPoolIdentityProv } /** - * Represents a identity provider that integrates with 'Apple' + * Represents an identity provider that integrates with Apple * @resource AWS::Cognito::UserPoolIdentityProvider */ export class UserPoolIdentityProviderApple extends UserPoolIdentityProviderBase { diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/facebook.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/facebook.ts index c19f1aeabfa04..9acdd68039bfe 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/facebook.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/facebook.ts @@ -12,12 +12,12 @@ export interface UserPoolIdentityProviderFacebookProps extends UserPoolIdentityP */ readonly clientId: string; /** - * The client secret to be accompanied with clientUd for Facebook to authenticate the client. + * The client secret to be accompanied with clientId for Facebook to authenticate the client. * @see https://developers.facebook.com/docs/facebook-login/security#appsecret */ readonly clientSecret: string; /** - * The list of facebook permissions to obtain for getting access to the Facebook profile. + * The list of Facebook permissions to obtain for getting access to the Facebook profile. * @see https://developers.facebook.com/docs/facebook-login/permissions * @default [ public_profile ] */ @@ -30,7 +30,7 @@ export interface UserPoolIdentityProviderFacebookProps extends UserPoolIdentityP } /** - * Represents a identity provider that integrates with 'Facebook Login' + * Represents an identity provider that integrates with Facebook Login * @resource AWS::Cognito::UserPoolIdentityProvider */ export class UserPoolIdentityProviderFacebook extends UserPoolIdentityProviderBase { diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts index c99b3c49cd6de..fe750c5db1fee 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/google.ts @@ -27,7 +27,7 @@ export interface UserPoolIdentityProviderGoogleProps extends UserPoolIdentityPro */ readonly clientSecretValue?: SecretValue; /** - * The list of google permissions to obtain for getting access to the google profile + * The list of Google permissions to obtain for getting access to the Google profile * @see https://developers.google.com/identity/sign-in/web/sign-in * @default [ profile ] */ @@ -35,7 +35,7 @@ export interface UserPoolIdentityProviderGoogleProps extends UserPoolIdentityPro } /** - * Represents a identity provider that integrates with 'Google' + * Represents an identity provider that integrates with Google * @resource AWS::Cognito::UserPoolIdentityProvider */ export class UserPoolIdentityProviderGoogle extends UserPoolIdentityProviderBase { diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts index b4eabc967908e..c17b48a799bdc 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/oidc.ts @@ -98,7 +98,7 @@ export enum OidcAttributeRequestMethod { } /** - * Represents a identity provider that integrates with OpenID Connect + * Represents an identity provider that integrates with OpenID Connect * @resource AWS::Cognito::UserPoolIdentityProvider */ export class UserPoolIdentityProviderOidc extends UserPoolIdentityProviderBase { diff --git a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts index 518cb67b62961..a4d5bedd1051c 100644 --- a/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts +++ b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/saml.ts @@ -78,7 +78,7 @@ export class UserPoolIdentityProviderSamlMetadata { } /** - * Represents a identity provider that integrates with SAML. + * Represents an identity provider that integrates with SAML. * @resource AWS::Cognito::UserPoolIdentityProvider */ export class UserPoolIdentityProviderSaml extends UserPoolIdentityProviderBase { diff --git a/packages/aws-cdk-lib/aws-eks/README.md b/packages/aws-cdk-lib/aws-eks/README.md index 081743a3d0d75..f5d2c00c9aca3 100644 --- a/packages/aws-cdk-lib/aws-eks/README.md +++ b/packages/aws-cdk-lib/aws-eks/README.md @@ -15,6 +15,7 @@ In addition, the library also supports defining Kubernetes resource manifests wi - [Node Groups with IPv6 Support](#node-groups-with-ipv6-support) - [Spot Instances Support](#spot-instances-support) - [Launch Template Support](#launch-template-support) + - [Update clusters](#update-clusters) - [Fargate profiles](#fargate-profiles) - [Self-managed nodes](#self-managed-nodes) - [Spot Instances](#spot-instances) @@ -366,6 +367,29 @@ You may specify one `instanceType` in the launch template or multiple `instanceT Graviton 2 instance types are supported including `c6g`, `m6g`, `r6g` and `t4g`. Graviton 3 instance types are supported including `c7g`. +### Update clusters + +When you rename the cluster name and redeploy the stack, the cluster replacement will be triggered and +the existing one will be deleted after the new one is provisioned. As the cluster resource ARN has been changed, +the cluster resource handler would not be able to delete the old one as the resource ARN in the IAM policy +has been changed. As a workaround, you need to add a temporary policy to the cluster admin role for +successful replacement. Consider this example if you are renaming the cluster from `foo` to `bar`: + +```ts +const cluster = new eks.Cluster(this, 'cluster-to-rename', { + clusterName: 'foo', // rename this to 'bar' + version: eks.KubernetesVersion.V1_29, +}); + +// allow the cluster admin role to delete the cluster 'foo' +cluster.adminRole.addToPolicy(new iam.PolicyStatement({ + actions: ['eks:DeleteCluster'], + resources: [ + Stack.of(this).formatArn({ service: 'eks', resource: 'cluster', resourceName: 'foo' }), +] +})) +``` + ### Fargate profiles AWS Fargate is a technology that provides on-demand, right-sized compute diff --git a/yarn.lock b/yarn.lock index d967a4b0e99e6..ac354b9dba1a3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7726,13 +7726,14 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.62" - resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" - integrity sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA== +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@^0.10.62, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: + version "0.10.63" + resolved "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.63.tgz#9c222a63b6a332ac80b1e373b426af723b895bd6" + integrity sha512-hUCZd2Byj/mNKjfP9jXrdVZ62B8KuA/VoK7X8nUh5qT+AxDmcbvZz041oDVZdbIN1qW6XY9VDNwzkvKnZvK2TQ== dependencies: es6-iterator "^2.0.3" es6-symbol "^3.1.3" + esniff "^2.0.1" next-tick "^1.1.0" es6-error@^4.0.1: @@ -8024,6 +8025,16 @@ eslint@^8: strip-ansi "^6.0.1" text-table "^0.2.0" +esniff@^2.0.1: + version "2.0.1" + resolved "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz#a4d4b43a5c71c7ec51c51098c1d8a29081f9b308" + integrity sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg== + dependencies: + d "^1.0.1" + es5-ext "^0.10.62" + event-emitter "^0.3.5" + type "^2.7.2" + espree@^7.3.0, espree@^7.3.1: version "7.3.1" resolved "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6"