diff --git a/CHANGELOG.md b/CHANGELOG.md index f9f908ccf..8e4d6652d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.71.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.70.0...v2.71.0) (2024-09-27) + +Build on CDK v2.160.0 + +### Bug Fixes +* **aws-openapigateway-lambda:** add id to permission resource id ([#1211](https://github.com/awslabs/aws-solutions-constructs/pull/1211)) + + ## [2.70.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.69.0...v2.70.0) (2024-09-18) Built on CDK v2.154.1 diff --git a/deployment/v2/align-version.js b/deployment/v2/align-version.js index 11409d34e..ae42df785 100755 --- a/deployment/v2/align-version.js +++ b/deployment/v2/align-version.js @@ -10,7 +10,7 @@ const nullVersionMarker = process.argv[2]; const targetSolutionsConstructsVersion = process.argv[3]; // these versions need to be sourced from a config file -const awsCdkLibVersion = '2.154.1'; +const awsCdkLibVersion = '2.160.0'; for (const file of process.argv.splice(4)) { const pkg = JSON.parse(fs.readFileSync(file).toString()); diff --git a/deployment/v2/bootstrap.sh b/deployment/v2/bootstrap.sh index 5597ba310..6a6a8dec4 100755 --- a/deployment/v2/bootstrap.sh +++ b/deployment/v2/bootstrap.sh @@ -22,7 +22,8 @@ npm install -g aws-cdk # Install cfn-guard and rules export RULE_BUCKET=solutions-build-assets -export RULE_FILE_NAME=aws-solutions-constructs.guard +# export RULE_FILE_NAME=aws-solutions-constructs.guard +export RULE_FILE_NAME=aws-solutions.guard mkdir -p ~/.guard mkdir -p ~/.guard/bin diff --git a/source/lerna.json b/source/lerna.json index 44e1bb335..3262810bd 100644 --- a/source/lerna.json +++ b/source/lerna.json @@ -1,10 +1,9 @@ { - "lerna": "3.15.0", + "lerna": "8.1.8", "npmClient": "yarn", - "useWorkspaces": true, "packages": [ - "./patterns/@aws-solutions-constructs/*" + "patterns/@aws-solutions-constructs/*" ], "rejectCycles": "true", - "version": "2.70.0" + "version": "2.71.0" } diff --git a/source/package.json b/source/package.json index 6f94382da..ccfda2494 100644 --- a/source/package.json +++ b/source/package.json @@ -32,13 +32,13 @@ "constructs": "^10.0.0" }, "devDependencies": { - "lerna": "^3.22.1", + "lerna": "8.1.8", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" }, "workspaces": { "packages": [ - "./patterns/@aws-solutions-constructs/*" + "patterns/@aws-solutions-constructs/*" ], "nohoist": [ "**/deepmerge", diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/lib/index.ts index 4ee0e2224..8aa5bb8ff 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/lib/index.ts +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/lib/index.ts @@ -158,7 +158,7 @@ export class OpenApiGatewayToLambda extends Construct { // Redeploy the API any time one of the lambda functions changes this.apiGateway.latestDeployment?.addToLogicalId(apiLambdaFunction.lambdaFunction.functionArn); // Grant APIGW invocation rights for each lambda function - apiLambdaFunction.lambdaFunction.addPermission('PermitAPIGInvocation', { + apiLambdaFunction.lambdaFunction.addPermission(`${id}PermitAPIGInvocation`, { principal: new iam.ServicePrincipal('apigateway.amazonaws.com'), sourceArn: this.apiGateway.arnForExecuteApi('*') }); diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/cfn-response.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/cfn-response.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/consts.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/consts.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js new file mode 100644 index 000000000..952048e6f --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js @@ -0,0 +1,3 @@ +"use strict";const cfnResponse=require("./cfn-response"),consts=require("./consts"),outbound_1=require("./outbound"),util_1=require("./util");async function onEvent(cfnRequest){const sanitizedRequest={...cfnRequest,ResponseURL:"..."};(0,util_1.log)("onEventHandler",sanitizedRequest),cfnRequest.ResourceProperties=cfnRequest.ResourceProperties||{};const onEventResult=await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV,sanitizedRequest,cfnRequest.ResponseURL);onEventResult?.NoEcho?(0,util_1.log)("redacted onEvent returned:",cfnResponse.redactDataFromPayload(onEventResult)):(0,util_1.log)("onEvent returned:",onEventResult);const resourceEvent=createResponseEvent(cfnRequest,onEventResult),sanitizedEvent={...resourceEvent,ResponseURL:"..."};if(onEventResult?.NoEcho?(0,util_1.log)("readacted event:",cfnResponse.redactDataFromPayload(sanitizedEvent)):(0,util_1.log)("event:",sanitizedEvent),!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV])return cfnResponse.submitResponse("SUCCESS",resourceEvent,{noEcho:resourceEvent.NoEcho});const waiter={stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId,input:JSON.stringify(resourceEvent)};(0,util_1.log)("starting waiter",{stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId}),await(0,outbound_1.startExecution)(waiter)}async function isComplete(event){const sanitizedRequest={...event,ResponseURL:"..."};event?.NoEcho?(0,util_1.log)("redacted isComplete request",cfnResponse.redactDataFromPayload(sanitizedRequest)):(0,util_1.log)("isComplete",sanitizedRequest);const isCompleteResult=await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV,sanitizedRequest,event.ResponseURL);if(event?.NoEcho?(0,util_1.log)("redacted user isComplete returned:",cfnResponse.redactDataFromPayload(isCompleteResult)):(0,util_1.log)("user isComplete returned:",isCompleteResult),!isCompleteResult.IsComplete)throw isCompleteResult.Data&&Object.keys(isCompleteResult.Data).length>0?new Error('"Data" is not allowed if "IsComplete" is "False"'):new cfnResponse.Retry(JSON.stringify(event));const response={...event,...isCompleteResult,Data:{...event.Data,...isCompleteResult.Data}};await cfnResponse.submitResponse("SUCCESS",response,{noEcho:event.NoEcho})}async function onTimeout(timeoutEvent){(0,util_1.log)("timeoutHandler",timeoutEvent);const isCompleteRequest=JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage);await cfnResponse.submitResponse("FAILED",isCompleteRequest,{reason:"Operation timed out"})}async function invokeUserFunction(functionArnEnv,sanitizedPayload,responseUrl){const functionArn=(0,util_1.getEnv)(functionArnEnv);(0,util_1.log)(`executing user function ${functionArn} with payload`,sanitizedPayload);const resp=await(0,outbound_1.invokeFunction)({FunctionName:functionArn,Payload:JSON.stringify({...sanitizedPayload,ResponseURL:responseUrl})});(0,util_1.log)("user function response:",resp,typeof resp);const jsonPayload=(0,util_1.parseJsonPayload)(resp.Payload);if(resp.FunctionError){(0,util_1.log)("user function threw an error:",resp.FunctionError);const errorMessage=jsonPayload.errorMessage||"error",arn=functionArn.split(":"),functionName=arn[arn.length-1],message=[errorMessage,"",`Logs: /aws/lambda/${functionName}`,""].join(` +`),e=new Error(message);throw jsonPayload.trace&&(e.stack=[message,...jsonPayload.trace.slice(1)].join(` +`)),e}return jsonPayload}function createResponseEvent(cfnRequest,onEventResult){onEventResult=onEventResult||{};const physicalResourceId=onEventResult.PhysicalResourceId||defaultPhysicalResourceId(cfnRequest);if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`);return cfnRequest.RequestType==="Update"&&physicalResourceId!==cfnRequest.PhysicalResourceId&&(0,util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`),{...cfnRequest,...onEventResult,PhysicalResourceId:physicalResourceId}}function defaultPhysicalResourceId(req){switch(req.RequestType){case"Create":return req.RequestId;case"Update":case"Delete":return req.PhysicalResourceId;default:throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`)}}module.exports={[consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]:cfnResponse.safeHandler(onEvent),[consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]:cfnResponse.safeHandler(isComplete),[consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]:onTimeout}; diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/outbound.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/outbound.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/util.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/util.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js deleted file mode 100644 index 42ca4b146..000000000 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict";const cfnResponse=require("./cfn-response"),consts=require("./consts"),outbound_1=require("./outbound"),util_1=require("./util");async function onEvent(cfnRequest){const sanitizedRequest={...cfnRequest,ResponseURL:"..."};(0,util_1.log)("onEventHandler",sanitizedRequest),cfnRequest.ResourceProperties=cfnRequest.ResourceProperties||{};const onEventResult=await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV,sanitizedRequest,cfnRequest.ResponseURL);onEventResult?.NoEcho?(0,util_1.log)("redacted onEvent returned:",cfnResponse.redactDataFromPayload(onEventResult)):(0,util_1.log)("onEvent returned:",onEventResult);const resourceEvent=createResponseEvent(cfnRequest,onEventResult);if(onEventResult?.NoEcho?(0,util_1.log)("readacted event:",cfnResponse.redactDataFromPayload(resourceEvent)):(0,util_1.log)("event:",resourceEvent),!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV])return cfnResponse.submitResponse("SUCCESS",resourceEvent,{noEcho:resourceEvent.NoEcho});const waiter={stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId,input:JSON.stringify(resourceEvent)};(0,util_1.log)("starting waiter",{stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId}),await(0,outbound_1.startExecution)(waiter)}async function isComplete(event){const sanitizedRequest={...event,ResponseURL:"..."};event?.NoEcho?(0,util_1.log)("redacted isComplete request",cfnResponse.redactDataFromPayload(sanitizedRequest)):(0,util_1.log)("isComplete",sanitizedRequest);const isCompleteResult=await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV,sanitizedRequest,event.ResponseURL);if(event?.NoEcho?(0,util_1.log)("redacted user isComplete returned:",cfnResponse.redactDataFromPayload(isCompleteResult)):(0,util_1.log)("user isComplete returned:",isCompleteResult),!isCompleteResult.IsComplete)throw isCompleteResult.Data&&Object.keys(isCompleteResult.Data).length>0?new Error('"Data" is not allowed if "IsComplete" is "False"'):new cfnResponse.Retry(JSON.stringify(event));const response={...event,...isCompleteResult,Data:{...event.Data,...isCompleteResult.Data}};await cfnResponse.submitResponse("SUCCESS",response,{noEcho:event.NoEcho})}async function onTimeout(timeoutEvent){(0,util_1.log)("timeoutHandler",timeoutEvent);const isCompleteRequest=JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage);await cfnResponse.submitResponse("FAILED",isCompleteRequest,{reason:"Operation timed out"})}async function invokeUserFunction(functionArnEnv,sanitizedPayload,responseUrl){const functionArn=(0,util_1.getEnv)(functionArnEnv);(0,util_1.log)(`executing user function ${functionArn} with payload`,sanitizedPayload);const resp=await(0,outbound_1.invokeFunction)({FunctionName:functionArn,Payload:JSON.stringify({...sanitizedPayload,ResponseURL:responseUrl})});(0,util_1.log)("user function response:",resp,typeof resp);const jsonPayload=(0,util_1.parseJsonPayload)(resp.Payload);if(resp.FunctionError){(0,util_1.log)("user function threw an error:",resp.FunctionError);const errorMessage=jsonPayload.errorMessage||"error",arn=functionArn.split(":"),functionName=arn[arn.length-1],message=[errorMessage,"",`Logs: /aws/lambda/${functionName}`,""].join(` -`),e=new Error(message);throw jsonPayload.trace&&(e.stack=[message,...jsonPayload.trace.slice(1)].join(` -`)),e}return jsonPayload}function createResponseEvent(cfnRequest,onEventResult){onEventResult=onEventResult||{};const physicalResourceId=onEventResult.PhysicalResourceId||defaultPhysicalResourceId(cfnRequest);if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`);return cfnRequest.RequestType==="Update"&&physicalResourceId!==cfnRequest.PhysicalResourceId&&(0,util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`),{...cfnRequest,...onEventResult,PhysicalResourceId:physicalResourceId}}function defaultPhysicalResourceId(req){switch(req.RequestType){case"Create":return req.RequestId;case"Update":case"Delete":return req.PhysicalResourceId;default:throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`)}}module.exports={[consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]:cfnResponse.safeHandler(onEvent),[consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]:cfnResponse.safeHandler(isComplete),[consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]:onTimeout}; diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/cdk.out index 1f0068d32..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/integ.json index 26f625a79..db06ca214 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "opilam-apiFromAssetExistingLambdaFunctions/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/manifest.json index f470f577d..805ac4342 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "opilamapiFromAssetExistingLambdaFunctionsIntegDefaultTestDeployAssertF0801F72.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "opilamapiFromAssetExistingLambdaFunctionsIntegDefaultTestDeployAssertF0801F72.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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", @@ -64,9 +65,10 @@ "templateFile": "opilam-apiFromAssetExistingLambdaFunctions.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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}/2bdc18dae70e061f5e53157f71d8fbde1d944a33f071b533f25022bc44680eba.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/df5244d59e9cb656a7d8d367445b78ea709c1e96ebc76b6f722390037f87be8d.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -100,10 +102,10 @@ "data": "LambdaFunctionBF21E41F" } ], - "/opilam-apiFromAssetExistingLambdaFunctions/LambdaFunction/PermitAPIGInvocation": [ + "/opilam-apiFromAssetExistingLambdaFunctions/LambdaFunction/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "LambdaFunctionPermitAPIGInvocation805898E4" + "data": "LambdaFunctionOpenApiGatewayToLambdaPermitAPIGInvocation9D043C93" } ], "/opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAssetServiceRole/Resource": [ @@ -124,10 +126,10 @@ "data": "PhotosLambdaTestFromAssetB776E3C5" } ], - "/opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAsset/PermitAPIGInvocation": [ + "/opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAsset/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "PhotosLambdaTestFromAssetPermitAPIGInvocation323F8FF0" + "data": "PhotosLambdaTestFromAssetOpenApiGatewayToLambdaPermitAPIGInvocationA0D5D04E" } ], "/opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/LambdaFunctionServiceRole/Resource": [ @@ -243,6 +245,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "LambdaFunctionPermitAPIGInvocation805898E4": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaFunctionPermitAPIGInvocation805898E4", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "PhotosLambdaTestFromAssetPermitAPIGInvocation323F8FF0": [ + { + "type": "aws:cdk:logicalId", + "data": "PhotosLambdaTestFromAssetPermitAPIGInvocation323F8FF0", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "opilam-apiFromAssetExistingLambdaFunctions" diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.assets.json index ba33c6fe3..2958044bd 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "c2b362b5f0d6d8f56ac2c011288aebd095499d839b130a932427f74232de2a32": { "source": { @@ -66,20 +66,20 @@ } } }, - "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b": { + "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e": { "source": { - "path": "asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b", + "path": "asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip", + "objectKey": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "2bdc18dae70e061f5e53157f71d8fbde1d944a33f071b533f25022bc44680eba": { + "df5244d59e9cb656a7d8d367445b78ea709c1e96ebc76b6f722390037f87be8d": { "source": { "path": "opilam-apiFromAssetExistingLambdaFunctions.template.json", "packaging": "file" @@ -87,7 +87,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2bdc18dae70e061f5e53157f71d8fbde1d944a33f071b533f25022bc44680eba.json", + "objectKey": "df5244d59e9cb656a7d8d367445b78ea709c1e96ebc76b6f722390037f87be8d.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.template.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.template.json index 8fc49860d..14be69995 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilam-apiFromAssetExistingLambdaFunctions.template.json @@ -146,7 +146,7 @@ } } }, - "LambdaFunctionPermitAPIGInvocation805898E4": { + "LambdaFunctionOpenApiGatewayToLambdaPermitAPIGInvocation9D043C93": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -329,7 +329,7 @@ } } }, - "PhotosLambdaTestFromAssetPermitAPIGInvocation323F8FF0": { + "PhotosLambdaTestFromAssetOpenApiGatewayToLambdaPermitAPIGInvocationA0D5D04E": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -649,7 +649,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip" + "S3Key": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip" }, "Description": "AWS CDK resource provider framework - onEvent (opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider)", "Environment": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilamapiFromAssetExistingLambdaFunctionsIntegDefaultTestDeployAssertF0801F72.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilamapiFromAssetExistingLambdaFunctionsIntegDefaultTestDeployAssertF0801F72.assets.json index b8f6012fd..0119fddbf 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilamapiFromAssetExistingLambdaFunctionsIntegDefaultTestDeployAssertF0801F72.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/opilamapiFromAssetExistingLambdaFunctionsIntegDefaultTestDeployAssertF0801F72.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/tree.json index 566453847..c2c490ff7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetExistingLambdaFunctions.js.snapshot/tree.json @@ -17,7 +17,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/ApiDefinitionAsset/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -25,13 +25,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/ApiDefinitionAsset/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunctionServiceRole": { @@ -43,7 +43,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/LambdaFunctionServiceRole/ImportLambdaFunctionServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -106,7 +106,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -142,19 +142,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunction": { @@ -170,7 +170,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/LambdaFunction/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -178,13 +178,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/LambdaFunction/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -219,12 +219,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromAssetExistingLambdaFunctions/LambdaFunction/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromAssetExistingLambdaFunctions/LambdaFunction/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -264,13 +264,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "PhotosLambdaTestFromAssetServiceRole": { @@ -282,7 +282,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAssetServiceRole/ImportPhotosLambdaTestFromAssetServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -345,7 +345,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -381,19 +381,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "PhotosLambdaTestFromAsset": { @@ -409,7 +409,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAsset/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -417,13 +417,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAsset/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -459,12 +459,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAsset/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromAssetExistingLambdaFunctions/PhotosLambdaTestFromAsset/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -504,13 +504,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "OpenApiGatewayToLambda": { @@ -526,7 +526,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiOutputAsset/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -534,13 +534,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiOutputAsset/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunctionServiceRole": { @@ -552,7 +552,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/LambdaFunctionServiceRole/ImportLambdaFunctionServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -615,7 +615,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -651,19 +651,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunction": { @@ -679,7 +679,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/LambdaFunction/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -687,13 +687,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/LambdaFunction/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -730,13 +730,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterPolicy": { @@ -804,13 +804,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterProvider": { @@ -830,7 +830,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -869,7 +869,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -923,19 +923,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "Code": { @@ -947,7 +947,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -955,13 +955,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -974,7 +974,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip" + "s3Key": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip" }, "description": "AWS CDK resource provider framework - onEvent (opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider)", "environment": { @@ -1008,19 +1008,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.custom_resources.Provider", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterCustomResource": { @@ -1032,13 +1032,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiAccessLogGroup": { @@ -1054,13 +1054,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.150.0" + "version": "2.160.0" } }, "SpecRestApi": { @@ -1109,7 +1109,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnRestApi", - "version": "2.150.0" + "version": "2.160.0" } }, "Default": { @@ -1117,7 +1117,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/SpecRestApi/Default", "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.ResourceBase", - "version": "2.150.0" + "version": "2.160.0" } }, "Deployment": { @@ -1138,13 +1138,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Deployment", - "version": "2.150.0" + "version": "2.160.0" } }, "DeploymentStage.prod": { @@ -1186,13 +1186,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Stage", - "version": "2.150.0" + "version": "2.160.0" } }, "Endpoint": { @@ -1200,7 +1200,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/SpecRestApi/Endpoint", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.150.0" + "version": "2.160.0" } }, "UsagePlan": { @@ -1228,19 +1228,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnUsagePlan", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.UsagePlan", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.SpecRestApi", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaRestApiCloudWatchRole": { @@ -1252,7 +1252,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/OpenApiGatewayToLambda/LambdaRestApiCloudWatchRole/ImportLambdaRestApiCloudWatchRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -1319,13 +1319,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaRestApiAccount": { @@ -1344,13 +1344,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnAccount", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-openapigateway-lambda.OpenApiGatewayToLambda", - "version": "2.63.0" + "version": "2.70.0" } }, "LatestNodeRuntimeMap": { @@ -1358,7 +1358,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.150.0" + "version": "2.160.0" } }, "Integ": { @@ -1386,7 +1386,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.150.0" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1394,25 +1394,25 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.150.0-alpha.0" + "version": "2.160.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.150.0-alpha.0" + "version": "2.160.0-alpha.0" } }, "BootstrapVersion": { @@ -1420,7 +1420,7 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.150.0" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1428,13 +1428,13 @@ "path": "opilam-apiFromAssetExistingLambdaFunctions/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.150.0" + "version": "2.160.0" } }, "Tree": { @@ -1448,7 +1448,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.150.0" + "version": "2.160.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/cfn-response.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/cfn-response.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/consts.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/consts.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js new file mode 100644 index 000000000..952048e6f --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js @@ -0,0 +1,3 @@ +"use strict";const cfnResponse=require("./cfn-response"),consts=require("./consts"),outbound_1=require("./outbound"),util_1=require("./util");async function onEvent(cfnRequest){const sanitizedRequest={...cfnRequest,ResponseURL:"..."};(0,util_1.log)("onEventHandler",sanitizedRequest),cfnRequest.ResourceProperties=cfnRequest.ResourceProperties||{};const onEventResult=await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV,sanitizedRequest,cfnRequest.ResponseURL);onEventResult?.NoEcho?(0,util_1.log)("redacted onEvent returned:",cfnResponse.redactDataFromPayload(onEventResult)):(0,util_1.log)("onEvent returned:",onEventResult);const resourceEvent=createResponseEvent(cfnRequest,onEventResult),sanitizedEvent={...resourceEvent,ResponseURL:"..."};if(onEventResult?.NoEcho?(0,util_1.log)("readacted event:",cfnResponse.redactDataFromPayload(sanitizedEvent)):(0,util_1.log)("event:",sanitizedEvent),!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV])return cfnResponse.submitResponse("SUCCESS",resourceEvent,{noEcho:resourceEvent.NoEcho});const waiter={stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId,input:JSON.stringify(resourceEvent)};(0,util_1.log)("starting waiter",{stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId}),await(0,outbound_1.startExecution)(waiter)}async function isComplete(event){const sanitizedRequest={...event,ResponseURL:"..."};event?.NoEcho?(0,util_1.log)("redacted isComplete request",cfnResponse.redactDataFromPayload(sanitizedRequest)):(0,util_1.log)("isComplete",sanitizedRequest);const isCompleteResult=await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV,sanitizedRequest,event.ResponseURL);if(event?.NoEcho?(0,util_1.log)("redacted user isComplete returned:",cfnResponse.redactDataFromPayload(isCompleteResult)):(0,util_1.log)("user isComplete returned:",isCompleteResult),!isCompleteResult.IsComplete)throw isCompleteResult.Data&&Object.keys(isCompleteResult.Data).length>0?new Error('"Data" is not allowed if "IsComplete" is "False"'):new cfnResponse.Retry(JSON.stringify(event));const response={...event,...isCompleteResult,Data:{...event.Data,...isCompleteResult.Data}};await cfnResponse.submitResponse("SUCCESS",response,{noEcho:event.NoEcho})}async function onTimeout(timeoutEvent){(0,util_1.log)("timeoutHandler",timeoutEvent);const isCompleteRequest=JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage);await cfnResponse.submitResponse("FAILED",isCompleteRequest,{reason:"Operation timed out"})}async function invokeUserFunction(functionArnEnv,sanitizedPayload,responseUrl){const functionArn=(0,util_1.getEnv)(functionArnEnv);(0,util_1.log)(`executing user function ${functionArn} with payload`,sanitizedPayload);const resp=await(0,outbound_1.invokeFunction)({FunctionName:functionArn,Payload:JSON.stringify({...sanitizedPayload,ResponseURL:responseUrl})});(0,util_1.log)("user function response:",resp,typeof resp);const jsonPayload=(0,util_1.parseJsonPayload)(resp.Payload);if(resp.FunctionError){(0,util_1.log)("user function threw an error:",resp.FunctionError);const errorMessage=jsonPayload.errorMessage||"error",arn=functionArn.split(":"),functionName=arn[arn.length-1],message=[errorMessage,"",`Logs: /aws/lambda/${functionName}`,""].join(` +`),e=new Error(message);throw jsonPayload.trace&&(e.stack=[message,...jsonPayload.trace.slice(1)].join(` +`)),e}return jsonPayload}function createResponseEvent(cfnRequest,onEventResult){onEventResult=onEventResult||{};const physicalResourceId=onEventResult.PhysicalResourceId||defaultPhysicalResourceId(cfnRequest);if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`);return cfnRequest.RequestType==="Update"&&physicalResourceId!==cfnRequest.PhysicalResourceId&&(0,util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`),{...cfnRequest,...onEventResult,PhysicalResourceId:physicalResourceId}}function defaultPhysicalResourceId(req){switch(req.RequestType){case"Create":return req.RequestId;case"Update":case"Delete":return req.PhysicalResourceId;default:throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`)}}module.exports={[consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]:cfnResponse.safeHandler(onEvent),[consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]:cfnResponse.safeHandler(isComplete),[consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]:onTimeout}; diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/outbound.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/outbound.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/util.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/util.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js deleted file mode 100644 index 42ca4b146..000000000 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict";const cfnResponse=require("./cfn-response"),consts=require("./consts"),outbound_1=require("./outbound"),util_1=require("./util");async function onEvent(cfnRequest){const sanitizedRequest={...cfnRequest,ResponseURL:"..."};(0,util_1.log)("onEventHandler",sanitizedRequest),cfnRequest.ResourceProperties=cfnRequest.ResourceProperties||{};const onEventResult=await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV,sanitizedRequest,cfnRequest.ResponseURL);onEventResult?.NoEcho?(0,util_1.log)("redacted onEvent returned:",cfnResponse.redactDataFromPayload(onEventResult)):(0,util_1.log)("onEvent returned:",onEventResult);const resourceEvent=createResponseEvent(cfnRequest,onEventResult);if(onEventResult?.NoEcho?(0,util_1.log)("readacted event:",cfnResponse.redactDataFromPayload(resourceEvent)):(0,util_1.log)("event:",resourceEvent),!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV])return cfnResponse.submitResponse("SUCCESS",resourceEvent,{noEcho:resourceEvent.NoEcho});const waiter={stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId,input:JSON.stringify(resourceEvent)};(0,util_1.log)("starting waiter",{stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId}),await(0,outbound_1.startExecution)(waiter)}async function isComplete(event){const sanitizedRequest={...event,ResponseURL:"..."};event?.NoEcho?(0,util_1.log)("redacted isComplete request",cfnResponse.redactDataFromPayload(sanitizedRequest)):(0,util_1.log)("isComplete",sanitizedRequest);const isCompleteResult=await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV,sanitizedRequest,event.ResponseURL);if(event?.NoEcho?(0,util_1.log)("redacted user isComplete returned:",cfnResponse.redactDataFromPayload(isCompleteResult)):(0,util_1.log)("user isComplete returned:",isCompleteResult),!isCompleteResult.IsComplete)throw isCompleteResult.Data&&Object.keys(isCompleteResult.Data).length>0?new Error('"Data" is not allowed if "IsComplete" is "False"'):new cfnResponse.Retry(JSON.stringify(event));const response={...event,...isCompleteResult,Data:{...event.Data,...isCompleteResult.Data}};await cfnResponse.submitResponse("SUCCESS",response,{noEcho:event.NoEcho})}async function onTimeout(timeoutEvent){(0,util_1.log)("timeoutHandler",timeoutEvent);const isCompleteRequest=JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage);await cfnResponse.submitResponse("FAILED",isCompleteRequest,{reason:"Operation timed out"})}async function invokeUserFunction(functionArnEnv,sanitizedPayload,responseUrl){const functionArn=(0,util_1.getEnv)(functionArnEnv);(0,util_1.log)(`executing user function ${functionArn} with payload`,sanitizedPayload);const resp=await(0,outbound_1.invokeFunction)({FunctionName:functionArn,Payload:JSON.stringify({...sanitizedPayload,ResponseURL:responseUrl})});(0,util_1.log)("user function response:",resp,typeof resp);const jsonPayload=(0,util_1.parseJsonPayload)(resp.Payload);if(resp.FunctionError){(0,util_1.log)("user function threw an error:",resp.FunctionError);const errorMessage=jsonPayload.errorMessage||"error",arn=functionArn.split(":"),functionName=arn[arn.length-1],message=[errorMessage,"",`Logs: /aws/lambda/${functionName}`,""].join(` -`),e=new Error(message);throw jsonPayload.trace&&(e.stack=[message,...jsonPayload.trace.slice(1)].join(` -`)),e}return jsonPayload}function createResponseEvent(cfnRequest,onEventResult){onEventResult=onEventResult||{};const physicalResourceId=onEventResult.PhysicalResourceId||defaultPhysicalResourceId(cfnRequest);if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`);return cfnRequest.RequestType==="Update"&&physicalResourceId!==cfnRequest.PhysicalResourceId&&(0,util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`),{...cfnRequest,...onEventResult,PhysicalResourceId:physicalResourceId}}function defaultPhysicalResourceId(req){switch(req.RequestType){case"Create":return req.RequestId;case"Update":case"Delete":return req.PhysicalResourceId;default:throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`)}}module.exports={[consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]:cfnResponse.safeHandler(onEvent),[consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]:cfnResponse.safeHandler(isComplete),[consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]:onTimeout}; diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/cdk.out index 1f0068d32..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/integ.json index 367f00910..bc64a64b3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "opilam-apiFromAssetNewLambdaFunctions/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/manifest.json index c1c95f8ca..df4d62d3d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "opilamapiFromAssetNewLambdaFunctionsIntegDefaultTestDeployAssert781D98B1.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "opilamapiFromAssetNewLambdaFunctionsIntegDefaultTestDeployAssert781D98B1.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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", @@ -64,9 +65,10 @@ "templateFile": "opilam-apiFromAssetNewLambdaFunctions.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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}/f0b0c06be1cc4b538f2b0a53cec8774dd03b9390f8bacb5054fb41b455fc9ef3.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1078a06460997393f4ab0948c3087da0656481e3e0f2940ad5f64a117c302127.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -100,10 +102,10 @@ "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0E78C5307" } ], - "/opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/PermitAPIGInvocation": [ + "/opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520" + "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0OpenApiGatewayToLambdaPermitAPIGInvocationC5ACBCDF" } ], "/opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1ServiceRole/Resource": [ @@ -124,10 +126,10 @@ "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1C42C52E8" } ], - "/opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/PermitAPIGInvocation": [ + "/opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB" + "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1OpenApiGatewayToLambdaPermitAPIGInvocation5B0B1DC7" } ], "/opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/LambdaFunctionServiceRole/Resource": [ @@ -243,6 +245,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520": [ + { + "type": "aws:cdk:logicalId", + "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB": [ + { + "type": "aws:cdk:logicalId", + "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "opilam-apiFromAssetNewLambdaFunctions" diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.assets.json index a80cfb82e..0bbf0e67c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "c2b362b5f0d6d8f56ac2c011288aebd095499d839b130a932427f74232de2a32": { "source": { @@ -66,20 +66,20 @@ } } }, - "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b": { + "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e": { "source": { - "path": "asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b", + "path": "asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip", + "objectKey": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "f0b0c06be1cc4b538f2b0a53cec8774dd03b9390f8bacb5054fb41b455fc9ef3": { + "1078a06460997393f4ab0948c3087da0656481e3e0f2940ad5f64a117c302127": { "source": { "path": "opilam-apiFromAssetNewLambdaFunctions.template.json", "packaging": "file" @@ -87,7 +87,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "f0b0c06be1cc4b538f2b0a53cec8774dd03b9390f8bacb5054fb41b455fc9ef3.json", + "objectKey": "1078a06460997393f4ab0948c3087da0656481e3e0f2940ad5f64a117c302127.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.template.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.template.json index 8f4f00198..f724f6d31 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilam-apiFromAssetNewLambdaFunctions.template.json @@ -146,7 +146,7 @@ } } }, - "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520": { + "OpenApiGatewayToLambdaMessagesHandlerApiFunction0OpenApiGatewayToLambdaPermitAPIGInvocationC5ACBCDF": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -328,7 +328,7 @@ } } }, - "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB": { + "OpenApiGatewayToLambdaPhotosHandlerApiFunction1OpenApiGatewayToLambdaPermitAPIGInvocation5B0B1DC7": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -648,7 +648,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip" + "S3Key": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip" }, "Description": "AWS CDK resource provider framework - onEvent (opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider)", "Environment": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilamapiFromAssetNewLambdaFunctionsIntegDefaultTestDeployAssert781D98B1.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilamapiFromAssetNewLambdaFunctionsIntegDefaultTestDeployAssert781D98B1.assets.json index 362074285..833c3a761 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilamapiFromAssetNewLambdaFunctionsIntegDefaultTestDeployAssert781D98B1.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/opilamapiFromAssetNewLambdaFunctionsIntegDefaultTestDeployAssert781D98B1.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/tree.json index 7da003a9e..dba1ce581 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetNewLambdaFunctions.js.snapshot/tree.json @@ -17,7 +17,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/ApiDefinitionAsset/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -25,13 +25,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/ApiDefinitionAsset/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "OpenApiGatewayToLambda": { @@ -47,7 +47,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0ServiceRole/ImportMessagesHandlerApiFunction0ServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -110,7 +110,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -146,19 +146,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "MessagesHandlerApiFunction0": { @@ -174,7 +174,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -182,13 +182,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -223,12 +223,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -268,13 +268,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "PhotosHandlerApiFunction1ServiceRole": { @@ -286,7 +286,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1ServiceRole/ImportPhotosHandlerApiFunction1ServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -349,7 +349,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -385,19 +385,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "PhotosHandlerApiFunction1": { @@ -413,7 +413,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -421,13 +421,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -462,12 +462,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -507,13 +507,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiOutputAsset": { @@ -525,7 +525,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiOutputAsset/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -533,13 +533,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiOutputAsset/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunctionServiceRole": { @@ -551,7 +551,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/LambdaFunctionServiceRole/ImportLambdaFunctionServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -614,7 +614,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -650,19 +650,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunction": { @@ -678,7 +678,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/LambdaFunction/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -686,13 +686,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/LambdaFunction/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -729,13 +729,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterPolicy": { @@ -803,13 +803,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterProvider": { @@ -829,7 +829,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -868,7 +868,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -922,19 +922,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "Code": { @@ -946,7 +946,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -954,13 +954,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -973,7 +973,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip" + "s3Key": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip" }, "description": "AWS CDK resource provider framework - onEvent (opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterProvider)", "environment": { @@ -1007,19 +1007,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.custom_resources.Provider", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterCustomResource": { @@ -1031,13 +1031,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/ApiTemplateWriterCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiAccessLogGroup": { @@ -1053,13 +1053,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.150.0" + "version": "2.160.0" } }, "SpecRestApi": { @@ -1108,7 +1108,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnRestApi", - "version": "2.150.0" + "version": "2.160.0" } }, "Default": { @@ -1116,7 +1116,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/SpecRestApi/Default", "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.ResourceBase", - "version": "2.150.0" + "version": "2.160.0" } }, "Deployment": { @@ -1137,13 +1137,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Deployment", - "version": "2.150.0" + "version": "2.160.0" } }, "DeploymentStage.prod": { @@ -1185,13 +1185,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Stage", - "version": "2.150.0" + "version": "2.160.0" } }, "Endpoint": { @@ -1199,7 +1199,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/SpecRestApi/Endpoint", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.150.0" + "version": "2.160.0" } }, "UsagePlan": { @@ -1227,19 +1227,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnUsagePlan", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.UsagePlan", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.SpecRestApi", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaRestApiCloudWatchRole": { @@ -1251,7 +1251,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/OpenApiGatewayToLambda/LambdaRestApiCloudWatchRole/ImportLambdaRestApiCloudWatchRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -1318,13 +1318,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaRestApiAccount": { @@ -1343,13 +1343,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnAccount", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-openapigateway-lambda.OpenApiGatewayToLambda", - "version": "2.63.0" + "version": "2.70.0" } }, "LatestNodeRuntimeMap": { @@ -1357,7 +1357,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.150.0" + "version": "2.160.0" } }, "Integ": { @@ -1385,7 +1385,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.150.0" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1393,25 +1393,25 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.150.0-alpha.0" + "version": "2.160.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.150.0-alpha.0" + "version": "2.160.0-alpha.0" } }, "BootstrapVersion": { @@ -1419,7 +1419,7 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.150.0" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1427,13 +1427,13 @@ "path": "opilam-apiFromAssetNewLambdaFunctions/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.150.0" + "version": "2.160.0" } }, "Tree": { @@ -1447,7 +1447,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.150.0" + "version": "2.160.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/cfn-response.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/cfn-response.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/cfn-response.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/consts.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/consts.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/consts.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js new file mode 100644 index 000000000..952048e6f --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/framework.js @@ -0,0 +1,3 @@ +"use strict";const cfnResponse=require("./cfn-response"),consts=require("./consts"),outbound_1=require("./outbound"),util_1=require("./util");async function onEvent(cfnRequest){const sanitizedRequest={...cfnRequest,ResponseURL:"..."};(0,util_1.log)("onEventHandler",sanitizedRequest),cfnRequest.ResourceProperties=cfnRequest.ResourceProperties||{};const onEventResult=await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV,sanitizedRequest,cfnRequest.ResponseURL);onEventResult?.NoEcho?(0,util_1.log)("redacted onEvent returned:",cfnResponse.redactDataFromPayload(onEventResult)):(0,util_1.log)("onEvent returned:",onEventResult);const resourceEvent=createResponseEvent(cfnRequest,onEventResult),sanitizedEvent={...resourceEvent,ResponseURL:"..."};if(onEventResult?.NoEcho?(0,util_1.log)("readacted event:",cfnResponse.redactDataFromPayload(sanitizedEvent)):(0,util_1.log)("event:",sanitizedEvent),!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV])return cfnResponse.submitResponse("SUCCESS",resourceEvent,{noEcho:resourceEvent.NoEcho});const waiter={stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId,input:JSON.stringify(resourceEvent)};(0,util_1.log)("starting waiter",{stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId}),await(0,outbound_1.startExecution)(waiter)}async function isComplete(event){const sanitizedRequest={...event,ResponseURL:"..."};event?.NoEcho?(0,util_1.log)("redacted isComplete request",cfnResponse.redactDataFromPayload(sanitizedRequest)):(0,util_1.log)("isComplete",sanitizedRequest);const isCompleteResult=await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV,sanitizedRequest,event.ResponseURL);if(event?.NoEcho?(0,util_1.log)("redacted user isComplete returned:",cfnResponse.redactDataFromPayload(isCompleteResult)):(0,util_1.log)("user isComplete returned:",isCompleteResult),!isCompleteResult.IsComplete)throw isCompleteResult.Data&&Object.keys(isCompleteResult.Data).length>0?new Error('"Data" is not allowed if "IsComplete" is "False"'):new cfnResponse.Retry(JSON.stringify(event));const response={...event,...isCompleteResult,Data:{...event.Data,...isCompleteResult.Data}};await cfnResponse.submitResponse("SUCCESS",response,{noEcho:event.NoEcho})}async function onTimeout(timeoutEvent){(0,util_1.log)("timeoutHandler",timeoutEvent);const isCompleteRequest=JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage);await cfnResponse.submitResponse("FAILED",isCompleteRequest,{reason:"Operation timed out"})}async function invokeUserFunction(functionArnEnv,sanitizedPayload,responseUrl){const functionArn=(0,util_1.getEnv)(functionArnEnv);(0,util_1.log)(`executing user function ${functionArn} with payload`,sanitizedPayload);const resp=await(0,outbound_1.invokeFunction)({FunctionName:functionArn,Payload:JSON.stringify({...sanitizedPayload,ResponseURL:responseUrl})});(0,util_1.log)("user function response:",resp,typeof resp);const jsonPayload=(0,util_1.parseJsonPayload)(resp.Payload);if(resp.FunctionError){(0,util_1.log)("user function threw an error:",resp.FunctionError);const errorMessage=jsonPayload.errorMessage||"error",arn=functionArn.split(":"),functionName=arn[arn.length-1],message=[errorMessage,"",`Logs: /aws/lambda/${functionName}`,""].join(` +`),e=new Error(message);throw jsonPayload.trace&&(e.stack=[message,...jsonPayload.trace.slice(1)].join(` +`)),e}return jsonPayload}function createResponseEvent(cfnRequest,onEventResult){onEventResult=onEventResult||{};const physicalResourceId=onEventResult.PhysicalResourceId||defaultPhysicalResourceId(cfnRequest);if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`);return cfnRequest.RequestType==="Update"&&physicalResourceId!==cfnRequest.PhysicalResourceId&&(0,util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`),{...cfnRequest,...onEventResult,PhysicalResourceId:physicalResourceId}}function defaultPhysicalResourceId(req){switch(req.RequestType){case"Create":return req.RequestId;case"Update":case"Delete":return req.PhysicalResourceId;default:throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`)}}module.exports={[consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]:cfnResponse.safeHandler(onEvent),[consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]:cfnResponse.safeHandler(isComplete),[consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]:onTimeout}; diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/outbound.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/outbound.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/outbound.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/util.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js similarity index 100% rename from source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/util.js rename to source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e/util.js diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js deleted file mode 100644 index 42ca4b146..000000000 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b/framework.js +++ /dev/null @@ -1,3 +0,0 @@ -"use strict";const cfnResponse=require("./cfn-response"),consts=require("./consts"),outbound_1=require("./outbound"),util_1=require("./util");async function onEvent(cfnRequest){const sanitizedRequest={...cfnRequest,ResponseURL:"..."};(0,util_1.log)("onEventHandler",sanitizedRequest),cfnRequest.ResourceProperties=cfnRequest.ResourceProperties||{};const onEventResult=await invokeUserFunction(consts.USER_ON_EVENT_FUNCTION_ARN_ENV,sanitizedRequest,cfnRequest.ResponseURL);onEventResult?.NoEcho?(0,util_1.log)("redacted onEvent returned:",cfnResponse.redactDataFromPayload(onEventResult)):(0,util_1.log)("onEvent returned:",onEventResult);const resourceEvent=createResponseEvent(cfnRequest,onEventResult);if(onEventResult?.NoEcho?(0,util_1.log)("readacted event:",cfnResponse.redactDataFromPayload(resourceEvent)):(0,util_1.log)("event:",resourceEvent),!process.env[consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV])return cfnResponse.submitResponse("SUCCESS",resourceEvent,{noEcho:resourceEvent.NoEcho});const waiter={stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId,input:JSON.stringify(resourceEvent)};(0,util_1.log)("starting waiter",{stateMachineArn:(0,util_1.getEnv)(consts.WAITER_STATE_MACHINE_ARN_ENV),name:resourceEvent.RequestId}),await(0,outbound_1.startExecution)(waiter)}async function isComplete(event){const sanitizedRequest={...event,ResponseURL:"..."};event?.NoEcho?(0,util_1.log)("redacted isComplete request",cfnResponse.redactDataFromPayload(sanitizedRequest)):(0,util_1.log)("isComplete",sanitizedRequest);const isCompleteResult=await invokeUserFunction(consts.USER_IS_COMPLETE_FUNCTION_ARN_ENV,sanitizedRequest,event.ResponseURL);if(event?.NoEcho?(0,util_1.log)("redacted user isComplete returned:",cfnResponse.redactDataFromPayload(isCompleteResult)):(0,util_1.log)("user isComplete returned:",isCompleteResult),!isCompleteResult.IsComplete)throw isCompleteResult.Data&&Object.keys(isCompleteResult.Data).length>0?new Error('"Data" is not allowed if "IsComplete" is "False"'):new cfnResponse.Retry(JSON.stringify(event));const response={...event,...isCompleteResult,Data:{...event.Data,...isCompleteResult.Data}};await cfnResponse.submitResponse("SUCCESS",response,{noEcho:event.NoEcho})}async function onTimeout(timeoutEvent){(0,util_1.log)("timeoutHandler",timeoutEvent);const isCompleteRequest=JSON.parse(JSON.parse(timeoutEvent.Cause).errorMessage);await cfnResponse.submitResponse("FAILED",isCompleteRequest,{reason:"Operation timed out"})}async function invokeUserFunction(functionArnEnv,sanitizedPayload,responseUrl){const functionArn=(0,util_1.getEnv)(functionArnEnv);(0,util_1.log)(`executing user function ${functionArn} with payload`,sanitizedPayload);const resp=await(0,outbound_1.invokeFunction)({FunctionName:functionArn,Payload:JSON.stringify({...sanitizedPayload,ResponseURL:responseUrl})});(0,util_1.log)("user function response:",resp,typeof resp);const jsonPayload=(0,util_1.parseJsonPayload)(resp.Payload);if(resp.FunctionError){(0,util_1.log)("user function threw an error:",resp.FunctionError);const errorMessage=jsonPayload.errorMessage||"error",arn=functionArn.split(":"),functionName=arn[arn.length-1],message=[errorMessage,"",`Logs: /aws/lambda/${functionName}`,""].join(` -`),e=new Error(message);throw jsonPayload.trace&&(e.stack=[message,...jsonPayload.trace.slice(1)].join(` -`)),e}return jsonPayload}function createResponseEvent(cfnRequest,onEventResult){onEventResult=onEventResult||{};const physicalResourceId=onEventResult.PhysicalResourceId||defaultPhysicalResourceId(cfnRequest);if(cfnRequest.RequestType==="Delete"&&physicalResourceId!==cfnRequest.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}" during deletion`);return cfnRequest.RequestType==="Update"&&physicalResourceId!==cfnRequest.PhysicalResourceId&&(0,util_1.log)(`UPDATE: changing physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${onEventResult.PhysicalResourceId}"`),{...cfnRequest,...onEventResult,PhysicalResourceId:physicalResourceId}}function defaultPhysicalResourceId(req){switch(req.RequestType){case"Create":return req.RequestId;case"Update":case"Delete":return req.PhysicalResourceId;default:throw new Error(`Invalid "RequestType" in request "${JSON.stringify(req)}"`)}}module.exports={[consts.FRAMEWORK_ON_EVENT_HANDLER_NAME]:cfnResponse.safeHandler(onEvent),[consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME]:cfnResponse.safeHandler(isComplete),[consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME]:onTimeout}; diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/cdk.out index 1f0068d32..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/integ.json index 8d8749a64..f14d54b84 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "opilam-apiFromAssetWithCognitoAuth/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/manifest.json index 5c549d17a..4a8a62a48 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "opilamapiFromAssetWithCognitoAuthIntegDefaultTestDeployAssert6E95D513.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "opilamapiFromAssetWithCognitoAuthIntegDefaultTestDeployAssert6E95D513.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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", @@ -64,9 +65,10 @@ "templateFile": "opilam-apiFromAssetWithCognitoAuth.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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}/78de035d8ee3297eab0e6faf9c8b0bab73d67f3f45ec8d462d6a60cc989f7cc4.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7db2f002d05cde6467b5e54b472bbef083325ec596560e1b312b2635fb947c6d.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -100,10 +102,10 @@ "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0E78C5307" } ], - "/opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/PermitAPIGInvocation": [ + "/opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520" + "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0OpenApiGatewayToLambdaPermitAPIGInvocationC5ACBCDF" } ], "/opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1ServiceRole/Resource": [ @@ -124,10 +126,10 @@ "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1C42C52E8" } ], - "/opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/PermitAPIGInvocation": [ + "/opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB" + "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1OpenApiGatewayToLambdaPermitAPIGInvocation5B0B1DC7" } ], "/opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/LambdaFunctionServiceRole/Resource": [ @@ -243,6 +245,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520": [ + { + "type": "aws:cdk:logicalId", + "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB": [ + { + "type": "aws:cdk:logicalId", + "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "opilam-apiFromAssetWithCognitoAuth" diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.assets.json index 04cc2d838..34d1f7bbc 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "8c48f41891550d16b8b5de60b76d4f7a2b045576775bc16e9b461062c830b50d": { "source": { @@ -66,20 +66,20 @@ } } }, - "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b": { + "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e": { "source": { - "path": "asset.d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b", + "path": "asset.4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip", + "objectKey": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "78de035d8ee3297eab0e6faf9c8b0bab73d67f3f45ec8d462d6a60cc989f7cc4": { + "7db2f002d05cde6467b5e54b472bbef083325ec596560e1b312b2635fb947c6d": { "source": { "path": "opilam-apiFromAssetWithCognitoAuth.template.json", "packaging": "file" @@ -87,7 +87,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "78de035d8ee3297eab0e6faf9c8b0bab73d67f3f45ec8d462d6a60cc989f7cc4.json", + "objectKey": "7db2f002d05cde6467b5e54b472bbef083325ec596560e1b312b2635fb947c6d.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.template.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.template.json index 0c9696315..95a4cbe7a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilam-apiFromAssetWithCognitoAuth.template.json @@ -146,7 +146,7 @@ } } }, - "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520": { + "OpenApiGatewayToLambdaMessagesHandlerApiFunction0OpenApiGatewayToLambdaPermitAPIGInvocationC5ACBCDF": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -328,7 +328,7 @@ } } }, - "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB": { + "OpenApiGatewayToLambdaPhotosHandlerApiFunction1OpenApiGatewayToLambdaPermitAPIGInvocation5B0B1DC7": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -648,7 +648,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip" + "S3Key": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip" }, "Description": "AWS CDK resource provider framework - onEvent (opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiTemplateWriterProvider)", "Environment": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilamapiFromAssetWithCognitoAuthIntegDefaultTestDeployAssert6E95D513.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilamapiFromAssetWithCognitoAuthIntegDefaultTestDeployAssert6E95D513.assets.json index aee347610..34ca7669e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilamapiFromAssetWithCognitoAuthIntegDefaultTestDeployAssert6E95D513.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/opilamapiFromAssetWithCognitoAuthIntegDefaultTestDeployAssert6E95D513.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/tree.json index b26810d43..cb7436266 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromAssetWithCognitoAuth.js.snapshot/tree.json @@ -17,7 +17,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/ApiDefinitionAsset/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -25,13 +25,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/ApiDefinitionAsset/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "OpenApiGatewayToLambda": { @@ -47,7 +47,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0ServiceRole/ImportMessagesHandlerApiFunction0ServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -110,7 +110,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -146,19 +146,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "MessagesHandlerApiFunction0": { @@ -174,7 +174,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -182,13 +182,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -223,12 +223,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -268,13 +268,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "PhotosHandlerApiFunction1ServiceRole": { @@ -286,7 +286,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1ServiceRole/ImportPhotosHandlerApiFunction1ServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -349,7 +349,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -385,19 +385,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "PhotosHandlerApiFunction1": { @@ -413,7 +413,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -421,13 +421,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -462,12 +462,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -507,13 +507,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiOutputAsset": { @@ -525,7 +525,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiOutputAsset/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -533,13 +533,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiOutputAsset/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunctionServiceRole": { @@ -551,7 +551,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/LambdaFunctionServiceRole/ImportLambdaFunctionServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -614,7 +614,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -650,19 +650,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaFunction": { @@ -678,7 +678,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/LambdaFunction/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -686,13 +686,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/LambdaFunction/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -729,13 +729,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterPolicy": { @@ -803,13 +803,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterProvider": { @@ -829,7 +829,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -868,7 +868,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -922,19 +922,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "Code": { @@ -946,7 +946,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.150.0" + "version": "2.160.0" } }, "AssetBucket": { @@ -954,13 +954,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiTemplateWriterProvider/framework-onEvent/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -973,7 +973,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "d9861ea7a45affd23e47a614acb2fddc6e45c20a891284c958187dafbf9ee36b.zip" + "s3Key": "4dc48ffba382f93077a1e6824599bbd4ceb6f91eb3d9442eca3b85bdb1a20b1e.zip" }, "description": "AWS CDK resource provider framework - onEvent (opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiTemplateWriterProvider)", "environment": { @@ -1007,19 +1007,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.custom_resources.Provider", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiTemplateWriterCustomResource": { @@ -1031,13 +1031,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/ApiTemplateWriterCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.150.0" + "version": "2.160.0" } }, "ApiAccessLogGroup": { @@ -1053,13 +1053,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.150.0" + "version": "2.160.0" } }, "SpecRestApi": { @@ -1108,7 +1108,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnRestApi", - "version": "2.150.0" + "version": "2.160.0" } }, "Default": { @@ -1116,7 +1116,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/SpecRestApi/Default", "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.ResourceBase", - "version": "2.150.0" + "version": "2.160.0" } }, "Deployment": { @@ -1137,13 +1137,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Deployment", - "version": "2.150.0" + "version": "2.160.0" } }, "DeploymentStage.prod": { @@ -1185,13 +1185,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Stage", - "version": "2.150.0" + "version": "2.160.0" } }, "Endpoint": { @@ -1199,7 +1199,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/SpecRestApi/Endpoint", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.150.0" + "version": "2.160.0" } }, "UsagePlan": { @@ -1227,19 +1227,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnUsagePlan", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.UsagePlan", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.SpecRestApi", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaRestApiCloudWatchRole": { @@ -1251,7 +1251,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/OpenApiGatewayToLambda/LambdaRestApiCloudWatchRole/ImportLambdaRestApiCloudWatchRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.150.0" + "version": "2.160.0" } }, "Resource": { @@ -1318,13 +1318,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.150.0" + "version": "2.160.0" } }, "LambdaRestApiAccount": { @@ -1343,13 +1343,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnAccount", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-openapigateway-lambda.OpenApiGatewayToLambda", - "version": "2.63.0" + "version": "2.70.0" } }, "LatestNodeRuntimeMap": { @@ -1357,7 +1357,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.150.0" + "version": "2.160.0" } }, "Integ": { @@ -1385,7 +1385,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.150.0" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1393,25 +1393,25 @@ "path": "opilam-apiFromAssetWithCognitoAuth/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.150.0-alpha.0" + "version": "2.160.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.150.0-alpha.0" + "version": "2.160.0-alpha.0" } }, "BootstrapVersion": { @@ -1419,7 +1419,7 @@ "path": "opilam-apiFromAssetWithCognitoAuth/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.150.0" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1427,13 +1427,13 @@ "path": "opilam-apiFromAssetWithCognitoAuth/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.150.0" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.150.0" + "version": "2.160.0" } }, "Tree": { @@ -1447,7 +1447,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.150.0" + "version": "2.160.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/cdk.out index e033e8360..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.20"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/integ.json index 1817a76af..98af3fb95 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.20", + "version": "38.0.1", "testCases": { "opilam-apiFromInlineDefinition/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/manifest.json index 79ac87f56..e5c794312 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "opilamapiFromInlineDefinitionIntegDefaultTestDeployAssertCF0E111E.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "opilamapiFromInlineDefinitionIntegDefaultTestDeployAssertCF0E111E.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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", @@ -64,9 +65,10 @@ "templateFile": "opilam-apiFromInlineDefinition.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "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}/97d284396586d88e440dcc04bdaa6eda5c6fea4dd2ba30fc55c76f9af72c20b8.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/880b32e5861284ef598b70d50c80e9160c9d4de49a7897118a74e4994a1600cb.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -100,10 +102,10 @@ "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0E78C5307" } ], - "/opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/PermitAPIGInvocation": [ + "/opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520" + "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0OpenApiGatewayToLambdaPermitAPIGInvocationC5ACBCDF" } ], "/opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1ServiceRole/Resource": [ @@ -124,10 +126,10 @@ "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1C42C52E8" } ], - "/opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/PermitAPIGInvocation": [ + "/opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/OpenApiGatewayToLambdaPermitAPIGInvocation": [ { "type": "aws:cdk:logicalId", - "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB" + "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1OpenApiGatewayToLambdaPermitAPIGInvocation5B0B1DC7" } ], "/opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/ApiAccessLogGroup/Resource": [ @@ -189,6 +191,24 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520": [ + { + "type": "aws:cdk:logicalId", + "data": "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB": [ + { + "type": "aws:cdk:logicalId", + "data": "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "opilam-apiFromInlineDefinition" diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.assets.json index 960504173..bd73b27c6 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.20", + "version": "38.0.1", "files": { "8ce85d10dcd7b8e6d43ffd909827afc76802ad40fcd7908886ff825cbe8e15df": { "source": { @@ -27,7 +27,7 @@ } } }, - "97d284396586d88e440dcc04bdaa6eda5c6fea4dd2ba30fc55c76f9af72c20b8": { + "880b32e5861284ef598b70d50c80e9160c9d4de49a7897118a74e4994a1600cb": { "source": { "path": "opilam-apiFromInlineDefinition.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "97d284396586d88e440dcc04bdaa6eda5c6fea4dd2ba30fc55c76f9af72c20b8.json", + "objectKey": "880b32e5861284ef598b70d50c80e9160c9d4de49a7897118a74e4994a1600cb.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.template.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.template.json index b8c350d41..17a49efbb 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilam-apiFromInlineDefinition.template.json @@ -146,7 +146,7 @@ } } }, - "OpenApiGatewayToLambdaMessagesHandlerApiFunction0PermitAPIGInvocationB70BC520": { + "OpenApiGatewayToLambdaMessagesHandlerApiFunction0OpenApiGatewayToLambdaPermitAPIGInvocationC5ACBCDF": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -328,7 +328,7 @@ } } }, - "OpenApiGatewayToLambdaPhotosHandlerApiFunction1PermitAPIGInvocationA20E40FB": { + "OpenApiGatewayToLambdaPhotosHandlerApiFunction1OpenApiGatewayToLambdaPermitAPIGInvocation5B0B1DC7": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilamapiFromInlineDefinitionIntegDefaultTestDeployAssertCF0E111E.assets.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilamapiFromInlineDefinitionIntegDefaultTestDeployAssertCF0E111E.assets.json index 5bb33cbe0..957b0326c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilamapiFromInlineDefinitionIntegDefaultTestDeployAssertCF0E111E.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/opilamapiFromInlineDefinitionIntegDefaultTestDeployAssertCF0E111E.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.20", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/tree.json index b8405f835..338b0ab6e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/integ.opilam-apiFromInlineDefinition.js.snapshot/tree.json @@ -21,7 +21,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0ServiceRole/ImportMessagesHandlerApiFunction0ServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.160.0" } }, "Resource": { @@ -84,7 +84,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -120,19 +120,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.160.0" } }, "MessagesHandlerApiFunction0": { @@ -148,7 +148,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.160.0" } }, "AssetBucket": { @@ -156,13 +156,13 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.154.1" + "version": "2.160.0" } }, "Resource": { @@ -197,12 +197,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/MessagesHandlerApiFunction0/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -242,13 +242,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.160.0" } }, "PhotosHandlerApiFunction1ServiceRole": { @@ -260,7 +260,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1ServiceRole/ImportPhotosHandlerApiFunction1ServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.160.0" } }, "Resource": { @@ -323,7 +323,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.160.0" } }, "DefaultPolicy": { @@ -359,19 +359,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.160.0" } }, "PhotosHandlerApiFunction1": { @@ -387,7 +387,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.160.0" } }, "AssetBucket": { @@ -395,13 +395,13 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.154.1" + "version": "2.160.0" } }, "Resource": { @@ -436,12 +436,12 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.160.0" } }, - "PermitAPIGInvocation": { - "id": "PermitAPIGInvocation", - "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/PermitAPIGInvocation", + "OpenApiGatewayToLambdaPermitAPIGInvocation": { + "id": "OpenApiGatewayToLambdaPermitAPIGInvocation", + "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/PhotosHandlerApiFunction1/OpenApiGatewayToLambdaPermitAPIGInvocation", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -481,13 +481,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.160.0" } }, "ApiAccessLogGroup": { @@ -503,13 +503,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.154.1" + "version": "2.160.0" } }, "SpecRestApi": { @@ -692,7 +692,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnRestApi", - "version": "2.154.1" + "version": "2.160.0" } }, "Default": { @@ -700,7 +700,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/SpecRestApi/Default", "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.ResourceBase", - "version": "2.154.1" + "version": "2.160.0" } }, "Deployment": { @@ -721,13 +721,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnDeployment", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Deployment", - "version": "2.154.1" + "version": "2.160.0" } }, "DeploymentStage.prod": { @@ -769,13 +769,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnStage", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.Stage", - "version": "2.154.1" + "version": "2.160.0" } }, "Endpoint": { @@ -783,7 +783,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/SpecRestApi/Endpoint", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.154.1" + "version": "2.160.0" } }, "UsagePlan": { @@ -811,19 +811,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnUsagePlan", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.UsagePlan", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.SpecRestApi", - "version": "2.154.1" + "version": "2.160.0" } }, "LambdaRestApiCloudWatchRole": { @@ -835,7 +835,7 @@ "path": "opilam-apiFromInlineDefinition/OpenApiGatewayToLambda/LambdaRestApiCloudWatchRole/ImportLambdaRestApiCloudWatchRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.160.0" } }, "Resource": { @@ -902,13 +902,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.160.0" } }, "LambdaRestApiAccount": { @@ -927,13 +927,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_apigateway.CfnAccount", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-openapigateway-lambda.OpenApiGatewayToLambda", - "version": "2.67.1" + "version": "2.70.0" } }, "Integ": { @@ -961,7 +961,7 @@ "path": "opilam-apiFromInlineDefinition/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -969,25 +969,25 @@ "path": "opilam-apiFromInlineDefinition/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.160.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.160.0-alpha.0" } }, "BootstrapVersion": { @@ -995,7 +995,7 @@ "path": "opilam-apiFromInlineDefinition/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.160.0" } }, "CheckBootstrapVersion": { @@ -1003,13 +1003,13 @@ "path": "opilam-apiFromInlineDefinition/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.160.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.160.0" } }, "Tree": { @@ -1023,7 +1023,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.160.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/test.openapigateway-lambda.test.ts b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/test.openapigateway-lambda.test.ts index 5ec0592bb..05442521c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/test.openapigateway-lambda.test.ts +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/test/test.openapigateway-lambda.test.ts @@ -708,3 +708,43 @@ test('ObtainApiDefinition uses custom properties', () => { } }); }); + +test('Shared lambda function works', () => { + const stack = new Stack(); + + const apiDefinitionAsset = new Asset(stack, 'OpenApiAsset', { + path: path.join(__dirname, 'openapi/apiDefinition.yaml') + }); + + const construct = new OpenApiGatewayToLambda(stack, 'test-apigateway-lambda', { + apiDefinitionAsset, + apiIntegrations: [ + { + id: 'MessagesHandler', + lambdaFunctionProps: { + runtime: defaults.COMMERCIAL_REGION_LAMBDA_NODE_RUNTIME, + handler: 'index.handler', + code: lambda.Code.fromAsset(`${__dirname}/messages-lambda`), + } + } + ] + }); + + const constructTwo = new OpenApiGatewayToLambda(stack, 'two-apigateway-lambda', { + apiDefinitionAsset, + apiIntegrations: [ + { + id: 'MessagesHandler', + existingLambdaObj: construct.apiLambdaFunctions[0].lambdaFunction + } + ] + }); + + expect(construct.apiGateway).toBeDefined(); + expect(construct.apiGatewayCloudWatchRole).toBeDefined(); + expect(construct.apiGatewayLogGroup).toBeDefined(); + expect(construct.apiLambdaFunctions.length).toEqual(1); + expect(construct.apiLambdaFunctions[0].id).toEqual('MessagesHandler'); + expect(construct.apiLambdaFunctions[0].lambdaFunction).toBeDefined(); + expect(construct.apiLambdaFunctions[0].lambdaFunction.functionArn).toEqual(constructTwo.apiLambdaFunctions[0].lambdaFunction.functionArn); +}); diff --git a/source/use_cases/aws-custom-glue-etl/.eslintignore b/source/use_cases/aws-custom-glue-etl/.eslintignore deleted file mode 100644 index ca2d1cdc8..000000000 --- a/source/use_cases/aws-custom-glue-etl/.eslintignore +++ /dev/null @@ -1,8 +0,0 @@ -lib/*.js -test/*.js -bin/*.js -*.d.ts -coverage -test/integ.*.js.snapshot/ -test/cdk-integ.out.integ.*.snapshot -cdk.out/**/*.js \ No newline at end of file diff --git a/source/use_cases/aws-custom-glue-etl/.gitignore b/source/use_cases/aws-custom-glue-etl/.gitignore deleted file mode 100644 index a71c7ac98..000000000 --- a/source/use_cases/aws-custom-glue-etl/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.js -!jest.config.js -*.d.ts -node_modules - -# CDK asset staging directory -.cdk.staging -cdk.out -coverage diff --git a/source/use_cases/aws-custom-glue-etl/.npmignore b/source/use_cases/aws-custom-glue-etl/.npmignore deleted file mode 100644 index c1d6d45dc..000000000 --- a/source/use_cases/aws-custom-glue-etl/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -*.ts -!*.d.ts - -# CDK asset staging directory -.cdk.staging -cdk.out diff --git a/source/use_cases/aws-custom-glue-etl/README.md b/source/use_cases/aws-custom-glue-etl/README.md deleted file mode 100644 index 9ba0ab73f..000000000 --- a/source/use_cases/aws-custom-glue-etl/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# AWS Glue Custom ETL Job - -This use case implements an example using the Kinesis Data Streams Glue Job construct. - -This use case is designed to be built and deployed into your account from your local environment using the AWS CDK Toolkit (or CLI). For information on the toolkit and how to install and configure it, please see the [guide](https://docs.aws.amazon.com/cdk/latest/guide/cli.html). - -## Architecture - -The application architecture uses a custom ETL job defined in AWS Glue that takes in data from Amazon Kinesis Data Streams to -process and store it in the target datastore as defined by the ETL script (for this example an S3 bucket location). - -![Architecture Diagram](architecture.png) - -## Deployment steps - -Below are the steps to deploy the use case: - -``` -# Set the proper version numbers in the package.json file -../../../deployment/v2/align-version.sh - -# Install dependencies -npm install - -# Build the use case -npm run build - -# Deploy the use case -cdk deploy -``` - -Post deployment, this example will publish the name of the Kinesis Data Stream in the CloudFormation output. Use that name to produce sample data into this data stream using the generator code in the `stream-producer` folder. - -``` -# Change into `stream-producer` directory. -cd stream-producer - -# Install the projects base dependencies. -pip install -r requirements.txt -``` - -In the `generate_data.py` file, please update the AWS credential portion of the code and then run the following command from the CLI -``` -python3 generate_data.py --region --streamname -``` - -This will generate data into the Kinesis Data Stream. For this example the AWS Glue Job has to be manually triggered and stopped (either from the CLI or -the AWS management console). This is to make sure that you control the time for which you want to run the job and its corresponding cost. - -Command Line Interface -``` -aws glue start-job-run --job-name -``` - -AWS Management Console -1. Go on AWS Glue -2. Click `Jobs` under ETL on the left-side panel -3. Click on the name of the created job -4. Click `Run` on the upper-right corner to start the Glue Job -![Run GlueJob](run.png) - -Once triggered, the ETL transform in AWS Glue writes the data into an S3 bucket (the ARN is published in CloudFormation stack resources) and publishes logs in Amazon CloudWatch. You can also view the job metrics like below in AWS Glue Studio. - -![Glue CloudWatch Metrics](metrics.png) - -© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/source/use_cases/aws-custom-glue-etl/architecture.png b/source/use_cases/aws-custom-glue-etl/architecture.png deleted file mode 100644 index bd7f5154d..000000000 Binary files a/source/use_cases/aws-custom-glue-etl/architecture.png and /dev/null differ diff --git a/source/use_cases/aws-custom-glue-etl/bin/aws-custom-glue-etl.ts b/source/use_cases/aws-custom-glue-etl/bin/aws-custom-glue-etl.ts deleted file mode 100644 index affde5651..000000000 --- a/source/use_cases/aws-custom-glue-etl/bin/aws-custom-glue-etl.ts +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env node - -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ - -import { App } from 'aws-cdk-lib'; -import 'source-map-support/register'; -import { AwsCustomGlueEtlStack } from '../lib/aws-custom-glue-etl-stack'; - -const app = new App(); -new AwsCustomGlueEtlStack(app, 'AwsCustomGlueEtlStack'); diff --git a/source/use_cases/aws-custom-glue-etl/cdk.json b/source/use_cases/aws-custom-glue-etl/cdk.json deleted file mode 100644 index b1d49c724..000000000 --- a/source/use_cases/aws-custom-glue-etl/cdk.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "app": "npx ts-node --prefer-ts-exts bin/aws-custom-glue-etl.ts", - "context": { - "aws-cdk:enableDiffNoFail": "true", - "@aws-cdk/core:stackRelativeExports": "true", - "@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true, - "@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true - } -} diff --git a/source/use_cases/aws-custom-glue-etl/etl/transform.py b/source/use_cases/aws-custom-glue-etl/etl/transform.py deleted file mode 100644 index 345581dd9..000000000 --- a/source/use_cases/aws-custom-glue-etl/etl/transform.py +++ /dev/null @@ -1,109 +0,0 @@ -""" - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. -""" - -import base64 -import datetime -import sys - -import boto3 -from awsglue import DynamicFrame -from awsglue.context import GlueContext -from awsglue.job import Job -from awsglue.transforms import * -from awsglue.utils import getResolvedOptions -from pyspark.context import SparkContext -from pyspark.sql import DataFrame, Row -from pyspark.sql.functions import * -from pyspark.sql.types import * - -args = getResolvedOptions(sys.argv, ["JOB_NAME", "output_path", "database_name", "table_name"]) - -sc = SparkContext() -glueContext = GlueContext(sc) -spark = glueContext.spark_session -job = Job(glueContext) -job.init(args["JOB_NAME"], args) - -# S3 sink locations -output_path = args["output_path"] -databasename = args["database_name"] -tablename = args["table_name"] - -s3_target = output_path + "ventilator_metrics" -checkpoint_location = output_path + "cp/" -temp_path = output_path + "temp/" - - -def processBatch(data_frame, batchId): - now = datetime.datetime.now() - year = now.year - month = now.month - day = now.day - hour = now.hour - minute = now.minute - if data_frame.count() > 0: - dynamic_frame = DynamicFrame.fromDF(data_frame, glueContext, "from_data_frame") - apply_mapping = ApplyMapping.apply( - frame=dynamic_frame, - mappings=[ - ("ventilatorid", "long", "ventilatorid", "long"), - ("eventtime", "string", "eventtime", "timestamp"), - ("serialnumber", "string", "serialnumber", "string"), - ("pressurecontrol", "long", "pressurecontrol", "long"), - ("o2stats", "long", "o2stats", "long"), - ("minutevolume", "long", "minutevolume", "long"), - ("manufacturer", "string", "manufacturer", "string"), - ], - transformation_ctx="apply_mapping", - ) - - dynamic_frame.printSchema() - - # Write to S3 Sink - s3path = ( - s3_target - + "/ingest_year=" - + "{:0>4}".format(str(year)) - + "/ingest_month=" - + "{:0>2}".format(str(month)) - + "/ingest_day=" - + "{:0>2}".format(str(day)) - + "/ingest_hour=" - + "{:0>2}".format(str(hour)) - + "/" - ) - s3sink = glueContext.write_dynamic_frame.from_options( - frame=apply_mapping, - connection_type="s3", - connection_options={"path": s3path}, - format="parquet", - transformation_ctx="s3sink", - ) - - -# Read from Kinesis Data Stream -sourceData = glueContext.create_data_frame.from_catalog( - database=databasename, - table_name=tablename, - transformation_ctx="datasource0", - additional_options={"startingPosition": "TRIM_HORIZON", "inferSchema": "true"}, -) - -sourceData.printSchema() - -glueContext.forEachBatch( - frame=sourceData, - batch_function=processBatch, - options={"windowSize": "100 seconds", "checkpointLocation": checkpoint_location}, -) -job.commit() diff --git a/source/use_cases/aws-custom-glue-etl/lib/aws-custom-glue-etl-stack.ts b/source/use_cases/aws-custom-glue-etl/lib/aws-custom-glue-etl-stack.ts deleted file mode 100644 index 56ec2d68d..000000000 --- a/source/use_cases/aws-custom-glue-etl/lib/aws-custom-glue-etl-stack.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ - -// Imports -import * as glue from 'aws-cdk-lib/aws-glue'; -import * as s3assets from 'aws-cdk-lib/aws-s3-assets'; -import { Construct } from 'constructs'; -import { CfnOutput, Stack, StackProps } from 'aws-cdk-lib'; -import { KinesisstreamsToGluejob } from '@aws-solutions-constructs/aws-kinesisstreams-gluejob'; - -export class AwsCustomGlueEtlStack extends Stack { - constructor(scope: Construct, id: string, props?: StackProps) { - super(scope, id, props); - - const fieldSchema: glue.CfnTable.ColumnProperty [] = [{ - "name": "ventilatorid", - "type": "int", - "comment": "" - }, - { - "name": "eventtime", - "type": "string", - "comment": "" - }, - { - "name": "serialnumber", - "type": "string", - "comment": "" - }, - { - "name": "pressurecontrol", - "type": "int", - "comment": "" - }, - { - "name": "o2stats", - "type": "int", - "comment": "" - }, - { - "name": "minutevolume", - "type": "int", - "comment": "" - }, - { - "name": "manufacturer", - "type": "string", - "comment": "" - }]; - - const customEtlJob = new KinesisstreamsToGluejob(this, 'CustomETL', { - glueJobProps: { - command: { - name: 'gluestreaming', - pythonVersion: '3' - } - }, - fieldSchema: fieldSchema, - etlCodeAsset: new s3assets.Asset(this, 'ScriptLocation', { - path: `${__dirname}/../etl/transform.py` - }) - }); - - new CfnOutput(this, 'KinesisStreamName', { - value: customEtlJob.kinesisStream.streamName - }); - - new CfnOutput(this, 'GlueJob', { - value: customEtlJob.glueJob.ref - }); - - new CfnOutput(this, 'JobRole', { - value: customEtlJob.glueJobRole.roleArn - }); - } -} diff --git a/source/use_cases/aws-custom-glue-etl/metrics.png b/source/use_cases/aws-custom-glue-etl/metrics.png deleted file mode 100644 index 1718c8107..000000000 Binary files a/source/use_cases/aws-custom-glue-etl/metrics.png and /dev/null differ diff --git a/source/use_cases/aws-custom-glue-etl/package.json b/source/use_cases/aws-custom-glue-etl/package.json deleted file mode 100644 index abae3a26b..000000000 --- a/source/use_cases/aws-custom-glue-etl/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@aws-solutions-constructs/aws-cust0m-glue-etl", - "version": "0.0.0", - "description": "Use case pattern for creating a custom ETL job in AWS Glue.", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/awslabs/aws-solutions-constructs.git", - "directory": "source/use_cases/aws-cust0m-glue-etl" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "scripts": { - "build": "tsc", - "lint": "eslint -c ../eslintrc.yml --ext=.js,.ts . && tslint --project .", - "lint-fix": "eslint -c ../eslintrc.yml --ext=.js,.ts --fix .", - "test": "jest --coverage", - "clean": "tsc -b --clean", - "watch": "tsc -b -w", - "integ": "integ-runner --update-on-failed", - "integ-no-clean": "integ-runner --update-on-failed --no-clean", - "integ-assert": "integ-runner", - "build+lint+test": "npm run build && npm run lint && npm test && npm run integ-assert" - }, - "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", - "@aws-solutions-constructs/aws-kinesisstreams-gluejob": "0.0.0", - "@aws-solutions-constructs/core": "0.0.0", - "source-map-support": "^0.5.16", - "constructs": "^10.0.0" - }, - "devDependencies": { - "@types/jest": "^24.9.1", - "@types/node": "^10.3.0", - "constructs": "^10.0.0", - "aws-cdk-lib": "0.0.0" - }, - "jest": { - "moduleFileExtensions": [ - "js" - ] - }, - "peerDependencies": { - "constructs": "^10.0.0", - "aws-cdk-lib": "^0.0.0" - } -} \ No newline at end of file diff --git a/source/use_cases/aws-custom-glue-etl/run.png b/source/use_cases/aws-custom-glue-etl/run.png deleted file mode 100644 index d516556ee..000000000 Binary files a/source/use_cases/aws-custom-glue-etl/run.png and /dev/null differ diff --git a/source/use_cases/aws-custom-glue-etl/stream-producer/___init__.py b/source/use_cases/aws-custom-glue-etl/stream-producer/___init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py b/source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py deleted file mode 100644 index 809573875..000000000 --- a/source/use_cases/aws-custom-glue-etl/stream-producer/generate_data.py +++ /dev/null @@ -1,122 +0,0 @@ -""" - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. - * -""" - -import argparse -import datetime as dt -import io -import json -import os -import random -import sys - -import boto3 -from faker import * - - -# Create a client with aws service and region -def create_client(service, region): - return boto3.client(service, region_name=region) - - -class RecordGenerator(object): - """ - A class used to generate ventilator data used as input for Glue Streaming ETL. - """ - - def __init__(self): - self.ventilatorid = 0 - self.eventtime = None - self.serialnumber = "" - self.pressurecontrol = 0 - self.o2stats = 0 - self.minutevolume = 0 - self.manufacturer = None - - def get_ventilator_record(self, fake): - """ - Generates fake ventilator metrics - """ - record = { - "ventilatorid": fake.pyint(min_value=1, max_value=50), - "eventtime": fake.date_time_between(start_date="-10m", end_date="now").isoformat(), - "serialnumber": fake.uuid4(), - "pressurecontrol": fake.pyint(min_value=3, max_value=40), - "o2stats": fake.pyint(min_value=90, max_value=100), - "minutevolume": fake.pyint(min_value=2, max_value=10), - "manufacturer": random.choice(["3M", "GE", "Vyaire", "Getinge"]), - } - data = json.dumps(record) - return {"Data": bytes(data, "utf-8"), "PartitionKey": "partition_key"} - - def get_ventilator_records(self, rate, fake): - return [self.get_ventilator_record(fake) for _ in range(rate)] - - def dumps_lines(objs): - for obj in objs: - yield json.dumps(obj, separators=(",", ":")) + "\n" - - -# main function -def main(): - - parser = argparse.ArgumentParser(description="Faker based streaming data generator") - - parser.add_argument( - "--streamname", action="store", dest="stream_name", help="Provide Kinesis Data Stream name to stream data" - ) - parser.add_argument("--region", action="store", dest="region", default="us-east-1") - - args = parser.parse_args() - - # print (args) - # Make sure to set credentials here or use profile_name. Also make sure that the user role for which credentials - # are set has write permissions to the Kinesis Data Streams - # session = boto3.Session( - # aws_access_key_id="FAKE_ID_UPDATE_ACCESS_KEY_ID", - # aws_secret_access_key="FAKE_KEY_UPDATE_ACCESS_KEY", - # aws_session_token="FAKE_TOKEN_UPDATE_SESSION_TOKEN", - # ) - - # OR - - session = boto3.Session(profile_name="default") - - try: - # Initialize Faker library - fake = Faker() - - # Kinesis settings - kinesis_client = session.client("kinesis", args.region) - - # Rate at which records are generated - rate = 500 - generator = RecordGenerator() - - # Generates ventilator data - while True: - fake_ventilator_records = generator.get_ventilator_records(rate, fake) - print(fake_ventilator_records) - kinesis_client.put_records(StreamName=args.stream_name, Records=fake_ventilator_records) - # fakeIO = StringIO() - # fakeIO.write(str(''.join(dumps_lines(fake_ventilator_records)))) - # fakeIO.close() - - except: - print("Error:", sys.exc_info()[0]) - raise - - -if __name__ == "__main__": - # run main - main() diff --git a/source/use_cases/aws-custom-glue-etl/stream-producer/requirements.txt b/source/use_cases/aws-custom-glue-etl/stream-producer/requirements.txt deleted file mode 100644 index 856a458e5..000000000 --- a/source/use_cases/aws-custom-glue-etl/stream-producer/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -faker==5.0.1 -boto3 \ No newline at end of file diff --git a/source/use_cases/aws-custom-glue-etl/test/__snapshots__/aws-custom-glue-etl.test.js.snap b/source/use_cases/aws-custom-glue-etl/test/__snapshots__/aws-custom-glue-etl.test.js.snap deleted file mode 100644 index 2f4bee777..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/__snapshots__/aws-custom-glue-etl.test.js.snap +++ /dev/null @@ -1,40 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should match snapshot 1`] = ` -Object { - "Parameters": Object { - "BootstrapVersion": Object { - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]", - "Type": "AWS::SSM::Parameter::Value", - }, - }, - "Rules": Object { - "CheckBootstrapVersion": Object { - "Assertions": Array [ - Object { - "Assert": Object { - "Fn::Not": Array [ - Object { - "Fn::Contains": Array [ - Array [ - "1", - "2", - "3", - "4", - "5", - ], - Object { - "Ref": "BootstrapVersion", - }, - ], - }, - ], - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI.", - }, - ], - }, - }, -} -`; diff --git a/source/use_cases/aws-custom-glue-etl/test/aws-custom-glue-etl.test.ts b/source/use_cases/aws-custom-glue-etl/test/aws-custom-glue-etl.test.ts deleted file mode 100644 index b28197c60..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/aws-custom-glue-etl.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ - -import { App, Stack } from 'aws-cdk-lib'; -import { AwsCustomGlueEtlStack } from '../lib/aws-custom-glue-etl-stack'; -import { Template } from 'aws-cdk-lib/assertions'; - -test('should match snapshot', () => { - const app = new App(); - const stack = new Stack(app); - - new AwsCustomGlueEtlStack(stack, 'testStack'); - const template = Template.fromStack(stack); - - expect(template).toMatchSnapshot(); -}); - diff --git a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJob.assets.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJob.assets.json deleted file mode 100644 index 320662272..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJob.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "36.0.0", - "files": { - "84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb": { - "source": { - "path": "asset.84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "f06dec671e2247660b421f7c66dcf0191b573e715d33b978c720e69361586132": { - "source": { - "path": "IntegTestGlueJob.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "f06dec671e2247660b421f7c66dcf0191b573e715d33b978c720e69361586132.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/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJob.template.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJob.template.json deleted file mode 100644 index 2e06e6bd7..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJob.template.json +++ /dev/null @@ -1,822 +0,0 @@ -{ - "Description": "Integration Test for sample application that uses aws-kineisstream-glue-job construct", - "Resources": { - "CustomETLKinesisStreamB4F1869F": { - "Type": "AWS::Kinesis::Stream", - "Properties": { - "RetentionPeriodHours": 24, - "ShardCount": 1, - "StreamEncryption": { - "EncryptionType": "KMS", - "KeyId": "alias/aws/kinesis" - } - } - }, - "CustomETLGlueSecurityConfigDFE12B1C": { - "Type": "AWS::Glue::SecurityConfiguration", - "Properties": { - "EncryptionConfiguration": { - "JobBookmarksEncryption": { - "JobBookmarksEncryptionMode": "CSE-KMS", - "KmsKeyArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":kms:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":alias/aws/glue" - ] - ] - } - }, - "S3Encryptions": [ - { - "S3EncryptionMode": "SSE-S3" - } - ] - }, - "Name": { - "Fn::Join": [ - "", - [ - "ETLJobSecurityConfig", - { - "Ref": "AWS::StackId" - } - ] - ] - } - } - }, - "CustomETLLogPolicyA74138E8": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws-glue/*" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "CustomETLLogPolicyA74138E8", - "Roles": [ - { - "Ref": "CustomETLJobRole53A1671F" - } - ] - } - }, - "CustomETLJobRole53A1671F": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "glue.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "Description": "Service role that Glue custom ETL jobs will assume for execution" - } - }, - "CustomETLJobRoleDefaultPolicy564ADEA9": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":s3:::", - { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "/*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":s3:::", - { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "CustomETLJobRoleDefaultPolicy564ADEA9", - "Roles": [ - { - "Ref": "CustomETLJobRole53A1671F" - } - ] - } - }, - "CustomETLS3LoggingBucketBBDD45CB": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } - } - ] - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - }, - "VersioningConfiguration": { - "Status": "Enabled" - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain", - "Metadata": { - "cfn_nag": { - "rules_to_suppress": [ - { - "id": "W35", - "reason": "This S3 bucket is used as the access logging bucket for another bucket" - } - ] - } - } - }, - "CustomETLS3LoggingBucketPolicy15C78253": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "CustomETLS3LoggingBucketBBDD45CB" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "CustomETLS3LoggingBucketBBDD45CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3LoggingBucketBBDD45CB", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": "s3:PutObject", - "Condition": { - "ArnLike": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - } - }, - "StringEquals": { - "aws:SourceAccount": { - "Ref": "AWS::AccountId" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "logging.s3.amazonaws.com" - }, - "Resource": { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3LoggingBucketBBDD45CB", - "Arn" - ] - }, - "/*" - ] - ] - } - } - ], - "Version": "2012-10-17" - } - } - }, - "CustomETLS3Bucket3EE58725": { - "Type": "AWS::S3::Bucket", - "Properties": { - "BucketEncryption": { - "ServerSideEncryptionConfiguration": [ - { - "ServerSideEncryptionByDefault": { - "SSEAlgorithm": "AES256" - } - } - ] - }, - "LifecycleConfiguration": { - "Rules": [ - { - "NoncurrentVersionTransitions": [ - { - "StorageClass": "GLACIER", - "TransitionInDays": 90 - } - ], - "Status": "Enabled" - } - ] - }, - "LoggingConfiguration": { - "DestinationBucketName": { - "Ref": "CustomETLS3LoggingBucketBBDD45CB" - } - }, - "PublicAccessBlockConfiguration": { - "BlockPublicAcls": true, - "BlockPublicPolicy": true, - "IgnorePublicAcls": true, - "RestrictPublicBuckets": true - }, - "VersioningConfiguration": { - "Status": "Enabled" - } - }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" - }, - "CustomETLS3BucketPolicy20FB337A": { - "Type": "AWS::S3::BucketPolicy", - "Properties": { - "Bucket": { - "Ref": "CustomETLS3Bucket3EE58725" - }, - "PolicyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "CustomETLKinesisETLJob04F57BEF": { - "Type": "AWS::Glue::Job", - "Properties": { - "Command": { - "Name": "gluestreaming", - "PythonVersion": "3", - "ScriptLocation": { - "Fn::Sub": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py" - } - }, - "DefaultArguments": { - "--enable-metrics": true, - "--enable-continuous-cloudwatch-log": true, - "--database_name": { - "Ref": "GlueDatabase" - }, - "--table_name": { - "Ref": "GlueTable" - }, - "--output_path": { - "Fn::Join": [ - "", - [ - "s3a://", - { - "Ref": "CustomETLS3Bucket3EE58725" - }, - "/output/" - ] - ] - } - }, - "GlueVersion": "2.0", - "NumberOfWorkers": 2, - "Role": { - "Fn::GetAtt": [ - "CustomETLJobRole53A1671F", - "Arn" - ] - }, - "SecurityConfiguration": { - "Fn::Join": [ - "", - [ - "ETLJobSecurityConfig", - { - "Ref": "AWS::StackId" - } - ] - ] - }, - "WorkerType": "G.1X" - } - }, - "CustomETLKinesisStreamGetRecordsIteratorAgeAlarmCD7F4E34": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Consumer Record Processing Falling Behind, there is risk for data loss due to record expiration.", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "EvaluationPeriods": 1, - "MetricName": "GetRecords.IteratorAgeMilliseconds", - "Namespace": "AWS/Kinesis", - "Period": 300, - "Statistic": "Maximum", - "Threshold": 43200000 - } - }, - "CustomETLKinesisStreamReadProvisionedThroughputExceededAlarm6AB32664": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Consumer Application is Reading at a Slower Rate Than Expected.", - "ComparisonOperator": "GreaterThanThreshold", - "EvaluationPeriods": 1, - "MetricName": "ReadProvisionedThroughputExceeded", - "Namespace": "AWS/Kinesis", - "Period": 300, - "Statistic": "Average", - "Threshold": 0 - } - }, - "GlueDatabase": { - "Type": "AWS::Glue::Database", - "Properties": { - "CatalogId": { - "Ref": "AWS::AccountId" - }, - "DatabaseInput": { - "Description": "An AWS Glue database generated by AWS Solutions Construct" - } - } - }, - "GlueTable": { - "Type": "AWS::Glue::Table", - "Properties": { - "CatalogId": { - "Ref": "AWS::AccountId" - }, - "DatabaseName": { - "Ref": "GlueDatabase" - }, - "TableInput": { - "Parameters": { - "classification": "json" - }, - "StorageDescriptor": { - "Columns": [ - { - "Comment": "", - "Name": "ventilatorid", - "Type": "int" - }, - { - "Comment": "", - "Name": "eventtime", - "Type": "string" - }, - { - "Comment": "", - "Name": "serialnumber", - "Type": "string" - }, - { - "Comment": "", - "Name": "pressurecontrol", - "Type": "int" - }, - { - "Comment": "", - "Name": "o2stats", - "Type": "int" - }, - { - "Comment": "", - "Name": "minutevolume", - "Type": "int" - }, - { - "Comment": "", - "Name": "manufacturer", - "Type": "string" - } - ], - "Compressed": false, - "InputFormat": "org.apache.hadoop.mapred.TextInputFormat", - "Location": { - "Ref": "CustomETLKinesisStreamB4F1869F" - }, - "NumberOfBuckets": -1, - "OutputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", - "Parameters": { - "endpointUrl": { - "Fn::Join": [ - "", - [ - "https://kinesis.", - { - "Ref": "AWS::Region" - }, - ".amazonaws.com" - ] - ] - }, - "streamName": { - "Ref": "CustomETLKinesisStreamB4F1869F" - }, - "typeOfData": "kinesis" - }, - "SerdeInfo": { - "Parameters": { - "paths": "ventilatorid,eventtime,serialnumber,pressurecontrol,o2stats,minutevolume,manufacturer" - }, - "SerializationLibrary": "org.openx.data.jsonserde.JsonSerDe" - } - }, - "TableType": "EXTERNAL_TABLE" - } - } - }, - "CustomETLGlueJobPolicy0AE5B5CB": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": "glue:GetJob", - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":job/", - { - "Ref": "CustomETLKinesisETLJob04F57BEF" - } - ] - ] - } - }, - { - "Action": "glue:GetSecurityConfiguration", - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "glue:GetTable", - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":catalog" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":database/", - { - "Ref": "GlueDatabase" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":table/", - { - "Ref": "GlueDatabase" - }, - "/", - { - "Ref": "GlueTable" - } - ] - ] - } - ] - }, - { - "Action": "cloudwatch:PutMetricData", - "Condition": { - "StringEquals": { - "cloudwatch:namespace": "Glue" - }, - "Bool": { - "aws:SecureTransport": "true" - } - }, - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "kinesis:DescribeStream", - "kinesis:DescribeStreamSummary", - "kinesis:GetRecords", - "kinesis:GetShardIterator", - "kinesis:ListShards", - "kinesis:SubscribeToShard" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "CustomETLKinesisStreamB4F1869F", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "CustomETLGlueJobPolicy0AE5B5CB", - "Roles": [ - { - "Ref": "CustomETLJobRole53A1671F" - } - ] - }, - "Metadata": { - "cfn_nag": { - "rules_to_suppress": [ - { - "id": "W12", - "reason": "Glue Security Configuration does not have an ARN, and the policy only allows reading the configuration. CloudWatch metrics also do not have an ARN but adding a namespace condition to the policy to allow it to publish metrics only for AWS Glue" - } - ] - } - } - } - }, - "Outputs": { - "KinesisStreamName": { - "Value": { - "Ref": "CustomETLKinesisStreamB4F1869F" - } - }, - "GlueJob": { - "Value": { - "Ref": "CustomETLKinesisETLJob04F57BEF" - } - }, - "JobRole": { - "Value": { - "Fn::GetAtt": [ - "CustomETLJobRole53A1671F", - "Arn" - ] - } - } - }, - "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/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJobIntegDefaultTestDeployAssert49434261.assets.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJobIntegDefaultTestDeployAssert49434261.assets.json deleted file mode 100644 index 4aa39c04c..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJobIntegDefaultTestDeployAssert49434261.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "36.0.0", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "IntegTestGlueJobIntegDefaultTestDeployAssert49434261.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/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJobIntegDefaultTestDeployAssert49434261.template.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJobIntegDefaultTestDeployAssert49434261.template.json deleted file mode 100644 index ad9d0fb73..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/IntegTestGlueJobIntegDefaultTestDeployAssert49434261.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "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/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/asset.84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/asset.84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py deleted file mode 100644 index 345581dd9..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/asset.84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py +++ /dev/null @@ -1,109 +0,0 @@ -""" - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. -""" - -import base64 -import datetime -import sys - -import boto3 -from awsglue import DynamicFrame -from awsglue.context import GlueContext -from awsglue.job import Job -from awsglue.transforms import * -from awsglue.utils import getResolvedOptions -from pyspark.context import SparkContext -from pyspark.sql import DataFrame, Row -from pyspark.sql.functions import * -from pyspark.sql.types import * - -args = getResolvedOptions(sys.argv, ["JOB_NAME", "output_path", "database_name", "table_name"]) - -sc = SparkContext() -glueContext = GlueContext(sc) -spark = glueContext.spark_session -job = Job(glueContext) -job.init(args["JOB_NAME"], args) - -# S3 sink locations -output_path = args["output_path"] -databasename = args["database_name"] -tablename = args["table_name"] - -s3_target = output_path + "ventilator_metrics" -checkpoint_location = output_path + "cp/" -temp_path = output_path + "temp/" - - -def processBatch(data_frame, batchId): - now = datetime.datetime.now() - year = now.year - month = now.month - day = now.day - hour = now.hour - minute = now.minute - if data_frame.count() > 0: - dynamic_frame = DynamicFrame.fromDF(data_frame, glueContext, "from_data_frame") - apply_mapping = ApplyMapping.apply( - frame=dynamic_frame, - mappings=[ - ("ventilatorid", "long", "ventilatorid", "long"), - ("eventtime", "string", "eventtime", "timestamp"), - ("serialnumber", "string", "serialnumber", "string"), - ("pressurecontrol", "long", "pressurecontrol", "long"), - ("o2stats", "long", "o2stats", "long"), - ("minutevolume", "long", "minutevolume", "long"), - ("manufacturer", "string", "manufacturer", "string"), - ], - transformation_ctx="apply_mapping", - ) - - dynamic_frame.printSchema() - - # Write to S3 Sink - s3path = ( - s3_target - + "/ingest_year=" - + "{:0>4}".format(str(year)) - + "/ingest_month=" - + "{:0>2}".format(str(month)) - + "/ingest_day=" - + "{:0>2}".format(str(day)) - + "/ingest_hour=" - + "{:0>2}".format(str(hour)) - + "/" - ) - s3sink = glueContext.write_dynamic_frame.from_options( - frame=apply_mapping, - connection_type="s3", - connection_options={"path": s3path}, - format="parquet", - transformation_ctx="s3sink", - ) - - -# Read from Kinesis Data Stream -sourceData = glueContext.create_data_frame.from_catalog( - database=databasename, - table_name=tablename, - transformation_ctx="datasource0", - additional_options={"startingPosition": "TRIM_HORIZON", "inferSchema": "true"}, -) - -sourceData.printSchema() - -glueContext.forEachBatch( - frame=sourceData, - batch_function=processBatch, - options={"windowSize": "100 seconds", "checkpointLocation": checkpoint_location}, -) -job.commit() diff --git a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/integ.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/integ.json deleted file mode 100644 index ddeb9882c..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "36.0.0", - "testCases": { - "IntegTestGlueJob/Integ/DefaultTest": { - "stacks": [ - "IntegTestGlueJob" - ], - "assertionStack": "IntegTestGlueJob/Integ/DefaultTest/DeployAssert", - "assertionStackName": "IntegTestGlueJobIntegDefaultTestDeployAssert49434261" - } - } -} \ No newline at end of file diff --git a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/manifest.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/manifest.json deleted file mode 100644 index f9927d6d9..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/manifest.json +++ /dev/null @@ -1,215 +0,0 @@ -{ - "version": "36.0.0", - "artifacts": { - "IntegTestGlueJobIntegDefaultTestDeployAssert49434261.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "IntegTestGlueJobIntegDefaultTestDeployAssert49434261.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "IntegTestGlueJobIntegDefaultTestDeployAssert49434261": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "IntegTestGlueJobIntegDefaultTestDeployAssert49434261.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": [ - "IntegTestGlueJobIntegDefaultTestDeployAssert49434261.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": [ - "IntegTestGlueJobIntegDefaultTestDeployAssert49434261.assets" - ], - "metadata": { - "/IntegTestGlueJob/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/IntegTestGlueJob/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "IntegTestGlueJob/Integ/DefaultTest/DeployAssert" - }, - "IntegTestGlueJob.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "IntegTestGlueJob.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "IntegTestGlueJob": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "IntegTestGlueJob.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}/f06dec671e2247660b421f7c66dcf0191b573e715d33b978c720e69361586132.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "IntegTestGlueJob.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": [ - "IntegTestGlueJob.assets" - ], - "metadata": { - "/IntegTestGlueJob/CustomETL/KinesisStream/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLKinesisStreamB4F1869F" - } - ], - "/IntegTestGlueJob/CustomETL/GlueSecurityConfig": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLGlueSecurityConfigDFE12B1C" - } - ], - "/IntegTestGlueJob/CustomETL/LogPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLLogPolicyA74138E8" - } - ], - "/IntegTestGlueJob/CustomETL/JobRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLJobRole53A1671F" - } - ], - "/IntegTestGlueJob/CustomETL/JobRole/DefaultPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLJobRoleDefaultPolicy564ADEA9" - } - ], - "/IntegTestGlueJob/CustomETL/S3LoggingBucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLS3LoggingBucketBBDD45CB" - } - ], - "/IntegTestGlueJob/CustomETL/S3LoggingBucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLS3LoggingBucketPolicy15C78253" - } - ], - "/IntegTestGlueJob/CustomETL/S3Bucket/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLS3Bucket3EE58725" - } - ], - "/IntegTestGlueJob/CustomETL/S3Bucket/Policy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLS3BucketPolicy20FB337A" - } - ], - "/IntegTestGlueJob/CustomETL/KinesisETLJob": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLKinesisETLJob04F57BEF" - } - ], - "/IntegTestGlueJob/CustomETL/KinesisStreamGetRecordsIteratorAgeAlarm/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLKinesisStreamGetRecordsIteratorAgeAlarmCD7F4E34" - } - ], - "/IntegTestGlueJob/CustomETL/KinesisStreamReadProvisionedThroughputExceededAlarm/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLKinesisStreamReadProvisionedThroughputExceededAlarm6AB32664" - } - ], - "/IntegTestGlueJob/GlueDatabase": [ - { - "type": "aws:cdk:logicalId", - "data": "GlueDatabase" - } - ], - "/IntegTestGlueJob/GlueTable": [ - { - "type": "aws:cdk:logicalId", - "data": "GlueTable" - } - ], - "/IntegTestGlueJob/CustomETLGlueJobPolicy/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomETLGlueJobPolicy0AE5B5CB" - } - ], - "/IntegTestGlueJob/KinesisStreamName": [ - { - "type": "aws:cdk:logicalId", - "data": "KinesisStreamName" - } - ], - "/IntegTestGlueJob/GlueJob": [ - { - "type": "aws:cdk:logicalId", - "data": "GlueJob" - } - ], - "/IntegTestGlueJob/JobRole": [ - { - "type": "aws:cdk:logicalId", - "data": "JobRole" - } - ], - "/IntegTestGlueJob/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/IntegTestGlueJob/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "IntegTestGlueJob" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/tree.json b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/tree.json deleted file mode 100644 index 5cbbac4fe..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.js.snapshot/tree.json +++ /dev/null @@ -1,1138 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "IntegTestGlueJob": { - "id": "IntegTestGlueJob", - "path": "IntegTestGlueJob", - "children": { - "ScriptLocation": { - "id": "ScriptLocation", - "path": "IntegTestGlueJob/ScriptLocation", - "children": { - "Stage": { - "id": "Stage", - "path": "IntegTestGlueJob/ScriptLocation/Stage", - "constructInfo": { - "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.118.0" - } - }, - "AssetBucket": { - "id": "AssetBucket", - "path": "IntegTestGlueJob/ScriptLocation/AssetBucket", - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.118.0" - } - }, - "CustomETL": { - "id": "CustomETL", - "path": "IntegTestGlueJob/CustomETL", - "children": { - "KinesisStream": { - "id": "KinesisStream", - "path": "IntegTestGlueJob/CustomETL/KinesisStream", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/KinesisStream/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Kinesis::Stream", - "aws:cdk:cloudformation:props": { - "retentionPeriodHours": 24, - "shardCount": 1, - "streamEncryption": { - "encryptionType": "KMS", - "keyId": "alias/aws/kinesis" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_kinesis.CfnStream", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_kinesis.Stream", - "version": "2.118.0" - } - }, - "GlueSecurityConfig": { - "id": "GlueSecurityConfig", - "path": "IntegTestGlueJob/CustomETL/GlueSecurityConfig", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Glue::SecurityConfiguration", - "aws:cdk:cloudformation:props": { - "encryptionConfiguration": { - "jobBookmarksEncryption": { - "jobBookmarksEncryptionMode": "CSE-KMS", - "kmsKeyArn": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":kms:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":alias/aws/glue" - ] - ] - } - }, - "s3Encryptions": [ - { - "s3EncryptionMode": "SSE-S3" - } - ] - }, - "name": { - "Fn::Join": [ - "", - [ - "ETLJobSecurityConfig", - { - "Ref": "AWS::StackId" - } - ] - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_glue.CfnSecurityConfiguration", - "version": "2.118.0" - } - }, - "LogPolicy": { - "id": "LogPolicy", - "path": "IntegTestGlueJob/CustomETL/LogPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/LogPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "logs:CreateLogGroup", - "logs:CreateLogStream", - "logs:PutLogEvents" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":logs:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":log-group:/aws-glue/*" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "CustomETLLogPolicyA74138E8", - "roles": [ - { - "Ref": "CustomETLJobRole53A1671F" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.118.0" - } - }, - "JobRole": { - "id": "JobRole", - "path": "IntegTestGlueJob/CustomETL/JobRole", - "children": { - "ImportJobRole": { - "id": "ImportJobRole", - "path": "IntegTestGlueJob/CustomETL/JobRole/ImportJobRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "2.118.0" - } - }, - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/JobRole/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Role", - "aws:cdk:cloudformation:props": { - "assumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "glue.amazonaws.com" - } - } - ], - "Version": "2012-10-17" - }, - "description": "Service role that Glue custom ETL jobs will assume for execution" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.118.0" - } - }, - "DefaultPolicy": { - "id": "DefaultPolicy", - "path": "IntegTestGlueJob/CustomETL/JobRole/DefaultPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/JobRole/DefaultPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": [ - "s3:Abort*", - "s3:DeleteObject*", - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*", - "s3:PutObject", - "s3:PutObjectLegalHold", - "s3:PutObjectRetention", - "s3:PutObjectTagging", - "s3:PutObjectVersionTagging" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": [ - "s3:GetBucket*", - "s3:GetObject*", - "s3:List*" - ], - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":s3:::", - { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "/*" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":s3:::", - { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - } - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - }, - "policyName": "CustomETLJobRoleDefaultPolicy564ADEA9", - "roles": [ - { - "Ref": "CustomETLJobRole53A1671F" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.118.0" - } - }, - "S3LoggingBucket": { - "id": "S3LoggingBucket", - "path": "IntegTestGlueJob/CustomETL/S3LoggingBucket", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/S3LoggingBucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "AES256" - } - } - ] - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - }, - "versioningConfiguration": { - "status": "Enabled" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.118.0" - } - }, - "Policy": { - "id": "Policy", - "path": "IntegTestGlueJob/CustomETL/S3LoggingBucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/S3LoggingBucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "CustomETLS3LoggingBucketBBDD45CB" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "CustomETLS3LoggingBucketBBDD45CB", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3LoggingBucketBBDD45CB", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - }, - { - "Action": "s3:PutObject", - "Condition": { - "ArnLike": { - "aws:SourceArn": { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - } - }, - "StringEquals": { - "aws:SourceAccount": { - "Ref": "AWS::AccountId" - } - } - }, - "Effect": "Allow", - "Principal": { - "Service": "logging.s3.amazonaws.com" - }, - "Resource": { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3LoggingBucketBBDD45CB", - "Arn" - ] - }, - "/*" - ] - ] - } - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.118.0" - } - }, - "S3Bucket": { - "id": "S3Bucket", - "path": "IntegTestGlueJob/CustomETL/S3Bucket", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/S3Bucket/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::Bucket", - "aws:cdk:cloudformation:props": { - "bucketEncryption": { - "serverSideEncryptionConfiguration": [ - { - "serverSideEncryptionByDefault": { - "sseAlgorithm": "AES256" - } - } - ] - }, - "lifecycleConfiguration": { - "rules": [ - { - "noncurrentVersionTransitions": [ - { - "storageClass": "GLACIER", - "transitionInDays": 90 - } - ], - "status": "Enabled" - } - ] - }, - "loggingConfiguration": { - "destinationBucketName": { - "Ref": "CustomETLS3LoggingBucketBBDD45CB" - } - }, - "publicAccessBlockConfiguration": { - "blockPublicAcls": true, - "blockPublicPolicy": true, - "ignorePublicAcls": true, - "restrictPublicBuckets": true - }, - "versioningConfiguration": { - "status": "Enabled" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.118.0" - } - }, - "Policy": { - "id": "Policy", - "path": "IntegTestGlueJob/CustomETL/S3Bucket/Policy", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/S3Bucket/Policy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", - "aws:cdk:cloudformation:props": { - "bucket": { - "Ref": "CustomETLS3Bucket3EE58725" - }, - "policyDocument": { - "Statement": [ - { - "Action": "s3:*", - "Condition": { - "Bool": { - "aws:SecureTransport": "false" - } - }, - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Resource": [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - { - "Fn::Join": [ - "", - [ - { - "Fn::GetAtt": [ - "CustomETLS3Bucket3EE58725", - "Arn" - ] - }, - "/*" - ] - ] - } - ] - } - ], - "Version": "2012-10-17" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.118.0" - } - }, - "KinesisETLJob": { - "id": "KinesisETLJob", - "path": "IntegTestGlueJob/CustomETL/KinesisETLJob", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Glue::Job", - "aws:cdk:cloudformation:props": { - "command": { - "name": "gluestreaming", - "pythonVersion": "3", - "scriptLocation": { - "Fn::Sub": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/84f8d5b3b3970239322b59ef748d86a112fab19fd3c8079859ed1569aad0eeeb.py" - } - }, - "defaultArguments": { - "--enable-metrics": true, - "--enable-continuous-cloudwatch-log": true, - "--database_name": { - "Ref": "GlueDatabase" - }, - "--table_name": { - "Ref": "GlueTable" - }, - "--output_path": { - "Fn::Join": [ - "", - [ - "s3a://", - { - "Ref": "CustomETLS3Bucket3EE58725" - }, - "/output/" - ] - ] - } - }, - "glueVersion": "2.0", - "numberOfWorkers": 2, - "role": { - "Fn::GetAtt": [ - "CustomETLJobRole53A1671F", - "Arn" - ] - }, - "securityConfiguration": { - "Fn::Join": [ - "", - [ - "ETLJobSecurityConfig", - { - "Ref": "AWS::StackId" - } - ] - ] - }, - "workerType": "G.1X" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_glue.CfnJob", - "version": "2.118.0" - } - }, - "KinesisStreamGetRecordsIteratorAgeAlarm": { - "id": "KinesisStreamGetRecordsIteratorAgeAlarm", - "path": "IntegTestGlueJob/CustomETL/KinesisStreamGetRecordsIteratorAgeAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/KinesisStreamGetRecordsIteratorAgeAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Consumer Record Processing Falling Behind, there is risk for data loss due to record expiration.", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "evaluationPeriods": 1, - "metricName": "GetRecords.IteratorAgeMilliseconds", - "namespace": "AWS/Kinesis", - "period": 300, - "statistic": "Maximum", - "threshold": 43200000 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.118.0" - } - }, - "KinesisStreamReadProvisionedThroughputExceededAlarm": { - "id": "KinesisStreamReadProvisionedThroughputExceededAlarm", - "path": "IntegTestGlueJob/CustomETL/KinesisStreamReadProvisionedThroughputExceededAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETL/KinesisStreamReadProvisionedThroughputExceededAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Consumer Application is Reading at a Slower Rate Than Expected.", - "comparisonOperator": "GreaterThanThreshold", - "evaluationPeriods": 1, - "metricName": "ReadProvisionedThroughputExceeded", - "namespace": "AWS/Kinesis", - "period": 300, - "statistic": "Average", - "threshold": 0 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-solutions-constructs/aws-kinesisstreams-gluejob.KinesisstreamsToGluejob", - "version": "2.51.0" - } - }, - "GlueDatabase": { - "id": "GlueDatabase", - "path": "IntegTestGlueJob/GlueDatabase", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Glue::Database", - "aws:cdk:cloudformation:props": { - "catalogId": { - "Ref": "AWS::AccountId" - }, - "databaseInput": { - "description": "An AWS Glue database generated by AWS Solutions Construct" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_glue.CfnDatabase", - "version": "2.118.0" - } - }, - "GlueTable": { - "id": "GlueTable", - "path": "IntegTestGlueJob/GlueTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Glue::Table", - "aws:cdk:cloudformation:props": { - "catalogId": { - "Ref": "AWS::AccountId" - }, - "databaseName": { - "Ref": "GlueDatabase" - }, - "tableInput": { - "storageDescriptor": { - "columns": [ - { - "name": "ventilatorid", - "type": "int", - "comment": "" - }, - { - "name": "eventtime", - "type": "string", - "comment": "" - }, - { - "name": "serialnumber", - "type": "string", - "comment": "" - }, - { - "name": "pressurecontrol", - "type": "int", - "comment": "" - }, - { - "name": "o2stats", - "type": "int", - "comment": "" - }, - { - "name": "minutevolume", - "type": "int", - "comment": "" - }, - { - "name": "manufacturer", - "type": "string", - "comment": "" - } - ], - "location": { - "Ref": "CustomETLKinesisStreamB4F1869F" - }, - "inputFormat": "org.apache.hadoop.mapred.TextInputFormat", - "outputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", - "compressed": false, - "numberOfBuckets": -1, - "serdeInfo": { - "serializationLibrary": "org.openx.data.jsonserde.JsonSerDe", - "parameters": { - "paths": "ventilatorid,eventtime,serialnumber,pressurecontrol,o2stats,minutevolume,manufacturer" - } - }, - "parameters": { - "endpointUrl": { - "Fn::Join": [ - "", - [ - "https://kinesis.", - { - "Ref": "AWS::Region" - }, - ".amazonaws.com" - ] - ] - }, - "streamName": { - "Ref": "CustomETLKinesisStreamB4F1869F" - }, - "typeOfData": "kinesis" - } - }, - "tableType": "EXTERNAL_TABLE", - "parameters": { - "classification": "json" - } - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_glue.CfnTable", - "version": "2.118.0" - } - }, - "CustomETLGlueJobPolicy": { - "id": "CustomETLGlueJobPolicy", - "path": "IntegTestGlueJob/CustomETLGlueJobPolicy", - "children": { - "Resource": { - "id": "Resource", - "path": "IntegTestGlueJob/CustomETLGlueJobPolicy/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::Policy", - "aws:cdk:cloudformation:props": { - "policyDocument": { - "Statement": [ - { - "Action": "glue:GetJob", - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":job/", - { - "Ref": "CustomETLKinesisETLJob04F57BEF" - } - ] - ] - } - }, - { - "Action": "glue:GetSecurityConfiguration", - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": "glue:GetTable", - "Effect": "Allow", - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":catalog" - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":database/", - { - "Ref": "GlueDatabase" - } - ] - ] - }, - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":glue:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":table/", - { - "Ref": "GlueDatabase" - }, - "/", - { - "Ref": "GlueTable" - } - ] - ] - } - ] - }, - { - "Action": "cloudwatch:PutMetricData", - "Condition": { - "StringEquals": { - "cloudwatch:namespace": "Glue" - }, - "Bool": { - "aws:SecureTransport": "true" - } - }, - "Effect": "Allow", - "Resource": "*" - }, - { - "Action": [ - "kinesis:DescribeStream", - "kinesis:DescribeStreamSummary", - "kinesis:GetRecords", - "kinesis:GetShardIterator", - "kinesis:ListShards", - "kinesis:SubscribeToShard" - ], - "Effect": "Allow", - "Resource": { - "Fn::GetAtt": [ - "CustomETLKinesisStreamB4F1869F", - "Arn" - ] - } - } - ], - "Version": "2012-10-17" - }, - "policyName": "CustomETLGlueJobPolicy0AE5B5CB", - "roles": [ - { - "Ref": "CustomETLJobRole53A1671F" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.118.0" - } - }, - "KinesisStreamName": { - "id": "KinesisStreamName", - "path": "IntegTestGlueJob/KinesisStreamName", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.118.0" - } - }, - "GlueJob": { - "id": "GlueJob", - "path": "IntegTestGlueJob/GlueJob", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.118.0" - } - }, - "JobRole": { - "id": "JobRole", - "path": "IntegTestGlueJob/JobRole", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.118.0" - } - }, - "Integ": { - "id": "Integ", - "path": "IntegTestGlueJob/Integ", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "IntegTestGlueJob/Integ/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "IntegTestGlueJob/Integ/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "IntegTestGlueJob/Integ/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "IntegTestGlueJob/Integ/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.118.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "IntegTestGlueJob/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.118.0-alpha.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.118.0-alpha.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "IntegTestGlueJob/BootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.118.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "IntegTestGlueJob/CheckBootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "2.118.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "2.118.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.App", - "version": "2.118.0" - } - } -} \ No newline at end of file diff --git a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.ts b/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.ts deleted file mode 100644 index 416d4bfed..000000000 --- a/source/use_cases/aws-custom-glue-etl/test/integ.gluejob.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance - * with the License. A copy of the License is located at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES - * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions - * and limitations under the License. - */ - -import { App } from "aws-cdk-lib"; -import { AwsCustomGlueEtlStack } from "../lib/aws-custom-glue-etl-stack"; -import { IntegTest } from '@aws-cdk/integ-tests-alpha'; - -const app = new App(); -const stack = new AwsCustomGlueEtlStack(app, 'IntegTestGlueJob'); -stack.templateOptions.description = 'Integration Test for sample application that uses aws-kineisstream-glue-job construct'; - -new IntegTest(stack, 'Integ', { testCases: [ - stack -] }); diff --git a/source/use_cases/aws-custom-glue-etl/tsconfig.json b/source/use_cases/aws-custom-glue-etl/tsconfig.json deleted file mode 100644 index 15eacca70..000000000 --- a/source/use_cases/aws-custom-glue-etl/tsconfig.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "alwaysStrict": true, - "declaration": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": [ - "es2018" - ], - "module": "CommonJS", - "noEmitOnError": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "strict": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "stripInternal": true, - "target": "ES2018" - }, - "include": [ - "**/*.ts" - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/complete-order/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/complete-order/index.js index 1d77332f9..634b86bdf 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/complete-order/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/complete-order/index.js @@ -12,8 +12,11 @@ */ // Imports -const aws = require('aws-sdk'); -const ddb = new aws.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); + +const { DynamoDBDocument, UpdateCommand } = require('@aws-sdk/lib-dynamodb'); +const { DynamoDB } = require('@aws-sdk/client-dynamodb'); + +const ddb = DynamoDBDocument.from(new DynamoDB({apiVersion: '2012-08-10'})); // Handler exports.handler = async (event) => { @@ -34,7 +37,7 @@ exports.handler = async (event) => { // Add the item to the database try { - const res = await ddb.update(params).promise(); + const res = await ddb.send(new UpdateCommand(params)); return { statusCode: 200, isBase64Encoded: false, diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/get-open-orders/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/get-open-orders/index.js index 9c6ed66b0..b81953a63 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/get-open-orders/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/kitchen-staff/get-open-orders/index.js @@ -12,8 +12,11 @@ */ // Imports -const aws = require('aws-sdk'); -const ddb = new aws.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); + +const { DynamoDBDocument, QueryCommand } = require("@aws-sdk/lib-dynamodb"); +const { DynamoDB } = require("@aws-sdk/client-dynamodb"); + +const ddb = DynamoDBDocument.from(new DynamoDB({apiVersion: '2012-08-10'})); // Handler exports.handler = async (event) => { @@ -32,7 +35,7 @@ exports.handler = async (event) => { // Perform the query try { - const result = await ddb.query(params).promise(); + const result = await ddb.send(new QueryCommand(params)); // Extract the order JSON objects const orders = Array.from(result.Items); // Return the open orders diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/layer/db-access.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/layer/db-access.js index c491ead37..a7f6b11e6 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/layer/db-access.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/layer/db-access.js @@ -12,8 +12,12 @@ */ // Imports -const aws = require('aws-sdk'); -const ddb = new aws.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); + + +const { DynamoDBDocument, ScanCommand } = require('@aws-sdk/lib-dynamodb'); +const { DynamoDB } = require('@aws-sdk/client-dynamodb'); + +const ddb = DynamoDBDocument.from(new DynamoDB({apiVersion: '2012-08-10'})); /** * Common function for scanning the database and getting all entries. Supports multiple functions within the system. @@ -32,7 +36,7 @@ exports.scanTable = async () => { // Perform the scan try { do { - items = await ddb.scan(params).promise(); + items = await ddb.send(new ScanCommand(params)); items.Items.forEach((item) => scanResults.push(item)); params.ExclusiveStartKey = items.LastEvaluatedKey; } while (typeof items.LastEvaluatedKey != "undefined"); diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/archive-orders/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/archive-orders/index.js index 7bf822977..be698fb8d 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/archive-orders/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/archive-orders/index.js @@ -12,9 +12,13 @@ */ // Imports -const aws = require('aws-sdk'); -const s3 = new aws.S3(); -const ddb = new aws.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); + +const { DynamoDBDocument, DeleteCommand } = require('@aws-sdk/lib-dynamodb'); +const { DynamoDB } = require('@aws-sdk/client-dynamodb'); +const { S3, PutObjectCommand } = require('@aws-sdk/client-s3'); + +const s3 = new S3(); +const ddb = DynamoDBDocument.from(new DynamoDB({apiVersion: '2012-08-10'})); const db_access = require('/opt/db-access'); exports.handler = async (event) => { @@ -46,7 +50,7 @@ exports.handler = async (event) => { // Save the report try { - await s3.putObject(s3_params).promise(); + await s3.send(new PutObjectCommand(s3_params)); console.log(`Successfully saved the report to "${process.env.S3_BUCKET_NAME}"`); console.log(`Report filename: "${s3_params.Key}"`); } catch (err) { @@ -56,17 +60,12 @@ exports.handler = async (event) => { // --------------------------------------------------------------------------- // Clear-out the table // --------------------------------------------------------------------------- - deleteEntries(scanResults); + await deleteEntries(scanResults); }; -/** - * Method to delete an entry from the DynamoDB table using recursion. Takes an - * array of entries, pops the array and deletes the popped item before repeating - * until the array is reduced to 0 indices. - * @param {array} entries - an array of entries - */ -const deleteEntries = (entries) => { - if (entries.length > 0) { + +async function deleteEntries(entries) { + while (entries.length > 0) { const entry = entries.pop(); const params = { Key: { @@ -74,13 +73,8 @@ const deleteEntries = (entries) => { }, TableName: process.env.DDB_TABLE_NAME }; + console.log(`deleting: ${entry.id}`); // Delete the entry - ddb.delete(params, function(err, data) { - if (err) console.log(err); - else { - console.log(data); - deleteEntries(entries); - } - }); + await ddb.send(new DeleteCommand(params)); } } diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/calculate-tips/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/calculate-tips/index.js index a8feba623..be2ea4b09 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/calculate-tips/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/calculate-tips/index.js @@ -12,8 +12,10 @@ */ // Imports -const aws = require('aws-sdk'); -const sns = new aws.SNS(); + +const { SNS, PublishCommand } = require('@aws-sdk/client-sns'); + +const sns = new SNS(); const db_access = require('/opt/db-access'); // Handler @@ -35,25 +37,21 @@ exports.handler = async (event) => { scanResults.forEach((r) => { if (r.tipAmount !== undefined) { if (!servers.includes(r.createdBy)) { - tips[r.createdBy] = Number(r.tipAmount) + tips[r.createdBy] = Number(r.tipAmount); + servers.push(r.createdBy); } else { - tips[r.createdBy] = Number(tips[r.createdBy]) + Number(r.tipAmount) + tips[r.createdBy] = Number(tips[r.createdBy]) + Number(r.tipAmount); } } }); - // Send a notification to each active server with tip information - Object.keys(tips).forEach((t) => { - // Message parameters + for (var i = 0; i { @@ -23,14 +27,15 @@ exports.handler = async (event) => { // that is still open is overdue const lateInterval = Number(process.env.LATE_ORDER_THRESHOLD) * 60000; const lateThreshold = Number(new Date().getTime()) - lateInterval; - + // Setup the parameters const params = { KeyConditionExpression: - "gsi1pk = :type and gsi1sk < :sortEnd", + "gsi1pk = :type and gsi1sk between :sortStart and :sortEnd", ExpressionAttributeValues: { ":type": "order", - ":sortEnd": `OPEN#${lateThreshold}` + ":sortEnd": `OPEN#${lateThreshold}`, + ":sortStart": "OPEN#0" }, TableName: process.env.DDB_TABLE_NAME, IndexName: 'gsi1pk-gsi1sk-index' @@ -38,30 +43,38 @@ exports.handler = async (event) => { // Hold the late orders in an array let lateOrders = []; - console.log(lateOrders); // Query all late orders from the table try { - const result = await ddb.query(params).promise(); + const result = await ddb.send(new QueryCommand(params)); // Extract the order JSON objects const orders = Array.from(result.Items); // Save the open orders to the array lateOrders = orders; } catch (error) { - console.error(error); + console.error(`Query error: ${error}`); } + console.log(`Late Orders:\n${JSON.stringify(lateOrders)}`); // Send a notification if there is one or more orders running late if (lateOrders.length > 0) { // Message parameters const sns_params = { - Message: 'One or more orders are running late!', + Message: `One or more orders are running late:\n${FormatLateOrders(lateOrders)}`, TopicArn: process.env.SNS_TOPIC_ARN }; - // Send the message - sns.publish(sns_params, function(err, data) { - if (err) console.log(err, err.stack); // an error occurred - else console.log(data); // successful response - }); + try { + await sns.send(new PublishCommand(sns_params)); + } catch (error) { + console.error(`SNS error: ${error}`); + } } }; + +function FormatLateOrders(lateOrders) { + let formattedOrders = ''; + lateOrders.forEach(order => { + formattedOrders += `${order.createdBy}: Table ${order.tableNumber}, order: ${order.items}\n`; + }); + return formattedOrders; +} \ No newline at end of file diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/close-out-service/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/close-out-service/index.js index c732758e2..d3b27e99a 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/close-out-service/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/close-out-service/index.js @@ -12,8 +12,10 @@ */ // Imports -const aws = require('aws-sdk'); -const sfn = new aws.StepFunctions(); + +const { SFN, StartExecutionCommand } = require('@aws-sdk/client-sfn'); + +const sfn = new SFN(); // Handler exports.handler = async (event) => { @@ -25,7 +27,7 @@ exports.handler = async (event) => { // Start the process try { - const res = await sfn.startExecution(params).promise(); + const res = await sfn.send(new StartExecutionCommand(params)); console.log(res); return { statusCode: 200, diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/create-report/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/create-report/index.js index b14c3ec90..8813eb1b4 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/create-report/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/create-report/index.js @@ -12,8 +12,10 @@ */ // Imports -const aws = require('aws-sdk'); -const s3 = new aws.S3(); + +const { S3, PutObjectCommand } = require('@aws-sdk/client-s3'); + +const s3 = new S3(); const db_access = require('/opt/db-access'); exports.handler = async (event) => { @@ -60,7 +62,7 @@ exports.handler = async (event) => { // Save the report try { - await s3.putObject(s3_params).promise(); + await s3.send(new PutObjectCommand(s3_params)); console.log(`Successfully saved the report to "${process.env.S3_BUCKET_NAME}"`); console.log(`Report filename: "${s3_params.Key}"`); } catch (err) { diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/get-report/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/get-report/index.js index 6345f4ba0..5ab93b1d5 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/get-report/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/manager/get-report/index.js @@ -12,8 +12,10 @@ */ // Imports -const aws = require('aws-sdk'); -const s3 = new aws.S3(); + +const { S3, GetObjectCommand } = require('@aws-sdk/client-s3'); + +const s3 = new S3(); exports.handler = async (event) => { @@ -30,9 +32,8 @@ exports.handler = async (event) => { // Get the report try { - const res = await s3.getObject(params).promise(); - const parsed = res.Body.toString('utf-8'); - console.log(parsed); + const res = await s3.send(new GetObjectCommand(params)); + const parsed = await res.Body.transformToString(); return { statusCode: 200, isBase64Encoded: false, diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/index.js index e0216b7bf..0d9c591fd 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/index.js @@ -12,15 +12,19 @@ */ // Imports -const aws = require('aws-sdk'); -const ddb = new aws.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); + +const { DynamoDBDocument, PutCommand } = require('@aws-sdk/lib-dynamodb'); +const { DynamoDB } = require('@aws-sdk/client-dynamodb'); + +const ddb = DynamoDBDocument.from(new DynamoDB({apiVersion: '2012-08-10'})); const { v4: uuidv4 } = require('uuid'); // Handler exports.handler = async (event) => { - + // Setup the parameters const req = JSON.parse(event.body); + const orderTime = new Date().getTime(); const params = { TableName: process.env.DDB_TABLE_NAME, Item: { @@ -31,16 +35,16 @@ exports.handler = async (event) => { orderStatus: 'OPEN', orderTotal: req.orderTotal, tipAmount: req.tipAmount, - timeOpened: new Date().getTime(), + timeOpened: orderTime, timeClosed: undefined, gsi1pk: 'order', - gsi1sk: `OPEN#${req.timeOpened}`, + gsi1sk: `OPEN#${orderTime}`, } }; // Add the item to the database try { - const res = await ddb.put(params).promise(); + const res = await ddb.send(new PutCommand(params)); return { statusCode: 200, isBase64Encoded: false, diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/package.json b/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/package.json index 38c9e933b..196518a13 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/package.json +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/create-order/package.json @@ -8,16 +8,10 @@ "author": "", "license": "ISC", "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", - "uuid": "^8.3.2", - "constructs": "^10.0.0" + "uuid": "^8.3.2" }, "peerDependencies": { - "constructs": "^10.0.0", - "aws-cdk-lib": "0.0.0" }, "devDependencies": { - "constructs": "^10.0.0", - "aws-cdk-lib": "^0.0.0" } } \ No newline at end of file diff --git a/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/process-payment/index.js b/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/process-payment/index.js index aba6939f9..10e58c691 100644 --- a/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/process-payment/index.js +++ b/source/use_cases/aws-restaurant-management-demo/lib/lambda/service-staff/process-payment/index.js @@ -12,8 +12,11 @@ */ // Imports -const aws = require('aws-sdk'); -const ddb = new aws.DynamoDB.DocumentClient({apiVersion: '2012-08-10'}); + +const { DynamoDBDocument, UpdateCommand } = require("@aws-sdk/lib-dynamodb"); +const { DynamoDB } = require("@aws-sdk/client-dynamodb"); + +const ddb = DynamoDBDocument.from(new DynamoDB({apiVersion: '2012-08-10'})); // Handler exports.handler = async (event) => { @@ -37,7 +40,7 @@ exports.handler = async (event) => { // Add the item to the database try { - const result = await ddb.update(params).promise(); + const result = await ddb.send(new UpdateCommand(params)); return { statusCode: 200, isBase64Encoded: false,