From 0f4a3fff4fb37f9f43a1ebdd6b91d1fd82591b4c Mon Sep 17 00:00:00 2001 From: Luca Pizzini Date: Fri, 4 Aug 2023 12:15:53 +0200 Subject: [PATCH 01/10] fix(apigateway): fixed StepFunctionsExecutionIntegration integrationResponses and Method methodResponses attributes --- ...y-stepfunctions-startexecution.assets.json | 19 + ...stepfunctions-startexecution.template.json | 358 ++++++++++ ...efaultTestDeployAssert3A9ACD49.assets.json | 19 + ...aultTestDeployAssert3A9ACD49.template.json | 36 + .../cdk.out | 1 + .../integ.json | 12 + .../manifest.json | 177 +++++ .../tree.json | 632 ++++++++++++++++++ .../integ.stepfunctions-startexecution.ts | 51 ++ .../lib/integrations/stepfunctions.ts | 8 +- .../aws-cdk-lib/aws-apigateway/lib/method.ts | 2 +- .../test/integrations/stepfunctions.test.ts | 78 +++ 12 files changed, 1389 insertions(+), 4 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json new file mode 100644 index 0000000000000..80015429f55da --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json @@ -0,0 +1,19 @@ +{ + "version": "33.0.0", + "files": { + "8cbe12776c2bea21b28f7f29c548b0d830b9c92d7f8f93dc5fe6047a274592bc": { + "source": { + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8cbe12776c2bea21b28f7f29c548b0d830b9c92d7f8f93dc5fe6047a274592bc.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-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json new file mode 100644 index 0000000000000..60b63f88fb599 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json @@ -0,0 +1,358 @@ +{ + "Resources": { + "myrestapiBAC2BF45": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "Name": "my-rest-api" + } + }, + "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "Description": "Automatically created by the RestApi construct", + "RestApiId": { + "Ref": "myrestapiBAC2BF45" + } + }, + "DependsOn": [ + "myrestapiGET3A49A218", + "myrestapiPOST155A9625" + ] + }, + "myrestapiDeploymentStageprod3140E1BE": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "DeploymentId": { + "Ref": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d" + }, + "RestApiId": { + "Ref": "myrestapiBAC2BF45" + }, + "StageName": "prod" + } + }, + "myrestapiGETStartSyncExecutionRoleC284C05B": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "myrestapiGETStartSyncExecutionRoleDefaultPolicy8B2F6ADF": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "myrestapiGETStartSyncExecutionRoleDefaultPolicy8B2F6ADF", + "Roles": [ + { + "Ref": "myrestapiGETStartSyncExecutionRoleC284C05B" + } + ] + } + }, + "myrestapiGET3A49A218": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "AuthorizationType": "NONE", + "HttpMethod": "GET", + "Integration": { + "Credentials": { + "Fn::GetAtt": [ + "myrestapiGETStartSyncExecutionRoleC284C05B", + "Arn" + ] + }, + "IntegrationHttpMethod": "POST", + "IntegrationResponses": [ + { + "ResponseParameters": { + "method.response.header.Access-Control-Allow-Origin": "'*'" + }, + "StatusCode": "200" + } + ], + "PassthroughBehavior": "NEVER", + "RequestTemplates": { + "application/json": { + "Fn::Join": [ + "", + [ + "## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = false)\n#set($includeQueryString = true)\n#set($includePath = true)\n#set($includeAuthorizer = false)\n#set($allParams = $input.params())\n{\n \"stateMachineArn\": \"", + { + "Ref": "StateMachine2E01A3A5" + }, + "\",\n\n #set($inputString = \"$inputString,@@body@@: $input.body\")\n\n #if ($includeHeaders)\n #set($inputString = \"$inputString, @@header@@:{\")\n #foreach($paramName in $allParams.header.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.header.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n \n #end\n\n #if ($includeQueryString)\n #set($inputString = \"$inputString, @@querystring@@:{\")\n #foreach($paramName in $allParams.querystring.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.querystring.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #if ($includePath)\n #set($inputString = \"$inputString, @@path@@:{\")\n #foreach($paramName in $allParams.path.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.path.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n \n #if ($includeAuthorizer)\n #set($inputString = \"$inputString, @@authorizer@@:{\")\n #foreach($paramName in $context.authorizer.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($context.authorizer.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #set($requestContext = \"\")\n ## Check if the request context should be included as part of the execution input\n #if($requestContext && !$requestContext.empty)\n #set($inputString = \"$inputString,\")\n #set($inputString = \"$inputString @@requestContext@@: $requestContext\")\n #end\n\n #set($inputString = \"$inputString}\")\n #set($inputString = $inputString.replaceAll(\"@@\",'\"'))\n #set($len = $inputString.length() - 1)\n \"input\": \"{$util.escapeJavaScript($inputString.substring(1,$len)).replaceAll(\"\\\\'\",\"'\")}\"\n}\n" + ] + ] + } + }, + "Type": "AWS", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":states:action/StartSyncExecution" + ] + ] + } + }, + "MethodResponses": [ + { + "ResponseParameters": { + "method.response.header.Access-Control-Allow-Origin": true + }, + "StatusCode": "200" + } + ], + "ResourceId": { + "Fn::GetAtt": [ + "myrestapiBAC2BF45", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myrestapiBAC2BF45" + } + } + }, + "myrestapiPOSTStartSyncExecutionRole7AFBE835": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "apigateway.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "myrestapiPOSTStartSyncExecutionRoleDefaultPolicy7D411AE9": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "myrestapiPOSTStartSyncExecutionRoleDefaultPolicy7D411AE9", + "Roles": [ + { + "Ref": "myrestapiPOSTStartSyncExecutionRole7AFBE835" + } + ] + } + }, + "myrestapiPOST155A9625": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "AuthorizationType": "NONE", + "HttpMethod": "POST", + "Integration": { + "Credentials": { + "Fn::GetAtt": [ + "myrestapiPOSTStartSyncExecutionRole7AFBE835", + "Arn" + ] + }, + "IntegrationHttpMethod": "POST", + "IntegrationResponses": [ + { + "ResponseParameters": { + "method.response.header.Access-Control-Allow-Origin": "'*'" + }, + "StatusCode": "200" + } + ], + "PassthroughBehavior": "NEVER", + "RequestTemplates": { + "application/json": { + "Fn::Join": [ + "", + [ + "## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = false)\n#set($includeQueryString = true)\n#set($includePath = true)\n#set($includeAuthorizer = false)\n#set($allParams = $input.params())\n{\n \"stateMachineArn\": \"", + { + "Ref": "StateMachine2E01A3A5" + }, + "\",\n\n #set($inputString = \"$inputString,@@body@@: $input.body\")\n\n #if ($includeHeaders)\n #set($inputString = \"$inputString, @@header@@:{\")\n #foreach($paramName in $allParams.header.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.header.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n \n #end\n\n #if ($includeQueryString)\n #set($inputString = \"$inputString, @@querystring@@:{\")\n #foreach($paramName in $allParams.querystring.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.querystring.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #if ($includePath)\n #set($inputString = \"$inputString, @@path@@:{\")\n #foreach($paramName in $allParams.path.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.path.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n \n #if ($includeAuthorizer)\n #set($inputString = \"$inputString, @@authorizer@@:{\")\n #foreach($paramName in $context.authorizer.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($context.authorizer.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #set($requestContext = \"\")\n ## Check if the request context should be included as part of the execution input\n #if($requestContext && !$requestContext.empty)\n #set($inputString = \"$inputString,\")\n #set($inputString = \"$inputString @@requestContext@@: $requestContext\")\n #end\n\n #set($inputString = \"$inputString}\")\n #set($inputString = $inputString.replaceAll(\"@@\",'\"'))\n #set($len = $inputString.length() - 1)\n \"input\": \"{$util.escapeJavaScript($inputString.substring(1,$len)).replaceAll(\"\\\\'\",\"'\")}\"\n}\n" + ] + ] + } + }, + "Type": "AWS", + "Uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":states:action/StartSyncExecution" + ] + ] + } + }, + "MethodResponses": [ + { + "ResponseParameters": { + "method.response.header.Access-Control-Allow-Origin": true + }, + "StatusCode": "200" + } + ], + "ResourceId": { + "Fn::GetAtt": [ + "myrestapiBAC2BF45", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "myrestapiBAC2BF45" + } + } + }, + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "StateMachine2E01A3A5": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": "{\"StartAt\":\"passTask\",\"States\":{\"passTask\":{\"Type\":\"Pass\",\"InputPath\":\"$.somekey\",\"End\":true}}}", + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "StateMachineType": "EXPRESS" + }, + "DependsOn": [ + "StateMachineRoleB840431D" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Outputs": { + "myrestapiEndpoint0DE8A5DE": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "myrestapiBAC2BF45" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "myrestapiDeploymentStageprod3140E1BE" + }, + "/" + ] + ] + } + } + }, + "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-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets.json new file mode 100644 index 0000000000000..914ca646ec74f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets.json @@ -0,0 +1,19 @@ +{ + "version": "33.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.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-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.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-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/cdk.out new file mode 100644 index 0000000000000..560dae10d018f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"33.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/integ.json new file mode 100644 index 0000000000000..d0083afa83de3 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "33.0.0", + "testCases": { + "aws-apigateway-stepfunctions-startexecution/DefaultTest": { + "stacks": [ + "aws-cdk-aws-apigateway-stepfunctions-startexecution" + ], + "assertionStack": "aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert", + "assertionStackName": "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json new file mode 100644 index 0000000000000..6bb244f507fd6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json @@ -0,0 +1,177 @@ +{ + "version": "33.0.0", + "artifacts": { + "aws-cdk-aws-apigateway-stepfunctions-startexecution.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-cdk-aws-apigateway-stepfunctions-startexecution": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json", + "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}/8cbe12776c2bea21b28f7f29c548b0d830b9c92d7f8f93dc5fe6047a274592bc.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-cdk-aws-apigateway-stepfunctions-startexecution.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": [ + "aws-cdk-aws-apigateway-stepfunctions-startexecution.assets" + ], + "metadata": { + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiBAC2BF45" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Deployment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/DeploymentStage.prod/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiDeploymentStageprod3140E1BE" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Endpoint": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiEndpoint0DE8A5DE" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiGETStartSyncExecutionRoleC284C05B" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiGETStartSyncExecutionRoleDefaultPolicy8B2F6ADF" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiGET3A49A218" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiPOSTStartSyncExecutionRole7AFBE835" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiPOSTStartSyncExecutionRoleDefaultPolicy7D411AE9" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiPOST155A9625" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachineRoleB840431D" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachine2E01A3A5" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-cdk-aws-apigateway-stepfunctions-startexecution" + }, + "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.template.json", + "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": [ + "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.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": [ + "awsapigatewaystepfunctionsstartexecutionDefaultTestDeployAssert3A9ACD49.assets" + ], + "metadata": { + "/aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-apigateway-stepfunctions-startexecution/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-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json new file mode 100644 index 0000000000000..7381baf22af5b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json @@ -0,0 +1,632 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-cdk-aws-apigateway-stepfunctions-startexecution": { + "id": "aws-cdk-aws-apigateway-stepfunctions-startexecution", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution", + "children": { + "my-rest-api": { + "id": "my-rest-api", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::RestApi", + "aws:cdk:cloudformation:props": { + "name": "my-rest-api" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.CfnRestApi", + "version": "0.0.0" + } + }, + "Deployment": { + "id": "Deployment", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Deployment", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Deployment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", + "aws:cdk:cloudformation:props": { + "description": "Automatically created by the RestApi construct", + "restApiId": { + "Ref": "myrestapiBAC2BF45" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.Deployment", + "version": "0.0.0" + } + }, + "DeploymentStage.prod": { + "id": "DeploymentStage.prod", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/DeploymentStage.prod", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/DeploymentStage.prod/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", + "aws:cdk:cloudformation:props": { + "deploymentId": { + "Ref": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d" + }, + "restApiId": { + "Ref": "myrestapiBAC2BF45" + }, + "stageName": "prod" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.Stage", + "version": "0.0.0" + } + }, + "Endpoint": { + "id": "Endpoint", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Endpoint", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnOutput", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default", + "children": { + "GET": { + "id": "GET", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET", + "children": { + "StartSyncExecutionRole": { + "id": "StartSyncExecutionRole", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole", + "children": { + "ImportStartSyncExecutionRole": { + "id": "ImportStartSyncExecutionRole", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/ImportStartSyncExecutionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/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": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "myrestapiGETStartSyncExecutionRoleDefaultPolicy8B2F6ADF", + "roles": [ + { + "Ref": "myrestapiGETStartSyncExecutionRoleC284C05B" + } + ] + } + }, + "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" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "authorizationType": "NONE", + "httpMethod": "GET", + "integration": { + "type": "AWS", + "uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":states:action/StartSyncExecution" + ] + ] + }, + "integrationHttpMethod": "POST", + "requestTemplates": { + "application/json": { + "Fn::Join": [ + "", + [ + "## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = false)\n#set($includeQueryString = true)\n#set($includePath = true)\n#set($includeAuthorizer = false)\n#set($allParams = $input.params())\n{\n \"stateMachineArn\": \"", + { + "Ref": "StateMachine2E01A3A5" + }, + "\",\n\n #set($inputString = \"$inputString,@@body@@: $input.body\")\n\n #if ($includeHeaders)\n #set($inputString = \"$inputString, @@header@@:{\")\n #foreach($paramName in $allParams.header.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.header.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n \n #end\n\n #if ($includeQueryString)\n #set($inputString = \"$inputString, @@querystring@@:{\")\n #foreach($paramName in $allParams.querystring.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.querystring.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #if ($includePath)\n #set($inputString = \"$inputString, @@path@@:{\")\n #foreach($paramName in $allParams.path.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.path.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n \n #if ($includeAuthorizer)\n #set($inputString = \"$inputString, @@authorizer@@:{\")\n #foreach($paramName in $context.authorizer.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($context.authorizer.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #set($requestContext = \"\")\n ## Check if the request context should be included as part of the execution input\n #if($requestContext && !$requestContext.empty)\n #set($inputString = \"$inputString,\")\n #set($inputString = \"$inputString @@requestContext@@: $requestContext\")\n #end\n\n #set($inputString = \"$inputString}\")\n #set($inputString = $inputString.replaceAll(\"@@\",'\"'))\n #set($len = $inputString.length() - 1)\n \"input\": \"{$util.escapeJavaScript($inputString.substring(1,$len)).replaceAll(\"\\\\'\",\"'\")}\"\n}\n" + ] + ] + } + }, + "passthroughBehavior": "NEVER", + "integrationResponses": [ + { + "responseParameters": { + "method.response.header.Access-Control-Allow-Origin": "'*'" + }, + "statusCode": "200" + } + ], + "credentials": { + "Fn::GetAtt": [ + "myrestapiGETStartSyncExecutionRoleC284C05B", + "Arn" + ] + } + }, + "methodResponses": [ + { + "statusCode": "200", + "responseParameters": { + "method.response.header.Access-Control-Allow-Origin": true + } + } + ], + "resourceId": { + "Fn::GetAtt": [ + "myrestapiBAC2BF45", + "RootResourceId" + ] + }, + "restApiId": { + "Ref": "myrestapiBAC2BF45" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.Method", + "version": "0.0.0" + } + }, + "POST": { + "id": "POST", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST", + "children": { + "StartSyncExecutionRole": { + "id": "StartSyncExecutionRole", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole", + "children": { + "ImportStartSyncExecutionRole": { + "id": "ImportStartSyncExecutionRole", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/ImportStartSyncExecutionRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/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": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "StateMachine2E01A3A5" + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "myrestapiPOSTStartSyncExecutionRoleDefaultPolicy7D411AE9", + "roles": [ + { + "Ref": "myrestapiPOSTStartSyncExecutionRole7AFBE835" + } + ] + } + }, + "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" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "authorizationType": "NONE", + "httpMethod": "POST", + "integration": { + "type": "AWS", + "uri": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":apigateway:", + { + "Ref": "AWS::Region" + }, + ":states:action/StartSyncExecution" + ] + ] + }, + "integrationHttpMethod": "POST", + "requestTemplates": { + "application/json": { + "Fn::Join": [ + "", + [ + "## Velocity Template used for API Gateway request mapping template\n##\n## This template forwards the request body, header, path, and querystring\n## to the execution input of the state machine.\n##\n## \"@@\" is used here as a placeholder for '\"' to avoid using escape characters.\n\n#set($inputString = '')\n#set($includeHeaders = false)\n#set($includeQueryString = true)\n#set($includePath = true)\n#set($includeAuthorizer = false)\n#set($allParams = $input.params())\n{\n \"stateMachineArn\": \"", + { + "Ref": "StateMachine2E01A3A5" + }, + "\",\n\n #set($inputString = \"$inputString,@@body@@: $input.body\")\n\n #if ($includeHeaders)\n #set($inputString = \"$inputString, @@header@@:{\")\n #foreach($paramName in $allParams.header.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.header.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n \n #end\n\n #if ($includeQueryString)\n #set($inputString = \"$inputString, @@querystring@@:{\")\n #foreach($paramName in $allParams.querystring.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.querystring.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #if ($includePath)\n #set($inputString = \"$inputString, @@path@@:{\")\n #foreach($paramName in $allParams.path.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($allParams.path.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n \n #if ($includeAuthorizer)\n #set($inputString = \"$inputString, @@authorizer@@:{\")\n #foreach($paramName in $context.authorizer.keySet())\n #set($inputString = \"$inputString @@$paramName@@: @@$util.escapeJavaScript($context.authorizer.get($paramName))@@\")\n #if($foreach.hasNext)\n #set($inputString = \"$inputString,\")\n #end\n #end\n #set($inputString = \"$inputString }\")\n #end\n\n #set($requestContext = \"\")\n ## Check if the request context should be included as part of the execution input\n #if($requestContext && !$requestContext.empty)\n #set($inputString = \"$inputString,\")\n #set($inputString = \"$inputString @@requestContext@@: $requestContext\")\n #end\n\n #set($inputString = \"$inputString}\")\n #set($inputString = $inputString.replaceAll(\"@@\",'\"'))\n #set($len = $inputString.length() - 1)\n \"input\": \"{$util.escapeJavaScript($inputString.substring(1,$len)).replaceAll(\"\\\\'\",\"'\")}\"\n}\n" + ] + ] + } + }, + "passthroughBehavior": "NEVER", + "integrationResponses": [ + { + "responseParameters": { + "method.response.header.Access-Control-Allow-Origin": "'*'" + }, + "statusCode": "200" + } + ], + "credentials": { + "Fn::GetAtt": [ + "myrestapiPOSTStartSyncExecutionRole7AFBE835", + "Arn" + ] + } + }, + "methodResponses": [ + { + "statusCode": "200", + "responseParameters": { + "method.response.header.Access-Control-Allow-Origin": true + } + } + ], + "resourceId": { + "Fn::GetAtt": [ + "myrestapiBAC2BF45", + "RootResourceId" + ] + }, + "restApiId": { + "Ref": "myrestapiBAC2BF45" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.Method", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.ResourceBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_apigateway.RestApi", + "version": "0.0.0" + } + }, + "passTask": { + "id": "passTask", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/passTask", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.Pass", + "version": "0.0.0" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/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": "aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": "{\"StartAt\":\"passTask\",\"States\":{\"passTask\":{\"Type\":\"Pass\",\"InputPath\":\"$.somekey\",\"End\":true}}}", + "roleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "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" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "aws-apigateway-stepfunctions-startexecution": { + "id": "aws-apigateway-stepfunctions-startexecution", + "path": "aws-apigateway-stepfunctions-startexecution", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "aws-apigateway-stepfunctions-startexecution/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "aws-apigateway-stepfunctions-startexecution/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.69" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-apigateway-stepfunctions-startexecution/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.2.69" + } + } + }, + "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-apigateway/test/integ.stepfunctions-startexecution.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.ts new file mode 100644 index 0000000000000..86dbe8f9c0974 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.ts @@ -0,0 +1,51 @@ +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as cdk from 'aws-cdk-lib'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as apigw from 'aws-cdk-lib/aws-apigateway'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'aws-cdk-aws-apigateway-stepfunctions-startexecution'); + +const api = new apigw.RestApi(stack, 'my-rest-api'); +const passTask = new sfn.Pass(stack, 'passTask', { + inputPath: '$.somekey', +}); + +const stateMachine: sfn.IStateMachine = new sfn.StateMachine(stack, 'StateMachine', { + definitionBody: sfn.DefinitionBody.fromChainable(passTask), + stateMachineType: sfn.StateMachineType.EXPRESS, +}); + +const methodOptions = { + methodResponses: [ + { + statusCode: '200', + responseParameters: { + 'method.response.header.Access-Control-Allow-Origin': true, + }, + }, + ], +}; + +const integrationOptions = { + integrationResponses: [ + { + responseParameters: { + 'method.response.header.Access-Control-Allow-Origin': "'*'", + }, + statusCode: '200', + }, + ], +}; + +const integ = apigw.StepFunctionsIntegration.startExecution(stateMachine, integrationOptions); +api.root.addMethod('GET', integ, methodOptions); +api.root.addMethod('POST', integ, methodOptions); + +new IntegTest(app, 'aws-apigateway-stepfunctions-startexecution', { + testCases: [ + stack, + ], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts index 4e75eb967afab..9b0a77bd6a87d 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts @@ -117,7 +117,7 @@ class StepFunctionsExecutionIntegration extends AwsIntegration { action: 'StartSyncExecution', options: { credentialsRole: options.credentialsRole, - integrationResponses: integrationResponse(), + integrationResponses: options.integrationResponses ?? integrationResponse(), passthroughBehavior: PassthroughBehavior.NEVER, requestTemplates: requestTemplates(stateMachine, options), ...options, @@ -157,8 +157,10 @@ class StepFunctionsExecutionIntegration extends AwsIntegration { deploymentToken = JSON.stringify({ stateMachineName }); } - for (const methodResponse of METHOD_RESPONSES) { - method.addMethodResponse(methodResponse); + if (method.methodResponses.length === 0) { + for (const methodResponse of METHOD_RESPONSES) { + method.addMethodResponse(methodResponse); + } } return { diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index db93c7ffef611..574ab1795813e 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -173,7 +173,7 @@ export class Method extends Resource { */ public readonly api: IRestApi; - private methodResponses: MethodResponse[]; + public readonly methodResponses: MethodResponse[]; constructor(scope: Construct, id: string, props: MethodProps) { super(scope, id); diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index 0f2a5c65bcf9a..a762cf73820ed 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -372,6 +372,84 @@ describe('StepFunctionsIntegration', () => { .toThrow(/State Machine must be of type "EXPRESS". Please use StateMachineType.EXPRESS as the stateMachineType/); }); }); + + test('with custom methodOptions and integrationOptions', () => { + //GIVEN + const { stack, api, stateMachine } = givenSetup(); + + //WHEN + const methodOptions = { + methodResponses: [ + { + statusCode: '200', + responseParameters: { + 'method.response.header.Access-Control-Allow-Origin': true, + }, + }, + ], + }; + + const integrationOptions = { + integrationResponses: [ + { + responseParameters: { + 'method.response.header.Access-Control-Allow-Origin': "'*'", + }, + statusCode: '200', + }, + ], + }; + + const integ = apigw.StepFunctionsIntegration.startExecution(stateMachine, integrationOptions); + api.root.addMethod('GET', integ, methodOptions); + api.root.addMethod('POST', integ, methodOptions); + + //THEN + Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 2); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'GET', + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Origin': true, + }, + StatusCode: '200', + }, + ], + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Origin': "'*'", + }, + StatusCode: '200', + }, + ], + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { + HttpMethod: 'POST', + MethodResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Origin': true, + }, + StatusCode: '200', + }, + ], + Integration: { + IntegrationResponses: [ + { + ResponseParameters: { + 'method.response.header.Access-Control-Allow-Origin': "'*'", + }, + StatusCode: '200', + }, + ], + }, + }); + }); }); function givenSetup() { From 870a143c9fd1301a5e99a4ea16c73c7875abca62 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Thu, 10 Aug 2023 17:02:30 +0200 Subject: [PATCH 02/10] This is weird, it is also broken?? --- .../lib/integrations/stepfunctions.ts | 6 ++--- .../aws-cdk-lib/aws-apigateway/lib/method.ts | 26 ++++++++++++++----- .../test/integrations/stepfunctions.test.ts | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts index 9b0a77bd6a87d..252322158d2b3 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/integrations/stepfunctions.ts @@ -157,10 +157,8 @@ class StepFunctionsExecutionIntegration extends AwsIntegration { deploymentToken = JSON.stringify({ stateMachineName }); } - if (method.methodResponses.length === 0) { - for (const methodResponse of METHOD_RESPONSES) { - method.addMethodResponse(methodResponse); - } + for (const methodResponse of METHOD_RESPONSES) { + method.addMethodResponse(methodResponse); } return { diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index 574ab1795813e..52c98258e4781 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -173,7 +173,7 @@ export class Method extends Resource { */ public readonly api: IRestApi; - public readonly methodResponses: MethodResponse[]; + private readonly methodResponses: MethodResponse[]; constructor(scope: Construct, id: string, props: MethodProps) { super(scope, id); @@ -242,6 +242,22 @@ export class Method extends Resource { }, }); } + + this.node.addValidation({ + validate: () => { + const responses = this.methodResponses; + + // Validate that all method response codes are unique + const counts: Record = {}; + for (const resp of responses) { + counts[resp.statusCode] = (counts[resp.statusCode] ?? 0) + 1; + } + const dupes = Object.entries(counts).filter(([_, n]) => n > 1).map(([c, _]) => c); + return dupes.map((code) => + `${counts[code]} methodResponses for code ${code}: ${this.methodResponses.filter((r) => r.statusCode === code).map((x) => JSON.stringify(x)).join(', ')}`, + ); + }, + }); } /** @@ -322,12 +338,8 @@ export class Method extends Resource { let responseModels: {[contentType: string]: string} | undefined; if (mr.responseModels) { - responseModels = {}; - for (const contentType in mr.responseModels) { - if (mr.responseModels.hasOwnProperty(contentType)) { - responseModels[contentType] = mr.responseModels[contentType].modelId; - } - } + responseModels = Object.fromEntries(Object.entries(mr.responseModels) + .map(([contentType, rm]) => [contentType, rm.modelId])); } const methodResponseProp = { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index a762cf73820ed..7e371d8669fbd 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -402,7 +402,7 @@ describe('StepFunctionsIntegration', () => { const integ = apigw.StepFunctionsIntegration.startExecution(stateMachine, integrationOptions); api.root.addMethod('GET', integ, methodOptions); - api.root.addMethod('POST', integ, methodOptions); + // api.root.addMethod('POST', integ, methodOptions); //THEN Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 2); From 69c5847ecae8ff88aacf0d6c6f6bbb54735cc221 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 12:01:43 +0200 Subject: [PATCH 03/10] Stop false sharing, make addMethodResponse merge response objects --- .../aws-cdk-lib/aws-apigateway/lib/method.ts | 42 ++++++++++--------- .../test/integrations/stepfunctions.test.ts | 4 +- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index 52c98258e4781..1303ff9d95893 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -173,7 +173,7 @@ export class Method extends Resource { */ public readonly api: IRestApi; - private readonly methodResponses: MethodResponse[]; + private readonly methodResponses: MethodResponse[] = []; constructor(scope: Construct, id: string, props: MethodProps) { super(scope, id); @@ -203,7 +203,9 @@ export class Method extends Resource { authorizer._attachToApi(this.api); } - this.methodResponses = options.methodResponses ?? defaultMethodOptions.methodResponses ?? []; + for (const mr of options.methodResponses ?? defaultMethodOptions.methodResponses ?? []) { + this.addMethodResponse(mr); + } const integration = props.integration ?? this.resource.defaultIntegration ?? new MockIntegration(); const bindResult = integration.bind(this); @@ -242,22 +244,6 @@ export class Method extends Resource { }, }); } - - this.node.addValidation({ - validate: () => { - const responses = this.methodResponses; - - // Validate that all method response codes are unique - const counts: Record = {}; - for (const resp of responses) { - counts[resp.statusCode] = (counts[resp.statusCode] ?? 0) + 1; - } - const dupes = Object.entries(counts).filter(([_, n]) => n > 1).map(([c, _]) => c); - return dupes.map((code) => - `${counts[code]} methodResponses for code ${code}: ${this.methodResponses.filter((r) => r.statusCode === code).map((x) => JSON.stringify(x)).join(', ')}`, - ); - }, - }); } /** @@ -294,9 +280,23 @@ export class Method extends Resource { /** * Add a method response to this method + * + * If a method response for the same status code already exists, the `responseModels` + * and `responseParameters` maps will be merged. */ public addMethodResponse(methodResponse: MethodResponse): void { - this.methodResponses.push(methodResponse); + const i = this.methodResponses.findIndex((mr) => mr.statusCode === methodResponse.statusCode); + if (i >= 0) { + // Need to do a splice because MethodResponses are immutable + const existing = this.methodResponses[i]; + this.methodResponses.splice(i, 1, { + statusCode: methodResponse.statusCode, + responseModels: mergeDicts(existing.responseModels, methodResponse.responseModels), + responseParameters: mergeDicts(existing.responseParameters, methodResponse.responseParameters), + }); + } else { + this.methodResponses.push(methodResponse); + } } private renderIntegration(bindResult: IntegrationConfig): CfnMethod.IntegrationProperty { @@ -519,3 +519,7 @@ export enum AuthorizationType { function pathForArn(path: string): string { return path.replace(/\{[^\}]*\}/g, '*'); // replace path parameters (like '{bookId}') with asterisk } + +function mergeDicts(xs?: Record, ys?: Record): Record | undefined { + return xs || ys ? Object.assign(xs ?? {}, ys) : undefined; +} \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index 7e371d8669fbd..3a7a6d9018744 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -373,7 +373,7 @@ describe('StepFunctionsIntegration', () => { }); }); - test('with custom methodOptions and integrationOptions', () => { + test('merging methodOptions.methodResponses, and not susceptible to false sharing of arrays', () => { //GIVEN const { stack, api, stateMachine } = givenSetup(); @@ -402,7 +402,7 @@ describe('StepFunctionsIntegration', () => { const integ = apigw.StepFunctionsIntegration.startExecution(stateMachine, integrationOptions); api.root.addMethod('GET', integ, methodOptions); - // api.root.addMethod('POST', integ, methodOptions); + api.root.addMethod('POST', integ, methodOptions); //THEN Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 2); From ab362409e20414805a29f799b04cb64789c8c452 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 13:15:59 +0200 Subject: [PATCH 04/10] Updated unit test for merge --- .../aws-apigateway/test/integrations/stepfunctions.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index 3a7a6d9018744..d5aa7ce3387cc 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -413,6 +413,9 @@ describe('StepFunctionsIntegration', () => { ResponseParameters: { 'method.response.header.Access-Control-Allow-Origin': true, }, + ResponseModels: { + 'application/json': 'Empty', + }, StatusCode: '200', }, ], @@ -435,6 +438,9 @@ describe('StepFunctionsIntegration', () => { ResponseParameters: { 'method.response.header.Access-Control-Allow-Origin': true, }, + ResponseModels: { + 'application/json': 'Empty', + }, StatusCode: '200', }, ], From 53ec4b315aaf2c2c8b612ea280896ed81b4c57c1 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 13:31:27 +0200 Subject: [PATCH 05/10] Split off half of the change to https://github.com/aws/aws-cdk/pull/26718 --- .../aws-cdk-lib/aws-apigateway/lib/method.ts | 17 +++++------------ .../test/integrations/stepfunctions.test.ts | 3 --- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index 1303ff9d95893..fe1150d9fa091 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -13,7 +13,7 @@ import { IStage } from './stage'; import { validateHttpMethod } from './util'; import * as cloudwatch from '../../aws-cloudwatch'; import * as iam from '../../aws-iam'; -import { ArnFormat, FeatureFlags, Lazy, Names, Resource, Stack } from '../../core'; +import { Annotations, ArnFormat, FeatureFlags, Lazy, Names, Resource, Stack } from '../../core'; import { APIGATEWAY_REQUEST_VALIDATOR_UNIQUE_ID } from '../../cx-api'; export interface MethodOptions { @@ -285,18 +285,11 @@ export class Method extends Resource { * and `responseParameters` maps will be merged. */ public addMethodResponse(methodResponse: MethodResponse): void { - const i = this.methodResponses.findIndex((mr) => mr.statusCode === methodResponse.statusCode); - if (i >= 0) { - // Need to do a splice because MethodResponses are immutable - const existing = this.methodResponses[i]; - this.methodResponses.splice(i, 1, { - statusCode: methodResponse.statusCode, - responseModels: mergeDicts(existing.responseModels, methodResponse.responseModels), - responseParameters: mergeDicts(existing.responseParameters, methodResponse.responseParameters), - }); - } else { - this.methodResponses.push(methodResponse); + const mr = this.methodResponses.find((mr) => mr.statusCode === methodResponse.statusCode); + if (mr) { + Annotations.of(this).addWarning(`addMethodResponse called multiple times with statusCode=${methodResponse.statusCode}, deployment will be nondeterministic. Use a single addMethodResponse call to configure the entire response.`); } + this.methodResponses.push(methodResponse); } private renderIntegration(bindResult: IntegrationConfig): CfnMethod.IntegrationProperty { diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index d5aa7ce3387cc..34e097afd5b63 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -438,9 +438,6 @@ describe('StepFunctionsIntegration', () => { ResponseParameters: { 'method.response.header.Access-Control-Allow-Origin': true, }, - ResponseModels: { - 'application/json': 'Empty', - }, StatusCode: '200', }, ], From 9632ec68847644c3f63e96ca4ef1ea64aa406480 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 13:34:56 +0200 Subject: [PATCH 06/10] Update docs --- packages/aws-cdk-lib/aws-apigateway/lib/method.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index fe1150d9fa091..3c723134fdb19 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -281,8 +281,9 @@ export class Method extends Resource { /** * Add a method response to this method * - * If a method response for the same status code already exists, the `responseModels` - * and `responseParameters` maps will be merged. + * You should only add one method reponse for every status code. The API allows it + * for historical reasons, but will add a warning if this happens. If you do, your Method + * will nondeterministically use one of the responses, and ignore the rest. */ public addMethodResponse(methodResponse: MethodResponse): void { const mr = this.methodResponses.find((mr) => mr.statusCode === methodResponse.statusCode); From d429fb58fbd7d24964cf325af90b2af0d0fc1b16 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 13:48:12 +0200 Subject: [PATCH 07/10] Remove unused function --- packages/aws-cdk-lib/aws-apigateway/lib/method.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index 3c723134fdb19..c83c3bc43b3d0 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -512,8 +512,4 @@ export enum AuthorizationType { function pathForArn(path: string): string { return path.replace(/\{[^\}]*\}/g, '*'); // replace path parameters (like '{bookId}') with asterisk -} - -function mergeDicts(xs?: Record, ys?: Record): Record | undefined { - return xs || ys ? Object.assign(xs ?? {}, ys) : undefined; } \ No newline at end of file From c1a109bdb7b851e08d8ba876fdc5203583e2c552 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 14:31:00 +0200 Subject: [PATCH 08/10] Linter problem --- packages/aws-cdk-lib/aws-apigateway/lib/method.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts index c83c3bc43b3d0..5b4ca0428f86f 100644 --- a/packages/aws-cdk-lib/aws-apigateway/lib/method.ts +++ b/packages/aws-cdk-lib/aws-apigateway/lib/method.ts @@ -286,7 +286,7 @@ export class Method extends Resource { * will nondeterministically use one of the responses, and ignore the rest. */ public addMethodResponse(methodResponse: MethodResponse): void { - const mr = this.methodResponses.find((mr) => mr.statusCode === methodResponse.statusCode); + const mr = this.methodResponses.find((x) => x.statusCode === methodResponse.statusCode); if (mr) { Annotations.of(this).addWarning(`addMethodResponse called multiple times with statusCode=${methodResponse.statusCode}, deployment will be nondeterministic. Use a single addMethodResponse call to configure the entire response.`); } From e140bbfc9960f1345368e3f0f524fe8320da6845 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Fri, 11 Aug 2023 15:30:51 +0200 Subject: [PATCH 09/10] Fix test --- .../test/integrations/stepfunctions.test.ts | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts index 34e097afd5b63..26b2a34662b09 100644 --- a/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts +++ b/packages/aws-cdk-lib/aws-apigateway/test/integrations/stepfunctions.test.ts @@ -373,7 +373,7 @@ describe('StepFunctionsIntegration', () => { }); }); - test('merging methodOptions.methodResponses, and not susceptible to false sharing of arrays', () => { + test('addMethod is not susceptible to false sharing of arrays', () => { //GIVEN const { stack, api, stateMachine } = givenSetup(); @@ -404,7 +404,9 @@ describe('StepFunctionsIntegration', () => { api.root.addMethod('GET', integ, methodOptions); api.root.addMethod('POST', integ, methodOptions); - //THEN + // THEN - the MethodResponses arrays have 4 elements instead of 8 + // (This is still incorrect because 200 occurs multiple times, but that's a separate + // issue with a non-straightforward solution) Template.fromStack(stack).resourceCountIs('AWS::ApiGateway::Method', 2); Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::Method', { HttpMethod: 'GET', @@ -413,11 +415,26 @@ describe('StepFunctionsIntegration', () => { ResponseParameters: { 'method.response.header.Access-Control-Allow-Origin': true, }, + StatusCode: '200', + }, + { ResponseModels: { 'application/json': 'Empty', }, StatusCode: '200', }, + { + ResponseModels: { + 'application/json': 'Error', + }, + StatusCode: '400', + }, + { + ResponseModels: { + 'application/json': 'Error', + }, + StatusCode: '500', + }, ], Integration: { IntegrationResponses: [ @@ -440,6 +457,24 @@ describe('StepFunctionsIntegration', () => { }, StatusCode: '200', }, + { + ResponseModels: { + 'application/json': 'Empty', + }, + StatusCode: '200', + }, + { + ResponseModels: { + 'application/json': 'Error', + }, + StatusCode: '400', + }, + { + ResponseModels: { + 'application/json': 'Error', + }, + StatusCode: '500', + }, ], Integration: { IntegrationResponses: [ From e70d481556232f0c1ee02a94fe7743fba00b301e Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 14 Aug 2023 11:44:16 +0200 Subject: [PATCH 10/10] Snapshot update --- ...y-stepfunctions-startexecution.assets.json | 4 +- ...stepfunctions-startexecution.template.json | 40 +++- .../manifest.json | 25 ++- .../tree.json | 178 +++++++++++------- 4 files changed, 170 insertions(+), 77 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json index 80015429f55da..b4c64ab60cc31 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.assets.json @@ -1,7 +1,7 @@ { "version": "33.0.0", "files": { - "8cbe12776c2bea21b28f7f29c548b0d830b9c92d7f8f93dc5fe6047a274592bc": { + "11071ca702d34295486ea4a64c45b64857f4bd23c672fe0895a0b7e753065d77": { "source": { "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8cbe12776c2bea21b28f7f29c548b0d830b9c92d7f8f93dc5fe6047a274592bc.json", + "objectKey": "11071ca702d34295486ea4a64c45b64857f4bd23c672fe0895a0b7e753065d77.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json index 60b63f88fb599..d117c9978ce39 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/aws-cdk-aws-apigateway-stepfunctions-startexecution.template.json @@ -6,7 +6,7 @@ "Name": "my-rest-api" } }, - "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d": { + "myrestapiDeployment010A9D4F8d8391dd5e41be487121f43257df00d7": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "Description": "Automatically created by the RestApi construct", @@ -23,7 +23,7 @@ "Type": "AWS::ApiGateway::Stage", "Properties": { "DeploymentId": { - "Ref": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d" + "Ref": "myrestapiDeployment010A9D4F8d8391dd5e41be487121f43257df00d7" }, "RestApiId": { "Ref": "myrestapiBAC2BF45" @@ -131,6 +131,24 @@ "method.response.header.Access-Control-Allow-Origin": true }, "StatusCode": "200" + }, + { + "ResponseModels": { + "application/json": "Empty" + }, + "StatusCode": "200" + }, + { + "ResponseModels": { + "application/json": "Error" + }, + "StatusCode": "400" + }, + { + "ResponseModels": { + "application/json": "Error" + }, + "StatusCode": "500" } ], "ResourceId": { @@ -244,6 +262,24 @@ "method.response.header.Access-Control-Allow-Origin": true }, "StatusCode": "200" + }, + { + "ResponseModels": { + "application/json": "Empty" + }, + "StatusCode": "200" + }, + { + "ResponseModels": { + "application/json": "Error" + }, + "StatusCode": "400" + }, + { + "ResponseModels": { + "application/json": "Error" + }, + "StatusCode": "500" } ], "ResourceId": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json index 6bb244f507fd6..7f56cd4cd730a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/manifest.json @@ -17,7 +17,7 @@ "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}/8cbe12776c2bea21b28f7f29c548b0d830b9c92d7f8f93dc5fe6047a274592bc.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/11071ca702d34295486ea4a64c45b64857f4bd23c672fe0895a0b7e753065d77.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -42,7 +42,7 @@ "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Deployment/Resource": [ { "type": "aws:cdk:logicalId", - "data": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d" + "data": "myrestapiDeployment010A9D4F8d8391dd5e41be487121f43257df00d7" } ], "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/DeploymentStage.prod/Resource": [ @@ -57,6 +57,12 @@ "data": "myrestapiEndpoint0DE8A5DE" } ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET": [ + { + "type": "aws:cdk:warning", + "data": "addMethodResponse called multiple times with statusCode=200, deployment will be nondeterministic. Use a single addMethodResponse call to configure the entire response." + } + ], "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -75,6 +81,12 @@ "data": "myrestapiGET3A49A218" } ], + "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST": [ + { + "type": "aws:cdk:warning", + "data": "addMethodResponse called multiple times with statusCode=200, deployment will be nondeterministic. Use a single addMethodResponse call to configure the entire response." + } + ], "/aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -116,6 +128,15 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d": [ + { + "type": "aws:cdk:logicalId", + "data": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-aws-apigateway-stepfunctions-startexecution" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json index 7381baf22af5b..73b02800aefcc 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.stepfunctions-startexecution.js.snapshot/tree.json @@ -22,8 +22,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnRestApi", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Deployment": { @@ -43,14 +43,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.Deployment", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "DeploymentStage.prod": { @@ -64,7 +64,7 @@ "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", "aws:cdk:cloudformation:props": { "deploymentId": { - "Ref": "myrestapiDeployment010A9D4F59b46296e944eb988c600755d169a00d" + "Ref": "myrestapiDeployment010A9D4F8d8391dd5e41be487121f43257df00d7" }, "restApiId": { "Ref": "myrestapiBAC2BF45" @@ -73,22 +73,22 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.Stage", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Endpoint": { "id": "Endpoint", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Endpoint", "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Default": { @@ -107,8 +107,8 @@ "id": "ImportStartSyncExecutionRole", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/GET/StartSyncExecutionRole/ImportStartSyncExecutionRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Resource": { @@ -132,8 +132,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "DefaultPolicy": { @@ -167,20 +167,20 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Resource": { @@ -246,6 +246,24 @@ "responseParameters": { "method.response.header.Access-Control-Allow-Origin": true } + }, + { + "statusCode": "200", + "responseModels": { + "application/json": "Empty" + } + }, + { + "statusCode": "400", + "responseModels": { + "application/json": "Error" + } + }, + { + "statusCode": "500", + "responseModels": { + "application/json": "Error" + } } ], "resourceId": { @@ -260,14 +278,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnMethod", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.Method", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "POST": { @@ -282,8 +300,8 @@ "id": "ImportStartSyncExecutionRole", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/my-rest-api/Default/POST/StartSyncExecutionRole/ImportStartSyncExecutionRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Resource": { @@ -307,8 +325,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "DefaultPolicy": { @@ -342,20 +360,20 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Resource": { @@ -421,6 +439,24 @@ "responseParameters": { "method.response.header.Access-Control-Allow-Origin": true } + }, + { + "statusCode": "200", + "responseModels": { + "application/json": "Empty" + } + }, + { + "statusCode": "400", + "responseModels": { + "application/json": "Error" + } + }, + { + "statusCode": "500", + "responseModels": { + "application/json": "Error" + } } ], "resourceId": { @@ -435,34 +471,34 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.CfnMethod", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.Method", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.ResourceBase", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_apigateway.RestApi", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "passTask": { "id": "passTask", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/passTask", "constructInfo": { - "fqn": "aws-cdk-lib.aws_stepfunctions.Pass", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "StateMachine": { @@ -477,8 +513,8 @@ "id": "ImportRole", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/StateMachine/Role/ImportRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Resource": { @@ -502,14 +538,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "Resource": { @@ -529,36 +565,36 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/BootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "aws-cdk-aws-apigateway-stepfunctions-startexecution/CheckBootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "aws-apigateway-stepfunctions-startexecution": { @@ -585,22 +621,22 @@ "id": "BootstrapVersion", "path": "aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "aws-apigateway-stepfunctions-startexecution/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } }, @@ -625,8 +661,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.App", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.2.69" } } } \ No newline at end of file