diff --git a/.viperlightignore b/.viperlightignore index d94f05b3b..3853c5642 100644 --- a/.viperlightignore +++ b/.viperlightignore @@ -183,4 +183,4 @@ source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.r53alb-depl source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.r53alb-deployPublicApiNewAlb.js.snapshot/r53alb-deployPublicApiNewAlb.template.json:214 source/patterns/@aws-solutions-constructs/aws-route53-alb/test/integ.r53alb-deployPublicApiNewAlb.js.snapshot/tree.json:269 # compressed test web site -source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip +source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip diff --git a/CHANGELOG.md b/CHANGELOG.md index 633ed1db3..3fc6d6d78 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.75.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.74.0...v2.75.0) (2024-12-23) + + +### Features + +* **aws-dynamodbstreams-pipes-stepfunctions:** new construct ([#1238](https://github.com/awslabs/aws-solutions-constructs/issues/1238)) ([7afe6e8](https://github.com/awslabs/aws-solutions-constructs/commit/7afe6e84f81db0a088301e15c8890d454ebf25da)) +* **aws-dynomodbstreams-pipes-stepfunctions:** add default maximum retries ([#1240](https://github.com/awslabs/aws-solutions-constructs/issues/1240)) ([50404c1](https://github.com/awslabs/aws-solutions-constructs/commit/50404c112407119c2dc7e282fe0de37d8ed586d0)) + ## [2.74.0](https://github.com/awslabs/aws-solutions-constructs/compare/v2.73.0...v2.74.0) (2024-10-22) Build on CDK v2.161.0 diff --git a/NOTICE.txt b/NOTICE.txt index 371697e3b..89df98ce5 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -20,8 +20,6 @@ This software includes third party software subject to the following copyrights: aws-cdk under the Apache License Version 2.0 aws-sdk under the Apache License Version 2.0 aws-sdk-mock under the Apache License Version 2.0 -bootstrap under the Massachusetts Institute of Technology (MIT) license -chai under the Massachusetts Institute of Technology (MIT) license color under the Massachusetts Institute of Technology (MIT) license color-name under the Massachusetts Institute of Technology (MIT) license deepmerge under the MIT License diff --git a/deployment/v2/align-version.js b/deployment/v2/align-version.js index 43f251dc9..c8a0e7b9a 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.161.0'; +const awsCdkLibVersion = '2.163.1'; for (const file of process.argv.splice(4)) { const pkg = JSON.parse(fs.readFileSync(file).toString()); diff --git a/source/THIRD-PARTY-LICENSES.txt b/source/THIRD-PARTY-LICENSES.txt new file mode 100644 index 000000000..a7bf919dd --- /dev/null +++ b/source/THIRD-PARTY-LICENSES.txt @@ -0,0 +1,522 @@ +** @aws-sdk/client-kms; version 3.687 -- https://github.com/aws/aws-sdk-js-v3.git +** @aws-sdk/client-s3; version 3.689.0 -- https://github.com/aws/aws-sdk-js-v3.git + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 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. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +* For @aws-sdk/client-kms see also this required NOTICE: + /* + * Copyright 2019 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://aws.amazon.com/apache2.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, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +* For @aws-sdk/client-s3 see also this required NOTICE: + /* + * Copyright 2019 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://aws.amazon.com/apache2.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, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + + +------ + +** Constructs; version 10.4.2 -- https://github.com/aws/constructs + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +* For Constructs see also this required NOTICE: + Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +------ + +** npmlog; version 7.0.1 -- https://github.com/npm/npmlog.git +Copyright npm, Inc. + + + +ISC License + +Copyright npm, Inc. + +Permission to use, copy, modify, and/or distribute this +software for any purpose with or without fee is hereby +granted, provided that the above copyright notice and this +permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND NPM DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO +EVENT SHALL NPM BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE +USE OR PERFORMANCE OF THIS SOFTWARE. + +------ + +** deepmerge; version 4.3.1 -- https://github.com/TehShrike/deepmerge +Copyright (c) 2012 James Halliday, Josh Duff, and other contributors + +The MIT License (MIT) + +Copyright (c) 2012 James Halliday, Josh Duff, and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +------ + +** deep-diff; version 1.0.2 -- git://github.com/flitbit/diff.git +Copyright (c) 2011-2018 Phillip Clark + +Copyright (c) 2011-2018 Phillip Clark + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/source/lerna.json b/source/lerna.json index 770425e98..a01a31fd4 100644 --- a/source/lerna.json +++ b/source/lerna.json @@ -5,5 +5,5 @@ "patterns/@aws-solutions-constructs/*" ], "rejectCycles": "true", - "version": "2.74.0" + "version": "2.75.0" } diff --git a/source/package.json b/source/package.json index ccfda2494..ef097aa93 100644 --- a/source/package.json +++ b/source/package.json @@ -14,27 +14,27 @@ }, "private": true, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", + "constructs": "^10.0.0" + }, + "devDependencies": { + "@aws-cdk/integ-tests-alpha": "2.163.1-alpha.0", "@typescript-eslint/eslint-plugin": "^2.14.0", "@typescript-eslint/parser": "^2.14.0", - "eslint": "^6.8.0", - "eslint-import-resolver-node": "^0.3.2", - "eslint-import-resolver-typescript": "^2.0.0", - "eslint-plugin-import": "^2.19.1", - "eslint-plugin-license-header": "^0.2.0", "fs-extra": "^8.1.0", + "typescript": "4.7.4", "jest": "^27.4.0", "jsii": "~5.4.26", "jsii-rosetta": "~5.4.25", "jsii-pacmak": "^1.92.0", "tslint": "^5.20.1", - "typescript": "4.7.4", - "constructs": "^10.0.0" - }, - "devDependencies": { "lerna": "8.1.8", + "eslint": "^6.8.0", + "eslint-import-resolver-node": "^0.3.2", + "eslint-import-resolver-typescript": "^2.0.0", + "eslint-plugin-import": "^2.19.1", + "eslint-plugin-license-header": "^0.2.0", "constructs": "^10.0.0", - "aws-cdk-lib": "0.0.0" + "aws-cdk-lib": "2.163.1" }, "workspaces": { "packages": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-alb-fargate/package.json b/source/patterns/@aws-solutions-constructs/aws-alb-fargate/package.json index 99828e24a..eb68f351f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-alb-fargate/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-alb-fargate/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@aws-solutions-constructs/core": "0.0.0", "@types/node": "^10.3.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md index b5adac68b..0ecfbb217 100755 --- a/source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-alb-lambda/README.md @@ -45,7 +45,7 @@ const certificate = acm.Certificate.fromCertificateArn( const constructProps: AlbToLambdaProps = { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, listenerProps: { @@ -85,7 +85,7 @@ certificate = acm.Certificate.from_certificate_arn( # MyStack(app, 'id', env=cdk.Environment(account='123456789012', region='us-east-1')) AlbToLambda(self, 'new-construct', lambda_function_props=_lambda.FunctionProps( - runtime=_lambda.Runtime.PYTHON_3_7, + runtime=_lambda.Runtime.Python_3_11, code=_lambda.Code.from_asset('lambda'), handler='index.handler', ), @@ -121,7 +121,7 @@ ListenerCertificate listenerCertificate = ListenerCertificate // .build()); new AlbToLambda(this, "AlbToLambdaPattern", new AlbToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-alb-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-alb-lambda/package.json index 654cf689b..8dac4b174 100644 --- a/source/patterns/@aws-solutions-constructs/aws-alb-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-alb-lambda/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@aws-solutions-constructs/core": "0.0.0", "@types/node": "^10.3.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/lambda/index.js index 35d9fbac5..dcb96c7b9 100644 --- a/source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-alb-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function (event) { console.log("request:", JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json index d7b413b0c..1e7bf6c7b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-dynamodb/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-iot/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-iot/package.json index fc8438db6..03ddad8ec 100755 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-iot/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-iot/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-kinesisstreams/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-kinesisstreams/package.json index e167c04fe..44593918e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-kinesisstreams/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-kinesisstreams/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/README.md index e7e2e4760..d37c77f2c 100755 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/README.md @@ -33,7 +33,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new ApiGatewayToLambda(this, 'ApiGatewayToLambdaPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -51,7 +51,7 @@ from constructs import Construct ApiGatewayToLambda(self, 'ApiGatewayToLambdaPattern', lambda_function_props=_lambda.FunctionProps( - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler', code=_lambda.Code.from_asset('lambda') ) @@ -71,7 +71,7 @@ import software.amazon.awsconstructs.services.apigatewaylambda.*; new ApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new ApiGatewayToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json index 720508506..34ef5e348 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-lambda/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-sagemakerendpoint/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-sagemakerendpoint/package.json index df18f0f5f..b08b32d92 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-sagemakerendpoint/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-sagemakerendpoint/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json index 1f3e396ee..36262a5c3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigateway-sqs/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-apigatewayv2websocket-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-apigatewayv2websocket-sqs/package.json index 0658ec6ea..8d0daffc4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-apigatewayv2websocket-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-apigatewayv2websocket-sqs/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.md index 95bad1f33..e4c88bd71 100755 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/README.md @@ -33,7 +33,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new CloudFrontToApiGatewayToLambda(this, 'test-cloudfront-apigateway-lambda', { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, apiGatewayProps: { @@ -57,7 +57,7 @@ from constructs import Construct CloudFrontToApiGatewayToLambda( self, 'CloudFrontApiGatewayToLambda', lambda_function_props=_lambda.FunctionProps( - runtime=_lambda.Runtime.PYTHON_3_7, + runtime=_lambda.Runtime.Python_3_11, code=_lambda.Code.from_asset('lambda'), handler='hello.handler', ), @@ -86,7 +86,7 @@ import software.amazon.awsconstructs.services.cloudfrontapigatewaylambda.CloudFr new CloudFrontToApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new CloudFrontToApiGatewayToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) // execution environment + .runtime(Runtime.NODEJS_20_X) // execution environment .code(Code.fromAsset("lambda")) // code loaded from the `lambda` directory (under root, next to `src`) .handler("hello.handler") // file is `hello`, function is `handler` .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json index 1858a92d4..d956dd7d7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/package.json @@ -53,12 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/aws-cloudfront-apigateway": "0.0.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/README.md b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/README.md index b813f9138..551e1d700 100755 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/README.md @@ -33,7 +33,7 @@ import * as api from 'aws-cdk-lib/aws-apigateway'; const lambdaProps: lambda.FunctionProps = { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }; @@ -69,7 +69,7 @@ from constructs import Construct lambda_function = _lambda.Function(self, 'LambdaFunction', code=_lambda.Code.from_asset( 'lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler') api_gateway = api.LambdaRestApi(self, 'LambdaRestApi', @@ -99,7 +99,7 @@ import software.amazon.awscdk.services.apigateway.*; import software.amazon.awsconstructs.services.cloudfrontapigateway.*; final Function lambdaFunction = Function.Builder.create(this, "IndexHandler") - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build(); diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json index 1c1ae2216..dceec1376 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-apigateway/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/package.json index 902b2d10c..a573b8035 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-mediastore/package.json @@ -53,11 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/jest": "^27.4.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json index b91ce1925..fddba573e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cloudfront-s3/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/resources": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/README.md index 5474d7011..e766831cf 100755 --- a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/README.md @@ -37,7 +37,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new CognitoToApiGatewayToLambda(this, 'test-cognito-apigateway-lambda', { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' } }); @@ -55,7 +55,7 @@ from constructs import Construct CognitoToApiGatewayToLambda(self, 'test-cognito-apigateway-lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -75,7 +75,7 @@ import software.amazon.awsconstructs.services.cognitoapigatewaylambda.*; new CognitoToApiGatewayToLambda(this, "test-cognito-apigateway-lambda", new CognitoToApiGatewayToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) @@ -94,7 +94,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const construct = new CognitoToApiGatewayToLambda(this, 'test-cognito-apigateway-lambda', { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, apiGatewayProps: { @@ -127,7 +127,7 @@ construct = CognitoToApiGatewayToLambda(self, 'test-cognito-apigateway-lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset( 'lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), api_gateway_props=gateway_props( @@ -163,7 +163,7 @@ final CognitoToApiGatewayToLambda construct = new CognitoToApiGatewayToLambda(th "test-cognito-apigateway-lambda", new CognitoToApiGatewayToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json index dc6cade48..56738ff07 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-cognito-apigateway-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/.eslintignore b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/.eslintignore index 9dcdc3666..b52288a88 100644 --- a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/.eslintignore +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/.eslintignore @@ -1,5 +1,7 @@ lib/*.js test/*.js +test/integ.*.js.snapshot/ +test/cdk-integ.out.integ.*.snapshot test/s3/*.js test/s3/integ.*.js.snapshot/ test/s3/cdk-integ.out.integ.*.snapshot diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/package.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/package.json index ab26b4ad5..630b43861 100644 --- a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/asset.faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6/index.js b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/asset.faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6/index.js new file mode 100644 index 000000000..2f92d06c1 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/asset.faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6/index.js @@ -0,0 +1 @@ +"use strict";var f=Object.create,i=Object.defineProperty,I=Object.getOwnPropertyDescriptor,C=Object.getOwnPropertyNames,w=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty,A=(t,e)=>{for(var o in e)i(t,o,{get:e[o],enumerable:!0})},d=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of C(e))!P.call(t,s)&&s!==o&&i(t,s,{get:()=>e[s],enumerable:!(r=I(e,s))||r.enumerable});return t},l=(t,e,o)=>(o=t!=null?f(w(t)):{},d(e||!t||!t.__esModule?i(o,"default",{value:t,enumerable:!0}):o,t)),B=t=>d(i({},"__esModule",{value:!0}),t),q={};A(q,{autoDeleteHandler:()=>S,handler:()=>H}),module.exports=B(q);var h=require("@aws-sdk/client-s3"),y=l(require("https")),m=l(require("url")),a={sendHttpRequest:D,log:T,includeStackTraces:!0,userHandlerIndex:"./index"},p="AWSCDK::CustomResourceProviderFramework::CREATE_FAILED",L="AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID";function R(t){return async(e,o)=>{let r={...e,ResponseURL:"..."};if(a.log(JSON.stringify(r,void 0,2)),e.RequestType==="Delete"&&e.PhysicalResourceId===p){a.log("ignoring DELETE event caused by a failed CREATE event"),await u("SUCCESS",e);return}try{let s=await t(r,o),n=k(e,s);await u("SUCCESS",n)}catch(s){let n={...e,Reason:a.includeStackTraces?s.stack:s.message};n.PhysicalResourceId||(e.RequestType==="Create"?(a.log("CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored"),n.PhysicalResourceId=p):a.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(e)}`)),await u("FAILED",n)}}}function k(t,e={}){let o=e.PhysicalResourceId??t.PhysicalResourceId??t.RequestId;if(t.RequestType==="Delete"&&o!==t.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${t.PhysicalResourceId}" to "${e.PhysicalResourceId}" during deletion`);return{...t,...e,PhysicalResourceId:o}}async function u(t,e){let o={Status:t,Reason:e.Reason??t,StackId:e.StackId,RequestId:e.RequestId,PhysicalResourceId:e.PhysicalResourceId||L,LogicalResourceId:e.LogicalResourceId,NoEcho:e.NoEcho,Data:e.Data},r=m.parse(e.ResponseURL),s=`${r.protocol}//${r.hostname}/${r.pathname}?***`;a.log("submit response to cloudformation",s,o);let n=JSON.stringify(o),E={hostname:r.hostname,path:r.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(n,"utf8")}};await O({attempts:5,sleep:1e3},a.sendHttpRequest)(E,n)}async function D(t,e){return new Promise((o,r)=>{try{let s=y.request(t,n=>{n.resume(),!n.statusCode||n.statusCode>=400?r(new Error(`Unsuccessful HTTP response: ${n.statusCode}`)):o()});s.on("error",r),s.write(e),s.end()}catch(s){r(s)}})}function T(t,...e){console.log(t,...e)}function O(t,e){return async(...o)=>{let r=t.attempts,s=t.sleep;for(;;)try{return await e(...o)}catch(n){if(r--<=0)throw n;await b(Math.floor(Math.random()*s)),s*=2}}}async function b(t){return new Promise(e=>setTimeout(e,t))}var g="aws-cdk:auto-delete-objects",x=JSON.stringify({Version:"2012-10-17",Statement:[]}),c=new h.S3({}),H=R(S);async function S(t){switch(t.RequestType){case"Create":return;case"Update":return{PhysicalResourceId:(await F(t)).PhysicalResourceId};case"Delete":return N(t.ResourceProperties?.BucketName)}}async function F(t){let e=t,o=e.OldResourceProperties?.BucketName;return{PhysicalResourceId:e.ResourceProperties?.BucketName??o}}async function _(t){try{let e=(await c.getBucketPolicy({Bucket:t}))?.Policy??x,o=JSON.parse(e);o.Statement.push({Principal:"*",Effect:"Deny",Action:["s3:PutObject"],Resource:[`arn:aws:s3:::${t}/*`]}),await c.putBucketPolicy({Bucket:t,Policy:JSON.stringify(o)})}catch(e){if(e.name==="NoSuchBucket")throw e;console.log(`Could not set new object deny policy on bucket '${t}' prior to deletion.`)}}async function U(t){let e;do{e=await c.listObjectVersions({Bucket:t});let o=[...e.Versions??[],...e.DeleteMarkers??[]];if(o.length===0)return;let r=o.map(s=>({Key:s.Key,VersionId:s.VersionId}));await c.deleteObjects({Bucket:t,Delete:{Objects:r}})}while(e?.IsTruncated)}async function N(t){if(!t)throw new Error("No BucketName was provided.");try{if(!await W(t)){console.log(`Bucket does not have '${g}' tag, skipping cleaning.`);return}await _(t),await U(t)}catch(e){if(e.name==="NoSuchBucket"){console.log(`Bucket '${t}' does not exist.`);return}throw e}}async function W(t){return(await c.getBucketTagging({Bucket:t})).TagSet?.some(o=>o.Key===g&&o.Value==="true")} diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/fac-all-resources-default.assets.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/fac-all-resources-default.assets.json new file mode 100644 index 000000000..0a19d211a --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/fac-all-resources-default.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { + "source": { + "path": "asset.faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "5e458d0a9a5d680ac7fb17c0589f2481d2d472793795ca6b9626568ca7de5715": { + "source": { + "path": "fac-all-resources-default.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "5e458d0a9a5d680ac7fb17c0589f2481d2d472793795ca6b9626568ca7de5715.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/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/fac-all-resources-default.template.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/fac-all-resources-default.template.json new file mode 100644 index 000000000..b4262af82 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/fac-all-resources-default.template.json @@ -0,0 +1,1004 @@ +{ + "Resources": { + "integtesttestS3LoggingBucket91D581BF": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + }, + "Tags": [ + { + "Key": "aws-cdk:auto-delete-objects", + "Value": "true" + } + ], + "VersioningConfiguration": { + "Status": "Enabled" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W35", + "reason": "This S3 bucket is used as the access logging bucket for another bucket" + } + ] + } + } + }, + "integtesttestS3LoggingBucketPolicy8C3AC577": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "integtesttestS3LoggingBucket91D581BF" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*", + "s3:PutBucketPolicy" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": "s3:PutObject", + "Condition": { + "ArnLike": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "integtesttestS3Bucket42B91B48", + "Arn" + ] + } + }, + "StringEquals": { + "aws:SourceAccount": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "logging.s3.amazonaws.com" + }, + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + "/*" + ] + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "integtesttestS3LoggingBucketAutoDeleteObjectsCustomResourceA4C82217": { + "Type": "Custom::S3AutoDeleteObjects", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F", + "Arn" + ] + }, + "BucketName": { + "Ref": "integtesttestS3LoggingBucket91D581BF" + } + }, + "DependsOn": [ + "integtesttestS3LoggingBucketPolicy8C3AC577" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "integtesttestS3Bucket42B91B48": { + "Type": "AWS::S3::Bucket", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + }, + "LifecycleConfiguration": { + "Rules": [ + { + "NoncurrentVersionTransitions": [ + { + "StorageClass": "GLACIER", + "TransitionInDays": 90 + } + ], + "Status": "Enabled" + } + ] + }, + "LoggingConfiguration": { + "DestinationBucketName": { + "Ref": "integtesttestS3LoggingBucket91D581BF" + } + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + }, + "VersioningConfiguration": { + "Status": "Enabled" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "integtesttestS3BucketPolicy54E2DE38": { + "Type": "AWS::S3::BucketPolicy", + "Properties": { + "Bucket": { + "Ref": "integtesttestS3Bucket42B91B48" + }, + "PolicyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "integtesttestS3Bucket42B91B48", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3Bucket42B91B48", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "integtesttestdlqF73DF092": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "integtesttestdlqPolicy2740E59D": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "integtesttestdlqF73DF092", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "integtesttestdlqF73DF092", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "integtesttestdlqF73DF092" + } + ] + } + }, + "integtest1192C30B": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs", + "RedrivePolicy": { + "deadLetterTargetArn": { + "Fn::GetAtt": [ + "integtesttestdlqF73DF092", + "Arn" + ] + }, + "maxReceiveCount": 15 + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "integtestPolicyF29A0B8B": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "integtest1192C30B", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "integtest1192C30B", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "integtest1192C30B" + } + ] + } + }, + "integtestStateMachineLogGrouptestsmA7D771BD": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/fac-all-resources-defaulttestsmStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "integtestStateMachinetestsmRoleD1F9CE9B": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "integtestStateMachinetestsmRoleDefaultPolicy7DBA7025": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdatest8B679D7F", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdatest8B679D7F", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "integtestStateMachinetestsmRoleDefaultPolicy7DBA7025", + "Roles": [ + { + "Ref": "integtestStateMachinetestsmRoleD1F9CE9B" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "integtestStateMachinetestsm53990095": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasktest\",\"States\":{\"tasktest\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdatest8B679D7F", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "integtestStateMachineLogGrouptestsmA7D771BD", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "integtestStateMachinetestsmRoleD1F9CE9B", + "Arn" + ] + } + }, + "DependsOn": [ + "integtestStateMachinetestsmRoleDefaultPolicy7DBA7025", + "integtestStateMachinetestsmRoleD1F9CE9B" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "integtestExecutionFailedAlarm8C10A26F": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "integtestStateMachinetestsm53990095" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "integtestExecutionThrottledAlarmD80EEBFB": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "integtestStateMachinetestsm53990095" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "integtestExecutionAbortedAlarm5571D1F6": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "integtestStateMachinetestsm53990095" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ] + } + }, + "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + }, + "Runtime": { + "Fn::FindInMap": [ + "LatestNodeRuntimeMap", + { + "Ref": "AWS::Region" + }, + "value" + ] + }, + "Description": { + "Fn::Join": [ + "", + [ + "Lambda function for auto-deleting objects in ", + { + "Ref": "integtesttestS3LoggingBucket91D581BF" + }, + " S3 bucket." + ] + ] + } + }, + "DependsOn": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "CDK generated custom resource" + }, + { + "id": "W89", + "reason": "CDK generated custom resource" + }, + { + "id": "W92", + "reason": "CDK generated custom resource" + }, + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "lambdatestServiceRoleF3BDB8FC": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdatest8B679D7F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdatestServiceRoleF3BDB8FC", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdatestServiceRoleF3BDB8FC" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + } + }, + "Mappings": { + "LatestNodeRuntimeMap": { + "af-south-1": { + "value": "nodejs20.x" + }, + "ap-east-1": { + "value": "nodejs20.x" + }, + "ap-northeast-1": { + "value": "nodejs20.x" + }, + "ap-northeast-2": { + "value": "nodejs20.x" + }, + "ap-northeast-3": { + "value": "nodejs20.x" + }, + "ap-south-1": { + "value": "nodejs20.x" + }, + "ap-south-2": { + "value": "nodejs20.x" + }, + "ap-southeast-1": { + "value": "nodejs20.x" + }, + "ap-southeast-2": { + "value": "nodejs20.x" + }, + "ap-southeast-3": { + "value": "nodejs20.x" + }, + "ap-southeast-4": { + "value": "nodejs20.x" + }, + "ap-southeast-5": { + "value": "nodejs20.x" + }, + "ap-southeast-7": { + "value": "nodejs20.x" + }, + "ca-central-1": { + "value": "nodejs20.x" + }, + "ca-west-1": { + "value": "nodejs20.x" + }, + "cn-north-1": { + "value": "nodejs18.x" + }, + "cn-northwest-1": { + "value": "nodejs18.x" + }, + "eu-central-1": { + "value": "nodejs20.x" + }, + "eu-central-2": { + "value": "nodejs20.x" + }, + "eu-isoe-west-1": { + "value": "nodejs18.x" + }, + "eu-north-1": { + "value": "nodejs20.x" + }, + "eu-south-1": { + "value": "nodejs20.x" + }, + "eu-south-2": { + "value": "nodejs20.x" + }, + "eu-west-1": { + "value": "nodejs20.x" + }, + "eu-west-2": { + "value": "nodejs20.x" + }, + "eu-west-3": { + "value": "nodejs20.x" + }, + "il-central-1": { + "value": "nodejs20.x" + }, + "me-central-1": { + "value": "nodejs20.x" + }, + "me-south-1": { + "value": "nodejs20.x" + }, + "mx-central-1": { + "value": "nodejs20.x" + }, + "sa-east-1": { + "value": "nodejs20.x" + }, + "us-east-1": { + "value": "nodejs20.x" + }, + "us-east-2": { + "value": "nodejs20.x" + }, + "us-gov-east-1": { + "value": "nodejs18.x" + }, + "us-gov-west-1": { + "value": "nodejs18.x" + }, + "us-iso-east-1": { + "value": "nodejs18.x" + }, + "us-iso-west-1": { + "value": "nodejs18.x" + }, + "us-isob-east-1": { + "value": "nodejs18.x" + }, + "us-west-1": { + "value": "nodejs20.x" + }, + "us-west-2": { + "value": "nodejs20.x" + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.assets.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.assets.json new file mode 100644 index 000000000..80cb04e16 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.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/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.template.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/integ.json new file mode 100644 index 000000000..b5ee2d802 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "fac-all-resources-default/Integ/DefaultTest": { + "stacks": [ + "fac-all-resources-default" + ], + "assertionStack": "fac-all-resources-default/Integ/DefaultTest/DeployAssert", + "assertionStackName": "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/manifest.json new file mode 100644 index 000000000..ba2901ab6 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/manifest.json @@ -0,0 +1,241 @@ +{ + "version": "38.0.1", + "artifacts": { + "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.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": [ + "facallresourcesdefaultIntegDefaultTestDeployAssertB575F841.assets" + ], + "metadata": { + "/fac-all-resources-default/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/fac-all-resources-default/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "fac-all-resources-default/Integ/DefaultTest/DeployAssert" + }, + "fac-all-resources-default.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "fac-all-resources-default.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "fac-all-resources-default": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "fac-all-resources-default.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}/5e458d0a9a5d680ac7fb17c0589f2481d2d472793795ca6b9626568ca7de5715.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "fac-all-resources-default.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": [ + "fac-all-resources-default.assets" + ], + "metadata": { + "/fac-all-resources-default/integ-test/testS3LoggingBucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestS3LoggingBucket91D581BF" + } + ], + "/fac-all-resources-default/integ-test/testS3LoggingBucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestS3LoggingBucketPolicy8C3AC577" + } + ], + "/fac-all-resources-default/integ-test/testS3LoggingBucket/AutoDeleteObjectsCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestS3LoggingBucketAutoDeleteObjectsCustomResourceA4C82217" + } + ], + "/fac-all-resources-default/integ-test/testS3Bucket/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestS3Bucket42B91B48" + } + ], + "/fac-all-resources-default/integ-test/testS3Bucket/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestS3BucketPolicy54E2DE38" + } + ], + "/fac-all-resources-default/integ-test/test-dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestdlqF73DF092" + } + ], + "/fac-all-resources-default/integ-test/test-dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtesttestdlqPolicy2740E59D" + } + ], + "/fac-all-resources-default/integ-test/test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtest1192C30B" + } + ], + "/fac-all-resources-default/integ-test/test/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestPolicyF29A0B8B" + } + ], + "/fac-all-resources-default/integ-test/StateMachineLogGrouptestsm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestStateMachineLogGrouptestsmA7D771BD" + } + ], + "/fac-all-resources-default/integ-test/StateMachinetestsm/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestStateMachinetestsmRoleD1F9CE9B" + } + ], + "/fac-all-resources-default/integ-test/StateMachinetestsm/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestStateMachinetestsmRoleDefaultPolicy7DBA7025" + } + ], + "/fac-all-resources-default/integ-test/StateMachinetestsm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestStateMachinetestsm53990095" + } + ], + "/fac-all-resources-default/integ-test/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestExecutionFailedAlarm8C10A26F" + } + ], + "/fac-all-resources-default/integ-test/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestExecutionThrottledAlarmD80EEBFB" + } + ], + "/fac-all-resources-default/integ-test/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "integtestExecutionAbortedAlarm5571D1F6" + } + ], + "/fac-all-resources-default/LatestNodeRuntimeMap": [ + { + "type": "aws:cdk:logicalId", + "data": "LatestNodeRuntimeMap" + } + ], + "/fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider": [ + { + "type": "aws:cdk:is-custom-resource-handler-customResourceProvider", + "data": true + } + ], + "/fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092" + } + ], + "/fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F" + } + ], + "/fac-all-resources-default/lambdatest/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdatestServiceRoleF3BDB8FC" + } + ], + "/fac-all-resources-default/lambdatest/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdatest8B679D7F" + } + ], + "/fac-all-resources-default/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/fac-all-resources-default/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "fac-all-resources-default" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/tree.json new file mode 100644 index 000000000..aeb21cf6e --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.js.snapshot/tree.json @@ -0,0 +1,1157 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "fac-all-resources-default": { + "id": "fac-all-resources-default", + "path": "fac-all-resources-default", + "children": { + "integ-test": { + "id": "integ-test", + "path": "fac-all-resources-default/integ-test", + "children": { + "testS3LoggingBucket": { + "id": "testS3LoggingBucket", + "path": "fac-all-resources-default/integ-test/testS3LoggingBucket", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/testS3LoggingBucket/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 + }, + "tags": [ + { + "key": "aws-cdk:auto-delete-objects", + "value": "true" + } + ], + "versioningConfiguration": { + "status": "Enabled" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "fac-all-resources-default/integ-test/testS3LoggingBucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/testS3LoggingBucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "integtesttestS3LoggingBucket91D581BF" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": [ + "s3:DeleteObject*", + "s3:GetBucket*", + "s3:List*", + "s3:PutBucketPolicy" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::GetAtt": [ + "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092", + "Arn" + ] + } + }, + "Resource": [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + }, + { + "Action": "s3:PutObject", + "Condition": { + "ArnLike": { + "aws:SourceArn": { + "Fn::GetAtt": [ + "integtesttestS3Bucket42B91B48", + "Arn" + ] + } + }, + "StringEquals": { + "aws:SourceAccount": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "logging.s3.amazonaws.com" + }, + "Resource": { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3LoggingBucket91D581BF", + "Arn" + ] + }, + "/*" + ] + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "2.163.1" + } + }, + "AutoDeleteObjectsCustomResource": { + "id": "AutoDeleteObjectsCustomResource", + "path": "fac-all-resources-default/integ-test/testS3LoggingBucket/AutoDeleteObjectsCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "fac-all-resources-default/integ-test/testS3LoggingBucket/AutoDeleteObjectsCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "2.163.1" + } + }, + "testS3Bucket": { + "id": "testS3Bucket", + "path": "fac-all-resources-default/integ-test/testS3Bucket", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/testS3Bucket/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": "integtesttestS3LoggingBucket91D581BF" + } + }, + "publicAccessBlockConfiguration": { + "blockPublicAcls": true, + "blockPublicPolicy": true, + "ignorePublicAcls": true, + "restrictPublicBuckets": true + }, + "versioningConfiguration": { + "status": "Enabled" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucket", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "fac-all-resources-default/integ-test/testS3Bucket/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/testS3Bucket/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::S3::BucketPolicy", + "aws:cdk:cloudformation:props": { + "bucket": { + "Ref": "integtesttestS3Bucket42B91B48" + }, + "policyDocument": { + "Statement": [ + { + "Action": "s3:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": [ + { + "Fn::GetAtt": [ + "integtesttestS3Bucket42B91B48", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "integtesttestS3Bucket42B91B48", + "Arn" + ] + }, + "/*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.Bucket", + "version": "2.163.1" + } + }, + "test-dlq": { + "id": "test-dlq", + "path": "fac-all-resources-default/integ-test/test-dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/test-dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "fac-all-resources-default/integ-test/test-dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/test-dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "integtesttestdlqF73DF092", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "integtesttestdlqF73DF092", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "integtesttestdlqF73DF092" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "test": { + "id": "test", + "path": "fac-all-resources-default/integ-test/test", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs", + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::GetAtt": [ + "integtesttestdlqF73DF092", + "Arn" + ] + }, + "maxReceiveCount": 15 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "fac-all-resources-default/integ-test/test/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/test/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "integtest1192C30B", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "integtest1192C30B", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "integtest1192C30B" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "StateMachineLogGrouptestsm": { + "id": "StateMachineLogGrouptestsm", + "path": "fac-all-resources-default/integ-test/StateMachineLogGrouptestsm", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/StateMachineLogGrouptestsm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/fac-all-resources-defaulttestsmStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachinetestsm": { + "id": "StateMachinetestsm", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm", + "children": { + "Role": { + "id": "Role", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdatest8B679D7F", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdatest8B679D7F", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "integtestStateMachinetestsmRoleDefaultPolicy7DBA7025", + "roles": [ + { + "Ref": "integtestStateMachinetestsmRoleD1F9CE9B" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/StateMachinetestsm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasktest\",\"States\":{\"tasktest\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdatest8B679D7F", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "integtestStateMachineLogGrouptestsmA7D771BD", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "integtestStateMachinetestsmRoleD1F9CE9B", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "fac-all-resources-default/integ-test/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "integtestStateMachinetestsm53990095" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "fac-all-resources-default/integ-test/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "integtestStateMachinetestsm53990095" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "fac-all-resources-default/integ-test/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/integ-test/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "integtestStateMachinetestsm53990095" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-constructs-factories.ConstructsFactories", + "version": "2.74.0" + } + }, + "LatestNodeRuntimeMap": { + "id": "LatestNodeRuntimeMap", + "path": "fac-all-resources-default/LatestNodeRuntimeMap", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnMapping", + "version": "2.163.1" + } + }, + "Custom::S3AutoDeleteObjectsCustomResourceProvider": { + "id": "Custom::S3AutoDeleteObjectsCustomResourceProvider", + "path": "fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "2.163.1" + } + }, + "Role": { + "id": "Role", + "path": "fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "2.163.1" + } + }, + "Handler": { + "id": "Handler", + "path": "fac-all-resources-default/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProviderBase", + "version": "2.163.1" + } + }, + "lambdatest": { + "id": "lambdatest", + "path": "fac-all-resources-default/lambdatest", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "fac-all-resources-default/lambdatest/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "fac-all-resources-default/lambdatest/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/lambdatest/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "fac-all-resources-default/lambdatest/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdatestServiceRoleF3BDB8FC", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "tasktest": { + "id": "tasktest", + "path": "fac-all-resources-default/tasktest", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "Integ": { + "id": "Integ", + "path": "fac-all-resources-default/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "fac-all-resources-default/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "fac-all-resources-default/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "fac-all-resources-default/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "fac-all-resources-default/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "fac-all-resources-default/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "fac-all-resources-default/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "fac-all-resources-default/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.ts b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.ts new file mode 100644 index 000000000..8d787a7d8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-constructs-factories/test/integ.fac-all-resources-default.ts @@ -0,0 +1,48 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack, RemovalPolicy } from "aws-cdk-lib"; +import { ConstructsFactories } from "../lib"; +import { generateIntegStackName, suppressCustomHandlerCfnNagWarnings, CreateTestStateMachineDefinitionBody } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +const app = new App(); + +// Empty arguments +const stack = new Stack(app, generateIntegStackName(__filename)); + +const factories = new ConstructsFactories(stack, 'integ-test'); + +factories.s3BucketFactory('test', { + bucketProps: { removalPolicy: RemovalPolicy.DESTROY }, + loggingBucketProps: { + removalPolicy: RemovalPolicy.DESTROY, + autoDeleteObjects: true + } +}); + +factories.sqsQueueFactory('test', { +}); + +factories.stateMachineFactory('testsm', { + stateMachineProps: { + definitionBody: CreateTestStateMachineDefinitionBody(stack, 'test') + } +}); + +suppressCustomHandlerCfnNagWarnings(stack, 'Custom::S3AutoDeleteObjectsCustomResourceProvider'); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/README.md b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/README.md index c3805fa70..26ebcd9dd 100755 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/README.md @@ -44,7 +44,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const constructProps: DynamoDBStreamsToLambdaToElasticSearchAndKibanaProps = { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, domainName: 'test-domain', @@ -69,7 +69,7 @@ DynamoDBStreamsToLambdaToElasticSearchAndKibana( self, 'test-dynamodbstreams-lambda-elasticsearch-kibana', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), domain_name='test-domain', @@ -91,7 +91,7 @@ import software.amazon.awsconstructs.services.dynamodbstreamslambdaelasticsearch new DynamoDBStreamsToLambdaToElasticSearchAndKibana(this, "test-dynamodb-stream-lambda-elasticsearch-kibana", new DynamoDBStreamsToLambdaToElasticSearchAndKibanaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/package.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/package.json index 2465aa1ca..dd04d71a8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/package.json @@ -53,14 +53,13 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-dynamodbstreams-lambda": "0.0.0", "@aws-solutions-constructs/aws-lambda-elasticsearch-kibana": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/test/lambda/index.js index 6d89b241c..b188689c3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda-elasticsearch-kibana/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + var AWS = require('aws-sdk'); var path = require('path'); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/README.md index 63f45c4a8..ab1a00246 100755 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/README.md @@ -23,7 +23,7 @@ |![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.dynamodbstreamslambda`| ## Overview -This AWS Solutions Construct implements a pattern Amazon DynamoDB table with stream to invoke the AWS Lambda function with the least privileged permissions. +This AWS Solutions Construct implements an Amazon DynamoDB table with stream that invokes an AWS Lambda function with the least privileged permissions. Here is a minimal deployable pattern definition: @@ -37,7 +37,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new DynamoDBStreamsToLambda(this, 'test-dynamodbstreams-lambda', { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, }); @@ -55,7 +55,7 @@ from constructs import Construct DynamoDBStreamsToLambda(self, 'test-dynamodbstreams-lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -74,7 +74,7 @@ import software.amazon.awsconstructs.services.dynamodbstreamslambda.*; new DynamoDBStreamsToLambda(this, "test-dynamodbstreams-lambda", new DynamoDBStreamsToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/package.json index 41c682dd3..c23d86d52 100644 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/test/lambda/index.js index 743e4fdbb..44a0a9467 100644 --- a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.eslintignore b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.eslintignore new file mode 100644 index 000000000..4866847c3 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.eslintignore @@ -0,0 +1,7 @@ +lib/*.js +test/*.js +*.d.ts +coverage +test/integ.*.js.snapshot/ +test/cdk-integ.out.integ.*.snapshot +test/lambda \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.gitignore b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.gitignore new file mode 100644 index 000000000..8626f2274 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.gitignore @@ -0,0 +1,16 @@ +lib/*.js +test/*.js +!test/lambda/* +*.js.map +*.d.ts +node_modules +*.generated.ts +dist +.jsii + +.LAST_BUILD +.nyc_output +coverage +.nycrc +.LAST_PACKAGE +*.snk \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.npmignore b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.npmignore new file mode 100644 index 000000000..f66791629 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/.npmignore @@ -0,0 +1,21 @@ +# Exclude typescript source and config +*.ts +tsconfig.json +coverage +.nyc_output +*.tgz +*.snk +*.tsbuildinfo + +# Include javascript files and typescript declarations +!*.js +!*.d.ts + +# Exclude jsii outdir +dist + +# Include .jsii +!.jsii + +# Include .jsii +!.jsii \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/README.md b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/README.md new file mode 100644 index 000000000..b6077c68b --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/README.md @@ -0,0 +1,139 @@ +# aws-dynamodbstreams-pipes-stepfunctions module + + +--- + +![Stability: Experimental](https://img.shields.io/badge/stability-Experimental-important.svg?style=for-the-badge) + +--- + + +| **Reference Documentation**:| https://docs.aws.amazon.com/solutions/latest/constructs/| +|:-------------|:-------------| +
+ +| **Language** | **Package** | +|:-------------|-----------------| +|![Python Logo](https://docs.aws.amazon.com/cdk/api/latest/img/python32.png) Python|`aws_solutions_constructs.aws_dynamodbstreams_pipes_stepfunctions`| +|![Typescript Logo](https://docs.aws.amazon.com/cdk/api/latest/img/typescript32.png) Typescript|`@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions`| +|![Java Logo](https://docs.aws.amazon.com/cdk/api/latest/img/java32.png) Java|`software.amazon.awsconstructs.services.dynamodbstreamspipesstepfunctions`| + +## Overview +This AWS Solutions Construct implements an Amazon DynamoDB table with stream that that executes an AWS Step Functions state machine via an Amazon Eventbridge pipe. + +Here is a minimal deployable pattern definition: + +Typescript +``` typescript +import { Construct } from 'constructs'; +import { Stack, StackProps } from 'aws-cdk-lib'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions"; + + const startState = new sfn.Pass(this, 'StartState'); + + new DynamoDBStreamsToPipesToStepfunctions(this, 'DynamoDBStreamsToPipesToStepfunctionsPattern', { + stateMachineProps: { + definitionBody: sfn.DefinitionBody.fromChainable(sfn.Chain.start(new sfn.Pass(this, 'Pass'))), + } + }); +``` + +Python +```python +from constructs import Construct +from aws_cdk import ( + aws_stepfunctions as _sfn, + Stack +) +from aws_solutions_constructs import ( + aws_dynamodbstreams_pipes_stepfunctions as dynamodbstreams_pipes_stepfunctions +) + +dynamodbstreams_pipes_stepfunctions.DynamoDBStreamsToPipesToStepfunctions( + self, 'DynamoDBStreamsToPipesToStepfunctions', + state_machine_props=_sfn.StateMachineProps( + definition_body=_sfn.DefinitionBody.from_chainable(_sfn.Chain.start(_sfn.Pass(self, "pass"))) + ) +) +``` + +Java +```java +package com.myorg; + +import software.constructs.Construct; +import software.amazon.awscdk.Stack; +import software.amazon.awscdk.StackProps; + +import software.amazon.awscdk.services.stepfunctions.*; +import software.amazon.awsconstructs.services.dynamodbstreamspipesstepfunctions.DynamoDBStreamsToPipesToStepfunctions; +import software.amazon.awsconstructs.services.dynamodbstreamspipesstepfunctions.DynamoDBStreamsToPipesToStepfunctionsProps; + +new DynamoDBStreamsToPipesToStepfunctions(this, "DynamoDBStreamsToPipesToStepfunctionsPattern", + DynamoDBStreamsToPipesToStepfunctionsProps.builder() + .stateMachineProps(StateMachineProps.builder() + .definitionBody(DefinitionBody.fromChainable(Chain.start(new Pass(scope, "Pass")))) + .build()) + .build()); + +``` + +## Pattern Construct Props + +| **Name** | **Type** | **Description** | +|:-------------|:----------------|-----------------| +|dynamoTableProps?|[`dynamodb.TableProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.TableProps.html)|Optional user provided props to override the default props for DynamoDB Table| +|existingTableInterface?|[`dynamodb.ITable`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ITable.html)|Existing instance of DynamoDB table object or interface, providing both this and `dynamoTableProps` will cause an error.| +|dynamoEventSourceProps?|[`aws-lambda-event-sources.DynamoEventSourceProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda_event_sources.DynamoEventSourceProps.html)|Optional user provided props to override the default props for DynamoDB Event Source| +|deploySqsDlqQueue|boolean|Whether to deploy a SQS dead letter queue when a data record reaches the Maximum Retry Attempts or Maximum Record Age, its metadata like shard ID and stream ARN will be sent to an SQS queue. The construct will create and configure the DLQ with a default maximumRetryAttempts of 2. To customize this, you should set maximumRecordAgeInSeconds and/or maximumRetryAttempts attempts in pipeProps.sourceParameters.dynamoDbStreamParameters. Default - deploy queue, MaximumRetryAttempts is set to 3, and maximumRecordAge is left to default (-1, or infinite)| +|sqsDlqQueueProps|[sqs.QueueProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.QueueProps.html)|Optional user provided properties for the SQS dead letter queue| +|stateMachineProps|[`sfn.StateMachineProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachineProps.html)|User provided props for the sfn.StateMachine.| +|existingStateMachineObj|[sfn.StateMachine](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachine.html)|Optional existing state machine to incorporate into the construct| +|createCloudWatchAlarms?|`boolean`|Whether to create recommended CloudWatch alarms| +| logGroupProps? | [logs.logGroupProps ](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogGroupProps.html)| Optional user provided props to override the default props for for the CloudWatchLogs LogGroup for the state machine. | +|pipeProps?|[ pipes.CfnPipeProps ](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_pipes.CfnPipeProps.html)|Optional customer provided ettings for the EventBridge pipe. source, target and roleArn are set by the construct and cannot be overriden. The construct will generate default sourceParameters, targetParameters and logConfiguration that can be overriden by populating those values in these props. If the client wants to implement enrichment or a filter, this is where that information can be provided. Any other props can be freely overridden. To control aspects of the Streams feed (e.g. batchSize, startingPosition), do that here under sourceParameters.dynamoDbStreamParameters.| +| enrichmentFunction? | [lambda.Function ](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html) | Optional - Lambda function that the construct will configure to be called to enrich the message between source and target. The construct will configure the pipe IAM role to allow invoking the function (but will not affect the IArole assigned to the function). Specifying both this and enrichmentStateMachine is an error. Default - undefined | +| enrichmentStateMachine? | [sfn.StateMachine ](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachine.html) | Optional - Step Functions state machine that the construct will configure to be called to enrich the message between source and target. The construct will configure the pipe IAM role to allow executing the state machine (but will not affect the IAM role assigned to the state machine). Specifying both this and enrichmentStateMachine is an error. Default - undefined | +|logLevel?|PipesLogLevel|Threshold for what messages the new pipe sends to the log, PipesLogLevel.OFF, PipesLogLevel.ERROR, PipesLogLevel.INFO, PipesLogLevel.TRACE. The default is INFO. Setting the level to OFF will prevent any log group from being created. Providing pipeProps.logConfiguration will controls all aspects of logging and any construct provided log configuration is disabled. If pipeProps.logConfiguration is provided then specifying this or pipeLogProps is an error. | +|pipeLogProps?|[logs.LogGroupProps]()| Default behavior is for the this construct to create a new CloudWatch Logs log group for the pipe. These props are used to override defaults set by AWS or this construct. If there are concerns about the cost of log storage, this is where a client can specify a shorter retention duration (in days) | + +## Pattern Properties + +| **Name** | **Type** | **Description** | +|:-------------|:----------------|-----------------| +|dynamoTableInterface|[`dynamodb.ITable`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ITable.html)|Returns an instance of dynamodb.ITable created by the construct| +|dynamoTable?|[`dynamodb.Table`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html)|Returns an instance of dynamodb.Table created by the construct. IMPORTANT: If existingTableInterface was provided in Pattern Construct |stateMachine|[`sfn.StateMachine`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_stepfunctions.StateMachine.html)|Returns an instance of StateMachine created by the construct.| +|stateMachineLogGroup|[`logs.ILogGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.ILogGroup.html)|Returns an instance of the ILogGroup created by the construct for StateMachine| +|cloudwatchAlarms?|[`cloudwatch.Alarm[]`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.Alarm.html)|Returns a list of alarms created by the construct.| +|pipe|[ pipes.CfnPipe](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_pipes.CfnPipe.html)| The L1 pipe construct created by this Solutions Construct. | +| pipeRole | [iam.Role ](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.Role.html) | The role created that allows the pipe to access both the source and the target. | + +## Default settings + +Out of the box implementation of the Construct without any override will set the following defaults: + +### Amazon DynamoDB Table +* Set the billing mode for DynamoDB Table to On-Demand (Pay per request) +* Enable server-side encryption for DynamoDB Table using AWS managed KMS Key +* Creates a partition key called 'id' for DynamoDB Table +* Retain the Table when deleting the CloudFormation stack +* Enable continuous backups and point-in-time recovery +* A DynamoDB stream based on the table. + +### AWS Step Functions State Machine +* Deploy Step Functions standard state machine +* Create CloudWatch log group with /vendedlogs/ prefix in name +* Deploy best practices CloudWatch Alarms for the Step Functions + +### AWS EventBridge Pipe +* Pipe configured with an DynamoDB stream source and state machine target +* A least privilege IAM role assigned to the pipe to access the queue and state machine +* CloudWatch logs set up at the 'INFO' level +* Encrypted with an AWS managed KMS key + +## Architecture +![Architecture Diagram](architecture.png) + +*** +© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/architecture.png b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/architecture.png new file mode 100644 index 000000000..d9bcf1b62 Binary files /dev/null and b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/architecture.png differ diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/integ.config.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/integ.config.json new file mode 100644 index 000000000..e69de29bb diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/lib/index.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/lib/index.ts new file mode 100644 index 000000000..1a00005d8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/lib/index.ts @@ -0,0 +1,205 @@ +/** + * 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 * as defaults from '@aws-solutions-constructs/core'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as logs from 'aws-cdk-lib/aws-logs'; +import * as iam from 'aws-cdk-lib/aws-iam'; +import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as sqs from 'aws-cdk-lib/aws-sqs'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import * as pipes from 'aws-cdk-lib/aws-pipes'; +import { PipesLogLevel } from '@aws-solutions-constructs/core'; +export { PipesLogLevel } from '@aws-solutions-constructs/core'; +// Note: To ensure CDKv2 compatibility, keep the import statement for Construct separate +import { Construct } from 'constructs'; + +export interface DynamoDBStreamsToPipesToStepfunctionsProps { + + // ******************* + // DynamoDB Props + // ******************* + + /** + * Optional user provided props to override the default props + * + * @default - Default props are used + */ + readonly dynamoTableProps?: dynamodb.TableProps, + /** + * Existing instance of DynamoDB table object, providing both this and `dynamoTableProps` will cause an error. + * + * @default - None + */ + readonly existingTableInterface?: dynamodb.ITable, + /** + * Whether to deploy a SQS dead letter queue when a data record reaches the Maximum Retry Attempts or Maximum Record Age, + * its metadata like shard ID and stream ARN will be sent to an SQS queue. The construct will create and configure the DLQ + * with a default maximumRetryAttempts of 2. To customize this, you should set maximumRecordAgeInSeconds and/or + * maximumRetryAttempts attempts in pipeProps.sourceParameters.dynamoDbStreamParameters. Default - deploy queue, + * MaximumRetryAttempts is set to 3, and maximumRecordAge is left to default (-1, or infinite) + * + * @default - true. + */ + readonly deploySqsDlqQueue?: boolean, + /** + * Optional user provided properties for the SQS dead letter queue + * + * @default - Default props are used + */ + readonly sqsDlqQueueProps?: sqs.QueueProps + + // ******************* + // State Machine Props + // ******************* + + /** + * User provided props for the sfn.StateMachine. This or existingStateMachine is required + */ + readonly stateMachineProps?: sfn.StateMachineProps, + /** + * Optional existing state machine to incorporate into the construct + */ + readonly existingStateMachineObj?: sfn.StateMachine, + /** + * Whether to create recommended CloudWatch alarms + * + * default = true + */ + readonly createCloudWatchAlarms?: boolean, + /** + * Optional user provided props to override the default props for for the CloudWatchLogs LogGroup. + */ + readonly logGroupProps?: logs.LogGroupProps, + + // ******************* + // Pipe Props + // ******************* + + /** + * Optional customer provided settings for the EventBridge pipe. source, target and + * roleArn are set by the construct and cannot be overriden. The construct will generate + * default sourceParameters, targetParameters and logConfiguration that can be + * overriden by populating those values in these props. If the client wants to implement + * enrichment or a filter, this is where that information can be provided. Any other props + * can be freely overridden. To control aspects of the Streams feed (e.g. batchSize, startingPosition), + * do that here under sourceParameters.dynamoDbStreamParameters. + */ + readonly pipeProps?: pipes.CfnPipeProps | any, + /** + * Default behavior is for the this construct to create a new CloudWatch Logs log group for the pipe. + * These props are used to override defaults set by AWS or this construct. If there are concerns about + * the cost of log storage, this is where a client can specify a shorter retention duration (in days) + */ + readonly pipeLogProps?: logs.LogGroupProps, + /** + * Threshold for what messages the new pipe sends to the log, PipesLogLevel.OFF, PipesLogLevel.ERROR, + * PipesLogLevel.INFO, PipesLogLevel.TRACE. The default is INFO. Setting the level to OFF will prevent + * any log group from being created. Providing pipeProps.logConfiguration will controls all aspects of + * logging and any construct provided log configuration is disabled. If pipeProps.logConfiguration is + * provided then specifying this or pipeLogProps is an error. + */ + readonly logLevel?: PipesLogLevel, + /** + * Optional - Lambda function that the construct will configure to be called to enrich the message + * between source and target. The construct will configure the pipe IAM role to allow invoking the + * function (but will not affect the IArole assigned to the function). Specifying both this and + * enrichmentStateMachine is an error. Default - undefined + */ + readonly enrichmentFunction?: lambda.Function, + /** + * Optional - Step Functions state machine that the construct will configure to be called to enrich the message + * between source and target. The construct will configure the pipe IAM role to allow executing the state + * machine (but will not affect the IAM role assigned to the state machine). Specifying both this and + * enrichmentStateMachine is an error. Enrichment is invoked synchronously, so this must be an EXPRESS + * state machin. Default - undefined + */ + readonly enrichmentStateMachine?: sfn.StateMachine, + +} + +export class DynamoDBStreamsToPipesToStepfunctions extends Construct { + public readonly stateMachine: sfn.StateMachine; + public readonly stateMachineLogGroup?: logs.ILogGroup; + public readonly cloudwatchAlarms?: cloudwatch.Alarm[]; + public readonly dynamoTableInterface: dynamodb.ITable; + public readonly dynamoTable?: dynamodb.Table; + public readonly pipe: pipes.CfnPipe; + public readonly pipeRole: iam.Role; + public readonly dlq?: sqs.Queue; + /** + * @summary Constructs a new instance of the DynamoDBStreamsToPipesToStepfunctions class. + * @param {cdk.App} scope - represents the scope for all the resources. + * @param {string} id - this is a a scope-unique id. + * @param {DynamoDBStreamsToPipesToStepfunctionsProps} props - user provided props for the construct. + * @access public + */ + constructor(scope: Construct, id: string, props: DynamoDBStreamsToPipesToStepfunctionsProps) { + super(scope, id); + + defaults.CheckStateMachineProps(props); + defaults.CheckDynamoDBProps(props); + defaults.CheckPipesProps(props); + + if ((props.deploySqsDlqQueue === false) && + (props.pipeProps?.sourceParameters?.dynamoDbStreamParameters?.maximumRecordAgeInSeconds || + props.pipeProps?.sourceParameters?.dynamoDbStreamParameters?.maximumRetryAttempts) + ) { + throw new Error('ERROR - Cannot define maximumRecordAgeInSeconds and maximumRetryAttempts when deploySqsDlqQueue is false\n'); + } + + const buildDynamoDBTableWithStreamResponse = defaults.buildDynamoDBTableWithStream(this, { + dynamoTableProps: props.dynamoTableProps, + existingTableInterface: props.existingTableInterface + }); + this.dynamoTableInterface = buildDynamoDBTableWithStreamResponse.tableInterface; + this.dynamoTable = buildDynamoDBTableWithStreamResponse.tableObject; + + // Create the State Machine + if (!props.existingStateMachineObj) { + const buildStateMachineResponse = defaults.buildStateMachine(this, defaults.idPlaceholder, { + stateMachineProps: props.stateMachineProps!, // CheckStateMachineProps ensures this is defined if existingStateMachineObj is not + logGroupProps: props.logGroupProps, + createCloudWatchAlarms: props.createCloudWatchAlarms, + }); + this.stateMachine = buildStateMachineResponse.stateMachine; + this.stateMachineLogGroup = buildStateMachineResponse.logGroup; + this.cloudwatchAlarms = buildStateMachineResponse.cloudWatchAlarms; + } else { + this.stateMachine = props.existingStateMachineObj; + } + + const ddbStreamsSource = defaults.CreateDynamoDBStreamsSource(this, { + table: this.dynamoTableInterface, + deploySqsDlqQueue: props.deploySqsDlqQueue, + sqsDlqQueueProps: props.sqsDlqQueueProps, + clientProps: props.pipeProps?.sourceParameters + }); + this.dlq = ddbStreamsSource.dlq; + + // Create the pipe to connect the queue and state machine + const buildPipeResponse = defaults.BuildPipe(this, id, { + source: ddbStreamsSource, + target: defaults.CreateStateMachineTarget(this.stateMachine, props.pipeProps?.targetParameters), + enrichmentFunction: props.enrichmentFunction, + enrichmentStateMachine: props.enrichmentStateMachine, + clientProps: props.pipeProps, + logLevel: props.logLevel, + pipeLogProps: props.pipeLogProps + }); + this.pipe = buildPipeResponse.pipe; + this.pipeRole = buildPipeResponse.pipeRole; + defaults.addCfnGuardSuppressRules(this.pipeRole, ["IAM_NO_INLINE_POLICY_CHECK"]); + } +} diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/package.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/package.json new file mode 100644 index 000000000..41472b507 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/package.json @@ -0,0 +1,95 @@ +{ + "name": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions", + "version": "0.0.0", + "description": "CDK Constructs for Amazon DynamoDB Streams to AWS Step Functions via Amazon EventBridge Pipes integration.", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/awslabs/aws-solutions-constructs.git", + "directory": "source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions" + }, + "author": { + "name": "Amazon Web Services", + "url": "https://aws.amazon.com", + "organization": true + }, + "license": "Apache-2.0", + "scripts": { + "build": "tsc -b .", + "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", + "jsii": "jsii", + "jsii-pacmak": "jsii-pacmak", + "build+lint+test": "npm run jsii && npm run lint && npm test && npm run integ-assert", + "snapshot-update": "npm run jsii && npm test -- -u && npm run integ-assert" + }, + "jsii": { + "outdir": "dist", + "targets": { + "java": { + "package": "software.amazon.awsconstructs.services.dynamodbstreamspipesstepfunctions", + "maven": { + "groupId": "software.amazon.awsconstructs", + "artifactId": "dynamodbstreamspipesstepfunctions" + } + }, + "dotnet": { + "namespace": "Amazon.SolutionsConstructs.AWS.DynamoDBStreamsPipesStepfunctions", + "packageId": "Amazon.SolutionsConstructs.AWS.DynamoDBStreamsPipesStepfunctions", + "signAssembly": true, + "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png" + }, + "python": { + "distName": "aws-solutions-constructs.aws-dynamodbstreams-pipes-stepfunctions", + "module": "aws_solutions_constructs.aws_dynamodbstreams_pipes_stepfunctions" + } + } + }, + "dependencies": { + "@aws-solutions-constructs/core": "0.0.0", + "@aws-solutions-constructs/resources": "0.0.0", + "constructs": "^10.0.0" + }, + "devDependencies": { + "@aws-cdk/integ-tests-alpha": "2.163.1-alpha.0", + "@types/node": "^10.3.0", + "constructs": "^10.0.0", + "aws-cdk-lib": "0.0.0" + }, + "jest": { + "moduleFileExtensions": [ + "js" + ], + "coverageReporters": [ + "text", + [ + "lcov", + { + "projectRoot": "../../../../" + } + ] + ] + }, + "peerDependencies": { + "@aws-solutions-constructs/core": "0.0.0", + "@aws-solutions-constructs/resources": "0.0.0", + "constructs": "^10.0.0", + "aws-cdk-lib": "^2.163.1" + }, + "keywords": [ + "aws", + "cdk", + "awscdk", + "AWS Solutions Constructs", + "Amazon DynamoDB", + "AWS Step Functions", + "Amazon EventBridge Pipes" + ] +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/dynamodbstreams-pipes-stepfunctions.test.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/dynamodbstreams-pipes-stepfunctions.test.ts new file mode 100644 index 000000000..ce6c2a514 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/dynamodbstreams-pipes-stepfunctions.test.ts @@ -0,0 +1,680 @@ +/** + * 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 { Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import * as defaults from '@aws-solutions-constructs/core'; +import { Match, Template } from 'aws-cdk-lib/assertions'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; +import { RetentionDays } from "aws-cdk-lib/aws-logs"; + +test('Test default behaviors', () => { + // Initial Setup + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + } + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-ddbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + expect(construct.stateMachine).toBeDefined(); + expect(construct.stateMachineLogGroup).toBeDefined(); + expect(construct.cloudwatchAlarms).toBeDefined(); + expect(construct.dynamoTable).toBeDefined(); + expect(construct.dlq).toBeDefined(); + + template.resourceCountIs('AWS::SQS::Queue', 1); + template.hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: "sts:AssumeRole", + Effect: "Allow", + Principal: { + Service: "pipes.amazonaws.com" + } + } + ], + Version: "2012-10-17" + }, + Policies: [ + { + PolicyDocument: { + Statement: [ + { + Action: [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + Effect: "Allow", + Resource: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testddbspipesstatesDynamoTable.*`), + "StreamArn" + ] + } + }, + { + Action: "sqs:SendMessage", + Effect: "Allow", + Resource: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testddbspipesstatesdlq.*`), + "Arn" + ] + } + } + ], + Version: "2012-10-17" + }, + PolicyName: "sourcePolicy" + }, + { + PolicyDocument: { + Statement: [ + { + Action: "states:StartExecution", + Effect: "Allow", + Resource: { + Ref: Match.stringLikeRegexp(`testddbspipesstatesStateMachine.*`) + } + } + ], + Version: "2012-10-17" + }, + PolicyName: "targetPolicy" + } + ] + }); + template.hasResourceProperties('AWS::Pipes::Pipe', { + Source: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testddbspipesstatesDynamoTable.*`), + "StreamArn" + ] + }, + Target: { + Ref: Match.stringLikeRegexp(`testddbspipesstatesStateMachine.*`), + }, + SourceParameters: { + DynamoDBStreamParameters: { + DeadLetterConfig: { + Arn: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testddbspipesstatesdlq.*`), + "Arn" + ] + } + } + } + }, + }); + + template.hasResourceProperties('AWS::Pipes::Pipe', { + LogConfiguration: { + CloudwatchLogsLogDestination: { + LogGroupArn: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testddbspipesstatesLogGrouptestddbspipesstates.*`), + "Arn" + ] + } + }, + Level: "INFO" + } + }); + template.hasResourceProperties('AWS::Logs::LogGroup', { + LogGroupName: { + "Fn::Join": [ + "", + [ + Match.stringLikeRegexp('\/aws\/vendedlogs\/pipes\/constructs'), + { + "Fn::Select": [ + 2, + Match.anyValue() + ] + } + ] + ] + }, + }); + +}); + +test('Test no DLQ', () => { + // Initial Setup + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + deploySqsDlqQueue: false + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-ddbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + expect(construct.stateMachine).toBeDefined(); + expect(construct.stateMachineLogGroup).toBeDefined(); + expect(construct.cloudwatchAlarms).toBeDefined(); + expect(construct.dynamoTable).toBeDefined(); + expect(construct.dlq).toBeUndefined(); + + template.resourceCountIs('AWS::SQS::Queue', 0); +}); + +test('Test existing state machine', () => { + // Initial Setup + const stack = new Stack(); + const stateMachine = defaults.CreateTestStateMachine(stack, 'state-machine'); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + existingStateMachineObj: stateMachine + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + + template.resourceCountIs("AWS::StepFunctions::StateMachine", 1); + + template.hasResourceProperties('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: "sts:AssumeRole", + Effect: "Allow", + Principal: { + Service: "pipes.amazonaws.com" + } + } + ], + Version: "2012-10-17" + }, + Policies: [ + { + PolicyDocument: { + Statement: [ + { + Action: [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + Effect: "Allow", + Resource: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testdbspipesstatesDynamoTable.*`), + "StreamArn" + ] + } + }, + { + Action: "sqs:SendMessage", + Effect: "Allow", + Resource: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testdbspipesstatesdlq.*`), + "Arn" + ] + } + } + ], + Version: "2012-10-17" + }, + PolicyName: "sourcePolicy" + }, + { + PolicyDocument: { + Statement: [ + { + Action: "states:StartExecution", + Effect: "Allow", + Resource: { + Ref: Match.stringLikeRegexp(`statemachine.*`) + } + } + ], + Version: "2012-10-17" + }, + PolicyName: "targetPolicy" + } + ] + }); + template.hasResourceProperties('AWS::Pipes::Pipe', { + Source: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testdbspipesstatesDynamoTable11606343.*`), + "StreamArn" + ] + }, + Target: { + Ref: Match.stringLikeRegexp(`statemachine.*`), + }, + }); + + template.hasResourceProperties('AWS::Pipes::Pipe', { + LogConfiguration: { + CloudwatchLogsLogDestination: { + LogGroupArn: { + "Fn::GetAtt": [ + Match.stringLikeRegexp(`testdbspipesstatesLogGrouptestdbspipesstates.*`), + "Arn" + ] + } + }, + Level: "INFO" + } + }); + template.hasResourceProperties('AWS::Logs::LogGroup', { + LogGroupName: { + "Fn::Join": [ + "", + [ + Match.stringLikeRegexp('\/aws\/vendedlogs\/pipes\/constructs'), + { + "Fn::Select": [ + 2, + Match.anyValue() + ] + } + ] + ] + }, + }); + +}); + +test('Test table and state machine aspects of construct', () => { + // Initial Setup + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'lamstp-test') + } + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.dynamoTable).toBeDefined(); + template.resourceCountIs("AWS::DynamoDB::Table", 1); + template.hasResourceProperties('AWS::DynamoDB::Table', { + StreamSpecification: { + StreamViewType: "NEW_AND_OLD_IMAGES" + } + }); + + const stateMachine = construct.stateMachine; + expect(stateMachine).toBeDefined(); + const cwAlarm = construct.cloudwatchAlarms; + expect(cwAlarm).toBeDefined(); + expect(construct.stateMachineLogGroup).toBeDefined(); +}); + +test('Test existing table', () => { + const stack = new Stack(); + const existingTable: dynamodb.ITable = new dynamodb.Table(stack, 'table', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING + }, + stream: dynamodb.StreamViewType.NEW_AND_OLD_IMAGES + }); + + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'lamstp-test') + }, + existingTableInterface: existingTable + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + expect(construct.dynamoTableInterface.tableArn).toEqual(existingTable.tableArn); +}); + +test('Test filter', () => { + // Stack + const stack = new Stack(); + const testFilterPattern = `{ + "body": { + "state": ["open"] + } + }`; + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'lamstp-test') + }, + pipeProps: { + sourceParameters: { + filterCriteria: { + filters: [{ pattern: testFilterPattern }], + }, + } + } + }; + new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-ddbs-pipes-states', props); + const template = Template.fromStack(stack); + template.hasResourceProperties('AWS::Pipes::Pipe', { + SourceParameters: { + FilterCriteria: { + Filters: [ + { + Pattern: testFilterPattern + } + ] + } + } + }); + +}); + +test('Test target parameters?', () => { + const testMessageGroupId = "test-id"; + // Stack + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'lamstp-test') + }, + pipeProps: { + // We realize that this would not launch because the target is not + // a queue, but it tests the functionality + targetParameters: { + sqsQueueParameters: { + messageGroupId: testMessageGroupId, + } + } + } + }; + new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-ddbs-pipes-states', props); + const template = Template.fromStack(stack); + + template.hasResourceProperties('AWS::Pipes::Pipe', { + TargetParameters: { + SqsQueueParameters: { + MessageGroupId: testMessageGroupId, + } + } + }); +}); + +test('test state machine enrichment', () => { + const stack = new Stack(); + const enrichmentStateMachine = defaults.CreateTestStateMachine(stack, 'enrichment-state-machine'); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + enrichmentStateMachine, + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + } + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test', props); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + + const template = Template.fromStack(stack); + + // Look for additional enrichment permision + template.hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: "states:StartSyncExecution", + Effect: "Allow", + Resource: { + Ref: Match.stringLikeRegexp('enrichmentstatemachine.*'), + } + } + ], + Version: "2012-10-17" + }, + PolicyName: Match.stringLikeRegexp(`testenrichmentpolicytest.*`), + Roles: [ + { + Ref: Match.stringLikeRegexp(`testPipeRoletest.*`) + } + ] + }); + template.hasResourceProperties('AWS::Pipes::Pipe', { + Enrichment: { + Ref: Match.stringLikeRegexp("enrichmentstatemachine.*") + }, + }); +}); + +test('Test lambda function enrichment', () => { + const stack = new Stack(); + const enrichmentFunction = new lambda.Function(stack, 'enrichment-function', { + runtime: lambda.Runtime.NODEJS_20_X, + handler: 'index.handler', + code: lambda.Code.fromInline(`exports.handler = async (event) => {return;}`) + }); + + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + enrichmentFunction + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'enrichment-function-test', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + + template.hasResourceProperties('AWS::IAM::Policy', { + PolicyDocument: { + Statement: [ + { + Action: "lambda:InvokeFunction", + Effect: "Allow", + Resource: { + "Fn::GetAtt": [ + Match.stringLikeRegexp('enrichmentfunction.*'), + "Arn" + ] + } + } + ], + Version: "2012-10-17" + }, + PolicyName: Match.stringLikeRegexp(`enrichmentfunctiontestenrichmentpolicyenrichmentfunctiontest.*`), + Roles: [ + { + Ref: Match.stringLikeRegexp(`enrichmentfunctiontestPipeRoleenrichmentfunctiontest.*`) + } + ] + }); + template.hasResourceProperties('AWS::Pipes::Pipe', { + Enrichment: { + "Fn::GetAtt": [ + Match.stringLikeRegexp("enrichmentfunction.*"), + "Arn" + ] + }, + }); +}); + +test('Test custom log level', () => { + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + logLevel: defaults.PipesLogLevel.TRACE + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + + template.hasResourceProperties('AWS::Pipes::Pipe', { + LogConfiguration: { + Level: "TRACE", + } + }); +}); + +test('Test log level OFF', () => { + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + logLevel: defaults.PipesLogLevel.OFF + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + + // Should be no LogConfiguration + template.resourcePropertiesCountIs('AWS::Pipes::Pipe', { LogConfiguration: {} }, 0); + + // One log group for the state machine, none for the pipe + template.resourceCountIs('AWS::Logs::LogGroup', 1); +}); + +test('Test custom pipe log props', () => { + const testRetention = RetentionDays.FOUR_MONTHS; + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + pipeLogProps: { + retention: testRetention + } + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + template.hasResourceProperties('AWS::Logs::LogGroup', { + RetentionInDays: 120, + }); +}); + +test('Test setting source parameters like batchSize', () => { + const testBatchSize = 123; + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + pipeProps: { + sourceParameters: { + dynamoDbStreamParameters: { + batchSize: testBatchSize + } + } + } + }; + const construct = new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + const template = Template.fromStack(stack); + + expect(construct.pipe).toBeDefined(); + expect(construct.pipeRole).toBeDefined(); + template.hasResourceProperties('AWS::Pipes::Pipe', { + SourceParameters: { + DynamoDBStreamParameters: { + BatchSize: testBatchSize, + } + } + }); +}); + +test('Test sending state machine props and existing state machine is an error', () => { + // These are all tested in CheckStateMachineProps, so this is just checking that CheckStateMachineProps is called. + + // Stack + const stack = new Stack(); + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'pipes-test') + }, + existingStateMachineObj: { pretend: "I'm A State Machine :-)" } as unknown as sfn.StateMachine, + }; + + const app = () => { + new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + }; + // Assertion + expect(app).toThrowError('ERROR - If existingStateMachine is provided, no other state machine props are allowed\n'); +}); + +test('Test sending existing table and table props is an error', () => { + const stack = new Stack(); + const existingTable: dynamodb.ITable = new dynamodb.Table(stack, 'table', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING + }, + stream: dynamodb.StreamViewType.NEW_AND_OLD_IMAGES + }); + + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'lamstp-test') + }, + existingTableInterface: existingTable, + dynamoTableProps: { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING + } + } + }; + const app = () => { + new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + }; + // Assertion + expect(app).toThrowError('Error - Either provide existingTableInterface or dynamoTableProps, but not both.\n'); +}); + +test('Test sending max retry or age restraints with no DLQ is an error', () => { + const stack = new Stack(); + + const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'lamstp-test') + }, + deploySqsDlqQueue: false, + pipeProps: { + sourceParameters: { + dynamoDbStreamParameters: { + startingPosition: 'LATEST', + maximumRetryAttempts: 2, + } + } + } + }; + const app = () => { + new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states', props); + }; + // Assertion + expect(app).toThrowError('ERROR - Cannot define maximumRecordAgeInSeconds and maximumRetryAttempts when deploySqsDlqQueue is false\n'); +}); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstp-custom-log-level.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstp-custom-log-level.assets.json new file mode 100644 index 000000000..c0cb2f993 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstp-custom-log-level.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "e08b3d3b83e0a1ee4dfd63c3dd630e7a64ac8f702b4be37e66a42a260cfb58fe": { + "source": { + "path": "dbspstp-custom-log-level.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e08b3d3b83e0a1ee4dfd63c3dd630e7a64ac8f702b4be37e66a42a260cfb58fe.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstp-custom-log-level.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstp-custom-log-level.template.json new file mode 100644 index 000000000..ef4081396 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstp-custom-log-level.template.json @@ -0,0 +1,626 @@ +{ + "Resources": { + "lambdadbsstptestServiceRole4515C09E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstptestE56C39A8": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstptestServiceRole4515C09E" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testdbspipesstatesconstructDynamoTable5457FA02": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-custom-log-leveltest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachineRole802AA550": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachine9909327F": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + }, + "DependsOn": [ + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "testdbspipesstatesconstructStateMachineRole802AA550" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructExecutionFailedAlarm6678470E": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructdlqF765E6A0": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructdlqPolicyB08573AE": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-custom-log-leveltest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "Level": "TRACE" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.assets.json new file mode 100644 index 000000000..1e8cd6b93 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/integ.json new file mode 100644 index 000000000..7b4720884 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-custom-log-level/Integ/DefaultTest": { + "stacks": [ + "dbspstp-custom-log-level" + ], + "assertionStack": "dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/manifest.json new file mode 100644 index 000000000..b3d0af3cb --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/manifest.json @@ -0,0 +1,199 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.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": [ + "dbspstpcustomloglevelIntegDefaultTestDeployAssert8DE150AA.assets" + ], + "metadata": { + "/dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-custom-log-level.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-custom-log-level.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-custom-log-level": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-custom-log-level.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}/e08b3d3b83e0a1ee4dfd63c3dd630e7a64ac8f702b4be37e66a42a260cfb58fe.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-custom-log-level.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": [ + "dbspstp-custom-log-level.assets" + ], + "metadata": { + "/dbspstp-custom-log-level/lambdadbsstp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestServiceRole4515C09E" + } + ], + "/dbspstp-custom-log-level/lambdadbsstp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestE56C39A8" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructDynamoTable5457FA02" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineLogGroup1E17AD86" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachine9909327F" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionFailedAlarm6678470E" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqF765E6A0" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqPolicyB08573AE" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F" + } + ], + "/dbspstp-custom-log-level/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F" + } + ], + "/dbspstp-custom-log-level/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-custom-log-level/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-custom-log-level" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/tree.json new file mode 100644 index 000000000..d59e109e8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.js.snapshot/tree.json @@ -0,0 +1,912 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-custom-log-level": { + "id": "dbspstp-custom-log-level", + "path": "dbspstp-custom-log-level", + "children": { + "lambdadbsstp-test": { + "id": "lambdadbsstp-test", + "path": "dbspstp-custom-log-level/lambdadbsstp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-custom-log-level/lambdadbsstp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-custom-log-level/lambdadbsstp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/lambdadbsstp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/lambdadbsstp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test": { + "id": "taskdbsstp-test", + "path": "dbspstp-custom-log-level/taskdbsstp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-dbs-pipes-states-construct": { + "id": "test-dbs-pipes-states-construct", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-custom-log-leveltest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-dbs-pipes-states-construct": { + "id": "PipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-dbs-pipes-states-construct": { + "id": "ImportPipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/ImportPipeRole--test-dbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-dbs-pipes-states-construct": { + "id": "LogGroup-test-dbs-pipes-states-construct", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-custom-log-leveltest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-dbs-pipes-states-construct": { + "id": "pipe-test-dbs-pipes-states-construct", + "path": "dbspstp-custom-log-level/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "level": "TRACE" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-custom-log-level/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-custom-log-level/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-custom-log-level/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-custom-log-level/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-custom-log-level/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-custom-log-level/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.ts new file mode 100644 index 000000000..d0f6ff844 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-custom-log-level.ts @@ -0,0 +1,35 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'dbsstp-test') + }, + logLevel: defaults.PipesLogLevel.TRACE +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstp-existing-state-machine.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstp-existing-state-machine.assets.json new file mode 100644 index 000000000..c2fd4740e --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstp-existing-state-machine.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "c4c50147e5bb7bc2be0d81507bdbe1b827dd1c8e3eac870ee7d59c4eaf4c2b32": { + "source": { + "path": "dbspstp-existing-state-machine.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "c4c50147e5bb7bc2be0d81507bdbe1b827dd1c8e3eac870ee7d59c4eaf4c2b32.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstp-existing-state-machine.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstp-existing-state-machine.template.json new file mode 100644 index 000000000..6040ce77e --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstp-existing-state-machine.template.json @@ -0,0 +1,482 @@ +{ + "Resources": { + "lambdadbsstpteststatemachineServiceRoleC5D3726D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstpteststatemachine3BB0B3E0": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachineServiceRoleC5D3726D", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstpteststatemachineServiceRoleC5D3726D" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "dbsstpteststatemachineRole41CB13EC": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "dbsstpteststatemachineRoleDefaultPolicy4870B679": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachine3BB0B3E0", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachine3BB0B3E0", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "dbsstpteststatemachineRoleDefaultPolicy4870B679", + "Roles": [ + { + "Ref": "dbsstpteststatemachineRole41CB13EC" + } + ] + } + }, + "dbsstpteststatemachine94317E1F": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test-state-machine\",\"States\":{\"taskdbsstp-test-state-machine\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachine3BB0B3E0", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "dbsstpteststatemachineRole41CB13EC", + "Arn" + ] + } + }, + "DependsOn": [ + "dbsstpteststatemachineRoleDefaultPolicy4870B679", + "dbsstpteststatemachineRole41CB13EC" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructDynamoTable5457FA02": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testdbspipesstatesconstructdlqF765E6A0": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructdlqPolicyB08573AE": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "dbsstpteststatemachine94317E1F" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-existing-state-machinetest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "Level": "INFO" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "dbsstpteststatemachine94317E1F" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.assets.json new file mode 100644 index 000000000..247c57c5d --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/integ.json new file mode 100644 index 000000000..27d0a351e --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-existing-state-machine/Integ/DefaultTest": { + "stacks": [ + "dbspstp-existing-state-machine" + ], + "assertionStack": "dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/manifest.json new file mode 100644 index 000000000..9aa9270b6 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/manifest.json @@ -0,0 +1,175 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.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": [ + "dbspstpexistingstatemachineIntegDefaultTestDeployAssert3C3118B7.assets" + ], + "metadata": { + "/dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-existing-state-machine.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-existing-state-machine.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-existing-state-machine": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-existing-state-machine.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}/c4c50147e5bb7bc2be0d81507bdbe1b827dd1c8e3eac870ee7d59c4eaf4c2b32.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-existing-state-machine.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": [ + "dbspstp-existing-state-machine.assets" + ], + "metadata": { + "/dbspstp-existing-state-machine/lambdadbsstp-test-state-machine/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstpteststatemachineServiceRoleC5D3726D" + } + ], + "/dbspstp-existing-state-machine/lambdadbsstp-test-state-machine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstpteststatemachine3BB0B3E0" + } + ], + "/dbspstp-existing-state-machine/dbsstp-test-state-machine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "dbsstpteststatemachineRole41CB13EC" + } + ], + "/dbspstp-existing-state-machine/dbsstp-test-state-machine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "dbsstpteststatemachineRoleDefaultPolicy4870B679" + } + ], + "/dbspstp-existing-state-machine/dbsstp-test-state-machine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "dbsstpteststatemachine94317E1F" + } + ], + "/dbspstp-existing-state-machine/test-dbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructDynamoTable5457FA02" + } + ], + "/dbspstp-existing-state-machine/test-dbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqF765E6A0" + } + ], + "/dbspstp-existing-state-machine/test-dbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqPolicyB08573AE" + } + ], + "/dbspstp-existing-state-machine/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ], + "/dbspstp-existing-state-machine/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F" + } + ], + "/dbspstp-existing-state-machine/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F" + } + ], + "/dbspstp-existing-state-machine/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-existing-state-machine/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-existing-state-machine" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/tree.json new file mode 100644 index 000000000..681a73df1 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.js.snapshot/tree.json @@ -0,0 +1,722 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-existing-state-machine": { + "id": "dbspstp-existing-state-machine", + "path": "dbspstp-existing-state-machine", + "children": { + "lambdadbsstp-test-state-machine": { + "id": "lambdadbsstp-test-state-machine", + "path": "dbspstp-existing-state-machine/lambdadbsstp-test-state-machine", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-existing-state-machine/lambdadbsstp-test-state-machine/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-existing-state-machine/lambdadbsstp-test-state-machine/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/lambdadbsstp-test-state-machine/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/lambdadbsstp-test-state-machine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachineServiceRoleC5D3726D", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test-state-machine": { + "id": "taskdbsstp-test-state-machine", + "path": "dbspstp-existing-state-machine/taskdbsstp-test-state-machine", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "dbsstp-test-state-machine": { + "id": "dbsstp-test-state-machine", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachine3BB0B3E0", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachine3BB0B3E0", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "dbsstpteststatemachineRoleDefaultPolicy4870B679", + "roles": [ + { + "Ref": "dbsstpteststatemachineRole41CB13EC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/dbsstp-test-state-machine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test-state-machine\",\"States\":{\"taskdbsstp-test-state-machine\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstpteststatemachine3BB0B3E0", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "dbsstpteststatemachineRole41CB13EC", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "test-dbs-pipes-states-construct": { + "id": "test-dbs-pipes-states-construct", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-dbs-pipes-states-construct": { + "id": "PipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-dbs-pipes-states-construct": { + "id": "ImportPipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/ImportPipeRole--test-dbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "dbsstpteststatemachine94317E1F" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-dbs-pipes-states-construct": { + "id": "LogGroup-test-dbs-pipes-states-construct", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-existing-state-machinetest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-dbs-pipes-states-construct": { + "id": "pipe-test-dbs-pipes-states-construct", + "path": "dbspstp-existing-state-machine/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "level": "INFO" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "dbsstpteststatemachine94317E1F" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-existing-state-machine/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-existing-state-machine/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-existing-state-machine/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-existing-state-machine/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-existing-state-machine/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-existing-state-machine/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.ts new file mode 100644 index 000000000..924f7ce86 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-state-machine.ts @@ -0,0 +1,33 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const existingStateMachineObj = defaults.CreateTestStateMachine(stack, 'dbsstp-test-state-machine'); +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + existingStateMachineObj +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstp-existing-table.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstp-existing-table.assets.json new file mode 100644 index 000000000..59c34d24a --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstp-existing-table.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "fc190c230e983251c0155f9e961881f2dc95d1b834b8262d18aae060d9a7ff46": { + "source": { + "path": "dbspstp-existing-table.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "fc190c230e983251c0155f9e961881f2dc95d1b834b8262d18aae060d9a7ff46.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstp-existing-table.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstp-existing-table.template.json new file mode 100644 index 000000000..4f42cd344 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstp-existing-table.template.json @@ -0,0 +1,626 @@ +{ + "Resources": { + "table8235A42E": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "lambdadbsstptestServiceRole4515C09E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstptestE56C39A8": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstptestServiceRole4515C09E" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-existing-tabletest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachineRole802AA550": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachine9909327F": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + }, + "DependsOn": [ + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "testdbspipesstatesconstructStateMachineRole802AA550" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructExecutionFailedAlarm6678470E": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructdlqF765E6A0": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructdlqPolicyB08573AE": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "table8235A42E", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-existing-tabletest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "Level": "INFO" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "table8235A42E", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.assets.json new file mode 100644 index 000000000..668502c5e --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/integ.json new file mode 100644 index 000000000..615c28f74 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-existing-table/Integ/DefaultTest": { + "stacks": [ + "dbspstp-existing-table" + ], + "assertionStack": "dbspstp-existing-table/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/manifest.json new file mode 100644 index 000000000..b25edab3d --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/manifest.json @@ -0,0 +1,199 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.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": [ + "dbspstpexistingtableIntegDefaultTestDeployAssert512B3A26.assets" + ], + "metadata": { + "/dbspstp-existing-table/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-existing-table/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-existing-table/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-existing-table.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-existing-table.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-existing-table": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-existing-table.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}/fc190c230e983251c0155f9e961881f2dc95d1b834b8262d18aae060d9a7ff46.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-existing-table.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": [ + "dbspstp-existing-table.assets" + ], + "metadata": { + "/dbspstp-existing-table/table/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "table8235A42E" + } + ], + "/dbspstp-existing-table/lambdadbsstp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestServiceRole4515C09E" + } + ], + "/dbspstp-existing-table/lambdadbsstp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestE56C39A8" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineLogGroup1E17AD86" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachine9909327F" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionFailedAlarm6678470E" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqF765E6A0" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqPolicyB08573AE" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F" + } + ], + "/dbspstp-existing-table/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F" + } + ], + "/dbspstp-existing-table/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-existing-table/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-existing-table" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/tree.json new file mode 100644 index 000000000..6a3c9b560 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.js.snapshot/tree.json @@ -0,0 +1,912 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-existing-table": { + "id": "dbspstp-existing-table", + "path": "dbspstp-existing-table", + "children": { + "table": { + "id": "table", + "path": "dbspstp-existing-table/table", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/table/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-existing-table/table/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "lambdadbsstp-test": { + "id": "lambdadbsstp-test", + "path": "dbspstp-existing-table/lambdadbsstp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-existing-table/lambdadbsstp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-existing-table/lambdadbsstp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/lambdadbsstp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/lambdadbsstp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test": { + "id": "taskdbsstp-test", + "path": "dbspstp-existing-table/taskdbsstp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-dbs-pipes-states-construct": { + "id": "test-dbs-pipes-states-construct", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct", + "children": { + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-existing-tabletest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-dbs-pipes-states-construct": { + "id": "PipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-dbs-pipes-states-construct": { + "id": "ImportPipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/ImportPipeRole--test-dbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "table8235A42E", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-dbs-pipes-states-construct": { + "id": "LogGroup-test-dbs-pipes-states-construct", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-existing-tabletest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-dbs-pipes-states-construct": { + "id": "pipe-test-dbs-pipes-states-construct", + "path": "dbspstp-existing-table/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "level": "INFO" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "table8235A42E", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-existing-table/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-existing-table/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-existing-table/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-existing-table/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-existing-table/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-existing-table/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-existing-table/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-existing-table/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.ts new file mode 100644 index 000000000..43990cd40 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-existing-table.ts @@ -0,0 +1,52 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const existingTable = new dynamodb.Table(stack, 'table', { + partitionKey: { + name: 'id', + type: dynamodb.AttributeType.STRING + }, + stream: dynamodb.StreamViewType.NEW_AND_OLD_IMAGES, + billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, + encryption: dynamodb.TableEncryption.AWS_MANAGED, + pointInTimeRecovery: true +}); +defaults.addCfnGuardSuppressRules(existingTable, + [ "DYNAMODB_TABLE_ENCRYPTED_KMS" ] +); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'dbsstp-test') + }, + existingTableInterface: existingTable, +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { + testCases: [ + stack + ] +}); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstp-filter.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstp-filter.assets.json new file mode 100644 index 000000000..48e6793ca --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstp-filter.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "2781742526675c52553353fbb90ecd8275bbfd15d16ed9106edf52a855fc7973": { + "source": { + "path": "dbspstp-filter.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "2781742526675c52553353fbb90ecd8275bbfd15d16ed9106edf52a855fc7973.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstp-filter.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstp-filter.template.json new file mode 100644 index 000000000..5c1436345 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstp-filter.template.json @@ -0,0 +1,633 @@ +{ + "Resources": { + "lambdadbsstptestServiceRole4515C09E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstptestE56C39A8": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstptestServiceRole4515C09E" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testdbspipesstatesconstructDynamoTable5457FA02": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-filtertest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachineRole802AA550": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachine9909327F": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + }, + "DependsOn": [ + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "testdbspipesstatesconstructStateMachineRole802AA550" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructExecutionFailedAlarm6678470E": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructdlqF765E6A0": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructdlqPolicyB08573AE": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-filtertest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "Level": "INFO" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + }, + "FilterCriteria": { + "Filters": [ + { + "Pattern": "{\n \"dynamodb\": {\n \"NewImage\": {\n \"state\": { \"S\": [\"open\"] }\n }\n }\n}" + } + ] + } + }, + "Target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.assets.json new file mode 100644 index 000000000..7d67cd6fa --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/integ.json new file mode 100644 index 000000000..e1a34da26 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-filter/Integ/DefaultTest": { + "stacks": [ + "dbspstp-filter" + ], + "assertionStack": "dbspstp-filter/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/manifest.json new file mode 100644 index 000000000..914973312 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/manifest.json @@ -0,0 +1,199 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.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": [ + "dbspstpfilterIntegDefaultTestDeployAssert5FF6F7CB.assets" + ], + "metadata": { + "/dbspstp-filter/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-filter/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-filter/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-filter.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-filter.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-filter": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-filter.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}/2781742526675c52553353fbb90ecd8275bbfd15d16ed9106edf52a855fc7973.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-filter.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": [ + "dbspstp-filter.assets" + ], + "metadata": { + "/dbspstp-filter/lambdadbsstp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestServiceRole4515C09E" + } + ], + "/dbspstp-filter/lambdadbsstp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestE56C39A8" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructDynamoTable5457FA02" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineLogGroup1E17AD86" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachine9909327F" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionFailedAlarm6678470E" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqF765E6A0" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqPolicyB08573AE" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F" + } + ], + "/dbspstp-filter/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F" + } + ], + "/dbspstp-filter/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-filter/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-filter" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/tree.json new file mode 100644 index 000000000..dd2d8cb4a --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.js.snapshot/tree.json @@ -0,0 +1,919 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-filter": { + "id": "dbspstp-filter", + "path": "dbspstp-filter", + "children": { + "lambdadbsstp-test": { + "id": "lambdadbsstp-test", + "path": "dbspstp-filter/lambdadbsstp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-filter/lambdadbsstp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-filter/lambdadbsstp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/lambdadbsstp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/lambdadbsstp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test": { + "id": "taskdbsstp-test", + "path": "dbspstp-filter/taskdbsstp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-dbs-pipes-states-construct": { + "id": "test-dbs-pipes-states-construct", + "path": "dbspstp-filter/test-dbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-filtertest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-dbs-pipes-states-construct": { + "id": "PipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-dbs-pipes-states-construct": { + "id": "ImportPipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/ImportPipeRole--test-dbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-dbs-pipes-states-construct": { + "id": "LogGroup-test-dbs-pipes-states-construct", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-filtertest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-dbs-pipes-states-construct": { + "id": "pipe-test-dbs-pipes-states-construct", + "path": "dbspstp-filter/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "level": "INFO" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "sourceParameters": { + "filterCriteria": { + "filters": [ + { + "pattern": "{\n \"dynamodb\": {\n \"NewImage\": {\n \"state\": { \"S\": [\"open\"] }\n }\n }\n}" + } + ] + }, + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-filter/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-filter/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-filter/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-filter/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-filter/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-filter/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-filter/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-filter/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.ts new file mode 100644 index 000000000..fb12a3a7a --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-filter.ts @@ -0,0 +1,49 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const testFilterPattern = `{ + "dynamodb": { + "NewImage": { + "state": { "S": ["open"] } + } + } +}`; + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'dbsstp-test') + }, + pipeProps: { + sourceParameters: { + filterCriteria: { + filters: [{ pattern: testFilterPattern }], + }, + } + } +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/asset.b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac/index.js b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/asset.b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac/index.js new file mode 100644 index 000000000..68532199d --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/asset.b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac/index.js @@ -0,0 +1,21 @@ +/** + * 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. + */ + +exports.handler = async (event) => { + console.log(event); + const response = event.map((x) =>{ + x.newAttrib = "content"; + return x; + }); + return response; +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstp-lambda-function-enrichment.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstp-lambda-function-enrichment.assets.json new file mode 100644 index 000000000..0b8b56bdf --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstp-lambda-function-enrichment.assets.json @@ -0,0 +1,32 @@ +{ + "version": "38.0.1", + "files": { + "b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac": { + "source": { + "path": "asset.b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "0eb5dfa4e7d186e1c36d51eefa8b6f155d8786ab1e73dfed34da54c5e192dbd2": { + "source": { + "path": "dbspstp-lambda-function-enrichment.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "0eb5dfa4e7d186e1c36d51eefa8b6f155d8786ab1e73dfed34da54c5e192dbd2.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstp-lambda-function-enrichment.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstp-lambda-function-enrichment.template.json new file mode 100644 index 000000000..bb8f937c3 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstp-lambda-function-enrichment.template.json @@ -0,0 +1,729 @@ +{ + "Resources": { + "enrichmentfunctionServiceRoleF21A0515": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "enrichmentfunction84C1BE72": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac.zip" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "enrichmentfunctionServiceRoleF21A0515", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "enrichmentfunctionServiceRoleF21A0515" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "lambdadbsstptestServiceRole4515C09E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstptestE56C39A8": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstptestServiceRole4515C09E" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testdbspipesstatesconstructDynamoTable5457FA02": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-lambda-function-enrichmenttest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachineRole802AA550": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachine9909327F": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + }, + "DependsOn": [ + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "testdbspipesstatesconstructStateMachineRole802AA550" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructExecutionFailedAlarm6678470E": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructdlqF765E6A0": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructdlqPolicyB08573AE": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "enrichmentfunction84C1BE72", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ] + } + }, + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-lambda-function-enrichmenttest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "Enrichment": { + "Fn::GetAtt": [ + "enrichmentfunction84C1BE72", + "Arn" + ] + }, + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "Level": "TRACE" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.assets.json new file mode 100644 index 000000000..32b50c0f8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/integ.json new file mode 100644 index 000000000..ec555d48c --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-lambda-function-enrichment/Integ/DefaultTest": { + "stacks": [ + "dbspstp-lambda-function-enrichment" + ], + "assertionStack": "dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/manifest.json new file mode 100644 index 000000000..571ce94d8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/manifest.json @@ -0,0 +1,217 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.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": [ + "dbspstplambdafunctionenrichmentIntegDefaultTestDeployAssertE09AE064.assets" + ], + "metadata": { + "/dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-lambda-function-enrichment.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-lambda-function-enrichment.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-lambda-function-enrichment": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-lambda-function-enrichment.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}/0eb5dfa4e7d186e1c36d51eefa8b6f155d8786ab1e73dfed34da54c5e192dbd2.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-lambda-function-enrichment.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": [ + "dbspstp-lambda-function-enrichment.assets" + ], + "metadata": { + "/dbspstp-lambda-function-enrichment/enrichment-function/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "enrichmentfunctionServiceRoleF21A0515" + } + ], + "/dbspstp-lambda-function-enrichment/enrichment-function/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "enrichmentfunction84C1BE72" + } + ], + "/dbspstp-lambda-function-enrichment/lambdadbsstp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestServiceRole4515C09E" + } + ], + "/dbspstp-lambda-function-enrichment/lambdadbsstp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestE56C39A8" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructDynamoTable5457FA02" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineLogGroup1E17AD86" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachine9909327F" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionFailedAlarm6678470E" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqF765E6A0" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqPolicyB08573AE" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/enrichmentpolicytest-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F" + } + ], + "/dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F" + } + ], + "/dbspstp-lambda-function-enrichment/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-lambda-function-enrichment/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-lambda-function-enrichment" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/tree.json new file mode 100644 index 000000000..574c0e7ea --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.js.snapshot/tree.json @@ -0,0 +1,1082 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-lambda-function-enrichment": { + "id": "dbspstp-lambda-function-enrichment", + "path": "dbspstp-lambda-function-enrichment", + "children": { + "enrichment-function": { + "id": "enrichment-function", + "path": "dbspstp-lambda-function-enrichment/enrichment-function", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Code": { + "id": "Code", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/Code", + "children": { + "Stage": { + "id": "Stage", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/Code/Stage", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "2.163.1" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/Code/AssetBucket", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3.BucketBase", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_s3_assets.Asset", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/enrichment-function/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "s3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "s3Key": "b2acf8c9fc806153dd62e2f9c3fd5d6042e7764d4584e06403b29a8b863d0bac.zip" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "enrichmentfunctionServiceRoleF21A0515", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "lambdadbsstp-test": { + "id": "lambdadbsstp-test", + "path": "dbspstp-lambda-function-enrichment/lambdadbsstp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-lambda-function-enrichment/lambdadbsstp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-lambda-function-enrichment/lambdadbsstp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/lambdadbsstp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/lambdadbsstp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test": { + "id": "taskdbsstp-test", + "path": "dbspstp-lambda-function-enrichment/taskdbsstp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-dbs-pipes-states-construct": { + "id": "test-dbs-pipes-states-construct", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-lambda-function-enrichmenttest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-dbs-pipes-states-construct": { + "id": "PipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-dbs-pipes-states-construct": { + "id": "ImportPipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/ImportPipeRole--test-dbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "enrichmentpolicytest-dbs-pipes-states-construct": { + "id": "enrichmentpolicytest-dbs-pipes-states-construct", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/enrichmentpolicytest-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/enrichmentpolicytest-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "enrichmentfunction84C1BE72", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11", + "roles": [ + { + "Ref": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + }, + "LogGroup-test-dbs-pipes-states-construct": { + "id": "LogGroup-test-dbs-pipes-states-construct", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-lambda-function-enrichmenttest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-dbs-pipes-states-construct": { + "id": "pipe-test-dbs-pipes-states-construct", + "path": "dbspstp-lambda-function-enrichment/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "enrichment": { + "Fn::GetAtt": [ + "enrichmentfunction84C1BE72", + "Arn" + ] + }, + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "level": "TRACE" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-lambda-function-enrichment/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-lambda-function-enrichment/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-lambda-function-enrichment/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-lambda-function-enrichment/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-lambda-function-enrichment/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-lambda-function-enrichment/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.ts new file mode 100644 index 000000000..2f824486c --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-lambda-function-enrichment.ts @@ -0,0 +1,43 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const enrichmentFunction = new lambda.Function(stack, 'enrichment-function', { + runtime: defaults.COMMERCIAL_REGION_LAMBDA_NODE_RUNTIME, + handler: 'index.handler', + code: lambda.Code.fromAsset(`${__dirname}/lambda`) +}); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'dbsstp-test') + }, + enrichmentFunction, + logLevel: defaults.PipesLogLevel.TRACE +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstp-logs-off.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstp-logs-off.assets.json new file mode 100644 index 000000000..8db5e6cdf --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstp-logs-off.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "be227a997cf86637cd910032fea817465f2e4c7cc3c817e0cd7fec573b517f50": { + "source": { + "path": "dbspstp-logs-off.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "be227a997cf86637cd910032fea817465f2e4c7cc3c817e0cd7fec573b517f50.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstp-logs-off.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstp-logs-off.template.json new file mode 100644 index 000000000..e26cedf8a --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstp-logs-off.template.json @@ -0,0 +1,573 @@ +{ + "Resources": { + "lambdas3stptestServiceRoleF17BB6C7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdas3stptest9FBDC6CE": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdas3stptestServiceRoleF17BB6C7" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testsqspipesstatesconstructDynamoTable17AE0B12": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-logs-offtest-sqs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testsqspipesstatesconstructStateMachineRoleBF97BFC0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "Roles": [ + { + "Ref": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testsqspipesstatesconstructStateMachine29272AA9": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineRoleBF97BFC0", + "Arn" + ] + } + }, + "DependsOn": [ + "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsqspipesstatesconstructExecutionFailedAlarm1002FF55": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructExecutionThrottledAlarm0242B01A": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructExecutionAbortedAlarm14349A7B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructdlq139B810A": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsqspipesstatesconstructdlqPolicyBFC2549A": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testsqspipesstatesconstructdlq139B810A" + } + ] + } + }, + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testsqspipesstatesconstructpipetestsqspipesstatesconstruct71A64A15": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.assets.json new file mode 100644 index 000000000..229350436 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/integ.json new file mode 100644 index 000000000..729517a1b --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-logs-off/Integ/DefaultTest": { + "stacks": [ + "dbspstp-logs-off" + ], + "assertionStack": "dbspstp-logs-off/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/manifest.json new file mode 100644 index 000000000..f971160ea --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/manifest.json @@ -0,0 +1,193 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.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": [ + "dbspstplogsoffIntegDefaultTestDeployAssert34D29E33.assets" + ], + "metadata": { + "/dbspstp-logs-off/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-logs-off/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-logs-off/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-logs-off.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-logs-off.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-logs-off": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-logs-off.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}/be227a997cf86637cd910032fea817465f2e4c7cc3c817e0cd7fec573b517f50.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-logs-off.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": [ + "dbspstp-logs-off.assets" + ], + "metadata": { + "/dbspstp-logs-off/lambdas3stp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptestServiceRoleF17BB6C7" + } + ], + "/dbspstp-logs-off/lambdas3stp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptest9FBDC6CE" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructDynamoTable17AE0B12" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineLogGroupADE94F1D" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachine29272AA9" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionFailedAlarm1002FF55" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionThrottledAlarm0242B01A" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionAbortedAlarm14349A7B" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructdlq139B810A" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructdlqPolicyBFC2549A" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C" + } + ], + "/dbspstp-logs-off/test-sqs-pipes-states-construct/pipe-test-sqs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructpipetestsqspipesstatesconstruct71A64A15" + } + ], + "/dbspstp-logs-off/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-logs-off/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-logs-off" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/tree.json new file mode 100644 index 000000000..54f25f90e --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.js.snapshot/tree.json @@ -0,0 +1,857 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-logs-off": { + "id": "dbspstp-logs-off", + "path": "dbspstp-logs-off", + "children": { + "lambdas3stp-test": { + "id": "lambdas3stp-test", + "path": "dbspstp-logs-off/lambdas3stp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-logs-off/lambdas3stp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-logs-off/lambdas3stp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/lambdas3stp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/lambdas3stp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "tasks3stp-test": { + "id": "tasks3stp-test", + "path": "dbspstp-logs-off/tasks3stp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-sqs-pipes-states-construct": { + "id": "test-sqs-pipes-states-construct", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-logs-offtest-sqs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "roles": [ + { + "Ref": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineRoleBF97BFC0", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testsqspipesstatesconstructdlq139B810A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-sqs-pipes-states-construct": { + "id": "PipeRole--test-sqs-pipes-states-construct", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct", + "children": { + "ImportPipeRole--test-sqs-pipes-states-construct": { + "id": "ImportPipeRole--test-sqs-pipes-states-construct", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/ImportPipeRole--test-sqs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "pipe-test-sqs-pipes-states-construct": { + "id": "pipe-test-sqs-pipes-states-construct", + "path": "dbspstp-logs-off/test-sqs-pipes-states-construct/pipe-test-sqs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-logs-off/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-logs-off/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-logs-off/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-logs-off/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-logs-off/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-logs-off/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-logs-off/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-logs-off/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.ts new file mode 100644 index 000000000..9f75fd6cc --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-logs-off.ts @@ -0,0 +1,35 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 's3stp-test') + }, + logLevel: defaults.PipesLogLevel.OFF +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-sqs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstp-no-arguments.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstp-no-arguments.assets.json new file mode 100644 index 000000000..81e02b826 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstp-no-arguments.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "10d491a681303161dde8f48f68c46e40ae69ff8001688a8efa33084d64190ceb": { + "source": { + "path": "dbspstp-no-arguments.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "10d491a681303161dde8f48f68c46e40ae69ff8001688a8efa33084d64190ceb.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstp-no-arguments.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstp-no-arguments.template.json new file mode 100644 index 000000000..c374fb488 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstp-no-arguments.template.json @@ -0,0 +1,626 @@ +{ + "Resources": { + "lambdas3stptestServiceRoleF17BB6C7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdas3stptest9FBDC6CE": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdas3stptestServiceRoleF17BB6C7" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testddbspipesstatesconstructDynamoTable4F0DA5B6": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testddbspipesstatesconstructStateMachineLogGroup6986BB22": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-no-argumentstest-ddbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testddbspipesstatesconstructStateMachineRole04A3CFBB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9", + "Roles": [ + { + "Ref": "testddbspipesstatesconstructStateMachineRole04A3CFBB" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testddbspipesstatesconstructStateMachine10DF8368": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineLogGroup6986BB22", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineRole04A3CFBB", + "Arn" + ] + } + }, + "DependsOn": [ + "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9", + "testddbspipesstatesconstructStateMachineRole04A3CFBB" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testddbspipesstatesconstructExecutionFailedAlarmC08BE65A": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testddbspipesstatesconstructExecutionThrottledAlarm9ABEAF66": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testddbspipesstatesconstructExecutionAbortedAlarm19AB16F0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testddbspipesstatesconstructdlq43239DE7": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testddbspipesstatesconstructdlqPolicy82F4B6C5": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testddbspipesstatesconstructdlq43239DE7" + } + ] + } + }, + "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-no-argumentstest-ddbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testddbspipesstatesconstructpipetestddbspipesstatesconstruct436AF0AF": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF", + "Arn" + ] + } + }, + "Level": "INFO" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.assets.json new file mode 100644 index 000000000..a414bbd5b --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/integ.json new file mode 100644 index 000000000..02a392d91 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-no-arguments/Integ/DefaultTest": { + "stacks": [ + "dbspstp-no-arguments" + ], + "assertionStack": "dbspstp-no-arguments/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/manifest.json new file mode 100644 index 000000000..2cf80d474 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/manifest.json @@ -0,0 +1,199 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.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": [ + "dbspstpnoargumentsIntegDefaultTestDeployAssertDCD87826.assets" + ], + "metadata": { + "/dbspstp-no-arguments/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-no-arguments/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-no-arguments/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-no-arguments.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-no-arguments.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-no-arguments": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-no-arguments.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}/10d491a681303161dde8f48f68c46e40ae69ff8001688a8efa33084d64190ceb.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-no-arguments.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": [ + "dbspstp-no-arguments.assets" + ], + "metadata": { + "/dbspstp-no-arguments/lambdas3stp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptestServiceRoleF17BB6C7" + } + ], + "/dbspstp-no-arguments/lambdas3stp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptest9FBDC6CE" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructDynamoTable4F0DA5B6" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachineLogGroup6986BB22" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachineRole04A3CFBB" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachine10DF8368" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructExecutionFailedAlarmC08BE65A" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructExecutionThrottledAlarm9ABEAF66" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructExecutionAbortedAlarm19AB16F0" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructdlq43239DE7" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructdlqPolicy82F4B6C5" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/LogGroup-test-ddbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF" + } + ], + "/dbspstp-no-arguments/test-ddbs-pipes-states-construct/pipe-test-ddbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructpipetestddbspipesstatesconstruct436AF0AF" + } + ], + "/dbspstp-no-arguments/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-no-arguments/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-no-arguments" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/tree.json new file mode 100644 index 000000000..01b4f552f --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.js.snapshot/tree.json @@ -0,0 +1,912 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-no-arguments": { + "id": "dbspstp-no-arguments", + "path": "dbspstp-no-arguments", + "children": { + "lambdas3stp-test": { + "id": "lambdas3stp-test", + "path": "dbspstp-no-arguments/lambdas3stp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-no-arguments/lambdas3stp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-no-arguments/lambdas3stp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/lambdas3stp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/lambdas3stp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "tasks3stp-test": { + "id": "tasks3stp-test", + "path": "dbspstp-no-arguments/tasks3stp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-ddbs-pipes-states-construct": { + "id": "test-ddbs-pipes-states-construct", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-no-argumentstest-ddbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9", + "roles": [ + { + "Ref": "testddbspipesstatesconstructStateMachineRole04A3CFBB" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineLogGroup6986BB22", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineRole04A3CFBB", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testddbspipesstatesconstructdlq43239DE7" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-ddbs-pipes-states-construct": { + "id": "PipeRole--test-ddbs-pipes-states-construct", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-ddbs-pipes-states-construct": { + "id": "ImportPipeRole--test-ddbs-pipes-states-construct", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct/ImportPipeRole--test-ddbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-ddbs-pipes-states-construct": { + "id": "LogGroup-test-ddbs-pipes-states-construct", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/LogGroup-test-ddbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/LogGroup-test-ddbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-no-argumentstest-ddbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-ddbs-pipes-states-construct": { + "id": "pipe-test-ddbs-pipes-states-construct", + "path": "dbspstp-no-arguments/test-ddbs-pipes-states-construct/pipe-test-ddbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF", + "Arn" + ] + } + }, + "level": "INFO" + }, + "roleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructdlq43239DE7", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-no-arguments/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-no-arguments/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-no-arguments/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-no-arguments/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-no-arguments/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-no-arguments/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-no-arguments/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-no-arguments/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.ts new file mode 100644 index 000000000..8794e37c7 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-arguments.ts @@ -0,0 +1,34 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 's3stp-test') + }, +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-ddbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstp-no-dlq.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstp-no-dlq.assets.json new file mode 100644 index 000000000..c09f51ade --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstp-no-dlq.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "7d50a5e90b7357f722adb46d110392737d63ade5acff24d07dd1d64691f32348": { + "source": { + "path": "dbspstp-no-dlq.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7d50a5e90b7357f722adb46d110392737d63ade5acff24d07dd1d64691f32348.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstp-no-dlq.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstp-no-dlq.template.json new file mode 100644 index 000000000..224e10333 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstp-no-dlq.template.json @@ -0,0 +1,528 @@ +{ + "Resources": { + "lambdas3stptestServiceRoleF17BB6C7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdas3stptest9FBDC6CE": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdas3stptestServiceRoleF17BB6C7" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testddbspipesstatesconstructDynamoTable4F0DA5B6": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testddbspipesstatesconstructStateMachineLogGroup6986BB22": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-no-dlqtest-ddbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testddbspipesstatesconstructStateMachineRole04A3CFBB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9", + "Roles": [ + { + "Ref": "testddbspipesstatesconstructStateMachineRole04A3CFBB" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testddbspipesstatesconstructStateMachine10DF8368": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineLogGroup6986BB22", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineRole04A3CFBB", + "Arn" + ] + } + }, + "DependsOn": [ + "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9", + "testddbspipesstatesconstructStateMachineRole04A3CFBB" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testddbspipesstatesconstructExecutionFailedAlarmC08BE65A": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testddbspipesstatesconstructExecutionThrottledAlarm9ABEAF66": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testddbspipesstatesconstructExecutionAbortedAlarm19AB16F0": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-no-dlqtest-ddbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testddbspipesstatesconstructpipetestddbspipesstatesconstruct436AF0AF": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF", + "Arn" + ] + } + }, + "Level": "INFO" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.assets.json new file mode 100644 index 000000000..f74878f02 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/integ.json new file mode 100644 index 000000000..c45e4d9c6 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-no-dlq/Integ/DefaultTest": { + "stacks": [ + "dbspstp-no-dlq" + ], + "assertionStack": "dbspstp-no-dlq/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/manifest.json new file mode 100644 index 000000000..b3d1077b4 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/manifest.json @@ -0,0 +1,187 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.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": [ + "dbspstpnodlqIntegDefaultTestDeployAssert3A2FCDBB.assets" + ], + "metadata": { + "/dbspstp-no-dlq/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-no-dlq/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-no-dlq/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-no-dlq.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-no-dlq.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-no-dlq": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-no-dlq.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}/7d50a5e90b7357f722adb46d110392737d63ade5acff24d07dd1d64691f32348.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-no-dlq.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": [ + "dbspstp-no-dlq.assets" + ], + "metadata": { + "/dbspstp-no-dlq/lambdas3stp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptestServiceRoleF17BB6C7" + } + ], + "/dbspstp-no-dlq/lambdas3stp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptest9FBDC6CE" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructDynamoTable4F0DA5B6" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachineLogGroup6986BB22" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachineRole04A3CFBB" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructStateMachine10DF8368" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructExecutionFailedAlarmC08BE65A" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructExecutionThrottledAlarm9ABEAF66" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructExecutionAbortedAlarm19AB16F0" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/LogGroup-test-ddbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF" + } + ], + "/dbspstp-no-dlq/test-ddbs-pipes-states-construct/pipe-test-ddbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testddbspipesstatesconstructpipetestddbspipesstatesconstruct436AF0AF" + } + ], + "/dbspstp-no-dlq/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-no-dlq/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-no-dlq" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/tree.json new file mode 100644 index 000000000..c67a4fbcc --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.js.snapshot/tree.json @@ -0,0 +1,780 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-no-dlq": { + "id": "dbspstp-no-dlq", + "path": "dbspstp-no-dlq", + "children": { + "lambdas3stp-test": { + "id": "lambdas3stp-test", + "path": "dbspstp-no-dlq/lambdas3stp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-no-dlq/lambdas3stp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-no-dlq/lambdas3stp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/lambdas3stp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/lambdas3stp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "tasks3stp-test": { + "id": "tasks3stp-test", + "path": "dbspstp-no-dlq/tasks3stp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-ddbs-pipes-states-construct": { + "id": "test-ddbs-pipes-states-construct", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-no-dlqtest-ddbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testddbspipesstatesconstructStateMachineRoleDefaultPolicyF472E1B9", + "roles": [ + { + "Ref": "testddbspipesstatesconstructStateMachineRole04A3CFBB" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineLogGroup6986BB22", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructStateMachineRole04A3CFBB", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "PipeRole--test-ddbs-pipes-states-construct": { + "id": "PipeRole--test-ddbs-pipes-states-construct", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-ddbs-pipes-states-construct": { + "id": "ImportPipeRole--test-ddbs-pipes-states-construct", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct/ImportPipeRole--test-ddbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/PipeRole--test-ddbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-ddbs-pipes-states-construct": { + "id": "LogGroup-test-ddbs-pipes-states-construct", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/LogGroup-test-ddbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/LogGroup-test-ddbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-no-dlqtest-ddbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-ddbs-pipes-states-construct": { + "id": "pipe-test-ddbs-pipes-states-construct", + "path": "dbspstp-no-dlq/test-ddbs-pipes-states-construct/pipe-test-ddbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructLogGrouptestddbspipesstatesconstruct26A05CCF", + "Arn" + ] + } + }, + "level": "INFO" + }, + "roleArn": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructPipeRoletestddbspipesstatesconstructED65D64D", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testddbspipesstatesconstructDynamoTable4F0DA5B6", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST" + } + }, + "target": { + "Ref": "testddbspipesstatesconstructStateMachine10DF8368" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-no-dlq/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-no-dlq/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-no-dlq/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-no-dlq/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-no-dlq/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-no-dlq/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-no-dlq/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-no-dlq/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.ts new file mode 100644 index 000000000..615da98aa --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-no-dlq.ts @@ -0,0 +1,35 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 's3stp-test') + }, + deploySqsDlqQueue: false +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-ddbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstp-set-stream-batch-size.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstp-set-stream-batch-size.assets.json new file mode 100644 index 000000000..595e53174 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstp-set-stream-batch-size.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "7e3f503cab01a51cb5a78839e0be3ad6acf51d18d6303e75b708e3e5674b8dec": { + "source": { + "path": "dbspstp-set-stream-batch-size.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "7e3f503cab01a51cb5a78839e0be3ad6acf51d18d6303e75b708e3e5674b8dec.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstp-set-stream-batch-size.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstp-set-stream-batch-size.template.json new file mode 100644 index 000000000..c6e8dd284 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstp-set-stream-batch-size.template.json @@ -0,0 +1,627 @@ +{ + "Resources": { + "lambdadbsstptestServiceRole4515C09E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstptestE56C39A8": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstptestServiceRole4515C09E" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testsqspipesstatesconstructDynamoTable17AE0B12": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-set-stream-batch-sizetest-sqs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testsqspipesstatesconstructStateMachineRoleBF97BFC0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "Roles": [ + { + "Ref": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testsqspipesstatesconstructStateMachine29272AA9": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineRoleBF97BFC0", + "Arn" + ] + } + }, + "DependsOn": [ + "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsqspipesstatesconstructExecutionFailedAlarm1002FF55": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructExecutionThrottledAlarm0242B01A": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructExecutionAbortedAlarm14349A7B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructdlq139B810A": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsqspipesstatesconstructdlqPolicyBFC2549A": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testsqspipesstatesconstructdlq139B810A" + } + ] + } + }, + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-set-stream-batch-sizetest-sqs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testsqspipesstatesconstructpipetestsqspipesstatesconstruct71A64A15": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15", + "Arn" + ] + } + }, + "Level": "INFO" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "BatchSize": 50, + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.assets.json new file mode 100644 index 000000000..aa1c3fab7 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/integ.json new file mode 100644 index 000000000..1c9687272 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-set-stream-batch-size/Integ/DefaultTest": { + "stacks": [ + "dbspstp-set-stream-batch-size" + ], + "assertionStack": "dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/manifest.json new file mode 100644 index 000000000..5dde9ab9c --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/manifest.json @@ -0,0 +1,199 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.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": [ + "dbspstpsetstreambatchsizeIntegDefaultTestDeployAssertC10D846F.assets" + ], + "metadata": { + "/dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-set-stream-batch-size.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-set-stream-batch-size.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-set-stream-batch-size": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-set-stream-batch-size.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}/7e3f503cab01a51cb5a78839e0be3ad6acf51d18d6303e75b708e3e5674b8dec.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-set-stream-batch-size.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": [ + "dbspstp-set-stream-batch-size.assets" + ], + "metadata": { + "/dbspstp-set-stream-batch-size/lambdadbsstp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestServiceRole4515C09E" + } + ], + "/dbspstp-set-stream-batch-size/lambdadbsstp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestE56C39A8" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructDynamoTable17AE0B12" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineLogGroupADE94F1D" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachine29272AA9" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionFailedAlarm1002FF55" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionThrottledAlarm0242B01A" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionAbortedAlarm14349A7B" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructdlq139B810A" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructdlqPolicyBFC2549A" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/LogGroup-test-sqs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15" + } + ], + "/dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/pipe-test-sqs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructpipetestsqspipesstatesconstruct71A64A15" + } + ], + "/dbspstp-set-stream-batch-size/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-set-stream-batch-size/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-set-stream-batch-size" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/tree.json new file mode 100644 index 000000000..d7b0798c9 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.js.snapshot/tree.json @@ -0,0 +1,913 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-set-stream-batch-size": { + "id": "dbspstp-set-stream-batch-size", + "path": "dbspstp-set-stream-batch-size", + "children": { + "lambdadbsstp-test": { + "id": "lambdadbsstp-test", + "path": "dbspstp-set-stream-batch-size/lambdadbsstp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-set-stream-batch-size/lambdadbsstp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-set-stream-batch-size/lambdadbsstp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/lambdadbsstp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/lambdadbsstp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test": { + "id": "taskdbsstp-test", + "path": "dbspstp-set-stream-batch-size/taskdbsstp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-sqs-pipes-states-construct": { + "id": "test-sqs-pipes-states-construct", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-set-stream-batch-sizetest-sqs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "roles": [ + { + "Ref": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineRoleBF97BFC0", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testsqspipesstatesconstructdlq139B810A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-sqs-pipes-states-construct": { + "id": "PipeRole--test-sqs-pipes-states-construct", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct", + "children": { + "ImportPipeRole--test-sqs-pipes-states-construct": { + "id": "ImportPipeRole--test-sqs-pipes-states-construct", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/ImportPipeRole--test-sqs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "LogGroup-test-sqs-pipes-states-construct": { + "id": "LogGroup-test-sqs-pipes-states-construct", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/LogGroup-test-sqs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/LogGroup-test-sqs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-set-stream-batch-sizetest-sqs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-sqs-pipes-states-construct": { + "id": "pipe-test-sqs-pipes-states-construct", + "path": "dbspstp-set-stream-batch-size/test-sqs-pipes-states-construct/pipe-test-sqs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15", + "Arn" + ] + } + }, + "level": "INFO" + }, + "roleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "batchSize": 50, + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-set-stream-batch-size/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-set-stream-batch-size/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-set-stream-batch-size/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-set-stream-batch-size/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-set-stream-batch-size/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-set-stream-batch-size/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.ts new file mode 100644 index 000000000..0d74159fd --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-set-stream-batch-size.ts @@ -0,0 +1,41 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'dbsstp-test') + }, + pipeProps: { + sourceParameters: { + dynamoDbStreamParameters: { + batchSize: 50, + }, + } + } +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-sqs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstp-state-machine-enrichment.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstp-state-machine-enrichment.assets.json new file mode 100644 index 000000000..ad4d683e2 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstp-state-machine-enrichment.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "690c3afba41fd84c15e79f468c082d1d3426baaf659324dd8fadeafcf984b890": { + "source": { + "path": "dbspstp-state-machine-enrichment.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "690c3afba41fd84c15e79f468c082d1d3426baaf659324dd8fadeafcf984b890.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstp-state-machine-enrichment.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstp-state-machine-enrichment.template.json new file mode 100644 index 000000000..5dc66f108 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstp-state-machine-enrichment.template.json @@ -0,0 +1,840 @@ +{ + "Resources": { + "lambdatempServiceRoleA1A0368B": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdatemp1CD2462E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdatempServiceRoleA1A0368B", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdatempServiceRoleA1A0368B" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "tempRole0DF4072C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "tempRoleDefaultPolicy6B471CA6": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdatemp1CD2462E", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdatemp1CD2462E", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "tempRoleDefaultPolicy6B471CA6", + "Roles": [ + { + "Ref": "tempRole0DF4072C" + } + ] + } + }, + "temp3A4F7567": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasktemp\",\"States\":{\"tasktemp\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdatemp1CD2462E", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "RoleArn": { + "Fn::GetAtt": [ + "tempRole0DF4072C", + "Arn" + ] + }, + "StateMachineType": "EXPRESS" + }, + "DependsOn": [ + "tempRoleDefaultPolicy6B471CA6", + "tempRole0DF4072C" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "lambdas3stptestServiceRoleF17BB6C7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdas3stptest9FBDC6CE": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdas3stptestServiceRoleF17BB6C7" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testsqspipesstatesconstructDynamoTable17AE0B12": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-state-machine-enrichmenttest-sqs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testsqspipesstatesconstructStateMachineRoleBF97BFC0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "Roles": [ + { + "Ref": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testsqspipesstatesconstructStateMachine29272AA9": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineRoleBF97BFC0", + "Arn" + ] + } + }, + "DependsOn": [ + "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsqspipesstatesconstructExecutionFailedAlarm1002FF55": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructExecutionThrottledAlarm0242B01A": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructExecutionAbortedAlarm14349A7B": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testsqspipesstatesconstructdlq139B810A": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsqspipesstatesconstructdlqPolicyBFC2549A": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testsqspipesstatesconstructdlq139B810A" + } + ] + } + }, + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testsqspipesstatesconstructenrichmentpolicytestsqspipesstatesconstructC752476A": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "temp3A4F7567" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testsqspipesstatesconstructenrichmentpolicytestsqspipesstatesconstructC752476A", + "Roles": [ + { + "Ref": "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C" + } + ] + } + }, + "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-state-machine-enrichmenttest-sqs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testsqspipesstatesconstructpipetestsqspipesstatesconstruct71A64A15": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "Enrichment": { + "Ref": "temp3A4F7567" + }, + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15", + "Arn" + ] + } + }, + "Level": "TRACE" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + }, + "MaximumRetryAttempts": 3, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.assets.json new file mode 100644 index 000000000..2ef0e630c --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/integ.json new file mode 100644 index 000000000..1feadb810 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-state-machine-enrichment/Integ/DefaultTest": { + "stacks": [ + "dbspstp-state-machine-enrichment" + ], + "assertionStack": "dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/manifest.json new file mode 100644 index 000000000..b63452ff3 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/manifest.json @@ -0,0 +1,235 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.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": [ + "dbspstpstatemachineenrichmentIntegDefaultTestDeployAssert82B6B0D6.assets" + ], + "metadata": { + "/dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-state-machine-enrichment.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-state-machine-enrichment.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-state-machine-enrichment": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-state-machine-enrichment.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}/690c3afba41fd84c15e79f468c082d1d3426baaf659324dd8fadeafcf984b890.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-state-machine-enrichment.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": [ + "dbspstp-state-machine-enrichment.assets" + ], + "metadata": { + "/dbspstp-state-machine-enrichment/lambdatemp/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdatempServiceRoleA1A0368B" + } + ], + "/dbspstp-state-machine-enrichment/lambdatemp/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdatemp1CD2462E" + } + ], + "/dbspstp-state-machine-enrichment/temp/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "tempRole0DF4072C" + } + ], + "/dbspstp-state-machine-enrichment/temp/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "tempRoleDefaultPolicy6B471CA6" + } + ], + "/dbspstp-state-machine-enrichment/temp/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "temp3A4F7567" + } + ], + "/dbspstp-state-machine-enrichment/lambdas3stp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptestServiceRoleF17BB6C7" + } + ], + "/dbspstp-state-machine-enrichment/lambdas3stp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdas3stptest9FBDC6CE" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructDynamoTable17AE0B12" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineLogGroupADE94F1D" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructStateMachine29272AA9" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionFailedAlarm1002FF55" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionThrottledAlarm0242B01A" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructExecutionAbortedAlarm14349A7B" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructdlq139B810A" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructdlqPolicyBFC2549A" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/enrichmentpolicytest-sqs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructenrichmentpolicytestsqspipesstatesconstructC752476A" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/LogGroup-test-sqs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15" + } + ], + "/dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/pipe-test-sqs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testsqspipesstatesconstructpipetestsqspipesstatesconstruct71A64A15" + } + ], + "/dbspstp-state-machine-enrichment/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-state-machine-enrichment/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-state-machine-enrichment" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/tree.json new file mode 100644 index 000000000..ec992ee73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.js.snapshot/tree.json @@ -0,0 +1,1207 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-state-machine-enrichment": { + "id": "dbspstp-state-machine-enrichment", + "path": "dbspstp-state-machine-enrichment", + "children": { + "lambdatemp": { + "id": "lambdatemp", + "path": "dbspstp-state-machine-enrichment/lambdatemp", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-state-machine-enrichment/lambdatemp/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-state-machine-enrichment/lambdatemp/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/lambdatemp/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/lambdatemp/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdatempServiceRoleA1A0368B", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "tasktemp": { + "id": "tasktemp", + "path": "dbspstp-state-machine-enrichment/tasktemp", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "temp": { + "id": "temp", + "path": "dbspstp-state-machine-enrichment/temp", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-state-machine-enrichment/temp/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-state-machine-enrichment/temp/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/temp/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-state-machine-enrichment/temp/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/temp/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdatemp1CD2462E", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdatemp1CD2462E", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "tempRoleDefaultPolicy6B471CA6", + "roles": [ + { + "Ref": "tempRole0DF4072C" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/temp/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasktemp\",\"States\":{\"tasktemp\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdatemp1CD2462E", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "roleArn": { + "Fn::GetAtt": [ + "tempRole0DF4072C", + "Arn" + ] + }, + "stateMachineType": "EXPRESS" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "lambdas3stp-test": { + "id": "lambdas3stp-test", + "path": "dbspstp-state-machine-enrichment/lambdas3stp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-state-machine-enrichment/lambdas3stp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-state-machine-enrichment/lambdas3stp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/lambdas3stp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/lambdas3stp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdas3stptestServiceRoleF17BB6C7", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "tasks3stp-test": { + "id": "tasks3stp-test", + "path": "dbspstp-state-machine-enrichment/tasks3stp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-sqs-pipes-states-construct": { + "id": "test-sqs-pipes-states-construct", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-state-machine-enrichmenttest-sqs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testsqspipesstatesconstructStateMachineRoleDefaultPolicyD1BA2BF2", + "roles": [ + { + "Ref": "testsqspipesstatesconstructStateMachineRoleBF97BFC0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"tasks3stp-test\",\"States\":{\"tasks3stp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdas3stptest9FBDC6CE", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineLogGroupADE94F1D", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructStateMachineRoleBF97BFC0", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testsqspipesstatesconstructdlq139B810A" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-sqs-pipes-states-construct": { + "id": "PipeRole--test-sqs-pipes-states-construct", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct", + "children": { + "ImportPipeRole--test-sqs-pipes-states-construct": { + "id": "ImportPipeRole--test-sqs-pipes-states-construct", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/ImportPipeRole--test-sqs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/PipeRole--test-sqs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "enrichmentpolicytest-sqs-pipes-states-construct": { + "id": "enrichmentpolicytest-sqs-pipes-states-construct", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/enrichmentpolicytest-sqs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/enrichmentpolicytest-sqs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "states:StartSyncExecution", + "Effect": "Allow", + "Resource": { + "Ref": "temp3A4F7567" + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "testsqspipesstatesconstructenrichmentpolicytestsqspipesstatesconstructC752476A", + "roles": [ + { + "Ref": "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + }, + "LogGroup-test-sqs-pipes-states-construct": { + "id": "LogGroup-test-sqs-pipes-states-construct", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/LogGroup-test-sqs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/LogGroup-test-sqs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-state-machine-enrichmenttest-sqs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-sqs-pipes-states-construct": { + "id": "pipe-test-sqs-pipes-states-construct", + "path": "dbspstp-state-machine-enrichment/test-sqs-pipes-states-construct/pipe-test-sqs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "enrichment": { + "Ref": "temp3A4F7567" + }, + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructLogGrouptestsqspipesstatesconstructF827FE15", + "Arn" + ] + } + }, + "level": "TRACE" + }, + "roleArn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructPipeRoletestsqspipesstatesconstruct2CC9A13C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructDynamoTable17AE0B12", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "startingPosition": "LATEST", + "maximumRetryAttempts": 3, + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testsqspipesstatesconstructdlq139B810A", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testsqspipesstatesconstructStateMachine29272AA9" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-state-machine-enrichment/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-state-machine-enrichment/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-state-machine-enrichment/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-state-machine-enrichment/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-state-machine-enrichment/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-state-machine-enrichment/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.ts new file mode 100644 index 000000000..d8dd70494 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-state-machine-enrichment.ts @@ -0,0 +1,40 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); +const enrichmentStateMachine = new sfn.StateMachine(stack, 'temp', { + stateMachineType: sfn.StateMachineType.EXPRESS, + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'temp') +}); +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 's3stp-test') + }, + enrichmentStateMachine, + logLevel: defaults.PipesLogLevel.TRACE +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-sqs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstp-test-dlq.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstp-test-dlq.assets.json new file mode 100644 index 000000000..ca86dd0b6 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstp-test-dlq.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "cbb67a75558e64c020ea7a5739b461757932164c84b09a36054ffe94f3ce2a4a": { + "source": { + "path": "dbspstp-test-dlq.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "cbb67a75558e64c020ea7a5739b461757932164c84b09a36054ffe94f3ce2a4a.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstp-test-dlq.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstp-test-dlq.template.json new file mode 100644 index 000000000..f950390d7 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstp-test-dlq.template.json @@ -0,0 +1,727 @@ +{ + "Resources": { + "badfunctionServiceRoleCA8E6EA9": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "badfunction3559C0E9": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => { console.log(event); throw new Error(\"JUST BREAK\");" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "badfunctionServiceRoleCA8E6EA9", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "badfunctionServiceRoleCA8E6EA9" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "lambdadbsstptestServiceRole4515C09E": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "lambdadbsstptestE56C39A8": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = async (event) => console.log(event)" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "Runtime": "nodejs20.x" + }, + "DependsOn": [ + "lambdadbsstptestServiceRole4515C09E" + ], + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W58", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W89", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + }, + { + "id": "W92", + "reason": "This Lambda Function is created for integration testing purposes only and is not part of an actual construct" + } + ] + } + } + }, + "testdbspipesstatesconstructDynamoTable5457FA02": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "AttributeDefinitions": [ + { + "AttributeName": "id", + "AttributeType": "S" + } + ], + "BillingMode": "PAY_PER_REQUEST", + "KeySchema": [ + { + "AttributeName": "id", + "KeyType": "HASH" + } + ], + "PointInTimeRecoverySpecification": { + "PointInTimeRecoveryEnabled": true + }, + "SSESpecification": { + "SSEEnabled": true + }, + "StreamSpecification": { + "StreamViewType": "NEW_AND_OLD_IMAGES" + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "guard": { + "SuppressedRules": [ + "DYNAMODB_TABLE_ENCRYPTED_KMS" + ] + } + } + }, + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-test-dlqtest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachineRole802AA550": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + }, + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W12", + "reason": "These are CDK defaults. The 'LogDelivery' actions do not support resource-level authorizations. Any logging is done by State Machine code" + } + ] + } + } + }, + "testdbspipesstatesconstructStateMachine9909327F": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "LoggingConfiguration": { + "Destinations": [ + { + "CloudWatchLogsLogGroup": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "Level": "ERROR" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + }, + "DependsOn": [ + "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "testdbspipesstatesconstructStateMachineRole802AA550" + ], + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructExecutionFailedAlarm6678470E": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, + "testdbspipesstatesconstructdlqF765E6A0": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testdbspipesstatesconstructdlqPolicyB08573AE": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Policies": [ + { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "sourcePolicy" + }, + { + "PolicyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "targetPolicy" + } + ] + }, + "Metadata": { + "guard": { + "SuppressedRules": [ + "IAM_NO_INLINE_POLICY_CHECK" + ] + } + } + }, + "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "badfunction3559C0E9", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11", + "Roles": [ + { + "Ref": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ] + } + }, + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F": { + "Type": "AWS::Logs::LogGroup", + "Properties": { + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-test-dlqtest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain", + "Metadata": { + "cfn_nag": { + "rules_to_suppress": [ + { + "id": "W86", + "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely" + }, + { + "id": "W84", + "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)" + } + ] + } + } + }, + "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F": { + "Type": "AWS::Pipes::Pipe", + "Properties": { + "Enrichment": { + "Fn::GetAtt": [ + "badfunction3559C0E9", + "Arn" + ] + }, + "LogConfiguration": { + "CloudwatchLogsLogDestination": { + "LogGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "Level": "TRACE" + }, + "RoleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "Source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "SourceParameters": { + "DynamoDBStreamParameters": { + "DeadLetterConfig": { + "Arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + }, + "MaximumRecordAgeInSeconds": 60, + "MaximumRetryAttempts": 1, + "StartingPosition": "LATEST" + } + }, + "Target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "TargetParameters": { + "StepFunctionStateMachineParameters": { + "InvocationType": "FIRE_AND_FORGET" + } + } + } + } + }, + "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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstptestdlqIntegDefaultTestDeployAssert93B72886.assets.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstptestdlqIntegDefaultTestDeployAssert93B72886.assets.json new file mode 100644 index 000000000..172390408 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstptestdlqIntegDefaultTestDeployAssert93B72886.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "dbspstptestdlqIntegDefaultTestDeployAssert93B72886.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/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstptestdlqIntegDefaultTestDeployAssert93B72886.template.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstptestdlqIntegDefaultTestDeployAssert93B72886.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/dbspstptestdlqIntegDefaultTestDeployAssert93B72886.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/integ.json new file mode 100644 index 000000000..766a2f623 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "dbspstp-test-dlq/Integ/DefaultTest": { + "stacks": [ + "dbspstp-test-dlq" + ], + "assertionStack": "dbspstp-test-dlq/Integ/DefaultTest/DeployAssert", + "assertionStackName": "dbspstptestdlqIntegDefaultTestDeployAssert93B72886" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/manifest.json new file mode 100644 index 000000000..c78618004 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/manifest.json @@ -0,0 +1,217 @@ +{ + "version": "38.0.1", + "artifacts": { + "dbspstptestdlqIntegDefaultTestDeployAssert93B72886.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstptestdlqIntegDefaultTestDeployAssert93B72886.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstptestdlqIntegDefaultTestDeployAssert93B72886": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstptestdlqIntegDefaultTestDeployAssert93B72886.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstptestdlqIntegDefaultTestDeployAssert93B72886.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": [ + "dbspstptestdlqIntegDefaultTestDeployAssert93B72886.assets" + ], + "metadata": { + "/dbspstp-test-dlq/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-test-dlq/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-test-dlq/Integ/DefaultTest/DeployAssert" + }, + "dbspstp-test-dlq.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "dbspstp-test-dlq.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dbspstp-test-dlq": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "dbspstp-test-dlq.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}/cbb67a75558e64c020ea7a5739b461757932164c84b09a36054ffe94f3ce2a4a.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "dbspstp-test-dlq.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": [ + "dbspstp-test-dlq.assets" + ], + "metadata": { + "/dbspstp-test-dlq/bad-function/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "badfunctionServiceRoleCA8E6EA9" + } + ], + "/dbspstp-test-dlq/bad-function/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "badfunction3559C0E9" + } + ], + "/dbspstp-test-dlq/lambdadbsstp-test/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestServiceRole4515C09E" + } + ], + "/dbspstp-test-dlq/lambdadbsstp-test/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "lambdadbsstptestE56C39A8" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/DynamoTable/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructDynamoTable5457FA02" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineLogGroup1E17AD86" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructStateMachine9909327F" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionFailedAlarm6678470E" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionThrottledAlarm0286BB10" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructExecutionAbortedAlarmF4C945F2" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqF765E6A0" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructdlqPolicyB08573AE" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/enrichmentpolicytest-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F" + } + ], + "/dbspstp-test-dlq/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct": [ + { + "type": "aws:cdk:logicalId", + "data": "testdbspipesstatesconstructpipetestdbspipesstatesconstruct6F9C482F" + } + ], + "/dbspstp-test-dlq/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/dbspstp-test-dlq/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "dbspstp-test-dlq" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/tree.json new file mode 100644 index 000000000..fee6f36de --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.js.snapshot/tree.json @@ -0,0 +1,1054 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "dbspstp-test-dlq": { + "id": "dbspstp-test-dlq", + "path": "dbspstp-test-dlq", + "children": { + "bad-function": { + "id": "bad-function", + "path": "dbspstp-test-dlq/bad-function", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-test-dlq/bad-function/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-test-dlq/bad-function/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/bad-function/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/bad-function/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => { console.log(event); throw new Error(\"JUST BREAK\");" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "badfunctionServiceRoleCA8E6EA9", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "lambdadbsstp-test": { + "id": "lambdadbsstp-test", + "path": "dbspstp-test-dlq/lambdadbsstp-test", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "dbspstp-test-dlq/lambdadbsstp-test/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "dbspstp-test-dlq/lambdadbsstp-test/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/lambdadbsstp-test/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/lambdadbsstp-test/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "exports.handler = async (event) => console.log(event)" + }, + "handler": "index.handler", + "role": { + "Fn::GetAtt": [ + "lambdadbsstptestServiceRole4515C09E", + "Arn" + ] + }, + "runtime": "nodejs20.x" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_lambda.Function", + "version": "2.163.1" + } + }, + "taskdbsstp-test": { + "id": "taskdbsstp-test", + "path": "dbspstp-test-dlq/taskdbsstp-test", + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", + "version": "2.163.1" + } + }, + "test-dbs-pipes-states-construct": { + "id": "test-dbs-pipes-states-construct", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct", + "children": { + "DynamoTable": { + "id": "DynamoTable", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/DynamoTable", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/DynamoTable/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "attributeDefinitions": [ + { + "attributeName": "id", + "attributeType": "S" + } + ], + "billingMode": "PAY_PER_REQUEST", + "keySchema": [ + { + "attributeName": "id", + "keyType": "HASH" + } + ], + "pointInTimeRecoverySpecification": { + "pointInTimeRecoveryEnabled": true + }, + "sseSpecification": { + "sseEnabled": true + }, + "streamSpecification": { + "streamViewType": "NEW_AND_OLD_IMAGES" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.CfnTable", + "version": "2.163.1" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/DynamoTable/ScalingRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_dynamodb.Table", + "version": "2.163.1" + } + }, + "StateMachineLogGroup": { + "id": "StateMachineLogGroup", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachineLogGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachineLogGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/states/constructs/dbspstp-test-dlqtest-dbs-pipes-states-constructStateMachineLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "states.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + { + "Fn::Join": [ + "", + [ + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + ":*" + ] + ] + } + ] + }, + { + "Action": [ + "logs:CreateLogDelivery", + "logs:DeleteLogDelivery", + "logs:DescribeLogGroups", + "logs:DescribeResourcePolicies", + "logs:GetLogDelivery", + "logs:ListLogDeliveries", + "logs:PutResourcePolicy", + "logs:UpdateLogDelivery" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructStateMachineRoleDefaultPolicy12413F49", + "roles": [ + { + "Ref": "testdbspipesstatesconstructStateMachineRole802AA550" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"taskdbsstp-test\",\"States\":{\"taskdbsstp-test\":{\"End\":true,\"Retry\":[{\"ErrorEquals\":[\"Lambda.ClientExecutionTimeoutException\",\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"", + { + "Fn::GetAtt": [ + "lambdadbsstptestE56C39A8", + "Arn" + ] + }, + "\",\"Payload.$\":\"$\"}}}}" + ] + ] + }, + "loggingConfiguration": { + "destinations": [ + { + "cloudWatchLogsLogGroup": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineLogGroup1E17AD86", + "Arn" + ] + } + } + } + ], + "level": "ERROR" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructStateMachineRole802AA550", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", + "version": "2.163.1" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.163.1" + } + }, + "dlq": { + "id": "dlq", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testdbspipesstatesconstructdlqF765E6A0" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "PipeRole--test-dbs-pipes-states-construct": { + "id": "PipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct", + "children": { + "ImportPipeRole--test-dbs-pipes-states-construct": { + "id": "ImportPipeRole--test-dbs-pipes-states-construct", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/ImportPipeRole--test-dbs-pipes-states-construct", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "2.163.1" + } + }, + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/PipeRole--test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "pipes.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "policies": [ + { + "policyName": "sourcePolicy", + "policyDocument": { + "Statement": [ + { + "Action": [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + } + }, + { + "Action": "sqs:SendMessage", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + } + }, + { + "policyName": "targetPolicy", + "policyDocument": { + "Statement": [ + { + "Action": "states:StartExecution", + "Effect": "Allow", + "Resource": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + } + } + ], + "Version": "2012-10-17" + } + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "2.163.1" + } + }, + "enrichmentpolicytest-dbs-pipes-states-construct": { + "id": "enrichmentpolicytest-dbs-pipes-states-construct", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/enrichmentpolicytest-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/enrichmentpolicytest-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "lambda:InvokeFunction", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "badfunction3559C0E9", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "testdbspipesstatesconstructenrichmentpolicytestdbspipesstatesconstruct28034D11", + "roles": [ + { + "Ref": "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "2.163.1" + } + }, + "LogGroup-test-dbs-pipes-states-construct": { + "id": "LogGroup-test-dbs-pipes-states-construct", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct", + "children": { + "Resource": { + "id": "Resource", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/LogGroup-test-dbs-pipes-states-construct/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Logs::LogGroup", + "aws:cdk:cloudformation:props": { + "logGroupName": { + "Fn::Join": [ + "", + [ + "/aws/vendedlogs/pipes/constructs/dbspstp-test-dlqtest-dbs-pipes-states-constructPipesLog-", + { + "Fn::Select": [ + 2, + { + "Fn::Split": [ + "/", + { + "Ref": "AWS::StackId" + } + ] + } + ] + } + ] + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_logs.LogGroup", + "version": "2.163.1" + } + }, + "pipe-test-dbs-pipes-states-construct": { + "id": "pipe-test-dbs-pipes-states-construct", + "path": "dbspstp-test-dlq/test-dbs-pipes-states-construct/pipe-test-dbs-pipes-states-construct", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Pipes::Pipe", + "aws:cdk:cloudformation:props": { + "enrichment": { + "Fn::GetAtt": [ + "badfunction3559C0E9", + "Arn" + ] + }, + "logConfiguration": { + "cloudwatchLogsLogDestination": { + "logGroupArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructLogGrouptestdbspipesstatesconstructAB6BC73F", + "Arn" + ] + } + }, + "level": "TRACE" + }, + "roleArn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructPipeRoletestdbspipesstatesconstruct4E57732C", + "Arn" + ] + }, + "source": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructDynamoTable5457FA02", + "StreamArn" + ] + }, + "sourceParameters": { + "dynamoDbStreamParameters": { + "maximumRecordAgeInSeconds": 60, + "maximumRetryAttempts": 1, + "startingPosition": "LATEST", + "deadLetterConfig": { + "arn": { + "Fn::GetAtt": [ + "testdbspipesstatesconstructdlqF765E6A0", + "Arn" + ] + } + } + } + }, + "target": { + "Ref": "testdbspipesstatesconstructStateMachine9909327F" + }, + "targetParameters": { + "stepFunctionStateMachineParameters": { + "invocationType": "FIRE_AND_FORGET" + } + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_pipes.CfnPipe", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions.DynamoDBStreamsToPipesToStepfunctions", + "version": "2.74.0" + } + }, + "Integ": { + "id": "Integ", + "path": "dbspstp-test-dlq/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "dbspstp-test-dlq/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "dbspstp-test-dlq/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "dbspstp-test-dlq/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-test-dlq/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-test-dlq/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "dbspstp-test-dlq/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "dbspstp-test-dlq/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.ts b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.ts new file mode 100644 index 000000000..0468d9bd5 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/integ.dbspstp-test-dlq.ts @@ -0,0 +1,54 @@ +/** + * 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. + */ + +/// !cdk-integ * +import { App, Stack } from "aws-cdk-lib"; +import { DynamoDBStreamsToPipesToStepfunctions, DynamoDBStreamsToPipesToStepfunctionsProps } from "../lib"; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; +import * as defaults from '@aws-solutions-constructs/core'; +import * as lambda from 'aws-cdk-lib/aws-lambda'; + +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); + +// This function fails ON PURPOSE so that we can test the DLQ functionality in this stack +const badFunction = new lambda.Function(stack, 'bad-function', { + code: new lambda.InlineCode('exports.handler = async (event) => { console.log(event); throw new Error("JUST BREAK");'), + runtime: lambda.Runtime.NODEJS_20_X, + handler: 'index.handler', +} +); +const props: DynamoDBStreamsToPipesToStepfunctionsProps = { + stateMachineProps: { + definitionBody: defaults.CreateTestStateMachineDefinitionBody(stack, 'dbsstp-test') + }, + enrichmentFunction: badFunction, + logLevel: defaults.PipesLogLevel.TRACE, + pipeProps: { + sourceParameters: { + dynamoDbStreamParameters: { + maximumRecordAgeInSeconds: 60, + maximumRetryAttempts: 1, + } + } + } +}; + +new DynamoDBStreamsToPipesToStepfunctions(stack, 'test-dbs-pipes-states-construct', props); + +new IntegTest(stack, 'Integ', { + testCases: [ + stack + ] +}); diff --git a/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/lambda/index.js new file mode 100644 index 000000000..68532199d --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-dynamodbstreams-pipes-stepfunctions/test/lambda/index.js @@ -0,0 +1,21 @@ +/** + * 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. + */ + +exports.handler = async (event) => { + console.log(event); + const response = event.map((x) =>{ + x.newAttrib = "content"; + return x; + }); + return response; +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisfirehose-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisfirehose-s3/package.json index 0025e9918..48c368b8e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisfirehose-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisfirehose-s3/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-kinesisfirehose-s3": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisstreams/package.json b/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisstreams/package.json index f2db824f3..de5737b5f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisstreams/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-kinesisstreams/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/README.md index 478f2cc1d..bb0b0af4c 100755 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/README.md @@ -34,7 +34,7 @@ import * as events from 'aws-cdk-lib/aws-events'; const constructProps: EventbridgeToLambdaProps = { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, eventRuleProps: { @@ -59,7 +59,7 @@ from constructs import Construct EventbridgeToLambda(self, 'test-eventbridge-lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), event_rule_props=events.RuleProps( @@ -83,7 +83,7 @@ import software.amazon.awsconstructs.services.eventbridgelambda.*; new EventbridgeToLambda(this, "test-eventbridge-lambda", new EventbridgeToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/package.json index cb2fc6191..0c83a0e84 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-sns/package.json b/source/patterns/@aws-solutions-constructs/aws-eventbridge-sns/package.json index 4c2932dda..d6fdae438 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-sns/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-sns/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-eventbridge-sqs/package.json index d97c47073..203565b0c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-sqs/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/package.json b/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/package.json index bfef146ab..f7fda141e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-eventbridge-stepfunctions/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-dynamodb/package.json index b72a6f471..dda610ec4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-dynamodb/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-eventbridge/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-eventbridge/package.json index c0c09fb1a..a3d42f1c2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-eventbridge/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-eventbridge/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisfirehose/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisfirehose/package.json index c19b294ef..82cd5dd7e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisfirehose/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisfirehose/package.json @@ -53,17 +53,15 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-kinesisfirehose-s3": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", - "aws-cdk-lib": "0.0.0", - "constructs": "^10.0.0" + "constructs": "^10.0.0", + "aws-cdk-lib": "0.0.0" }, "jest": { "moduleFileExtensions": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisstreams/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisstreams/package.json index 9ab67c548..785b2014c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisstreams/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-kinesisstreams/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-opensearch/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-opensearch/package.json index aba97c7de..1886faff2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-opensearch/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-opensearch/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-s3/package.json index 36e5b63a6..d5a0c1075 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-s3/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-secretsmanager/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-secretsmanager/package.json index f29ff6624..3d2cea85b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-secretsmanager/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-secretsmanager/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-sns/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-sns/package.json index ce7cc6709..4c097008b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-sns/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-sns/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-sqs/package.json index 1f4339b6e..ea69a8a86 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-sqs/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-ssmstringparameter/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-ssmstringparameter/package.json index 479916930..28bef3363 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-ssmstringparameter/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-ssmstringparameter/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", - "@aws-solutions-constructs/core": "0.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-fargate-stepfunctions/package.json b/source/patterns/@aws-solutions-constructs/aws-fargate-stepfunctions/package.json index f973ca845..8d590f677 100644 --- a/source/patterns/@aws-solutions-constructs/aws-fargate-stepfunctions/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-fargate-stepfunctions/package.json @@ -53,13 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@aws-solutions-constructs/core": "0.0.0", - "@types/jest": "^26.0.22", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json index 8c7ee7995..fe4c625be 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-kinesisfirehose-s3/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-kinesisfirehose-s3": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-kinesisstreams/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-kinesisstreams/package.json index c23617851..11f5f902a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-kinesisstreams/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-kinesisstreams/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/README.md b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/README.md index df66209e9..67d740c75 100755 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/README.md @@ -37,7 +37,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const constructProps: IotToLambdaToDynamoDBProps = { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, iotTopicRuleProps: { @@ -66,7 +66,7 @@ from constructs import Construct IotToLambdaToDynamoDB(self, 'test-iot-lambda-dynamodb-stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), iot_topic_rule_props=iot.CfnTopicRuleProps( @@ -94,7 +94,7 @@ import software.amazon.awsconstructs.services.iotlambdadynamodb.*; new IotToLambdaToDynamoDB(this, "test-iot-lambda-dynamodb-stack", new IotToLambdaToDynamoDBProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json index ed11978f1..83b1d0945 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/package.json @@ -53,14 +53,13 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-iot-lambda": "0.0.0", "@aws-solutions-constructs/aws-lambda-dynamodb": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda-dynamodb/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/README.md index a56988567..df15c379b 100755 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/README.md @@ -37,7 +37,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const constructProps: IotToLambdaProps = { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, iotTopicRuleProps: { @@ -66,7 +66,7 @@ from constructs import Construct IotToLambda(self, 'test_iot_lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), iot_topic_rule_props=iot.CfnTopicRuleProps( @@ -94,7 +94,7 @@ import software.amazon.awsconstructs.services.iotlambda.*; new IotToLambda(this, "test-iot-lambda-integration", new IotToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json index 7ee06471e..4b6f93e9c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-iot-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-s3/package.json index ccd311345..1005d44fc 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-s3/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-iot-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-iot-sqs/package.json index 9b35af18d..b6b62fb1e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-iot-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-iot-sqs/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json index 74bab896b..510e593ce 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisfirehose-s3/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-gluejob/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-gluejob/package.json index 6d82a3111..f2356d88e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-gluejob/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-gluejob/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3/package.json index ead487efd..f48d2f091 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-kinesisfirehose-s3/package.json @@ -53,14 +53,13 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-kinesisfirehose-s3": "0.0.0", "@aws-solutions-constructs/aws-kinesisstreams-lambda": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/README.md index 1f2b63a03..10e15bad7 100755 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/README.md @@ -36,7 +36,7 @@ new KinesisStreamsToLambda(this, 'KinesisToLambdaPattern', { batchSize: 1 }, lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -60,7 +60,7 @@ KinesisStreamsToLambda(self, 'KinesisToLambdaPattern', batch_size=1 ), lambda_function_props=_lambda.FunctionProps( - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler', code=_lambda.Code.from_asset( 'lambda') @@ -86,7 +86,7 @@ new KinesisStreamsToLambda(this, "KinesisToLambdaPattern", new KinesisStreamsToL .batchSize(1) .build()) .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json index 35ba5aea8..f57aeba0f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-kinesisstreams-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/README.md index 4e1c2e62e..c9375944f 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/README.md @@ -33,7 +33,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const constructProps: LambdaToDynamoDBProps = { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, }; @@ -54,7 +54,7 @@ LambdaToDynamoDB(self, 'test_lambda_dynamodb_stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset( 'lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' )) ``` @@ -71,7 +71,7 @@ import software.amazon.awsconstructs.services.lambdadynamodb.*; new LambdaToDynamoDB(this, "test_lambda_dynamodb_stack", new LambdaToDynamoDBProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json index a47428dba..3ded0de9b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda/index.js index 743e4fdbb..44a0a9467 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-dynamodb/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/README.md index 67ff61b56..03c815e8e 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToElasticachememcached(this, 'LambdaToElasticachememcachedPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -51,7 +51,7 @@ from constructs import Construct LambdaToElasticachememcached(self, 'LambdaToCachePattern', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -69,7 +69,7 @@ import software.amazon.awsconstructs.services.lambdaelasticachememcached.*; new LambdaToElasticachememcached(this, "LambdaToCachePattern", new LambdaToElasticachememcachedProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/package.json index 470fca0ba..a940df3f9 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/test/lambda/index.js index 93b955782..670c20ce8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticachememcached/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function (event) { console.log(`request:${JSON.stringify(event, undefined, 2)}`); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/README.md index 972d3818c..1df0b92b2 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/README.md @@ -43,7 +43,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda"; const lambdaProps: lambda.FunctionProps = { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }; @@ -67,7 +67,7 @@ from constructs import Construct lambda_props = _lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) @@ -93,7 +93,7 @@ import software.amazon.awsconstructs.services.lambdaelasticsearchkibana.*; new LambdaToElasticSearchAndKibana(this, "sample", new LambdaToElasticSearchAndKibanaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json index c4b79ec22..cfceb99d4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/test/lambda/index.js index 5362a2cd1..414e0b959 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-elasticsearch-kibana/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + var AWS = require('aws-sdk'); var path = require('path'); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/README.md index aa6663b1e..8dffc8aca 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/README.md @@ -36,7 +36,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToEventbridge(this, 'LambdaToEventbridgePattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -55,7 +55,7 @@ from constructs import Construct LambdaToEventbridge(self, 'LambdaToEventbridgePattern', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -73,7 +73,7 @@ import software.amazon.awsconstructs.services.lambdaeventbridge.*; new LambdaToEventbridge(this, "LambdaToEventbridgePattern", new LambdaToEventbridgeProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/package.json index 032dc1fc9..917f3a49b 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-eventbridge/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/README.md index 03992a347..ec8a573a4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/README.md @@ -36,7 +36,7 @@ import * as s3 from "aws-cdk-lib/aws-s3"; const lambdaProps: lambda.FunctionProps = { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_18_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }; diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/package.json index a34ee0035..cd0cda92d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/package.json @@ -49,12 +49,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "aws-cdk-lib": "0.0.0", "@aws-solutions-constructs/core": "0.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/test/lambda/index.js index 3c81710ce..297328cfd 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kendra/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/README.md index 90356dc65..a587afe75 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/README.md @@ -36,7 +36,7 @@ const existingFirehoseDeliveryStream = previouslyCreatedKinesisFirehoseToS3Const new LambdaToKinesisFirehose(this, 'LambdaToFirehosePattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) }, @@ -61,7 +61,7 @@ LambdaToKinesisFirehose(self, 'LambdaToFirehosePattern', existingKinesisFirehose=existingFirehoseDeliveryStream, lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -84,7 +84,7 @@ existingFirehoseDeliveryStream = previouslyCreatedKinesisFirehoseToS3Construct.k new LambdaToKinesisFirehose(this, "LambdaToFirehosePattern", new LambdaToKinesisFirehoseProps.Builder() .existingKinesisFirehose(existingFirehoseDeliveryStream) .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/package.json index 75cbe4347..b7f913b4c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisfirehose/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-kinesisfirehose-s3": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/README.md index ac642e0af..cb86ebd2b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToKinesisStreams(this, 'LambdaToKinesisStreams', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_18_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -51,7 +51,7 @@ from constructs import Construct LambdaToKinesisStreams(self, 'LambdaToKinesisStreams', lambda_function_props=_lambda.FunctionProps( - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler', code=_lambda.Code.from_asset('lambda') ) @@ -71,7 +71,7 @@ import software.amazon.awsconstructs.services.lambdakinesisstreams.*; new LambdaToKinesisStreams(this, "LambdaToKinesisStreams", new LambdaToKinesisStreamsProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_18_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/package.json index 18a0af34c..017cf129f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-kinesisstreams/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/README.md index 6a6a4349a..9cde2a468 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/README.md @@ -36,7 +36,7 @@ import * as lambda from "aws-cdk-lib/aws-lambda"; const lambdaProps: lambda.FunctionProps = { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }; @@ -60,7 +60,7 @@ from constructs import Construct lambda_props = _lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) @@ -86,7 +86,7 @@ import software.amazon.awsconstructs.services.lambdaopensearch.*; new LambdaToOpenSearch(this, "sample", new LambdaToOpenSearchProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/package.json index 4465cb5f9..26d47df04 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/test/lambda/index.js index 77e37ea45..e59c6e167 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-opensearch/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + var AWS = require('aws-sdk'); var path = require('path'); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/README.md index 40a8fa9d6..22fe40683 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToS3(this, 'LambdaToS3Pattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -51,7 +51,7 @@ from constructs import Construct LambdaToS3(self, 'LambdaToS3Pattern', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -69,7 +69,7 @@ import software.amazon.awsconstructs.services.lambdas3.*; new LambdaToS3(this, "LambdaToS3Pattern", new LambdaToS3Props.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json index 58c1d92bd..f41628c47 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-s3/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/README.md index 4320a0cae..7cf822589 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/README.md @@ -80,7 +80,7 @@ LambdaToSagemakerEndpoint( ), lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler', timeout=Duration.minutes(5), memory_size=128 @@ -109,7 +109,7 @@ new LambdaToSagemakerEndpoint(this, "LambdaToSagemakerEndpointPattern", .executionRoleArn("executionRoleArn") .build()) .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .timeout(Duration.minutes(5)) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/package.json index 366dde6ae..df203f0c8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sagemakerendpoint/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/README.md index 9ed75c85b..b09c87250 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/README.md @@ -36,7 +36,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const constructProps: LambdaToSecretsmanagerProps = { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, code: lambda.Code.fromAsset(`lambda`), handler: 'index.handler' }, @@ -59,7 +59,7 @@ LambdaToSecretsmanager( self, 'test-lambda-secretsmanager-stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -77,7 +77,7 @@ import software.amazon.awsconstructs.services.lambdasecretsmanager.*; new LambdaToSecretsmanager(this, "test-lambda-secretsmanager-stack", new LambdaToSecretsmanagerProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/package.json index d3aedfb48..3d327cb99 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^24.0.23", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda/index.js index 743e4fdbb..44a0a9467 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-secretsmanager/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md index 44f691972..b972e57f4 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToSns(this, 'test-lambda-sns', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -52,7 +52,7 @@ LambdaToSns( self, 'test-lambda-sns-stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -70,7 +70,7 @@ import software.amazon.awsconstructs.services.lambdasns.*; new LambdaToSns(this, "test-lambda-sns-stack", new LambdaToSnsProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json index 657349d42..3fca82323 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sns/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md index 4a8ca705b..14247efc1 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/README.md @@ -36,12 +36,12 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToSqsToLambda(this, 'LambdaToSqsToLambdaPattern', { producerLambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`producer-lambda`) }, consumerLambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`consumer-lambda`) } @@ -61,12 +61,12 @@ LambdaToSqsToLambda( self, 'LambdaToSqsToLambdaPattern', producer_lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('producer_lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), consumer_lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('consumer_lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -84,12 +84,12 @@ import software.amazon.awsconstructs.services.lambdasqslambda.*; new LambdaToSqsToLambda(this, "LambdaToSqsToLambdaPattern", new LambdaToSqsToLambdaProps.Builder() .producerLambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("producer-lambda")) .handler("index.handler") .build()) .consumerLambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("consumer-lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json index b687ec3ee..799d918dd 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs-lambda/package.json @@ -53,14 +53,13 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-lambda-sqs": "0.0.0", "@aws-solutions-constructs/aws-sqs-lambda": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md index ce9e3dbbf..e569138fb 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new LambdaToSqs(this, 'LambdaToSqsPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -52,7 +52,7 @@ LambdaToSqs( self, 'test-lambda-sqs-stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -70,7 +70,7 @@ import software.amazon.awsconstructs.services.lambdasqs.*; new LambdaToSqs(this, "test-lambda-sqs-stack", new LambdaToSqsProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json index f6b206f82..224e81432 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-sqs/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md index d360c0e7a..45ac79865 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/README.md @@ -36,7 +36,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; const constructProps: LambdaToSsmstringparameterProps = { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, code: lambda.Code.fromAsset(`lambda`), handler: 'index.handler' }, @@ -60,7 +60,7 @@ LambdaToSsmstringparameter( self, 'test-lambda-ssmstringparameter-stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), string_parameter_props=ssm.StringParameterProps( @@ -82,7 +82,7 @@ import software.amazon.awsconstructs.services.lambdassmstringparameter.*; new LambdaToSsmstringparameter(this, "test-lambda-ssmstringparameter-stack", new LambdaToSsmstringparameterProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json index 43ed15e8b..fc1f41b83 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^24.0.23", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda/index.js index 743e4fdbb..44a0a9467 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-ssmstringparameter/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/README.md b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/README.md index 7d8b983fe..bbf5ae402 100755 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/README.md @@ -35,7 +35,7 @@ const startState = new stepfunctions.Pass(this, 'StartState'); new LambdaToStepfunctions(this, 'LambdaToStepfunctionsPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) }, @@ -61,7 +61,7 @@ LambdaToStepfunctions( self, 'test-lambda-stepfunctions-stack', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ), state_machine_props=stepfunctions.StateMachineProps( @@ -85,7 +85,7 @@ final Pass startState = new Pass(this, "StartState"); new LambdaToStepfunctions(this, "test-lambda-stepfunctions-stack", new LambdaToStepfunctionsProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/package.json b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/package.json index 9fc5b67d9..89b0bb6ae 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "eslint-plugin-import": "^2.22.0", "constructs": "^10.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda-task/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda-task/index.js index 6d9bf9c3a..1a432c40d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda-task/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda-task/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async event => { // Log the event argument for debugging and for use in local development. console.log(JSON.stringify(event, undefined, 2)); diff --git a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda/index.js index 2a786d862..8d2499730 100644 --- a/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-lambda-stepfunctions/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + const aws = require('aws-sdk'); console.log('Loading function'); diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/README.md index 8d8b4a8d3..e4f7a1ff0 100755 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/README.md @@ -45,7 +45,7 @@ new OpenApiGatewayToLambda(this, 'OpenApiGatewayToLambda', { { id: 'MessagesHandler', lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_18_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/messages-lambda`), } @@ -72,7 +72,7 @@ class TestStack(Stack): api_definition_asset = s3_assets.Asset(self, "ApiDefinitionAsset", path="./openapi/apiDefinition.yaml") api_integration = ApiIntegration(id="MessagesHandler", lambda_function_props={ - "runtime": lambda_.Runtime.NODEJS_18_X, + "runtime": lambda_.Runtime.NODEJS_20_X, "handler": "index.handler", "code": lambda_.Code.from_asset("./messages-lambda") }) @@ -99,14 +99,14 @@ import software.amazon.awscdk.StackProps; import java.util.Collections; -import static software.amazon.awscdk.services.lambda.Runtime.NODEJS_18_X; +import static software.amazon.awscdk.services.lambda.Runtime.NODEJS_20_X; final Asset apiDefinitionAsset = new Asset(this, "ApiDefinition", AssetProps.builder().path("openapi/apiDefinition.yaml").build()); final ApiIntegration apiIntegration = ApiIntegration.builder() .id("MessagesHandler") .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(NODEJS_18_X) + .runtime(NODEJS_20_X) .code(Code.fromAsset("messages-lambda")) .handler("index.handler") .build()) @@ -149,7 +149,7 @@ const apiIntegrations: ApiIntegration[] = [ { id: 'MessagesHandler', lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_18_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/messages-lambda`), } @@ -157,7 +157,7 @@ const apiIntegrations: ApiIntegration[] = [ { id: 'PhotosHandler', existingLambdaObj: new lambda.Function(this, 'PhotosLambda', { - runtime: lambda.Runtime.NODEJS_18_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`${__dirname}/photos-lambda`), }) diff --git a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/package.json index 76c5d0014..1454cd546 100644 --- a/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-openapigateway-lambda/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/resources": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "@aws-sdk/client-s3": "^3.0.0", "@types/aws-lambda": "^8.0.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-route53-alb/package.json b/source/patterns/@aws-solutions-constructs/aws-route53-alb/package.json index 30cb028e5..bdea8ffad 100644 --- a/source/patterns/@aws-solutions-constructs/aws-route53-alb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-route53-alb/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0", "@types/node": "^10.3.0", diff --git a/source/patterns/@aws-solutions-constructs/aws-route53-apigateway/package.json b/source/patterns/@aws-solutions-constructs/aws-route53-apigateway/package.json index 4381fe603..6700ac06f 100755 --- a/source/patterns/@aws-solutions-constructs/aws-route53-apigateway/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-route53-apigateway/package.json @@ -53,14 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^26.0.22", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", - "prettier": "^2.5.1", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" }, diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/README.md index 56ae1f980..96c086153 100755 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/README.md @@ -33,7 +33,7 @@ import { S3ToLambdaProps, S3ToLambda } from '@aws-solutions-constructs/aws-s3-la new S3ToLambda(this, 'test-s3-lambda', { lambdaFunctionProps: { code: lambda.Code.fromAsset(`lambda`), - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler' }, }); @@ -51,7 +51,7 @@ from constructs import Construct S3ToLambda(self, 'test_s3_lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -70,7 +70,7 @@ import software.amazon.awsconstructs.services.s3lambda.*; new S3ToLambda(this, "test-s3-lambda'", new S3ToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json index e6b6a8e39..4bbcbb9ba 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/integ.json index e511f4bbb..04d7e6f46 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3lam-existing-s3-bucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/manifest.json index 583415f78..2bf0db277 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3lamexistings3bucketIntegDefaultTestDeployAssert7738D7BA.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3lamexistings3bucketIntegDefaultTestDeployAssert7738D7BA.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": "s3lam-existing-s3-bucket.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}/b1c9809625e97eb91957892b468c8d62285613da64b2e793b50991d0724fbc10.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/0e4a155a5ef57a3a6562cc65a3368ae5b85899cda9582d4888595db33285e72c.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.assets.json index c7993b3e9..62f1beefb 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -27,7 +27,7 @@ } } }, - "b1c9809625e97eb91957892b468c8d62285613da64b2e793b50991d0724fbc10": { + "0e4a155a5ef57a3a6562cc65a3368ae5b85899cda9582d4888595db33285e72c": { "source": { "path": "s3lam-existing-s3-bucket.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "b1c9809625e97eb91957892b468c8d62285613da64b2e793b50991d0724fbc10.json", + "objectKey": "0e4a155a5ef57a3a6562cc65a3368ae5b85899cda9582d4888595db33285e72c.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-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.template.json index f05dce7b8..de8b18eab 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lam-existing-s3-bucket.template.json @@ -664,7 +664,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lamexistings3bucketIntegDefaultTestDeployAssert7738D7BA.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lamexistings3bucketIntegDefaultTestDeployAssert7738D7BA.assets.json index 3f2bdd12d..5bc6fd7d2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lamexistings3bucketIntegDefaultTestDeployAssert7738D7BA.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/s3lamexistings3bucketIntegDefaultTestDeployAssert7738D7BA.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/tree.json index 4621fb266..47d3ee69f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.js.snapshot/tree.json @@ -40,7 +40,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -174,13 +174,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -192,19 +192,19 @@ "path": "s3lam-existing-s3-bucket/scrapBucketLog/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "LatestNodeRuntimeMap": { @@ -212,7 +212,7 @@ "path": "s3lam-existing-s3-bucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -224,7 +224,7 @@ "path": "s3lam-existing-s3-bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -232,7 +232,7 @@ "path": "s3lam-existing-s3-bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -240,13 +240,13 @@ "path": "s3lam-existing-s3-bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "scrapBucket": { @@ -286,7 +286,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -384,13 +384,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -402,13 +402,13 @@ "path": "s3lam-existing-s3-bucket/scrapBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -420,13 +420,13 @@ "path": "s3lam-existing-s3-bucket/scrapBucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "AllowBucketNotificationsTos3lamexistings3buckettests3lambdaLambdaFunctionCA1AFC4C": { @@ -456,13 +456,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-lambda": { @@ -478,7 +478,7 @@ "path": "s3lam-existing-s3-bucket/test-s3-lambda/LambdaFunctionServiceRole/ImportLambdaFunctionServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -541,7 +541,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -577,19 +577,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "LambdaFunction": { @@ -605,7 +605,7 @@ "path": "s3lam-existing-s3-bucket/test-s3-lambda/LambdaFunction/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "AssetBucket": { @@ -613,13 +613,13 @@ "path": "s3lam-existing-s3-bucket/test-s3-lambda/LambdaFunction/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -654,19 +654,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-lambda.S3ToLambda", - "version": "2.67.1" + "version": "2.74.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -682,7 +682,7 @@ "path": "s3lam-existing-s3-bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -721,7 +721,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -754,19 +754,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -774,13 +774,13 @@ "path": "s3lam-existing-s3-bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -796,7 +796,7 @@ "path": "s3lam-existing-s3-bucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -808,7 +808,7 @@ "path": "s3lam-existing-s3-bucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -816,25 +816,25 @@ "path": "s3lam-existing-s3-bucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -842,7 +842,7 @@ "path": "s3lam-existing-s3-bucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -850,13 +850,13 @@ "path": "s3lam-existing-s3-bucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -864,13 +864,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.ts index 57d831cde..ae21ea523 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-existing-s3-bucket.ts @@ -20,7 +20,11 @@ import { generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as defaults from '@aws-solutions-constructs/core'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); // Empty arguments const stack = new Stack(app, generateIntegStackName(__filename)); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/integ.json index fbea9b4fb..ba403c001 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3lam-no-arguments/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/manifest.json index e7ae73589..760fa93ed 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3lamnoargumentsIntegDefaultTestDeployAssert35992089.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3lamnoargumentsIntegDefaultTestDeployAssert35992089.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": "s3lam-no-arguments.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}/90bdcd24f3061e9c3c899d59c1acd15eeef4aacc3e632dbbc0bd627f8b773027.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/55e25a4ebe8fb5623cbde9a9a645f250c21e03ef58766bf2bdcd9fa304c4bcfc.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.assets.json index 74d1b3f40..66e0dca84 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "0c3255e93ffe7a906c7422e9f0e9cc4c7fd86ee996ee3bb302e2f134b38463c8": { "source": { @@ -27,7 +27,7 @@ } } }, - "90bdcd24f3061e9c3c899d59c1acd15eeef4aacc3e632dbbc0bd627f8b773027": { + "55e25a4ebe8fb5623cbde9a9a645f250c21e03ef58766bf2bdcd9fa304c4bcfc": { "source": { "path": "s3lam-no-arguments.template.json", "packaging": "file" @@ -35,7 +35,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "90bdcd24f3061e9c3c899d59c1acd15eeef4aacc3e632dbbc0bd627f8b773027.json", + "objectKey": "55e25a4ebe8fb5623cbde9a9a645f250c21e03ef58766bf2bdcd9fa304c4bcfc.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-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.template.json index 5cf7e9661..9fb1103b2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lam-no-arguments.template.json @@ -635,7 +635,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lamnoargumentsIntegDefaultTestDeployAssert35992089.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lamnoargumentsIntegDefaultTestDeployAssert35992089.assets.json index 0f5a614da..fc6f41b5b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lamnoargumentsIntegDefaultTestDeployAssert35992089.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/s3lamnoargumentsIntegDefaultTestDeployAssert35992089.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/tree.json index 8f4e6f342..2d03793d6 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.js.snapshot/tree.json @@ -21,7 +21,7 @@ "path": "s3lam-no-arguments/test-s3-lambda/LambdaFunctionServiceRole/ImportLambdaFunctionServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -84,7 +84,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -120,19 +120,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "LambdaFunction": { @@ -148,7 +148,7 @@ "path": "s3lam-no-arguments/test-s3-lambda/LambdaFunction/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "AssetBucket": { @@ -156,13 +156,13 @@ "path": "s3lam-no-arguments/test-s3-lambda/LambdaFunction/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -197,13 +197,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.162.0" } }, "S3LoggingBucket": { @@ -244,7 +244,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -378,13 +378,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -396,19 +396,19 @@ "path": "s3lam-no-arguments/test-s3-lambda/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -461,7 +461,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -520,13 +520,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -538,13 +538,13 @@ "path": "s3lam-no-arguments/test-s3-lambda/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "AllowBucketNotificationsTos3lamnoargumentstests3lambdaLambdaFunction7F4DB5A1": { @@ -574,19 +574,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnPermission", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-lambda.S3ToLambda", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -594,7 +594,7 @@ "path": "s3lam-no-arguments/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -606,7 +606,7 @@ "path": "s3lam-no-arguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -614,7 +614,7 @@ "path": "s3lam-no-arguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -622,13 +622,13 @@ "path": "s3lam-no-arguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -644,7 +644,7 @@ "path": "s3lam-no-arguments/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -683,7 +683,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -716,19 +716,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -736,13 +736,13 @@ "path": "s3lam-no-arguments/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -758,7 +758,7 @@ "path": "s3lam-no-arguments/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -770,7 +770,7 @@ "path": "s3lam-no-arguments/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -778,25 +778,25 @@ "path": "s3lam-no-arguments/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -804,7 +804,7 @@ "path": "s3lam-no-arguments/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -812,13 +812,13 @@ "path": "s3lam-no-arguments/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -826,13 +826,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.ts b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.ts index 565303813..5f80adfe0 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/integ.s3lam-no-arguments.ts @@ -20,7 +20,11 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as s3 from "aws-cdk-lib/aws-s3"; import * as defaults from '@aws-solutions-constructs/core'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); // Empty arguments const stack = new Stack(app, generateIntegStackName(__filename)); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/lambda/index.js index 743e4fdbb..44a0a9467 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-s3-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/package.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/package.json index fed458deb..b813b6e2a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/integ.json index 8e1b62fd4..6b495f1fa 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-customLoggingBucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/manifest.json index cb6dd0f6f..57f61c61d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snscustomLoggingBucketIntegDefaultTestDeployAssert43459459.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snscustomLoggingBucketIntegDefaultTestDeployAssert43459459.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": "s3sns-customLoggingBucket.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}/5e3169018ced6a35b8e4cfc058da84b8b45a74be4e31725e2e0bc4e6da7f281e.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2bc8673f04e737049f3b90445909556674198662f9e118971f49fc4831535cf7.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.assets.json index 3276f359d..6379d1e92 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "5e3169018ced6a35b8e4cfc058da84b8b45a74be4e31725e2e0bc4e6da7f281e": { + "2bc8673f04e737049f3b90445909556674198662f9e118971f49fc4831535cf7": { "source": { "path": "s3sns-customLoggingBucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "5e3169018ced6a35b8e4cfc058da84b8b45a74be4e31725e2e0bc4e6da7f281e.json", + "objectKey": "2bc8673f04e737049f3b90445909556674198662f9e118971f49fc4831535cf7.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-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.template.json index 267698f16..b6c7da7a2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3sns-customLoggingBucket.template.json @@ -632,7 +632,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3snscustomLoggingBucketIntegDefaultTestDeployAssert43459459.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3snscustomLoggingBucketIntegDefaultTestDeployAssert43459459.assets.json index f0bb8cc93..e5ae33b7c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3snscustomLoggingBucketIntegDefaultTestDeployAssert43459459.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/s3snscustomLoggingBucketIntegDefaultTestDeployAssert43459459.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/tree.json index b271d0610..56bec0367 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.js.snapshot/tree.json @@ -63,7 +63,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -197,13 +197,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -215,19 +215,19 @@ "path": "s3sns-customLoggingBucket/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -280,7 +280,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -339,13 +339,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -357,19 +357,19 @@ "path": "s3sns-customLoggingBucket/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "'test-s3-snsKey'": { @@ -426,13 +426,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -455,7 +455,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -572,25 +572,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -598,7 +598,7 @@ "path": "s3sns-customLoggingBucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -610,7 +610,7 @@ "path": "s3sns-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -618,7 +618,7 @@ "path": "s3sns-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -626,13 +626,13 @@ "path": "s3sns-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -648,7 +648,7 @@ "path": "s3sns-customLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -687,7 +687,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -720,19 +720,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -740,13 +740,13 @@ "path": "s3sns-customLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -762,7 +762,7 @@ "path": "s3sns-customLoggingBucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -774,7 +774,7 @@ "path": "s3sns-customLoggingBucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -782,25 +782,25 @@ "path": "s3sns-customLoggingBucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -808,7 +808,7 @@ "path": "s3sns-customLoggingBucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -816,13 +816,13 @@ "path": "s3sns-customLoggingBucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -830,13 +830,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.ts index 1cd69deda..17ed8682d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-customLoggingBucket.ts @@ -18,7 +18,11 @@ import { S3ToSns } from "../lib"; import { generateIntegStackName, suppressCustomHandlerCfnNagWarnings } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); new S3ToSns(stack, 'test-s3-sns', { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/integ.json index 46899fab3..390c5d9e2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-existingS3Bucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/manifest.json index 18aa5579a..006559063 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snsexistingS3BucketIntegDefaultTestDeployAssert53691ABE.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snsexistingS3BucketIntegDefaultTestDeployAssert53691ABE.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": "s3sns-existingS3Bucket.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}/62db6396b66beee98da758accf978d0d029032aab71918bd5cd669cec973748d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/badea1426a1d5236c39dadde042536c682c43c5aabe5334e27151334e55822ed.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.assets.json index 3e89676a9..13a4984a2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "62db6396b66beee98da758accf978d0d029032aab71918bd5cd669cec973748d": { + "badea1426a1d5236c39dadde042536c682c43c5aabe5334e27151334e55822ed": { "source": { "path": "s3sns-existingS3Bucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "62db6396b66beee98da758accf978d0d029032aab71918bd5cd669cec973748d.json", + "objectKey": "badea1426a1d5236c39dadde042536c682c43c5aabe5334e27151334e55822ed.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-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.template.json index bda709bab..da18644bc 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3sns-existingS3Bucket.template.json @@ -658,7 +658,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3snsexistingS3BucketIntegDefaultTestDeployAssert53691ABE.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3snsexistingS3BucketIntegDefaultTestDeployAssert53691ABE.assets.json index 0b6b94cd6..8ebedafb4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3snsexistingS3BucketIntegDefaultTestDeployAssert53691ABE.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/s3snsexistingS3BucketIntegDefaultTestDeployAssert53691ABE.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/tree.json index 5474c3ed0..b223480ba 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.js.snapshot/tree.json @@ -40,7 +40,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -174,13 +174,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -192,19 +192,19 @@ "path": "s3sns-existingS3Bucket/scrapBucketLog/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "LatestNodeRuntimeMap": { @@ -212,7 +212,7 @@ "path": "s3sns-existingS3Bucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -224,7 +224,7 @@ "path": "s3sns-existingS3Bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -232,7 +232,7 @@ "path": "s3sns-existingS3Bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -240,13 +240,13 @@ "path": "s3sns-existingS3Bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "scrapBucket": { @@ -286,7 +286,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -384,13 +384,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -402,13 +402,13 @@ "path": "s3sns-existingS3Bucket/scrapBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -420,19 +420,19 @@ "path": "s3sns-existingS3Bucket/scrapBucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sns": { @@ -493,13 +493,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -522,7 +522,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -639,25 +639,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -673,7 +673,7 @@ "path": "s3sns-existingS3Bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -712,7 +712,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -745,19 +745,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -765,13 +765,13 @@ "path": "s3sns-existingS3Bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -787,7 +787,7 @@ "path": "s3sns-existingS3Bucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -799,7 +799,7 @@ "path": "s3sns-existingS3Bucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -807,25 +807,25 @@ "path": "s3sns-existingS3Bucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -833,7 +833,7 @@ "path": "s3sns-existingS3Bucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -841,13 +841,13 @@ "path": "s3sns-existingS3Bucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -855,13 +855,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.ts index 611686dcb..85d8c0ba7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingS3Bucket.ts @@ -17,7 +17,11 @@ import { S3ToSns } from "../lib"; import { CreateScrapBucket, generateIntegStackName, suppressCustomHandlerCfnNagWarnings } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); stack.node.setContext("@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy", true); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/integ.json index ab7511c71..f3e637011 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-existingSnsTopic/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/manifest.json index 642cfcbf9..df41bf37d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snsexistingSnsTopicIntegDefaultTestDeployAssert304A22E2.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snsexistingSnsTopicIntegDefaultTestDeployAssert304A22E2.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": "s3sns-existingSnsTopic.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}/0f4471a1db887017c62f2875525740287bb06dfe346ea550e70b9133198bc6a3.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/ff97926298bf30510586b6f2826ab76fc7d4769421ffd2a08dbf374127965fa1.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.assets.json index c9682924c..c1187cb59 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "0f4471a1db887017c62f2875525740287bb06dfe346ea550e70b9133198bc6a3": { + "ff97926298bf30510586b6f2826ab76fc7d4769421ffd2a08dbf374127965fa1": { "source": { "path": "s3sns-existingSnsTopic.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "0f4471a1db887017c62f2875525740287bb06dfe346ea550e70b9133198bc6a3.json", + "objectKey": "ff97926298bf30510586b6f2826ab76fc7d4769421ffd2a08dbf374127965fa1.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-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.template.json index 32b93fd65..86df88e84 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3sns-existingSnsTopic.template.json @@ -683,7 +683,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3snsexistingSnsTopicIntegDefaultTestDeployAssert304A22E2.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3snsexistingSnsTopicIntegDefaultTestDeployAssert304A22E2.assets.json index 728d7aa4e..40c96fbdf 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3snsexistingSnsTopicIntegDefaultTestDeployAssert304A22E2.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/s3snsexistingSnsTopicIntegDefaultTestDeployAssert304A22E2.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/tree.json index d6c730b9d..25aa5491d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.js.snapshot/tree.json @@ -62,13 +62,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -91,7 +91,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -208,19 +208,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sns": { @@ -265,7 +265,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -399,13 +399,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -417,19 +417,19 @@ "path": "s3sns-existingSnsTopic/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -488,7 +488,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -586,13 +586,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -604,13 +604,13 @@ "path": "s3sns-existingSnsTopic/test-s3-sns/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -622,25 +622,25 @@ "path": "s3sns-existingSnsTopic/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -648,7 +648,7 @@ "path": "s3sns-existingSnsTopic/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -660,7 +660,7 @@ "path": "s3sns-existingSnsTopic/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -668,7 +668,7 @@ "path": "s3sns-existingSnsTopic/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -676,13 +676,13 @@ "path": "s3sns-existingSnsTopic/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -698,7 +698,7 @@ "path": "s3sns-existingSnsTopic/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -737,7 +737,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -770,19 +770,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -790,13 +790,13 @@ "path": "s3sns-existingSnsTopic/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -812,7 +812,7 @@ "path": "s3sns-existingSnsTopic/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -824,7 +824,7 @@ "path": "s3sns-existingSnsTopic/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -832,25 +832,25 @@ "path": "s3sns-existingSnsTopic/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -858,7 +858,7 @@ "path": "s3sns-existingSnsTopic/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -866,13 +866,13 @@ "path": "s3sns-existingSnsTopic/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -880,13 +880,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.ts index 0ea36879a..e33364804 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingSnsTopic.ts @@ -18,7 +18,11 @@ import { generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as defaults from '@aws-solutions-constructs/core'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); const existingTopicEncryptionKey = defaults.buildEncryptionKey(stack, 'test', {}); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/integ.json index 0240e0964..22fd8b9c3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-existingUnencryptedSnsTopic/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/manifest.json index 53627461c..2c79630a0 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snsexistingUnencryptedSnsTopicIntegDefaultTestDeployAssertC680C0D6.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snsexistingUnencryptedSnsTopicIntegDefaultTestDeployAssertC680C0D6.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": "s3sns-existingUnencryptedSnsTopic.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}/bbbf317f8402a0d9664c734f1689aea7ce98b3a74171e30fc620bbf2f18298c9.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/787479876ab3f199c7d2c75284e5cbe9c4300bd6ec984384eda3ca2296ba7346.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.assets.json index 286a3bd0b..dcf86e92e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "bbbf317f8402a0d9664c734f1689aea7ce98b3a74171e30fc620bbf2f18298c9": { + "787479876ab3f199c7d2c75284e5cbe9c4300bd6ec984384eda3ca2296ba7346": { "source": { "path": "s3sns-existingUnencryptedSnsTopic.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "bbbf317f8402a0d9664c734f1689aea7ce98b3a74171e30fc620bbf2f18298c9.json", + "objectKey": "787479876ab3f199c7d2c75284e5cbe9c4300bd6ec984384eda3ca2296ba7346.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-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.template.json index 34acf0582..b562a426c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3sns-existingUnencryptedSnsTopic.template.json @@ -569,7 +569,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3snsexistingUnencryptedSnsTopicIntegDefaultTestDeployAssertC680C0D6.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3snsexistingUnencryptedSnsTopicIntegDefaultTestDeployAssertC680C0D6.assets.json index f95df5b23..1812e6e76 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3snsexistingUnencryptedSnsTopicIntegDefaultTestDeployAssertC680C0D6.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/s3snsexistingUnencryptedSnsTopicIntegDefaultTestDeployAssertC680C0D6.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/tree.json index 60c360aa0..68fb6334a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.js.snapshot/tree.json @@ -21,7 +21,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -69,19 +69,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sns": { @@ -126,7 +126,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -260,13 +260,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -278,19 +278,19 @@ "path": "s3sns-existingUnencryptedSnsTopic/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -349,7 +349,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -447,13 +447,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -465,13 +465,13 @@ "path": "s3sns-existingUnencryptedSnsTopic/test-s3-sns/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -483,25 +483,25 @@ "path": "s3sns-existingUnencryptedSnsTopic/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -509,7 +509,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -521,7 +521,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -529,7 +529,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -537,13 +537,13 @@ "path": "s3sns-existingUnencryptedSnsTopic/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -559,7 +559,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -598,7 +598,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -631,19 +631,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -651,13 +651,13 @@ "path": "s3sns-existingUnencryptedSnsTopic/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -673,7 +673,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -685,7 +685,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -693,25 +693,25 @@ "path": "s3sns-existingUnencryptedSnsTopic/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -719,7 +719,7 @@ "path": "s3sns-existingUnencryptedSnsTopic/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -727,13 +727,13 @@ "path": "s3sns-existingUnencryptedSnsTopic/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -741,13 +741,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.ts index 8826a6ccf..0f1f7b3eb 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-existingUnencryptedSnsTopic.ts @@ -18,7 +18,11 @@ import { SuppressCfnNagLambdaWarnings, addCfnSuppressRules, generateIntegStackNa import * as sns from 'aws-cdk-lib/aws-sns'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); const existingTopicObj = new sns.Topic(stack, 'Topic'); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/integ.json index 80f0ee1a2..b7c73a73e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-newTopicFromProps/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/manifest.json index 4da85c5a8..92cf67a6c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snsnewTopicFromPropsIntegDefaultTestDeployAssert834567BB.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snsnewTopicFromPropsIntegDefaultTestDeployAssert834567BB.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": "s3sns-newTopicFromProps.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}/e211e9acbc935c58a4dd3c7d83cebff5ab7e302d9113e7bc78b3f4bf8a2b8915.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/aaa877158f372caf0ad673b61804a86ebeba5122c3cf7d36a3dd380b14bb67a4.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.assets.json index d3c396126..5861d11a1 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "e211e9acbc935c58a4dd3c7d83cebff5ab7e302d9113e7bc78b3f4bf8a2b8915": { + "aaa877158f372caf0ad673b61804a86ebeba5122c3cf7d36a3dd380b14bb67a4": { "source": { "path": "s3sns-newTopicFromProps.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e211e9acbc935c58a4dd3c7d83cebff5ab7e302d9113e7bc78b3f4bf8a2b8915.json", + "objectKey": "aaa877158f372caf0ad673b61804a86ebeba5122c3cf7d36a3dd380b14bb67a4.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-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.template.json index b7ad1d414..d5a1bfbca 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3sns-newTopicFromProps.template.json @@ -684,7 +684,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3snsnewTopicFromPropsIntegDefaultTestDeployAssert834567BB.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3snsnewTopicFromPropsIntegDefaultTestDeployAssert834567BB.assets.json index 67dc261c1..4bd4cd4e7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3snsnewTopicFromPropsIntegDefaultTestDeployAssert834567BB.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/s3snsnewTopicFromPropsIntegDefaultTestDeployAssert834567BB.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/tree.json index 6033f9e75..3fb93a8ce 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.js.snapshot/tree.json @@ -50,7 +50,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -184,13 +184,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -202,19 +202,19 @@ "path": "s3sns-newTopicFromProps/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -273,7 +273,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -371,13 +371,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -389,13 +389,13 @@ "path": "s3sns-newTopicFromProps/test-s3-sns/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -407,19 +407,19 @@ "path": "s3sns-newTopicFromProps/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "'test-s3-snsKey'": { @@ -476,13 +476,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -506,7 +506,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -623,25 +623,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -649,7 +649,7 @@ "path": "s3sns-newTopicFromProps/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -661,7 +661,7 @@ "path": "s3sns-newTopicFromProps/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -669,7 +669,7 @@ "path": "s3sns-newTopicFromProps/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -677,13 +677,13 @@ "path": "s3sns-newTopicFromProps/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -699,7 +699,7 @@ "path": "s3sns-newTopicFromProps/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -738,7 +738,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -771,19 +771,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -791,13 +791,13 @@ "path": "s3sns-newTopicFromProps/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -813,7 +813,7 @@ "path": "s3sns-newTopicFromProps/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -825,7 +825,7 @@ "path": "s3sns-newTopicFromProps/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -833,25 +833,25 @@ "path": "s3sns-newTopicFromProps/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -859,7 +859,7 @@ "path": "s3sns-newTopicFromProps/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -867,13 +867,13 @@ "path": "s3sns-newTopicFromProps/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -881,13 +881,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.ts index e3a776f11..4a00a5e9c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-newTopicFromProps.ts @@ -17,7 +17,11 @@ import { S3ToSns } from "../lib"; import { SuppressCfnNagLambdaWarnings, generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); new S3ToSns(stack, 'test-s3-sns', { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-noArguments.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/integ.json index 01ffea655..0701230da 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-noArguments/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/manifest.json index 5fd69199f..755f17a01 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snsnoArgumentsIntegDefaultTestDeployAssert313DD81E.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snsnoArgumentsIntegDefaultTestDeployAssert313DD81E.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": "s3sns-noArguments.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}/2cad37cb25452b26fd2ff244b6c7a3ded255c3e815edc8fc3af0019aa3629aa2.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/54fc8a2ef0a5b737d6700e496cc1e6369b2eadd3d3b9a0654c767a2de528aa93.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.assets.json index 4625fdb3a..4714f0d8d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "2cad37cb25452b26fd2ff244b6c7a3ded255c3e815edc8fc3af0019aa3629aa2": { + "54fc8a2ef0a5b737d6700e496cc1e6369b2eadd3d3b9a0654c767a2de528aa93": { "source": { "path": "s3sns-noArguments.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2cad37cb25452b26fd2ff244b6c7a3ded255c3e815edc8fc3af0019aa3629aa2.json", + "objectKey": "54fc8a2ef0a5b737d6700e496cc1e6369b2eadd3d3b9a0654c767a2de528aa93.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-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.template.json index 38ea7506b..d9db2e253 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3sns-noArguments.template.json @@ -683,7 +683,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3snsnoArgumentsIntegDefaultTestDeployAssert313DD81E.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3snsnoArgumentsIntegDefaultTestDeployAssert313DD81E.assets.json index e8f997b84..31d7767b5 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3snsnoArgumentsIntegDefaultTestDeployAssert313DD81E.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/s3snsnoArgumentsIntegDefaultTestDeployAssert313DD81E.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/tree.json index e7edbbd91..e3e41e5c8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.js.snapshot/tree.json @@ -50,7 +50,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -184,13 +184,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -202,19 +202,19 @@ "path": "s3sns-noArguments/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -273,7 +273,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -371,13 +371,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -389,13 +389,13 @@ "path": "s3sns-noArguments/test-s3-sns/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -407,19 +407,19 @@ "path": "s3sns-noArguments/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "'test-s3-snsKey'": { @@ -476,13 +476,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -505,7 +505,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -622,25 +622,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -648,7 +648,7 @@ "path": "s3sns-noArguments/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -660,7 +660,7 @@ "path": "s3sns-noArguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -668,7 +668,7 @@ "path": "s3sns-noArguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -676,13 +676,13 @@ "path": "s3sns-noArguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -698,7 +698,7 @@ "path": "s3sns-noArguments/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -737,7 +737,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -770,19 +770,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -790,13 +790,13 @@ "path": "s3sns-noArguments/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -812,7 +812,7 @@ "path": "s3sns-noArguments/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -824,7 +824,7 @@ "path": "s3sns-noArguments/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -832,25 +832,25 @@ "path": "s3sns-noArguments/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -858,7 +858,7 @@ "path": "s3sns-noArguments/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -866,13 +866,13 @@ "path": "s3sns-noArguments/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -880,13 +880,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.ts index 49742115c..fd7378006 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-noArguments.ts @@ -17,7 +17,11 @@ import { S3ToSns } from "../lib"; import { SuppressCfnNagLambdaWarnings, generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); new S3ToSns(stack, 'test-s3-sns', { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/integ.json index 220a1c3a9..077dd4c66 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-s3EventTypesAndFilters/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/manifest.json index f95826948..fe03a532c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snss3EventTypesAndFiltersIntegDefaultTestDeployAssert277CA5E7.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snss3EventTypesAndFiltersIntegDefaultTestDeployAssert277CA5E7.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": "s3sns-s3EventTypesAndFilters.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}/71acdd18bd599ca339ed12958e4dbbb8d14bf7495a9a50b22ea9ed8c8b43270e.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/78d7433469624586536ea9c9d928eb87bbd560b5406c0acf40ee3651d9556194.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.assets.json index 79fafc404..9e9f2a1a8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "71acdd18bd599ca339ed12958e4dbbb8d14bf7495a9a50b22ea9ed8c8b43270e": { + "78d7433469624586536ea9c9d928eb87bbd560b5406c0acf40ee3651d9556194": { "source": { "path": "s3sns-s3EventTypesAndFilters.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "71acdd18bd599ca339ed12958e4dbbb8d14bf7495a9a50b22ea9ed8c8b43270e.json", + "objectKey": "78d7433469624586536ea9c9d928eb87bbd560b5406c0acf40ee3651d9556194.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-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.template.json index 1fe90550b..3121ddf74 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3sns-s3EventTypesAndFilters.template.json @@ -697,7 +697,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3snss3EventTypesAndFiltersIntegDefaultTestDeployAssert277CA5E7.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3snss3EventTypesAndFiltersIntegDefaultTestDeployAssert277CA5E7.assets.json index c4dec757c..863acb383 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3snss3EventTypesAndFiltersIntegDefaultTestDeployAssert277CA5E7.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/s3snss3EventTypesAndFiltersIntegDefaultTestDeployAssert277CA5E7.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/tree.json index 92ca78ece..a3a63800e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.js.snapshot/tree.json @@ -50,7 +50,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -184,13 +184,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -202,19 +202,19 @@ "path": "s3sns-s3EventTypesAndFilters/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -273,7 +273,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -371,13 +371,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -389,13 +389,13 @@ "path": "s3sns-s3EventTypesAndFilters/test-s3-sns/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -407,19 +407,19 @@ "path": "s3sns-s3EventTypesAndFilters/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "'test-s3-snsKey'": { @@ -476,13 +476,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -505,7 +505,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -622,25 +622,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -648,7 +648,7 @@ "path": "s3sns-s3EventTypesAndFilters/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -660,7 +660,7 @@ "path": "s3sns-s3EventTypesAndFilters/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -668,7 +668,7 @@ "path": "s3sns-s3EventTypesAndFilters/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -676,13 +676,13 @@ "path": "s3sns-s3EventTypesAndFilters/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -698,7 +698,7 @@ "path": "s3sns-s3EventTypesAndFilters/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -737,7 +737,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -770,19 +770,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -790,13 +790,13 @@ "path": "s3sns-s3EventTypesAndFilters/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -812,7 +812,7 @@ "path": "s3sns-s3EventTypesAndFilters/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -824,7 +824,7 @@ "path": "s3sns-s3EventTypesAndFilters/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -832,25 +832,25 @@ "path": "s3sns-s3EventTypesAndFilters/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -858,7 +858,7 @@ "path": "s3sns-s3EventTypesAndFilters/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -866,13 +866,13 @@ "path": "s3sns-s3EventTypesAndFilters/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -880,13 +880,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.ts index 6344ed076..176cc13db 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-s3EventTypesAndFilters.ts @@ -18,7 +18,11 @@ import { SuppressCfnNagLambdaWarnings, generateIntegStackName } from '@aws-solut import * as s3 from 'aws-cdk-lib/aws-s3'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); new S3ToSns(stack, 'test-s3-sns', { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/integ.json index 67c952aca..480353567 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sns-snsTopicWithAwsManagedKey/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/manifest.json index 0164df917..ad2bfdc19 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3snssnsTopicWithAwsManagedKeyIntegDefaultTestDeployAssertBD7193C2.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3snssnsTopicWithAwsManagedKeyIntegDefaultTestDeployAssertBD7193C2.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": "s3sns-snsTopicWithAwsManagedKey.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}/93c61445962a090343bf6a4045124df9ab3bc117dbff38a39aeddf54753038c3.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9ebbfcda2e0b30b723020e142d4c44d32a7a57d7771a168f661352c510c927d7.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.assets.json index fa908ebaf..5a3a91a51 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "93c61445962a090343bf6a4045124df9ab3bc117dbff38a39aeddf54753038c3": { + "9ebbfcda2e0b30b723020e142d4c44d32a7a57d7771a168f661352c510c927d7": { "source": { "path": "s3sns-snsTopicWithAwsManagedKey.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "93c61445962a090343bf6a4045124df9ab3bc117dbff38a39aeddf54753038c3.json", + "objectKey": "9ebbfcda2e0b30b723020e142d4c44d32a7a57d7771a168f661352c510c927d7.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-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.template.json index 0d763206c..acc35e571 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3sns-snsTopicWithAwsManagedKey.template.json @@ -650,7 +650,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3snssnsTopicWithAwsManagedKeyIntegDefaultTestDeployAssertBD7193C2.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3snssnsTopicWithAwsManagedKeyIntegDefaultTestDeployAssertBD7193C2.assets.json index 767dbfd65..f196c9b2a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3snssnsTopicWithAwsManagedKeyIntegDefaultTestDeployAssertBD7193C2.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/s3snssnsTopicWithAwsManagedKeyIntegDefaultTestDeployAssertBD7193C2.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/tree.json index f87ee0113..4962e655b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.js.snapshot/tree.json @@ -50,7 +50,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -184,13 +184,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -202,19 +202,19 @@ "path": "s3sns-snsTopicWithAwsManagedKey/test-s3-sns/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -273,7 +273,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -371,13 +371,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -389,13 +389,13 @@ "path": "s3sns-snsTopicWithAwsManagedKey/test-s3-sns/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -407,19 +407,19 @@ "path": "s3sns-snsTopicWithAwsManagedKey/test-s3-sns/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "aws-managed-key": { @@ -427,7 +427,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/test-s3-sns/aws-managed-key", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "SnsTopic": { @@ -464,7 +464,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopic", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -581,25 +581,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sns.Topic", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sns.S3ToSns", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -607,7 +607,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -619,7 +619,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -627,7 +627,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -635,13 +635,13 @@ "path": "s3sns-snsTopicWithAwsManagedKey/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -657,7 +657,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -696,7 +696,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -729,19 +729,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -749,13 +749,13 @@ "path": "s3sns-snsTopicWithAwsManagedKey/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -771,7 +771,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -783,7 +783,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -791,25 +791,25 @@ "path": "s3sns-snsTopicWithAwsManagedKey/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -817,7 +817,7 @@ "path": "s3sns-snsTopicWithAwsManagedKey/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -825,13 +825,13 @@ "path": "s3sns-snsTopicWithAwsManagedKey/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -839,13 +839,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.ts index d712279a9..41ee7a130 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sns/test/integ.s3sns-snsTopicWithAwsManagedKey.ts @@ -17,7 +17,11 @@ import { S3ToSns } from "../lib"; import { SuppressCfnNagLambdaWarnings, generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); new S3ToSns(stack, 'test-s3-sns', { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/package.json index c16eae220..479f17a65 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/integ.json index f2c74144f..d40b9227d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sqs-creatingNewQueue/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/manifest.json index 4140b6a9d..8ff2bf5f9 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3sqscreatingNewQueueIntegDefaultTestDeployAssert480EFBFF.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3sqscreatingNewQueueIntegDefaultTestDeployAssert480EFBFF.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": "s3sqs-creatingNewQueue.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}/20d530215759104400ee4d49061d0f3aa3b06c9ee1b9b5868725762e35c49786.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4a86411cd3e3e5f1e12fffdef8a1d8ca66e3f69fd089fc83ef420c07b82b9dec.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.assets.json index b9230868c..c2cca28f4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "20d530215759104400ee4d49061d0f3aa3b06c9ee1b9b5868725762e35c49786": { + "4a86411cd3e3e5f1e12fffdef8a1d8ca66e3f69fd089fc83ef420c07b82b9dec": { "source": { "path": "s3sqs-creatingNewQueue.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "20d530215759104400ee4d49061d0f3aa3b06c9ee1b9b5868725762e35c49786.json", + "objectKey": "4a86411cd3e3e5f1e12fffdef8a1d8ca66e3f69fd089fc83ef420c07b82b9dec.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-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.template.json index 22aedc306..cc6e1ceda 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqs-creatingNewQueue.template.json @@ -632,7 +632,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqscreatingNewQueueIntegDefaultTestDeployAssert480EFBFF.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqscreatingNewQueueIntegDefaultTestDeployAssert480EFBFF.assets.json index 4c153872e..e257e014c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqscreatingNewQueueIntegDefaultTestDeployAssert480EFBFF.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/s3sqscreatingNewQueueIntegDefaultTestDeployAssert480EFBFF.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/tree.json index b62ec069d..4f9223267 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.js.snapshot/tree.json @@ -85,13 +85,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sqs": { @@ -149,7 +149,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -247,13 +247,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -265,13 +265,13 @@ "path": "s3sqs-creatingNewQueue/test-s3-sqs/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -283,19 +283,19 @@ "path": "s3sqs-creatingNewQueue/test-s3-sqs/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "queue-dlq": { @@ -314,7 +314,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -397,19 +397,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "queue": { @@ -442,7 +442,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -552,25 +552,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sqs.S3ToSqs", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -578,7 +578,7 @@ "path": "s3sqs-creatingNewQueue/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -590,7 +590,7 @@ "path": "s3sqs-creatingNewQueue/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -598,7 +598,7 @@ "path": "s3sqs-creatingNewQueue/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -606,13 +606,13 @@ "path": "s3sqs-creatingNewQueue/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -628,7 +628,7 @@ "path": "s3sqs-creatingNewQueue/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -667,7 +667,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -700,19 +700,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -720,13 +720,13 @@ "path": "s3sqs-creatingNewQueue/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -742,7 +742,7 @@ "path": "s3sqs-creatingNewQueue/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -754,7 +754,7 @@ "path": "s3sqs-creatingNewQueue/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -762,25 +762,25 @@ "path": "s3sqs-creatingNewQueue/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -788,7 +788,7 @@ "path": "s3sqs-creatingNewQueue/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -796,13 +796,13 @@ "path": "s3sqs-creatingNewQueue/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -810,13 +810,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.ts index 9c0754e78..dea462841 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-creatingNewQueue.ts @@ -21,7 +21,11 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as defaults from '@aws-solutions-constructs/core'; // Setup -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); stack.templateOptions.description = 'Integration Test for aws-s3-sqs with standard Queue'; diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/integ.json index d7a7bb308..f781c74b5 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sqs-customLoggingBucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/manifest.json index aa793dd67..d418bbd4e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3sqscustomLoggingBucketIntegDefaultTestDeployAssert5A53409E.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3sqscustomLoggingBucketIntegDefaultTestDeployAssert5A53409E.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": "s3sqs-customLoggingBucket.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}/ff6438a12364a42f25c6e5e972a11450be09d9f59085193473e5ea03e24390b2.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1c3da947d8e2da9537281a289204bb99d7b663010ea6d8acb32d1ec8ff24d577.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.assets.json index 743cc48d8..dba3eca3a 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "ff6438a12364a42f25c6e5e972a11450be09d9f59085193473e5ea03e24390b2": { + "1c3da947d8e2da9537281a289204bb99d7b663010ea6d8acb32d1ec8ff24d577": { "source": { "path": "s3sqs-customLoggingBucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "ff6438a12364a42f25c6e5e972a11450be09d9f59085193473e5ea03e24390b2.json", + "objectKey": "1c3da947d8e2da9537281a289204bb99d7b663010ea6d8acb32d1ec8ff24d577.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-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.template.json index 8a41fda6f..879136916 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqs-customLoggingBucket.template.json @@ -741,7 +741,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqscustomLoggingBucketIntegDefaultTestDeployAssert5A53409E.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqscustomLoggingBucketIntegDefaultTestDeployAssert5A53409E.assets.json index 8241967f5..d53f71d4f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqscustomLoggingBucketIntegDefaultTestDeployAssert5A53409E.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/s3sqscustomLoggingBucketIntegDefaultTestDeployAssert5A53409E.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/tree.json index b47f60784..e072624a4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.js.snapshot/tree.json @@ -63,7 +63,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -197,13 +197,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -215,19 +215,19 @@ "path": "s3sqs-customLoggingBucket/test-s3-sqs/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -280,7 +280,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -339,13 +339,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -357,19 +357,19 @@ "path": "s3sqs-customLoggingBucket/test-s3-sqs/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "queue-dlq": { @@ -387,7 +387,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -470,19 +470,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "'queueKey'": { @@ -562,13 +562,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "queue": { @@ -600,7 +600,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -710,25 +710,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sqs.S3ToSqs", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -736,7 +736,7 @@ "path": "s3sqs-customLoggingBucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -748,7 +748,7 @@ "path": "s3sqs-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -756,7 +756,7 @@ "path": "s3sqs-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -764,13 +764,13 @@ "path": "s3sqs-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -786,7 +786,7 @@ "path": "s3sqs-customLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -825,7 +825,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -858,19 +858,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -878,13 +878,13 @@ "path": "s3sqs-customLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -900,7 +900,7 @@ "path": "s3sqs-customLoggingBucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -912,7 +912,7 @@ "path": "s3sqs-customLoggingBucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -920,25 +920,25 @@ "path": "s3sqs-customLoggingBucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -946,7 +946,7 @@ "path": "s3sqs-customLoggingBucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -954,13 +954,13 @@ "path": "s3sqs-customLoggingBucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -968,13 +968,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.ts index beee87fa0..579ae8e82 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-customLoggingBucket.ts @@ -18,7 +18,11 @@ import {S3ToSqs} from "../lib"; import { generateIntegStackName, suppressCustomHandlerCfnNagWarnings } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); // Empty arguments const stack = new Stack(app, generateIntegStackName(__filename)); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/integ.json index 197a3cd79..2a72ba3f3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sqs-existingLoggingBucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/manifest.json index 6761a2aaa..fb45e3db8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3sqsexistingLoggingBucketIntegDefaultTestDeployAssert9EECE2F2.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3sqsexistingLoggingBucketIntegDefaultTestDeployAssert9EECE2F2.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": "s3sqs-existingLoggingBucket.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}/79bf84f93d68d37787a767e03d3fa4a29aad6e501ff82bb134295a70b636f25c.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1da0fcde55fe48e08358103eb891427ceb279d9e10f709570cd310fedc8a126e.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.assets.json index 0d543c9ed..b6ba242b7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "79bf84f93d68d37787a767e03d3fa4a29aad6e501ff82bb134295a70b636f25c": { + "1da0fcde55fe48e08358103eb891427ceb279d9e10f709570cd310fedc8a126e": { "source": { "path": "s3sqs-existingLoggingBucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "79bf84f93d68d37787a767e03d3fa4a29aad6e501ff82bb134295a70b636f25c.json", + "objectKey": "1da0fcde55fe48e08358103eb891427ceb279d9e10f709570cd310fedc8a126e.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-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.template.json index 1923622e6..2bfac757f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqs-existingLoggingBucket.template.json @@ -957,7 +957,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqsexistingLoggingBucketIntegDefaultTestDeployAssert9EECE2F2.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqsexistingLoggingBucketIntegDefaultTestDeployAssert9EECE2F2.assets.json index 7590de371..ee4838f15 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqsexistingLoggingBucketIntegDefaultTestDeployAssert9EECE2F2.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/s3sqsexistingLoggingBucketIntegDefaultTestDeployAssert9EECE2F2.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/tree.json index 9b2ac5115..e7fb00a69 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.js.snapshot/tree.json @@ -40,7 +40,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -174,13 +174,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -192,19 +192,19 @@ "path": "s3sqs-existingLoggingBucket/scrapBucketLog/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "LatestNodeRuntimeMap": { @@ -212,7 +212,7 @@ "path": "s3sqs-existingLoggingBucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -224,7 +224,7 @@ "path": "s3sqs-existingLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -232,7 +232,7 @@ "path": "s3sqs-existingLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -240,13 +240,13 @@ "path": "s3sqs-existingLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "scrapBucket": { @@ -286,7 +286,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -420,13 +420,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -438,19 +438,19 @@ "path": "s3sqs-existingLoggingBucket/scrapBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sqs-temp": { @@ -513,7 +513,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -611,13 +611,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -629,13 +629,13 @@ "path": "s3sqs-existingLoggingBucket/test-s3-sqs-temp/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -647,19 +647,19 @@ "path": "s3sqs-existingLoggingBucket/test-s3-sqs-temp/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "queue-dlq": { @@ -677,7 +677,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -760,19 +760,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "'queueKey'": { @@ -852,13 +852,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "queue": { @@ -890,7 +890,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -1000,25 +1000,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sqs.S3ToSqs", - "version": "2.67.1" + "version": "2.74.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -1034,7 +1034,7 @@ "path": "s3sqs-existingLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -1073,7 +1073,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -1106,19 +1106,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -1126,13 +1126,13 @@ "path": "s3sqs-existingLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -1148,7 +1148,7 @@ "path": "s3sqs-existingLoggingBucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -1160,7 +1160,7 @@ "path": "s3sqs-existingLoggingBucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1168,25 +1168,25 @@ "path": "s3sqs-existingLoggingBucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -1194,7 +1194,7 @@ "path": "s3sqs-existingLoggingBucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1202,13 +1202,13 @@ "path": "s3sqs-existingLoggingBucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -1216,13 +1216,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.ts index e95dce0fe..1e44995ec 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingLoggingBucket.ts @@ -18,7 +18,11 @@ import * as defaults from '@aws-solutions-constructs/core'; import { generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); stack.node.setContext("@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy", true); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/integ.json index 5a1dd6ab9..5d039139b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sqs-existingQueue/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/manifest.json index 9c1bda8a0..7c6c76137 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3sqsexistingQueueIntegDefaultTestDeployAssert82F5925F.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3sqsexistingQueueIntegDefaultTestDeployAssert82F5925F.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": "s3sqs-existingQueue.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}/b541e0f455c7d1715567224b68f2b2c9d080651cd3117d1a94067b1dceeb83f1.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/3ac21d6f7cac9698e496f8410fc1887c5afd55ac44c6d3afd8a0fc130c4debd5.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.assets.json index 9925fd2b2..c7c236a08 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "b541e0f455c7d1715567224b68f2b2c9d080651cd3117d1a94067b1dceeb83f1": { + "3ac21d6f7cac9698e496f8410fc1887c5afd55ac44c6d3afd8a0fc130c4debd5": { "source": { "path": "s3sqs-existingQueue.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "b541e0f455c7d1715567224b68f2b2c9d080651cd3117d1a94067b1dceeb83f1.json", + "objectKey": "3ac21d6f7cac9698e496f8410fc1887c5afd55ac44c6d3afd8a0fc130c4debd5.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-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.template.json index d1d6dfdc7..80554a2cc 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqs-existingQueue.template.json @@ -615,7 +615,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqsexistingQueueIntegDefaultTestDeployAssert82F5925F.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqsexistingQueueIntegDefaultTestDeployAssert82F5925F.assets.json index 807954f45..79e63a6dd 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqsexistingQueueIntegDefaultTestDeployAssert82F5925F.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/s3sqsexistingQueueIntegDefaultTestDeployAssert82F5925F.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/tree.json index 77f25a3c8..6fb08efc4 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.js.snapshot/tree.json @@ -23,7 +23,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -106,19 +106,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "'test-existing-queueKey'": { @@ -198,13 +198,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "test-existing-queue": { @@ -236,7 +236,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -346,19 +346,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sqs": { @@ -416,7 +416,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -514,13 +514,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -532,13 +532,13 @@ "path": "s3sqs-existingQueue/test-s3-sqs/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -550,25 +550,25 @@ "path": "s3sqs-existingQueue/test-s3-sqs/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sqs.S3ToSqs", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -576,7 +576,7 @@ "path": "s3sqs-existingQueue/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -588,7 +588,7 @@ "path": "s3sqs-existingQueue/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -596,7 +596,7 @@ "path": "s3sqs-existingQueue/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -604,13 +604,13 @@ "path": "s3sqs-existingQueue/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -626,7 +626,7 @@ "path": "s3sqs-existingQueue/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -665,7 +665,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -698,19 +698,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -718,13 +718,13 @@ "path": "s3sqs-existingQueue/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -740,7 +740,7 @@ "path": "s3sqs-existingQueue/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -752,7 +752,7 @@ "path": "s3sqs-existingQueue/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -760,25 +760,25 @@ "path": "s3sqs-existingQueue/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -786,7 +786,7 @@ "path": "s3sqs-existingQueue/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -794,13 +794,13 @@ "path": "s3sqs-existingQueue/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -808,13 +808,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.ts index 3b5e3a944..b86a92292 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingQueue.ts @@ -19,7 +19,11 @@ import { generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as s3 from "aws-cdk-lib/aws-s3"; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/integ.json index 3f3e50f60..839b42292 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sqs-existingS3Bucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/manifest.json index 373c49cfc..f88f65e15 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3sqsexistingS3BucketIntegDefaultTestDeployAssertECBDD151.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3sqsexistingS3BucketIntegDefaultTestDeployAssertECBDD151.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": "s3sqs-existingS3Bucket.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}/bc92191a55e3352b3ee8143a7d101bba7d74914f949c3a46c3966217fabfc337.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5b4d2f6b6851d215901d75a7c37dfb19110fd3d0f6baaa944f79b999ca59de26.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.assets.json index 5864bf729..7a1e57dfc 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "bc92191a55e3352b3ee8143a7d101bba7d74914f949c3a46c3966217fabfc337": { + "5b4d2f6b6851d215901d75a7c37dfb19110fd3d0f6baaa944f79b999ca59de26": { "source": { "path": "s3sqs-existingS3Bucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "bc92191a55e3352b3ee8143a7d101bba7d74914f949c3a46c3966217fabfc337.json", + "objectKey": "5b4d2f6b6851d215901d75a7c37dfb19110fd3d0f6baaa944f79b999ca59de26.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-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.template.json index de214c3f2..ef100abcc 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqs-existingS3Bucket.template.json @@ -767,7 +767,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqsexistingS3BucketIntegDefaultTestDeployAssertECBDD151.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqsexistingS3BucketIntegDefaultTestDeployAssertECBDD151.assets.json index fbcc299b4..cfac92821 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqsexistingS3BucketIntegDefaultTestDeployAssertECBDD151.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/s3sqsexistingS3BucketIntegDefaultTestDeployAssertECBDD151.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/tree.json index f75f3ef3a..d3428ab97 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.js.snapshot/tree.json @@ -40,7 +40,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -174,13 +174,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -192,19 +192,19 @@ "path": "s3sqs-existingS3Bucket/scrapBucketLog/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "LatestNodeRuntimeMap": { @@ -212,7 +212,7 @@ "path": "s3sqs-existingS3Bucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -224,7 +224,7 @@ "path": "s3sqs-existingS3Bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -232,7 +232,7 @@ "path": "s3sqs-existingS3Bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -240,13 +240,13 @@ "path": "s3sqs-existingS3Bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "scrapBucket": { @@ -286,7 +286,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -384,13 +384,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -402,13 +402,13 @@ "path": "s3sqs-existingS3Bucket/scrapBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -420,19 +420,19 @@ "path": "s3sqs-existingS3Bucket/scrapBucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-sqs": { @@ -454,7 +454,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -537,19 +537,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "'queueKey'": { @@ -629,13 +629,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "queue": { @@ -667,7 +667,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -777,25 +777,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sqs.S3ToSqs", - "version": "2.67.1" + "version": "2.74.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -811,7 +811,7 @@ "path": "s3sqs-existingS3Bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -850,7 +850,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -883,19 +883,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -903,13 +903,13 @@ "path": "s3sqs-existingS3Bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -925,7 +925,7 @@ "path": "s3sqs-existingS3Bucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -937,7 +937,7 @@ "path": "s3sqs-existingS3Bucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -945,25 +945,25 @@ "path": "s3sqs-existingS3Bucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -971,7 +971,7 @@ "path": "s3sqs-existingS3Bucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -979,13 +979,13 @@ "path": "s3sqs-existingS3Bucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -993,13 +993,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.ts index 673ef8200..4d36aaea2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-existingS3Bucket.ts @@ -18,7 +18,11 @@ import * as defaults from '@aws-solutions-constructs/core'; import { generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); stack.node.setContext("@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy", true); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/integ.json index 39c0e7d7d..7d47bc0b2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3sqs-noArguments/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/manifest.json index 24cde6502..2867d21d2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3sqsnoArgumentsIntegDefaultTestDeployAssert15EDF636.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3sqsnoArgumentsIntegDefaultTestDeployAssert15EDF636.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": "s3sqs-noArguments.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}/70bd66777ea4faafa10563cab976ee4962de08e96dd07ad32746e4fdc7214b7c.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a07e9ee5fc0382cd1d112442991bfb32160ea89d2dfd971544d785d2362e8da3.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.assets.json index 7ad38c911..0194dee08 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "70bd66777ea4faafa10563cab976ee4962de08e96dd07ad32746e4fdc7214b7c": { + "a07e9ee5fc0382cd1d112442991bfb32160ea89d2dfd971544d785d2362e8da3": { "source": { "path": "s3sqs-noArguments.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "70bd66777ea4faafa10563cab976ee4962de08e96dd07ad32746e4fdc7214b7c.json", + "objectKey": "a07e9ee5fc0382cd1d112442991bfb32160ea89d2dfd971544d785d2362e8da3.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-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.template.json index c419600a4..ec4fb93bd 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqs-noArguments.template.json @@ -792,7 +792,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqsnoArgumentsIntegDefaultTestDeployAssert15EDF636.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqsnoArgumentsIntegDefaultTestDeployAssert15EDF636.assets.json index b991fae05..143d06ca8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqsnoArgumentsIntegDefaultTestDeployAssert15EDF636.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/s3sqsnoArgumentsIntegDefaultTestDeployAssert15EDF636.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/tree.json index 5cd24efb4..5af91628d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.js.snapshot/tree.json @@ -50,7 +50,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -184,13 +184,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -202,19 +202,19 @@ "path": "s3sqs-noArguments/test-s3-sqs/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -273,7 +273,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -371,13 +371,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -389,13 +389,13 @@ "path": "s3sqs-noArguments/test-s3-sqs/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -407,19 +407,19 @@ "path": "s3sqs-noArguments/test-s3-sqs/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "queue-dlq": { @@ -437,7 +437,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -520,19 +520,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } }, "'queueKey'": { @@ -612,13 +612,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.CfnKey", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_kms.Key", - "version": "2.154.1" + "version": "2.162.0" } }, "queue": { @@ -650,7 +650,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -760,25 +760,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_sqs.Queue", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-sqs.S3ToSqs", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -786,7 +786,7 @@ "path": "s3sqs-noArguments/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -798,7 +798,7 @@ "path": "s3sqs-noArguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -806,7 +806,7 @@ "path": "s3sqs-noArguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -814,13 +814,13 @@ "path": "s3sqs-noArguments/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -836,7 +836,7 @@ "path": "s3sqs-noArguments/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -875,7 +875,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -908,19 +908,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -928,13 +928,13 @@ "path": "s3sqs-noArguments/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -950,7 +950,7 @@ "path": "s3sqs-noArguments/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -962,7 +962,7 @@ "path": "s3sqs-noArguments/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -970,25 +970,25 @@ "path": "s3sqs-noArguments/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -996,7 +996,7 @@ "path": "s3sqs-noArguments/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1004,13 +1004,13 @@ "path": "s3sqs-noArguments/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -1018,13 +1018,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.ts b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.ts index 30e16b6f1..10dc7ed11 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-sqs/test/integ.s3sqs-noArguments.ts @@ -17,7 +17,11 @@ import {S3ToSqs} from "../lib"; import { SuppressCfnNagLambdaWarnings, generateIntegStackName } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); // Empty arguments const stack = new Stack(app, generateIntegStackName(__filename)); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/package.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/package.json index 84abf10e0..11eead5ef 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-eventbridge-stepfunctions": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/integ.json index 3a4c584cb..c8d3d14f2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3stp-customLoggingBucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/manifest.json index 0670ef67d..adb8dd932 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3stpcustomLoggingBucketIntegDefaultTestDeployAssert2EFDBF9D.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3stpcustomLoggingBucketIntegDefaultTestDeployAssert2EFDBF9D.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": "s3stp-customLoggingBucket.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}/3d1adbd7b0d119fc845c1a918d386cd022b4ca63b9cedcdb6c0a84fe748a98d8.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8e4ea827533d5c208730dfb8a52196a4bb3a1a9e517eb90fc84ef6e17cf9c1c8.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -160,40 +162,40 @@ "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" } ], - "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRuleRole/Resource": [ + "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionFailedAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleRoleE7CAD359" + "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionFailedAlarm9C7AF57A" } ], - "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRuleRole/DefaultPolicy/Resource": [ + "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleRoleDefaultPolicy0353F447" + "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionThrottledAlarm99D8FF54" } ], - "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRule/Resource": [ + "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleEF658568" + "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionAbortedAlarm1689CFA6" } ], - "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionFailedAlarm/Resource": [ + "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRuleRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionFailedAlarm9C7AF57A" + "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleRoleE7CAD359" } ], - "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource": [ + "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRuleRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionThrottledAlarm99D8FF54" + "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleRoleDefaultPolicy0353F447" } ], - "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource": [ + "/s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRule/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionAbortedAlarm1689CFA6" + "data": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleEF658568" } ], "/s3stp-customLoggingBucket/LatestNodeRuntimeMap": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.assets.json index 6bf523af4..e88784e73 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "3d1adbd7b0d119fc845c1a918d386cd022b4ca63b9cedcdb6c0a84fe748a98d8": { + "8e4ea827533d5c208730dfb8a52196a4bb3a1a9e517eb90fc84ef6e17cf9c1c8": { "source": { "path": "s3stp-customLoggingBucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "3d1adbd7b0d119fc845c1a918d386cd022b4ca63b9cedcdb6c0a84fe748a98d8.json", + "objectKey": "8e4ea827533d5c208730dfb8a52196a4bb3a1a9e517eb90fc84ef6e17cf9c1c8.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-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.template.json index 2e95b337a..51c55dfbf 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stp-customLoggingBucket.template.json @@ -615,6 +615,69 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, + "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionFailedAlarm9C7AF57A": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionThrottledAlarm99D8FF54": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionAbortedAlarm1689CFA6": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructEventsRuleRoleE7CAD359": { "Type": "AWS::IAM::Role", "Properties": { @@ -692,69 +755,6 @@ ] } }, - "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionFailedAlarm9C7AF57A": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionsFailed", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Sum", - "Threshold": 1 - } - }, - "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionThrottledAlarm99D8FF54": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionThrottled", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Sum", - "Threshold": 1 - } - }, - "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructExecutionAbortedAlarm1689CFA6": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionsAborted", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Maximum", - "Threshold": 1 - } - }, "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { "Type": "AWS::IAM::Role", "Properties": { @@ -918,7 +918,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stpcustomLoggingBucketIntegDefaultTestDeployAssert2EFDBF9D.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stpcustomLoggingBucketIntegDefaultTestDeployAssert2EFDBF9D.assets.json index 45c0481fc..7783c1b5c 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stpcustomLoggingBucketIntegDefaultTestDeployAssert2EFDBF9D.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/s3stpcustomLoggingBucketIntegDefaultTestDeployAssert2EFDBF9D.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/tree.json index 821f17c82..db78b3758 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.js.snapshot/tree.json @@ -21,7 +21,7 @@ "path": "s3stp-customLoggingBucket/lambdas3stp-test/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -60,13 +60,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -90,13 +90,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.162.0" } }, "tasks3stp-test": { @@ -104,7 +104,7 @@ "path": "s3stp-customLoggingBucket/tasks3stp-test", "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-stepfunctions": { @@ -162,7 +162,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -296,13 +296,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -314,19 +314,19 @@ "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -385,7 +385,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -483,13 +483,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -501,13 +501,13 @@ "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -519,19 +519,19 @@ "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-stepfunctions-event-rule-step-function-construct": { @@ -573,13 +573,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.154.1" + "version": "2.162.0" } }, "StateMachine": { @@ -595,7 +595,7 @@ "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/StateMachine/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -620,7 +620,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -688,19 +688,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -753,13 +753,130 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", - "version": "2.154.1" + "version": "2.162.0" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" } }, "EventsRuleRole": { @@ -771,7 +888,7 @@ "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/EventsRuleRole/ImportEventsRuleRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -796,7 +913,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -831,19 +948,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "EventsRule": { @@ -892,142 +1009,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_events.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_events.Rule", - "version": "2.154.1" - } - }, - "ExecutionFailedAlarm": { - "id": "ExecutionFailedAlarm", - "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionFailedAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionFailedAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionsFailed", - "namespace": "AWS/States", - "period": 300, - "statistic": "Sum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" - } - }, - "ExecutionThrottledAlarm": { - "id": "ExecutionThrottledAlarm", - "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionThrottledAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionThrottled", - "namespace": "AWS/States", - "period": 300, - "statistic": "Sum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" - } - }, - "ExecutionAbortedAlarm": { - "id": "ExecutionAbortedAlarm", - "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionAbortedAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-customLoggingBucket/test-s3-stepfunctions/test-s3-stepfunctions-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionstests3stepfunctionseventrulestepfunctionconstructStateMachine67197269" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionsAborted", - "namespace": "AWS/States", - "period": 300, - "statistic": "Maximum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-eventbridge-stepfunctions.EventbridgeToStepfunctions", - "version": "2.67.1" + "version": "2.74.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-stepfunctions.S3ToStepfunctions", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -1035,7 +1035,7 @@ "path": "s3stp-customLoggingBucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -1047,7 +1047,7 @@ "path": "s3stp-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -1055,7 +1055,7 @@ "path": "s3stp-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -1063,13 +1063,13 @@ "path": "s3stp-customLoggingBucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -1085,7 +1085,7 @@ "path": "s3stp-customLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -1124,7 +1124,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -1157,19 +1157,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -1177,13 +1177,13 @@ "path": "s3stp-customLoggingBucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -1199,7 +1199,7 @@ "path": "s3stp-customLoggingBucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -1211,7 +1211,7 @@ "path": "s3stp-customLoggingBucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1219,25 +1219,25 @@ "path": "s3stp-customLoggingBucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -1245,7 +1245,7 @@ "path": "s3stp-customLoggingBucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1253,13 +1253,13 @@ "path": "s3stp-customLoggingBucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -1267,13 +1267,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.ts index ce327ad91..1ad9ea066 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-customLoggingBucket.ts @@ -19,7 +19,11 @@ import * as defaults from '@aws-solutions-constructs/core'; import { generateIntegStackName, suppressCustomHandlerCfnNagWarnings } from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); // Empty arguments const stack = new Stack(app, generateIntegStackName(__filename)); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/integ.json index da3fe9054..6d7b80452 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3stp-pre-existing-bucket/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/manifest.json index 01238f50f..78cdc3594 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3stppreexistingbucketIntegDefaultTestDeployAssert71C6CEBC.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3stppreexistingbucketIntegDefaultTestDeployAssert71C6CEBC.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": "s3stp-pre-existing-bucket.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}/651b65da8db533c3c46ff7f63eb9b3a1afdcc036b27bef76c6df60511ef65b57.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/72ca2516f9c3ed6fbc8c7ac973bc1db81de65c66c27b6aabb71d8b0fea0e69de.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -202,40 +204,40 @@ "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" } ], - "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRuleRole/Resource": [ + "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleRole3CF23446" + "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionFailedAlarmAC11687E" } ], - "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRuleRole/DefaultPolicy/Resource": [ + "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleRoleDefaultPolicyBF1D043B" + "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionThrottledAlarm630846CA" } ], - "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRule/Resource": [ + "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleAA9C6DCF" + "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionAbortedAlarmB47B3FC8" } ], - "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource": [ + "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRuleRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionFailedAlarmAC11687E" + "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleRole3CF23446" } ], - "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource": [ + "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRuleRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionThrottledAlarm630846CA" + "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleRoleDefaultPolicyBF1D043B" } ], - "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource": [ + "/s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRule/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionAbortedAlarmB47B3FC8" + "data": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleAA9C6DCF" } ], "/s3stp-pre-existing-bucket/BootstrapVersion": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.assets.json index 2e63f8577..571b4813f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "651b65da8db533c3c46ff7f63eb9b3a1afdcc036b27bef76c6df60511ef65b57": { + "72ca2516f9c3ed6fbc8c7ac973bc1db81de65c66c27b6aabb71d8b0fea0e69de": { "source": { "path": "s3stp-pre-existing-bucket.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "651b65da8db533c3c46ff7f63eb9b3a1afdcc036b27bef76c6df60511ef65b57.json", + "objectKey": "72ca2516f9c3ed6fbc8c7ac973bc1db81de65c66c27b6aabb71d8b0fea0e69de.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-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.template.json index f695cf6af..64ea02082 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stp-pre-existing-bucket.template.json @@ -496,7 +496,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { @@ -787,6 +787,69 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, + "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionFailedAlarmAC11687E": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionThrottledAlarm630846CA": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionAbortedAlarmB47B3FC8": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructEventsRuleRole3CF23446": { "Type": "AWS::IAM::Role", "Properties": { @@ -863,69 +926,6 @@ } ] } - }, - "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionFailedAlarmAC11687E": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionsFailed", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Sum", - "Threshold": 1 - } - }, - "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionThrottledAlarm630846CA": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionThrottled", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Sum", - "Threshold": 1 - } - }, - "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructExecutionAbortedAlarmB47B3FC8": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionsAborted", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Maximum", - "Threshold": 1 - } } }, "Mappings": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stppreexistingbucketIntegDefaultTestDeployAssert71C6CEBC.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stppreexistingbucketIntegDefaultTestDeployAssert71C6CEBC.assets.json index ec33e9ff1..0ee553d68 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stppreexistingbucketIntegDefaultTestDeployAssert71C6CEBC.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/s3stppreexistingbucketIntegDefaultTestDeployAssert71C6CEBC.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/tree.json index d248e04c2..731da3c38 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.js.snapshot/tree.json @@ -40,7 +40,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -174,13 +174,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -192,19 +192,19 @@ "path": "s3stp-pre-existing-bucket/scrapBucketLog/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "LatestNodeRuntimeMap": { @@ -212,7 +212,7 @@ "path": "s3stp-pre-existing-bucket/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -224,7 +224,7 @@ "path": "s3stp-pre-existing-bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -232,7 +232,7 @@ "path": "s3stp-pre-existing-bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -240,13 +240,13 @@ "path": "s3stp-pre-existing-bucket/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "scrapBucket": { @@ -286,7 +286,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -384,13 +384,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -402,13 +402,13 @@ "path": "s3stp-pre-existing-bucket/scrapBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -420,19 +420,19 @@ "path": "s3stp-pre-existing-bucket/scrapBucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -448,7 +448,7 @@ "path": "s3stp-pre-existing-bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -487,7 +487,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -520,19 +520,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -540,13 +540,13 @@ "path": "s3stp-pre-existing-bucket/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "lambdas3stp-test": { @@ -562,7 +562,7 @@ "path": "s3stp-pre-existing-bucket/lambdas3stp-test/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -601,13 +601,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -631,13 +631,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.162.0" } }, "tasks3stp-test": { @@ -645,7 +645,7 @@ "path": "s3stp-pre-existing-bucket/tasks3stp-test", "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-stepfunctions-pre-existing-bucket-construct": { @@ -691,13 +691,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.154.1" + "version": "2.162.0" } }, "StateMachine": { @@ -713,7 +713,7 @@ "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/StateMachine/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -738,7 +738,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -806,19 +806,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -871,13 +871,130 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", - "version": "2.154.1" + "version": "2.162.0" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" } }, "EventsRuleRole": { @@ -889,7 +1006,7 @@ "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/EventsRuleRole/ImportEventsRuleRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -914,7 +1031,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -949,19 +1066,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "EventsRule": { @@ -1010,142 +1127,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_events.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_events.Rule", - "version": "2.154.1" - } - }, - "ExecutionFailedAlarm": { - "id": "ExecutionFailedAlarm", - "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionFailedAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionsFailed", - "namespace": "AWS/States", - "period": 300, - "statistic": "Sum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" - } - }, - "ExecutionThrottledAlarm": { - "id": "ExecutionThrottledAlarm", - "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionThrottledAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionThrottled", - "namespace": "AWS/States", - "period": 300, - "statistic": "Sum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" - } - }, - "ExecutionAbortedAlarm": { - "id": "ExecutionAbortedAlarm", - "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionAbortedAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-pre-existing-bucket/test-s3-stepfunctions-pre-existing-bucket-construct/test-s3-stepfunctions-pre-existing-bucket-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionspreexistingbucketconstructtests3stepfunctionspreexistingbucketconstructeventrulestepfunctionconstructStateMachine326BB1C1" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionsAborted", - "namespace": "AWS/States", - "period": 300, - "statistic": "Maximum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-eventbridge-stepfunctions.EventbridgeToStepfunctions", - "version": "2.67.1" + "version": "2.74.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-stepfunctions.S3ToStepfunctions", - "version": "2.67.1" + "version": "2.74.0" } }, "Integ": { @@ -1161,7 +1161,7 @@ "path": "s3stp-pre-existing-bucket/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -1173,7 +1173,7 @@ "path": "s3stp-pre-existing-bucket/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1181,25 +1181,25 @@ "path": "s3stp-pre-existing-bucket/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -1207,7 +1207,7 @@ "path": "s3stp-pre-existing-bucket/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1215,13 +1215,13 @@ "path": "s3stp-pre-existing-bucket/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -1229,13 +1229,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.ts b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.ts index b02cc2d49..a8d55f3a3 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-pre-existing-bucket.ts @@ -17,7 +17,11 @@ import { S3ToStepfunctions, S3ToStepfunctionsProps } from "../lib"; import * as defaults from '@aws-solutions-constructs/core'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, defaults.generateIntegStackName(__filename)); stack.node.setContext("@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy", true); diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/cdk.out index 0d15a78da..c6e612584 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/cdk.out +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.18"} \ 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-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/integ.json index bf87834d6..a6077f16b 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/integ.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "testCases": { "s3stp-s3-stepfunctions-no-argument/Integ/DefaultTest": { "stacks": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/manifest.json index a67dc31f3..831b175c8 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/manifest.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "s3stps3stepfunctionsnoargumentIntegDefaultTestDeployAssertB7C63989.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "s3stps3stepfunctionsnoargumentIntegDefaultTestDeployAssertB7C63989.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": "s3stp-s3-stepfunctions-no-argument.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}/7e469a4f8951d0ed47ff7285591386a122ad7f89d58781aa927a2e143a465f87.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d5999b271e5ace230465259f6dedb9204e8c7e24dd349119de5e471cfff28f59.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -160,40 +162,40 @@ "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" } ], - "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRuleRole/Resource": [ + "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRuleRoleF724FFA6" + "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionFailedAlarm511B7A93" } ], - "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRuleRole/DefaultPolicy/Resource": [ + "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRuleRoleDefaultPolicyDD60D2A3" + "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionThrottledAlarmF97ADDFF" } ], - "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRule/Resource": [ + "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRule35BD8569" + "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionAbortedAlarm8B04A073" } ], - "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource": [ + "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRuleRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionFailedAlarm511B7A93" + "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRuleRoleF724FFA6" } ], - "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource": [ + "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRuleRole/DefaultPolicy/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionThrottledAlarmF97ADDFF" + "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRuleRoleDefaultPolicyDD60D2A3" } ], - "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource": [ + "/s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRule/Resource": [ { "type": "aws:cdk:logicalId", - "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionAbortedAlarm8B04A073" + "data": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRule35BD8569" } ], "/s3stp-s3-stepfunctions-no-argument/LatestNodeRuntimeMap": [ diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.assets.json index 4ff20192b..c8be3de0f 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "faa95a81ae7d7373f3e1f242268f904eb748d8d0fdd306e8a6fe515a1905a7d6": { "source": { @@ -14,7 +14,7 @@ } } }, - "7e469a4f8951d0ed47ff7285591386a122ad7f89d58781aa927a2e143a465f87": { + "d5999b271e5ace230465259f6dedb9204e8c7e24dd349119de5e471cfff28f59": { "source": { "path": "s3stp-s3-stepfunctions-no-argument.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7e469a4f8951d0ed47ff7285591386a122ad7f89d58781aa927a2e143a465f87.json", + "objectKey": "d5999b271e5ace230465259f6dedb9204e8c7e24dd349119de5e471cfff28f59.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-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.template.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.template.json index 72e1d4742..a15fe64e7 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.template.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stp-s3-stepfunctions-no-argument.template.json @@ -612,6 +612,69 @@ "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" }, + "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionFailedAlarm511B7A93": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsFailed", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionThrottledAlarmF97ADDFF": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionThrottled", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Sum", + "Threshold": 1 + } + }, + "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionAbortedAlarm8B04A073": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "Dimensions": [ + { + "Name": "StateMachineArn", + "Value": { + "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" + } + } + ], + "EvaluationPeriods": 1, + "MetricName": "ExecutionsAborted", + "Namespace": "AWS/States", + "Period": 300, + "Statistic": "Maximum", + "Threshold": 1 + } + }, "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructEventsRuleRoleF724FFA6": { "Type": "AWS::IAM::Role", "Properties": { @@ -689,69 +752,6 @@ ] } }, - "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionFailedAlarm511B7A93": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionsFailed", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Sum", - "Threshold": 1 - } - }, - "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionThrottledAlarmF97ADDFF": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionThrottled", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Sum", - "Threshold": 1 - } - }, - "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructExecutionAbortedAlarm8B04A073": { - "Type": "AWS::CloudWatch::Alarm", - "Properties": { - "AlarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", - "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "Dimensions": [ - { - "Name": "StateMachineArn", - "Value": { - "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" - } - } - ], - "EvaluationPeriods": 1, - "MetricName": "ExecutionsAborted", - "Namespace": "AWS/States", - "Period": 300, - "Statistic": "Maximum", - "Threshold": 1 - } - }, "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092": { "Type": "AWS::IAM::Role", "Properties": { @@ -915,7 +915,7 @@ "Properties": { "Description": "AWS CloudFormation handler for \"Custom::S3BucketNotifications\" resources (@aws-cdk/aws-s3)", "Code": { - "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n strToHash=json.dumps(n, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))" + "ZipFile": "import boto3 # type: ignore\nimport json\nimport logging\nimport urllib.request\n\ns3 = boto3.client(\"s3\")\n\nEVENTBRIDGE_CONFIGURATION = 'EventBridgeConfiguration'\nCONFIGURATION_TYPES = [\"TopicConfigurations\", \"QueueConfigurations\", \"LambdaFunctionConfigurations\"]\n\ndef handler(event: dict, context):\n response_status = \"SUCCESS\"\n error_message = \"\"\n try:\n props = event[\"ResourceProperties\"]\n notification_configuration = props[\"NotificationConfiguration\"]\n managed = props.get('Managed', 'true').lower() == 'true'\n skipDestinationValidation = props.get('SkipDestinationValidation', 'false').lower() == 'true'\n stack_id = event['StackId']\n old = event.get(\"OldResourceProperties\", {}).get(\"NotificationConfiguration\", {})\n if managed:\n config = handle_managed(event[\"RequestType\"], notification_configuration)\n else:\n config = handle_unmanaged(props[\"BucketName\"], stack_id, event[\"RequestType\"], notification_configuration, old)\n s3.put_bucket_notification_configuration(Bucket=props[\"BucketName\"], NotificationConfiguration=config, SkipDestinationValidation=skipDestinationValidation)\n except Exception as e:\n logging.exception(\"Failed to put bucket notification configuration\")\n response_status = \"FAILED\"\n error_message = f\"Error: {str(e)}. \"\n finally:\n submit_response(event, context, response_status, error_message)\n\ndef handle_managed(request_type, notification_configuration):\n if request_type == 'Delete':\n return {}\n return notification_configuration\n\ndef handle_unmanaged(bucket, stack_id, request_type, notification_configuration, old):\n def get_id(n):\n n['Id'] = ''\n sorted_notifications = sort_filter_rules(n)\n strToHash=json.dumps(sorted_notifications, sort_keys=True).replace('\"Name\": \"prefix\"', '\"Name\": \"Prefix\"').replace('\"Name\": \"suffix\"', '\"Name\": \"Suffix\"')\n return f\"{stack_id}-{hash(strToHash)}\"\n def with_id(n):\n n['Id'] = get_id(n)\n return n\n\n external_notifications = {}\n existing_notifications = s3.get_bucket_notification_configuration(Bucket=bucket)\n for t in CONFIGURATION_TYPES:\n if request_type == 'Update':\n old_incoming_ids = [get_id(n) for n in old.get(t, [])]\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not get_id(n) in old_incoming_ids] \n elif request_type == 'Delete':\n external_notifications[t] = [n for n in existing_notifications.get(t, []) if not n['Id'].startswith(f\"{stack_id}-\")]\n elif request_type == 'Create':\n external_notifications[t] = [n for n in existing_notifications.get(t, [])]\n if EVENTBRIDGE_CONFIGURATION in existing_notifications:\n external_notifications[EVENTBRIDGE_CONFIGURATION] = existing_notifications[EVENTBRIDGE_CONFIGURATION]\n\n if request_type == 'Delete':\n return external_notifications\n\n notifications = {}\n for t in CONFIGURATION_TYPES:\n external = external_notifications.get(t, [])\n incoming = [with_id(n) for n in notification_configuration.get(t, [])]\n notifications[t] = external + incoming\n\n if EVENTBRIDGE_CONFIGURATION in notification_configuration:\n notifications[EVENTBRIDGE_CONFIGURATION] = notification_configuration[EVENTBRIDGE_CONFIGURATION]\n elif EVENTBRIDGE_CONFIGURATION in external_notifications:\n notifications[EVENTBRIDGE_CONFIGURATION] = external_notifications[EVENTBRIDGE_CONFIGURATION]\n\n return notifications\n\ndef submit_response(event: dict, context, response_status: str, error_message: str):\n response_body = json.dumps(\n {\n \"Status\": response_status,\n \"Reason\": f\"{error_message}See the details in CloudWatch Log Stream: {context.log_stream_name}\",\n \"PhysicalResourceId\": event.get(\"PhysicalResourceId\") or event[\"LogicalResourceId\"],\n \"StackId\": event[\"StackId\"],\n \"RequestId\": event[\"RequestId\"],\n \"LogicalResourceId\": event[\"LogicalResourceId\"],\n \"NoEcho\": False,\n }\n ).encode(\"utf-8\")\n headers = {\"content-type\": \"\", \"content-length\": str(len(response_body))}\n try:\n req = urllib.request.Request(url=event[\"ResponseURL\"], headers=headers, data=response_body, method=\"PUT\")\n with urllib.request.urlopen(req) as response:\n print(response.read().decode(\"utf-8\"))\n print(\"Status code: \" + response.reason)\n except Exception as e:\n print(\"send(..) failed executing request.urlopen(..): \" + str(e))\n\ndef sort_filter_rules(json_obj):\n if not isinstance(json_obj, dict):\n return json_obj\n for key, value in json_obj.items():\n if isinstance(value, dict):\n json_obj[key] = sort_filter_rules(value)\n elif isinstance(value, list):\n json_obj[key] = [sort_filter_rules(item) for item in value]\n if \"Filter\" in json_obj and \"Key\" in json_obj[\"Filter\"] and \"FilterRules\" in json_obj[\"Filter\"][\"Key\"]:\n filter_rules = json_obj[\"Filter\"][\"Key\"][\"FilterRules\"]\n sorted_filter_rules = sorted(filter_rules, key=lambda x: x[\"Name\"])\n json_obj[\"Filter\"][\"Key\"][\"FilterRules\"] = sorted_filter_rules\n return json_obj" }, "Handler": "index.handler", "Role": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stps3stepfunctionsnoargumentIntegDefaultTestDeployAssertB7C63989.assets.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stps3stepfunctionsnoargumentIntegDefaultTestDeployAssertB7C63989.assets.json index 28b80ea28..d964f8181 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stps3stepfunctionsnoargumentIntegDefaultTestDeployAssertB7C63989.assets.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/s3stps3stepfunctionsnoargumentIntegDefaultTestDeployAssertB7C63989.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.18", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/tree.json index 9c7f0d146..d094c0c78 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/tree.json +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.js.snapshot/tree.json @@ -21,7 +21,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/lambdas3stp-test/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -60,13 +60,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -90,13 +90,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.154.1" + "version": "2.162.0" } }, "tasks3stp-test": { @@ -104,7 +104,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/tasks3stp-test", "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions_tasks.LambdaInvoke", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-stepfunctions-construct": { @@ -149,7 +149,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -283,13 +283,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -301,19 +301,19 @@ "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/S3LoggingBucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "S3Bucket": { @@ -372,7 +372,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.154.1" + "version": "2.162.0" } }, "Policy": { @@ -470,13 +470,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.154.1" + "version": "2.162.0" } }, "AutoDeleteObjectsCustomResource": { @@ -488,13 +488,13 @@ "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/S3Bucket/AutoDeleteObjectsCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Notifications": { @@ -506,19 +506,19 @@ "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/S3Bucket/Notifications/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.154.1" + "version": "2.162.0" } }, "test-s3-stepfunctions-construct-event-rule-step-function-construct": { @@ -560,13 +560,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.CfnLogGroup", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_logs.LogGroup", - "version": "2.154.1" + "version": "2.162.0" } }, "StateMachine": { @@ -582,7 +582,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/StateMachine/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -607,7 +607,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -675,19 +675,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -740,13 +740,130 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions.CfnStateMachine", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_stepfunctions.StateMachine", - "version": "2.154.1" + "version": "2.162.0" + } + }, + "ExecutionFailedAlarm": { + "id": "ExecutionFailedAlarm", + "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionFailedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsFailed", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" + } + }, + "ExecutionThrottledAlarm": { + "id": "ExecutionThrottledAlarm", + "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionThrottledAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionThrottled", + "namespace": "AWS/States", + "period": 300, + "statistic": "Sum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" + } + }, + "ExecutionAbortedAlarm": { + "id": "ExecutionAbortedAlarm", + "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionAbortedAlarm", + "children": { + "Resource": { + "id": "Resource", + "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", + "aws:cdk:cloudformation:props": { + "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", + "comparisonOperator": "GreaterThanOrEqualToThreshold", + "dimensions": [ + { + "name": "StateMachineArn", + "value": { + "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" + } + } + ], + "evaluationPeriods": 1, + "metricName": "ExecutionsAborted", + "namespace": "AWS/States", + "period": 300, + "statistic": "Maximum", + "threshold": 1 + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", + "version": "2.162.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", + "version": "2.162.0" } }, "EventsRuleRole": { @@ -758,7 +875,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/EventsRuleRole/ImportEventsRuleRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -783,7 +900,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -818,19 +935,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "EventsRule": { @@ -879,142 +996,25 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_events.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_events.Rule", - "version": "2.154.1" - } - }, - "ExecutionFailedAlarm": { - "id": "ExecutionFailedAlarm", - "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionFailedAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionFailedAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that failed exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionsFailed", - "namespace": "AWS/States", - "period": 300, - "statistic": "Sum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" - } - }, - "ExecutionThrottledAlarm": { - "id": "ExecutionThrottledAlarm", - "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionThrottledAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionThrottledAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that throttled exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionThrottled", - "namespace": "AWS/States", - "period": 300, - "statistic": "Sum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" - } - }, - "ExecutionAbortedAlarm": { - "id": "ExecutionAbortedAlarm", - "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionAbortedAlarm", - "children": { - "Resource": { - "id": "Resource", - "path": "s3stp-s3-stepfunctions-no-argument/test-s3-stepfunctions-construct/test-s3-stepfunctions-construct-event-rule-step-function-construct/ExecutionAbortedAlarm/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", - "aws:cdk:cloudformation:props": { - "alarmDescription": "Alarm for the number of executions that aborted exceeded the threshold of 1. ", - "comparisonOperator": "GreaterThanOrEqualToThreshold", - "dimensions": [ - { - "name": "StateMachineArn", - "value": { - "Ref": "tests3stepfunctionsconstructtests3stepfunctionsconstructeventrulestepfunctionconstructStateMachineCC5D0DD7" - } - } - ], - "evaluationPeriods": 1, - "metricName": "ExecutionsAborted", - "namespace": "AWS/States", - "period": 300, - "statistic": "Maximum", - "threshold": 1 - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", - "version": "2.154.1" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-eventbridge-stepfunctions.EventbridgeToStepfunctions", - "version": "2.67.1" + "version": "2.74.0" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-s3-stepfunctions.S3ToStepfunctions", - "version": "2.67.1" + "version": "2.74.0" } }, "LatestNodeRuntimeMap": { @@ -1022,7 +1022,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/LatestNodeRuntimeMap", "constructInfo": { "fqn": "aws-cdk-lib.CfnMapping", - "version": "2.154.1" + "version": "2.162.0" } }, "Custom::S3AutoDeleteObjectsCustomResourceProvider": { @@ -1034,7 +1034,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/Custom::S3AutoDeleteObjectsCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.154.1" + "version": "2.162.0" } }, "Role": { @@ -1042,7 +1042,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/Custom::S3AutoDeleteObjectsCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } }, "Handler": { @@ -1050,13 +1050,13 @@ "path": "s3stp-s3-stepfunctions-no-argument/Custom::S3AutoDeleteObjectsCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "2.154.1" + "version": "2.162.0" } }, "BucketNotificationsHandler050a0587b7544547bf325f094a3db834": { @@ -1072,7 +1072,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/ImportRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -1111,7 +1111,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.154.1" + "version": "2.162.0" } }, "DefaultPolicy": { @@ -1144,19 +1144,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.154.1" + "version": "2.162.0" } }, "Resource": { @@ -1164,13 +1164,13 @@ "path": "s3stp-s3-stepfunctions-no-argument/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Integ": { @@ -1186,7 +1186,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -1198,7 +1198,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1206,25 +1206,25 @@ "path": "s3stp-s3-stepfunctions-no-argument/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.154.1-alpha.0" + "version": "2.162.0-alpha.0" } }, "BootstrapVersion": { @@ -1232,7 +1232,7 @@ "path": "s3stp-s3-stepfunctions-no-argument/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.154.1" + "version": "2.162.0" } }, "CheckBootstrapVersion": { @@ -1240,13 +1240,13 @@ "path": "s3stp-s3-stepfunctions-no-argument/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.154.1" + "version": "2.162.0" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.154.1" + "version": "2.162.0" } }, "Tree": { @@ -1254,13 +1254,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.154.1" + "version": "2.162.0" } } } \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.ts b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.ts index 72cf2e7d4..a05c67e41 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.ts +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/integ.s3stp-s3-stepfunctions-no-argument.ts @@ -19,7 +19,11 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as s3 from 'aws-cdk-lib/aws-s3'; import * as defaults from '@aws-solutions-constructs/core'; -const app = new App(); +const app = new App({ + postCliContext: { + '@aws-cdk/aws-s3:keepNotificationInImportedBucket': false, + }, +}); const stack = new Stack(app, generateIntegStackName(__filename)); const props: S3ToStepfunctionsProps = { diff --git a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-s3-stepfunctions/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md index d508a30eb..f37c20e45 100755 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new SnsToLambda(this, 'test-sns-lambda', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -50,7 +50,7 @@ from constructs import Construct SnsToLambda(self, 'test_sns_lambda', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -68,7 +68,7 @@ import software.amazon.awsconstructs.services.snslambda.*; new SnsToLambda(this, "test-lambda-sqs-stack", new SnsToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json index 7dbb42ad1..100f9fa4d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/lambda/index.js index 743e4fdbb..44a0a9467 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-sns-lambda/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { console.log('request:', JSON.stringify(event, undefined, 2)); return { diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json index 652e6f340..ab5f90282 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/cdk.out b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/cdk.out new file mode 100644 index 000000000..c6e612584 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"38.0.1"} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/integ.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/integ.json new file mode 100644 index 000000000..6fdff1de8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "38.0.1", + "testCases": { + "snssqs-no-arguments-for-scan/Integ/DefaultTest": { + "stacks": [ + "snssqs-no-arguments-for-scan" + ], + "assertionStack": "snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert", + "assertionStackName": "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/manifest.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/manifest.json new file mode 100644 index 000000000..03174f859 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/manifest.json @@ -0,0 +1,169 @@ +{ + "version": "38.0.1", + "artifacts": { + "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.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", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.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": [ + "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.assets" + ], + "metadata": { + "/snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert" + }, + "snssqs-no-arguments-for-scan.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "snssqs-no-arguments-for-scan.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "snssqs-no-arguments-for-scan": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "snssqs-no-arguments-for-scan.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}/da037dc6900766c40cbd02620e248cf178cbd6e86ad0dce8406cfe1c6a2a7c71.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "snssqs-no-arguments-for-scan.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": [ + "snssqs-no-arguments-for-scan.assets" + ], + "metadata": { + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/SnsTopic/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackSnsTopic92693DD8" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/SnsTopic/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackSnsTopicPolicyBD0740CC" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue-dlq/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackqueuedlq0BD0C2B9" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue-dlq/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackqueuedlqPolicy3BB4A79B" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue": [ + { + "type": "aws:cdk:warning", + "data": "encryption: Automatically changed to QueueEncryption.KMS, was: QueueEncryption.KMS_MANAGED\nWhen encryptionMasterKey is provided, always set `encryption: QueueEncryption.KMS` [ack: @aws-cdk/aws-sqs:queueEncryptionChangedToKMS]" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackqueue908D8D48" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/Policy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackqueuePolicyFD3F4725" + } + ], + "/snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/snssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackqueuesnssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280B8A3D245" + } + ], + "/snssqs-no-arguments-for-scan/'test-sns-sqs-stacktopicKey'/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstacktopicKeyCC048007" + } + ], + "/snssqs-no-arguments-for-scan/'test-sns-sqs-stackqueueKey'/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testsnssqsstackqueueKey4F05EC55" + } + ], + "/snssqs-no-arguments-for-scan/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/snssqs-no-arguments-for-scan/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "snssqs-no-arguments-for-scan" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqs-no-arguments-for-scan.assets.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqs-no-arguments-for-scan.assets.json new file mode 100644 index 000000000..e1dd819b1 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqs-no-arguments-for-scan.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "da037dc6900766c40cbd02620e248cf178cbd6e86ad0dce8406cfe1c6a2a7c71": { + "source": { + "path": "snssqs-no-arguments-for-scan.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "da037dc6900766c40cbd02620e248cf178cbd6e86ad0dce8406cfe1c6a2a7c71.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/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqs-no-arguments-for-scan.template.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqs-no-arguments-for-scan.template.json new file mode 100644 index 000000000..6e40e18f8 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqs-no-arguments-for-scan.template.json @@ -0,0 +1,486 @@ +{ + "Description": "Integration Test for aws-sns-sqs", + "Resources": { + "testsnssqsstackSnsTopic92693DD8": { + "Type": "AWS::SNS::Topic", + "Properties": { + "KmsMasterKeyId": { + "Fn::GetAtt": [ + "testsnssqsstacktopicKeyCC048007", + "Arn" + ] + } + } + }, + "testsnssqsstackSnsTopicPolicyBD0740CC": { + "Type": "AWS::SNS::TopicPolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "SNS:AddPermission", + "SNS:DeleteTopic", + "SNS:GetTopicAttributes", + "SNS:ListSubscriptionsByTopic", + "SNS:Publish", + "SNS:Receive", + "SNS:RemovePermission", + "SNS:SetTopicAttributes", + "SNS:Subscribe" + ], + "Condition": { + "StringEquals": { + "AWS:SourceOwner": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + }, + "Sid": "TopicOwnerOnlyAccess" + }, + { + "Action": [ + "SNS:AddPermission", + "SNS:DeleteTopic", + "SNS:GetTopicAttributes", + "SNS:ListSubscriptionsByTopic", + "SNS:Publish", + "SNS:Receive", + "SNS:RemovePermission", + "SNS:SetTopicAttributes", + "SNS:Subscribe" + ], + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Topics": [ + { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + ] + } + }, + "testsnssqsstackqueuedlq0BD0C2B9": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": "alias/aws/sqs" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsnssqsstackqueuedlqPolicy3BB4A79B": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueuedlq0BD0C2B9", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueuedlq0BD0C2B9", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testsnssqsstackqueuedlq0BD0C2B9" + } + ] + } + }, + "testsnssqsstackqueue908D8D48": { + "Type": "AWS::SQS::Queue", + "Properties": { + "KmsMasterKeyId": { + "Fn::GetAtt": [ + "testsnssqsstackqueueKey4F05EC55", + "Arn" + ] + }, + "RedrivePolicy": { + "deadLetterTargetArn": { + "Fn::GetAtt": [ + "testsnssqsstackqueuedlq0BD0C2B9", + "Arn" + ] + }, + "maxReceiveCount": 15 + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsnssqsstackqueuePolicyFD3F4725": { + "Type": "AWS::SQS::QueuePolicy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + }, + "Sid": "HttpsOnly" + }, + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "sns.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "Queues": [ + { + "Ref": "testsnssqsstackqueue908D8D48" + } + ] + } + }, + "testsnssqsstackqueuesnssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280B8A3D245": { + "Type": "AWS::SNS::Subscription", + "Properties": { + "Endpoint": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + }, + "Protocol": "sqs", + "TopicArn": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + }, + "DependsOn": [ + "testsnssqsstackqueuePolicyFD3F4725" + ] + }, + "testsnssqsstacktopicKeyCC048007": { + "Type": "AWS::KMS::Key", + "Properties": { + "EnableKeyRotation": true, + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "testsnssqsstackqueueKey4F05EC55": { + "Type": "AWS::KMS::Key", + "Properties": { + "EnableKeyRotation": true, + "KeyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:GenerateDataKey" + ], + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "sns.amazonaws.com" + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "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/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.assets.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.assets.json new file mode 100644 index 000000000..55d68c125 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.assets.json @@ -0,0 +1,19 @@ +{ + "version": "38.0.1", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.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/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.template.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.template.json new file mode 100644 index 000000000..ad9d0fb73 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/snssqsnoargumentsforscanIntegDefaultTestDeployAssert25F8795A.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/tree.json b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/tree.json new file mode 100644 index 000000000..453cf55cb --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.js.snapshot/tree.json @@ -0,0 +1,709 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "snssqs-no-arguments-for-scan": { + "id": "snssqs-no-arguments-for-scan", + "path": "snssqs-no-arguments-for-scan", + "children": { + "test-sns-sqs-stack": { + "id": "test-sns-sqs-stack", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack", + "children": { + "SnsTopic": { + "id": "SnsTopic", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/SnsTopic", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/SnsTopic/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::Topic", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": { + "Fn::GetAtt": [ + "testsnssqsstacktopicKeyCC048007", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sns.CfnTopic", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/SnsTopic/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/SnsTopic/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::TopicPolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "SNS:AddPermission", + "SNS:DeleteTopic", + "SNS:GetTopicAttributes", + "SNS:ListSubscriptionsByTopic", + "SNS:Publish", + "SNS:Receive", + "SNS:RemovePermission", + "SNS:SetTopicAttributes", + "SNS:Subscribe" + ], + "Condition": { + "StringEquals": { + "AWS:SourceOwner": { + "Ref": "AWS::AccountId" + } + } + }, + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + }, + "Sid": "TopicOwnerOnlyAccess" + }, + { + "Action": [ + "SNS:AddPermission", + "SNS:DeleteTopic", + "SNS:GetTopicAttributes", + "SNS:ListSubscriptionsByTopic", + "SNS:Publish", + "SNS:Receive", + "SNS:RemovePermission", + "SNS:SetTopicAttributes", + "SNS:Subscribe" + ], + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "topics": [ + { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sns.CfnTopicPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sns.TopicPolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sns.Topic", + "version": "2.163.1" + } + }, + "queue-dlq": { + "id": "queue-dlq", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue-dlq", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue-dlq/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": "alias/aws/sqs" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue-dlq/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue-dlq/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueuedlq0BD0C2B9", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueuedlq0BD0C2B9", + "Arn" + ] + }, + "Sid": "HttpsOnly" + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testsnssqsstackqueuedlq0BD0C2B9" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + }, + "queue": { + "id": "queue", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::Queue", + "aws:cdk:cloudformation:props": { + "kmsMasterKeyId": { + "Fn::GetAtt": [ + "testsnssqsstackqueueKey4F05EC55", + "Arn" + ] + }, + "redrivePolicy": { + "deadLetterTargetArn": { + "Fn::GetAtt": [ + "testsnssqsstackqueuedlq0BD0C2B9", + "Arn" + ] + }, + "maxReceiveCount": 15 + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueue", + "version": "2.163.1" + } + }, + "Policy": { + "id": "Policy", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/Policy", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/Policy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SQS::QueuePolicy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "sqs:AddPermission", + "sqs:DeleteMessage", + "sqs:GetQueueAttributes", + "sqs:ReceiveMessage", + "sqs:RemovePermission", + "sqs:SendMessage", + "sqs:SetQueueAttributes" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + }, + "Sid": "QueueOwnerOnlyAccess" + }, + { + "Action": "SQS:*", + "Condition": { + "Bool": { + "aws:SecureTransport": "false" + } + }, + "Effect": "Deny", + "Principal": { + "AWS": "*" + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + }, + "Sid": "HttpsOnly" + }, + { + "Action": "sqs:SendMessage", + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "sns.amazonaws.com" + }, + "Resource": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "queues": [ + { + "Ref": "testsnssqsstackqueue908D8D48" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.CfnQueuePolicy", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.QueuePolicy", + "version": "2.163.1" + } + }, + "snssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280": { + "id": "snssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/snssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/test-sns-sqs-stack/queue/snssqsnoargumentsforscantestsnssqsstackSnsTopic4E060280/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SNS::Subscription", + "aws:cdk:cloudformation:props": { + "endpoint": { + "Fn::GetAtt": [ + "testsnssqsstackqueue908D8D48", + "Arn" + ] + }, + "protocol": "sqs", + "topicArn": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sns.CfnSubscription", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sns.Subscription", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_sqs.Queue", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-solutions-constructs/aws-sns-sqs.SnsToSqs", + "version": "2.74.0" + } + }, + "'test-sns-sqs-stacktopicKey'": { + "id": "'test-sns-sqs-stacktopicKey'", + "path": "snssqs-no-arguments-for-scan/'test-sns-sqs-stacktopicKey'", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/'test-sns-sqs-stacktopicKey'/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "enableKeyRotation": true, + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "2.163.1" + } + }, + "'test-sns-sqs-stackqueueKey'": { + "id": "'test-sns-sqs-stackqueueKey'", + "path": "snssqs-no-arguments-for-scan/'test-sns-sqs-stackqueueKey'", + "children": { + "Resource": { + "id": "Resource", + "path": "snssqs-no-arguments-for-scan/'test-sns-sqs-stackqueueKey'/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::KMS::Key", + "aws:cdk:cloudformation:props": { + "enableKeyRotation": true, + "keyPolicy": { + "Statement": [ + { + "Action": "kms:*", + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:GenerateDataKey" + ], + "Condition": { + "ArnEquals": { + "aws:SourceArn": { + "Ref": "testsnssqsstackSnsTopic92693DD8" + } + } + }, + "Effect": "Allow", + "Principal": { + "Service": "sns.amazonaws.com" + }, + "Resource": "*" + }, + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt" + ], + "Effect": "Allow", + "Principal": { + "AWS": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::", + { + "Ref": "AWS::AccountId" + }, + ":root" + ] + ] + } + }, + "Resource": "*" + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.CfnKey", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_kms.Key", + "version": "2.163.1" + } + }, + "Integ": { + "id": "Integ", + "path": "snssqs-no-arguments-for-scan/Integ", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "snssqs-no-arguments-for-scan/Integ/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "snssqs-no-arguments-for-scan/Integ/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "snssqs-no-arguments-for-scan/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "2.163.1-alpha.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "2.163.1-alpha.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "snssqs-no-arguments-for-scan/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "2.163.1" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "snssqs-no-arguments-for-scan/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "2.163.1" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "2.163.1" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.4.2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "2.163.1" + } + } +} \ No newline at end of file diff --git a/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.ts b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.ts new file mode 100644 index 000000000..bdcd06a72 --- /dev/null +++ b/source/patterns/@aws-solutions-constructs/aws-sns-sqs/test/integ.snssqs-no-arguments-for-scan.ts @@ -0,0 +1,54 @@ +/** + * 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. + */ + +// Same as New Interface test, but here for scan load + +// Imports +import { App, RemovalPolicy, Stack } from "aws-cdk-lib"; +import { SnsToSqs, SnsToSqsProps } from "../lib"; +import * as iam from 'aws-cdk-lib/aws-iam'; +import { generateIntegStackName } from '@aws-solutions-constructs/core'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +// Setup +const app = new App(); +const stack = new Stack(app, generateIntegStackName(__filename)); +stack.templateOptions.description = 'Integration Test for aws-sns-sqs'; +stack.node.setContext("@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption", true); + +// Definitions +const props: SnsToSqsProps = { + topicEncryptionKeyProps: { + removalPolicy: RemovalPolicy.DESTROY + }, + queueEncryptionKeyProps: { + removalPolicy: RemovalPolicy.DESTROY + } +}; + +const snsToSqsStack = new SnsToSqs(stack, 'test-sns-sqs-stack', props); + +// Grant yourself permissions to use the Customer Managed KMS Key +const policyStatement = new iam.PolicyStatement({ + actions: ["kms:Encrypt", "kms:Decrypt"], + effect: iam.Effect.ALLOW, + principals: [ new iam.AccountRootPrincipal() ], + resources: [ "*" ] +}); + +snsToSqsStack.queueEncryptionKey?.addToResourcePolicy(policyStatement); +snsToSqsStack.topicEncryptionKey?.addToResourcePolicy(policyStatement); + +new IntegTest(stack, 'Integ', { testCases: [ + stack +] }); diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md index e6d88dd8b..cbd3c830b 100755 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/README.md @@ -32,7 +32,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda'; new SqsToLambda(this, 'SqsToLambdaPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -52,7 +52,7 @@ from constructs import Construct SqsToLambda(self, 'SqsToLambdaPattern', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset('lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -70,7 +70,7 @@ import software.amazon.awsconstructs.services.sqslambda.*; new SqsToLambda(this, "SnsToSqsPattern", new SqsToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json index fa97dd4d6..3eb8a96e5 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-lambda/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/README.md b/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/README.md index 2ce7bff79..22d18e6f2 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/README.md @@ -27,16 +27,55 @@ Typescript ``` typescript import { Construct } from 'constructs'; import { Stack, StackProps } from 'aws-cdk-lib'; -import * as stepfunctions from 'aws-cdk-lib/aws-stepfunctions'; +import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; import { SqsToPipesToStepfunctions, SqsToPipesToStepfunctionsProps } from "@aws-solutions-constructs/aws-sqs-pipes-stepfunctions"; -const startState = new stepfunctions.Pass(this, 'StartState'); + const startState = new sfn.Pass(this, 'StartState'); + + new SqsToPipesToStepfunctions(this, 'SqsToPipesToStepfunctionsPattern', { + stateMachineProps: { + definitionBody: sfn.DefinitionBody.fromChainable(sfn.Chain.start(new sfn.Pass(this, 'Pass'))), + } + }); +``` + +Python +```python +from constructs import Construct +from aws_cdk import ( + aws_stepfunctions as _sfn, + Stack +) +from aws_solutions_constructs import ( + aws_sqs_pipes_stepfunctions as sqs_pipes_stepfunctions +) + +sqs_pipes_stepfunctions.SqsToPipesToStepfunctions( + self, 'SqsToPipesToStepfunctions', + state_machine_props=_sfn.StateMachineProps( + definition_body=_sfn.DefinitionBody.from_chainable(_sfn.Chain.start(_sfn.Pass(self, "pass"))) + ) +) +``` + +Java +```java +package com.myorg; + +import software.constructs.Construct; +import software.amazon.awscdk.Stack; +import software.amazon.awscdk.StackProps; + +import software.amazon.awscdk.services.stepfunctions.*; +import software.amazon.awsconstructs.services.sqspipesstepfunctions.SqsToPipesToStepfunctions; +import software.amazon.awsconstructs.services.sqspipesstepfunctions.SqsToPipesToStepfunctionsProps; -new SqsToPipesToStepfunctions(this, 'SqsToLambdaToStepfunctionsPattern', { - stateMachineProps: { - definition: startState - } -}); +new SqsToPipesToStepfunctions(this, "SqsToLambdaToStepfunctionsPattern", + SqsToPipesToStepfunctionsProps.builder() + .stateMachineProps(StateMachineProps.builder() + .definitionBody(DefinitionBody.fromChainable(Chain.start(new Pass(scope, "Pass")))) + .build()) + .build()); ``` ## Pattern Construct Props diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/package.json b/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/package.json index 844ea8e89..93adf438d 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/resources": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/test/lambda/index.js index 34d92af16..35397315e 100644 --- a/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/aws-sqs-pipes-stepfunctions/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async (event) => { console.log(event); const response = event.map((x) =>{ diff --git a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-alb/package.json b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-alb/package.json index 884db5760..bbe2a4540 100644 --- a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-alb/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-alb/package.json @@ -53,13 +53,12 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "@aws-solutions-constructs/aws-route53-alb": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/README.md b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/README.md index a085ad543..013ce0402 100755 --- a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/README.md +++ b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/README.md @@ -38,7 +38,7 @@ import { WafwebaclToApiGatewayProps, WafwebaclToApiGateway } from "@aws-solution const apiGatewayToLambda = new ApiGatewayToLambda(this, 'ApiGatewayToLambdaPattern', { lambdaFunctionProps: { - runtime: lambda.Runtime.NODEJS_16_X, + runtime: lambda.Runtime.NODEJS_20_X, handler: 'index.handler', code: lambda.Code.fromAsset(`lambda`) } @@ -65,7 +65,7 @@ api_gateway_to_lambda = ApiGatewayToLambda(self, 'ApiGatewayToLambdaPattern', lambda_function_props=_lambda.FunctionProps( code=_lambda.Code.from_asset( 'lambda'), - runtime=_lambda.Runtime.PYTHON_3_9, + runtime=_lambda.Runtime.Python_3_11, handler='index.handler' ) ) @@ -91,7 +91,7 @@ import software.amazon.awsconstructs.services.wafwebaclapigateway.*; final ApiGatewayToLambda apiGatewayToLambda = new ApiGatewayToLambda(this, "ApiGatewayToLambdaPattern", new ApiGatewayToLambdaProps.Builder() .lambdaFunctionProps(new FunctionProps.Builder() - .runtime(Runtime.NODEJS_16_X) + .runtime(Runtime.NODEJS_20_X) .code(Code.fromAsset("lambda")) .handler("index.handler") .build()) diff --git a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/package.json b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/package.json index d58901fa2..f0eba4313 100644 --- a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-apigateway/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-appsync/package.json b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-appsync/package.json index 50d0c7b09..aabe446ed 100644 --- a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-appsync/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-appsync/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "aws-cdk-lib": "0.0.0", "constructs": "^10.0.0" diff --git a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-cloudfront/package.json b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-cloudfront/package.json index 9da86db55..30e6e31ed 100644 --- a/source/patterns/@aws-solutions-constructs/aws-wafwebacl-cloudfront/package.json +++ b/source/patterns/@aws-solutions-constructs/aws-wafwebacl-cloudfront/package.json @@ -53,12 +53,11 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-solutions-constructs/core": "0.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" diff --git a/source/patterns/@aws-solutions-constructs/core/lib/pipes-defaults.ts b/source/patterns/@aws-solutions-constructs/core/lib/pipes-defaults.ts index bb920e31d..f0ac6caeb 100644 --- a/source/patterns/@aws-solutions-constructs/core/lib/pipes-defaults.ts +++ b/source/patterns/@aws-solutions-constructs/core/lib/pipes-defaults.ts @@ -22,6 +22,15 @@ export function defaultSqsSourceProps(): any { }; } +export function defaultDynamoDBStreamsSourceProps(deployDlq: boolean): any { + return { + dynamoDbStreamParameters: { + startingPosition: "LATEST", + maximumRetryAttempts: deployDlq ? 3 : undefined, + } + }; +} + export function defaultStateMachineTargetProps(): any { return { stepFunctionStateMachineParameters: { diff --git a/source/patterns/@aws-solutions-constructs/core/lib/pipes-helper.ts b/source/patterns/@aws-solutions-constructs/core/lib/pipes-helper.ts index ec95b5cf8..8b2bc4759 100644 --- a/source/patterns/@aws-solutions-constructs/core/lib/pipes-helper.ts +++ b/source/patterns/@aws-solutions-constructs/core/lib/pipes-helper.ts @@ -15,6 +15,7 @@ import * as pipes from 'aws-cdk-lib/aws-pipes'; import * as sqs from 'aws-cdk-lib/aws-sqs'; import * as iam from 'aws-cdk-lib/aws-iam'; import * as logs from 'aws-cdk-lib/aws-logs'; +import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import * as sfn from 'aws-cdk-lib/aws-stepfunctions'; import * as defaults from ".."; @@ -31,7 +32,9 @@ export enum PipesLogLevel { export interface CreateSourceResponse { readonly sourceParameters: pipes.CfnPipe.PipeSourceParametersProperty, readonly sourceArn: string, - readonly sourcePolicy: iam.PolicyDocument + readonly sourcePolicy: iam.PolicyDocument, + // Not populated for every source, not populated if existing queue is passed in someday + readonly dlq?: sqs.Queue } export interface BuildPipesProps { @@ -185,6 +188,74 @@ export function CreateSqsSource(queue: sqs.IQueue, clientProps?: pipes.CfnPipe.P }; } +interface CreateDynamoDBStreamsSourceProps { + table: dynamodb.ITable, + deploySqsDlqQueue?: boolean, + sqsDlqQueueProps?: sqs.QueueProps, + clientProps?: pipes.CfnPipe.PipeSourceParametersProperty | cdk.IResolvable +} + +export function CreateDynamoDBStreamsSource( + scope: Construct, props: CreateDynamoDBStreamsSourceProps): CreateSourceResponse { + if (!props.table.tableStreamArn) { + throw new Error("ERROR - DynamoDB Table must have an associated stream"); + } + const deployDlq = defaults.CheckBooleanWithDefault(props.deploySqsDlqQueue, true); + let sourceParameters: pipes.CfnPipe.PipeSourceParametersProperty = + defaults.consolidateProps(defaults.defaultDynamoDBStreamsSourceProps(deployDlq), props.clientProps); + + const sourcePolicy: iam.PolicyDocument = new iam.PolicyDocument({ + statements: [ + new iam.PolicyStatement({ + resources: [props.table.tableStreamArn], + actions: [ + "dynamodb:DescribeStream", + "dynamodb:GetRecords", + "dynamodb:GetShardIterator", + "dynamodb:ListStreams" + ], + effect: iam.Effect.ALLOW, + }) + ] + }); + let buildQueueResponse: defaults.BuildQueueResponse | undefined; + // Default to setting up DLQ for failed messages + if (deployDlq) { + buildQueueResponse = defaults.buildQueue(scope, 'dlq', { + deployDeadLetterQueue: false, + queueProps: props.sqsDlqQueueProps + }); + sourceParameters = defaults.consolidateProps(sourceParameters, { + dynamoDbStreamParameters: { + deadLetterConfig: { + arn: buildQueueResponse.queue.queueArn + } + } + }); + sourcePolicy.addStatements( + new iam.PolicyStatement({ + resources: [buildQueueResponse.queue.queueArn], + actions: [ + "sqs:SendMessage" + ], + effect: iam.Effect.ALLOW, + }) + ); + } else { + if (((sourceParameters.dynamoDbStreamParameters as pipes.CfnPipe.PipeSourceDynamoDBStreamParametersProperty)?.maximumRecordAgeInSeconds) || + ((sourceParameters.dynamoDbStreamParameters as pipes.CfnPipe.PipeSourceDynamoDBStreamParametersProperty)?.maximumRetryAttempts)) { + throw new Error('ERROR - retry and record age constraints cannot be specified with no DLQ\n'); + } + } + + return { + sourceParameters, + sourceArn: props.table.tableStreamArn!, + sourcePolicy, + dlq: buildQueueResponse?.queue ?? undefined + }; +} + export interface CreateTargetResponse { readonly targetParameters: pipes.CfnPipe.PipeTargetParametersProperty, readonly targetArn: string, diff --git a/source/patterns/@aws-solutions-constructs/core/package.json b/source/patterns/@aws-solutions-constructs/core/package.json index a02ed96cb..8aefdf254 100644 --- a/source/patterns/@aws-solutions-constructs/core/package.json +++ b/source/patterns/@aws-solutions-constructs/core/package.json @@ -52,7 +52,6 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "deep-diff": "^1.0.2", "deepmerge": "^4.0.0", "npmlog": "^7.0.0", diff --git a/source/patterns/@aws-solutions-constructs/core/test/lambda-test/index.js b/source/patterns/@aws-solutions-constructs/core/test/lambda-test/index.js index b12fff204..e8a2cf8af 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/lambda-test/index.js +++ b/source/patterns/@aws-solutions-constructs/core/test/lambda-test/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + exports.handler = async function(event) { return { statusCode: 200, diff --git a/source/patterns/@aws-solutions-constructs/core/test/lambda/index.js b/source/patterns/@aws-solutions-constructs/core/test/lambda/index.js index 4b3640c1e..b8d33b611 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/lambda/index.js +++ b/source/patterns/@aws-solutions-constructs/core/test/lambda/index.js @@ -1,3 +1,16 @@ +/** + * 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. + */ + console.log('Loading function'); exports.handler = async (event, context) => { diff --git a/source/patterns/@aws-solutions-constructs/core/test/pipes-helper.test.ts b/source/patterns/@aws-solutions-constructs/core/test/pipes-helper.test.ts index 82122c621..8a126dc46 100644 --- a/source/patterns/@aws-solutions-constructs/core/test/pipes-helper.test.ts +++ b/source/patterns/@aws-solutions-constructs/core/test/pipes-helper.test.ts @@ -13,6 +13,7 @@ import { buildQueue } from "../lib/sqs-helper"; import { buildStateMachine } from "../lib/step-function-helper"; +import { buildDynamoDBTableWithStream } from "../lib/dynamodb-table-helper"; import { Stack } from "aws-cdk-lib"; import * as defaults from '../'; import * as pipes from 'aws-cdk-lib/aws-pipes'; @@ -60,6 +61,93 @@ test('Create an SQS Source with overrides', () => { expect(sqsSource.sourcePolicy.statementCount).toEqual(1); }); +test('Create a default DDB Streams Source', () => { + // Stack + const stack = new Stack(); + + const buildTableResponse = buildDynamoDBTableWithStream(stack, {}); + const tableSource = defaults.CreateDynamoDBStreamsSource(stack, { + table: buildTableResponse.tableObject! + }); + + expect(tableSource.sourceArn).toEqual(buildTableResponse.tableObject?.tableStreamArn); + expect(Object.keys(tableSource.sourceParameters).length).toEqual(1); + expect(tableSource.sourcePolicy.statementCount).toEqual(2); + expect(tableSource.dlq).toBeDefined(); + const streamParamters = (tableSource.sourceParameters.dynamoDbStreamParameters! as pipes.CfnPipe.PipeSourceDynamoDBStreamParametersProperty); + expect(streamParamters.deadLetterConfig).toBeDefined(); +}); + +test('Confirm that we use custom DLQ props', () => { + const queueName = 'something-unique-asdf'; + // Stack + const stack = new Stack(); + + const buildTableResponse = buildDynamoDBTableWithStream(stack, {}); + defaults.CreateDynamoDBStreamsSource(stack, { + table: buildTableResponse.tableObject!, + sqsDlqQueueProps: { + queueName, + } + }); + + const template = Template.fromStack(stack); + template.hasResourceProperties("AWS::SQS::Queue", { + QueueName: queueName + }); +}); + +test('Create DDB Streams Source with no DLQ', () => { + // Stack + const stack = new Stack(); + + const buildTableResponse = buildDynamoDBTableWithStream(stack, {}); + const tableSource = defaults.CreateDynamoDBStreamsSource(stack, { + table: buildTableResponse.tableObject!, + deploySqsDlqQueue: false + }); + + expect(tableSource.sourceArn).toEqual(buildTableResponse.tableObject?.tableStreamArn); + expect(Object.keys(tableSource.sourceParameters).length).toEqual(1); + expect(tableSource.sourcePolicy.statementCount).toEqual(1); + expect(tableSource.dlq).toBeUndefined(); + const streamParamters = (tableSource.sourceParameters.dynamoDbStreamParameters! as pipes.CfnPipe.PipeSourceDynamoDBStreamParametersProperty); + expect(streamParamters.maximumRetryAttempts).toBeUndefined(); + expect(streamParamters.deadLetterConfig).toBeUndefined(); + expect(streamParamters.startingPosition).toBeDefined(); + +}); + +test('Create an DDB Streams Source with overrides', () => { + const batchSizeValue = 4642; + // Stack + const stack = new Stack(); + + const buildTableResponse = buildDynamoDBTableWithStream(stack, {}); + const tableSource = defaults.CreateDynamoDBStreamsSource(stack, { + table: buildTableResponse.tableObject!, + clientProps: { + dynamoDbStreamParameters: { + startingPosition: 'LATEST', + batchSize: batchSizeValue + } + } + }); + + expect(tableSource.sourceArn).toEqual(buildTableResponse.tableObject?.tableStreamArn); + // Because sqsQueueParameters type include 'IResolvable |', we need to extract the property this way + const batchSizeProp = + (tableSource.sourceParameters.dynamoDbStreamParameters as pipes.CfnPipe.PipeSourceDynamoDBStreamParametersProperty)!.batchSize; + expect(batchSizeProp).toEqual(batchSizeValue); + // best we can do here, confirm values when we instantiate the actual pipe + expect(tableSource.sourcePolicy.statementCount).toEqual(2); + + const streamParamters = (tableSource.sourceParameters.dynamoDbStreamParameters! as pipes.CfnPipe.PipeSourceDynamoDBStreamParametersProperty); + expect(streamParamters.maximumRetryAttempts).toEqual(3); + expect(streamParamters.deadLetterConfig).toBeDefined(); + expect(streamParamters.startingPosition).toBeDefined(); +}); + test('Create a default Step Functions Target', () => { // Stack @@ -110,6 +198,28 @@ test('Create a Step Functions Target with overrides', () => { expect(stateMachineTarget.targetPolicy.statementCount).toEqual(1); }); +test('Check for error when DLQ is off but max constraint set', () => { + // Stack + const stack = new Stack(); + + const buildTableResponse = buildDynamoDBTableWithStream(stack, {}); + + const app = () => { + defaults.CreateDynamoDBStreamsSource(stack, { + clientProps: { + dynamoDbStreamParameters: { + startingPosition: 'LATEST', + maximumRecordAgeInSeconds: 100 + } + }, + table: buildTableResponse.tableObject!, + deploySqsDlqQueue: false + }); + }; + // Assertion + expect(app).toThrowError('ERROR - retry and record age constraints cannot be specified with no DLQ\n'); +}); + // ================================= // Test pipe creation // ================================= diff --git a/source/patterns/@aws-solutions-constructs/resources/package.json b/source/patterns/@aws-solutions-constructs/resources/package.json index 8364cd845..c2e7214e9 100644 --- a/source/patterns/@aws-solutions-constructs/resources/package.json +++ b/source/patterns/@aws-solutions-constructs/resources/package.json @@ -52,15 +52,14 @@ } }, "dependencies": { - "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@aws-sdk/client-kms": "^3.478.0", "@aws-sdk/client-s3": "^3.478.0", "@aws-solutions-constructs/core": "0.0.0", - "aws-sdk-client-mock": "^3.0.0", "constructs": "^10.0.0" }, "devDependencies": { - "@types/jest": "^27.4.0", + "aws-sdk-client-mock": "^3.0.0", + "@aws-cdk/integ-tests-alpha": "0.0.0-alpha.0", "@types/node": "^10.3.0", "constructs": "^10.0.0", "aws-cdk-lib": "0.0.0" @@ -81,8 +80,7 @@ }, "bundledDependencies": [ "@aws-sdk/client-kms", - "@aws-sdk/client-s3", - "aws-sdk-client-mock" + "@aws-sdk/client-s3" ], "peerDependencies": { "@aws-solutions-constructs/core": "0.0.0", diff --git a/source/use_cases/THIRD-PARTY-LICENSES.txt b/source/use_cases/THIRD-PARTY-LICENSES.txt new file mode 100644 index 000000000..b7f8e691c --- /dev/null +++ b/source/use_cases/THIRD-PARTY-LICENSES.txt @@ -0,0 +1,894 @@ +** aws-cdk-lib; version 2.163.1 -- https://github.com/aws/aws-cdk.git + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2023 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. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +* For aws-cdk-lib see also this required NOTICE: + Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + +------ + +** @aws-cdk/integ-tests-alpha; version 2.163.1 -- https://github.com/aws/aws-cdk.git + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018-2024 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. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +* For @aws-cdk/integ-tests-alpha see also this required NOTICE: + AWS Cloud Development Kit (AWS CDK) + Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. + + +------ + +** typescript; version 4.9.5 -- https://www.typescriptlang.org/ + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is included +in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, non- +exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, +prepare Derivative Works of, publicly display, publicly perform, sublicense, and +distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, +each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no- +charge, royalty-free, irrevocable (except as stated in this section) patent +license to make, have made, use, offer to sell, sell, import, and otherwise +transfer the Work, where such license applies only to those patent claims +licensable by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) with the Work +to which such Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Work or a Contribution incorporated within the Work +constitutes direct or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate as of the date +such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and in +Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and + +You must cause any modified files to carry prominent notices stating that You +changed the files; and + +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and + +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. You may add Your own copyright statement to Your +modifications and may provide additional or different license terms and +conditions for use, reproduction, or distribution of Your modifications, or for +any such Derivative Works as a whole, provided Your use, reproduction, and +distribution of the Work otherwise complies with the conditions stated in this +License. + +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to the +Licensor shall be under the terms and conditions of this License, without any +additional terms or conditions. Notwithstanding the above, nothing herein shall +supersede or modify the terms of any separate license agreement you may have +executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, +trademarks, service marks, or product names of the Licensor, except as required +for reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in +writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any warranties +or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any risks +associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in +tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to in +writing, shall any Contributor be liable to You for damages, including any +direct, indirect, special, incidental, or consequential damages of any character +arising as a result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, work stoppage, +computer failure or malfunction, or any and all other commercial damages or +losses), even if such Contributor has been advised of the possibility of such +damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or +Derivative Works thereof, You may choose to offer, and charge a fee for, +acceptance of support, warranty, indemnity, or other liability obligations +and/or rights consistent with this License. However, in accepting such +obligations, You may act only on Your own behalf and on Your sole +responsibility, not on behalf of any other Contributor, and only if You agree to +indemnify, defend, and hold each Contributor harmless for any liability incurred +by, or claims asserted against, such Contributor by reason of your accepting any +such warranty or additional liability. + +END OF TERMS AND CONDITIONS +* For typescript see also this required NOTICE: + Copyright (c) Microsoft Corporation. All rights reserved. + +------ + +** Constructs; version 10.4.2 -- https://github.com/aws/constructs + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +* For Constructs see also this required NOTICE: + Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +------ + +** source-map-support; version 0.5.21 -- https://github.com/evanw/node-source-map-support +Copyright (c) 2014 Evan Wallace + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +The MIT License (MIT) + +Copyright (c) 2014 Evan Wallace + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------ + +** uuid; version 8.3.2 -- https://github.com/uuidjs/uuid +Copyright (c) 2010-2020 Robert Kieffer and other contributors + +The MIT License (MIT) + +Copyright (c) 2010-2020 Robert Kieffer and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +------ + +** @types/jest; version 27.5.2 -- https://www.npmjs.com/package/@types/jest +Copyright (c) Microsoft Corporation. +** @types/node; version 10.17.60 -- https://www.npmjs.com/package/@types/node?activeTab=readme +Copyright (c) Microsoft Corporation. + + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to +deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in +all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE + SOFTWARE diff --git a/source/use_cases/aws-s3-static-website/README.md b/source/use_cases/aws-s3-static-website/README.md index 4ad791b1e..d3545b63e 100644 --- a/source/use_cases/aws-s3-static-website/README.md +++ b/source/use_cases/aws-s3-static-website/README.md @@ -26,7 +26,7 @@ cdk deploy ``` ## Deployment Verification -After the stack is deployed successfully, go to the Outputs tab in AWS Cloudformation console, it should show the 'websiteURL', click on the link and enjoy the Wile Rydes Unicorn website. +After the stack is deployed successfully, go to the Outputs tab in AWS Cloudformation console, it should show the 'websiteURL', click on the link to see the bare bones web site defined in the website-dist folder. *** © Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. \ No newline at end of file diff --git a/source/use_cases/aws-s3-static-website/test/__snapshots__/s3-static-site-stack.test.js.snap b/source/use_cases/aws-s3-static-website/test/__snapshots__/s3-static-site-stack.test.js.snap index 39d8b4777..fbe4e20ba 100644 --- a/source/use_cases/aws-s3-static-website/test/__snapshots__/s3-static-site-stack.test.js.snap +++ b/source/use_cases/aws-s3-static-website/test/__snapshots__/s3-static-site-stack.test.js.snap @@ -79,18 +79,14 @@ Object { ], }, "Id": "S3StaticWebsiteStackCloudFrontToS3CloudFrontDistributionOrigin1F7C9B507", + "OriginAccessControlId": Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3CloudFrontOacFB5D4E73", + "Id", + ], + }, "S3OriginConfig": Object { - "OriginAccessIdentity": Object { - "Fn::Join": Array [ - "", - Array [ - "origin-access-identity/cloudfront/", - Object { - "Ref": "CloudFrontToS3CloudFrontDistributionOrigin1S3OriginB0637B8F", - }, - ], - ], - }, + "OriginAccessIdentity": "", }, }, ], @@ -98,28 +94,89 @@ Object { }, "Type": "AWS::CloudFront::Distribution", }, - "CloudFrontToS3CloudFrontDistributionOrigin1S3OriginB0637B8F": Object { + "CloudFrontToS3CloudFrontOacFB5D4E73": Object { "Properties": Object { - "CloudFrontOriginAccessIdentityConfig": Object { - "Comment": "Identity for S3StaticWebsiteStackCloudFrontToS3CloudFrontDistributionOrigin1F7C9B507", + "OriginAccessControlConfig": Object { + "Description": "Origin access control provisioned by aws-cloudfront-s3", + "Name": Object { + "Fn::Join": Array [ + "", + Array [ + "aws-cloudfront-s3-CloutToS3-", + Object { + "Fn::Select": Array [ + 2, + Object { + "Fn::Split": Array [ + "/", + Object { + "Ref": "AWS::StackId", + }, + ], + }, + ], + }, + ], + ], + }, + "OriginAccessControlOriginType": "s3", + "SigningBehavior": "always", + "SigningProtocol": "sigv4", }, }, - "Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity", + "Type": "AWS::CloudFront::OriginAccessControl", }, "CloudFrontToS3CloudfrontLoggingBucket8350BE9B": Object { + "DeletionPolicy": "Retain", + "Properties": Object { + "AccessControl": "LogDeliveryWrite", + "BucketEncryption": Object { + "ServerSideEncryptionConfiguration": Array [ + Object { + "ServerSideEncryptionByDefault": Object { + "SSEAlgorithm": "AES256", + }, + }, + ], + }, + "LoggingConfiguration": Object { + "DestinationBucketName": Object { + "Ref": "CloudFrontToS3CloudfrontLoggingBucketAccessLog0E3BAD05", + }, + }, + "OwnershipControls": Object { + "Rules": Array [ + Object { + "ObjectOwnership": "ObjectWriter", + }, + ], + }, + "PublicAccessBlockConfiguration": Object { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true, + }, + "VersioningConfiguration": Object { + "Status": "Enabled", + }, + }, + "Type": "AWS::S3::Bucket", + "UpdateReplacePolicy": "Retain", + }, + "CloudFrontToS3CloudfrontLoggingBucketAccessLog0E3BAD05": Object { "DeletionPolicy": "Retain", "Metadata": Object { "cfn_nag": Object { "rules_to_suppress": Array [ Object { "id": "W35", - "reason": "This S3 bucket is used as the access logging bucket for CloudFront Distribution", + "reason": "This S3 bucket is used as the access logging bucket for another bucket", }, ], }, }, "Properties": Object { - "AccessControl": "LogDeliveryWrite", "BucketEncryption": Object { "ServerSideEncryptionConfiguration": Array [ Object { @@ -142,6 +199,89 @@ Object { "Type": "AWS::S3::Bucket", "UpdateReplacePolicy": "Retain", }, + "CloudFrontToS3CloudfrontLoggingBucketAccessLogPolicy2AAA13DA": Object { + "Properties": Object { + "Bucket": Object { + "Ref": "CloudFrontToS3CloudfrontLoggingBucketAccessLog0E3BAD05", + }, + "PolicyDocument": Object { + "Statement": Array [ + Object { + "Action": "s3:*", + "Condition": Object { + "Bool": Object { + "aws:SecureTransport": "false", + }, + }, + "Effect": "Deny", + "Principal": Object { + "AWS": "*", + }, + "Resource": Array [ + Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3CloudfrontLoggingBucketAccessLog0E3BAD05", + "Arn", + ], + }, + Object { + "Fn::Join": Array [ + "", + Array [ + Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3CloudfrontLoggingBucketAccessLog0E3BAD05", + "Arn", + ], + }, + "/*", + ], + ], + }, + ], + }, + Object { + "Action": "s3:PutObject", + "Condition": Object { + "ArnLike": Object { + "aws:SourceArn": Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3CloudfrontLoggingBucket8350BE9B", + "Arn", + ], + }, + }, + "StringEquals": Object { + "aws:SourceAccount": Object { + "Ref": "AWS::AccountId", + }, + }, + }, + "Effect": "Allow", + "Principal": Object { + "Service": "logging.s3.amazonaws.com", + }, + "Resource": Object { + "Fn::Join": Array [ + "", + Array [ + Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3CloudfrontLoggingBucketAccessLog0E3BAD05", + "Arn", + ], + }, + "/*", + ], + ], + }, + }, + ], + "Version": "2012-10-17", + }, + }, + "Type": "AWS::S3::BucketPolicy", + }, "CloudFrontToS3CloudfrontLoggingBucketPolicy416B82D9": Object { "Properties": Object { "Bucket": Object { @@ -225,6 +365,12 @@ Object { "IgnorePublicAcls": true, "RestrictPublicBuckets": true, }, + "Tags": Array [ + Object { + "Key": "aws-cdk:cr-owned:0ff41d4f", + "Value": "true", + }, + ], "VersioningConfiguration": Object { "Status": "Enabled", }, @@ -285,14 +431,32 @@ Object { }, Object { "Action": "s3:GetObject", + "Condition": Object { + "StringEquals": Object { + "AWS:SourceArn": Object { + "Fn::Join": Array [ + "", + Array [ + "arn:", + Object { + "Ref": "AWS::Partition", + }, + ":cloudfront::", + Object { + "Ref": "AWS::AccountId", + }, + ":distribution/", + Object { + "Ref": "CloudFrontToS3CloudFrontDistribution241D9866", + }, + ], + ], + }, + }, + }, "Effect": "Allow", "Principal": Object { - "CanonicalUser": Object { - "Fn::GetAtt": Array [ - "CloudFrontToS3CloudFrontDistributionOrigin1S3OriginB0637B8F", - "S3CanonicalUserId", - ], - }, + "Service": "cloudfront.amazonaws.com", }, "Resource": Object { "Fn::Join": Array [ @@ -328,7 +492,6 @@ Object { }, }, "Properties": Object { - "AccessControl": "LogDeliveryWrite", "BucketEncryption": Object { "ServerSideEncryptionConfiguration": Array [ Object { @@ -392,6 +555,42 @@ Object { }, ], }, + Object { + "Action": "s3:PutObject", + "Condition": Object { + "ArnLike": Object { + "aws:SourceArn": Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3S3Bucket9CE6AB04", + "Arn", + ], + }, + }, + "StringEquals": Object { + "aws:SourceAccount": Object { + "Ref": "AWS::AccountId", + }, + }, + }, + "Effect": "Allow", + "Principal": Object { + "Service": "logging.s3.amazonaws.com", + }, + "Resource": Object { + "Fn::Join": Array [ + "", + Array [ + Object { + "Fn::GetAtt": Array [ + "CloudFrontToS3S3LoggingBucketEF5CD8B2", + "Arn", + ], + }, + "/*", + ], + ], + }, + }, ], "Version": "2012-10-17", }, @@ -401,7 +600,7 @@ Object { "CloudFrontToS3SetHttpSecurityHeaders9E6088E2": Object { "Properties": Object { "AutoPublish": true, - "FunctionCode": "function handler(event) { var response = event.response; var headers = response.headers; headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'}; headers['content-security-policy'] = { value: \\"default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'\\"}; headers['x-content-type-options'] = { value: 'nosniff'}; headers['x-frame-options'] = {value: 'DENY'}; headers['x-xss-protection'] = {value: '1; mode=block'}; return response; }", + "FunctionCode": "function handler(event) { var response = event.response; var headers = response.headers; headers['strict-transport-security'] = { value: 'max-age=63072000; includeSubdomains; preload'}; headers['content-security-policy'] = { value: \\"default-src 'none'; img-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'\\"}; headers['x-content-type-options'] = { value: 'nosniff'}; headers['x-frame-options'] = {value: 'DENY'}; headers['x-xss-protection'] = {value: '1; mode=block'}; return response; }", "FunctionConfig": Object { "Comment": "SetHttpSecurityHeadersc876981af0ddffc7454da8dcf76a116580471cc611", "Runtime": "cloudfront-js-1.0", @@ -410,60 +609,41 @@ Object { }, "Type": "AWS::CloudFront::Function", }, - "CustomResource": Object { - "DeletionPolicy": "Delete", - "Properties": Object { - "Bucket": Object { - "Ref": "CloudFrontToS3S3Bucket9CE6AB04", - }, - "ServiceToken": Object { - "Fn::GetAtt": Array [ - "CustomResourceProviderframeworkonEvent0AA4376C", - "Arn", - ], - }, - "SourceBucket": "wildrydes-us-east-1", - "SourcePrefix": "WebApplication/1_StaticWebHosting/website/", - }, - "Type": "AWS::CloudFormation::CustomResource", - "UpdateReplacePolicy": "Delete", - }, - "CustomResourceProviderframeworkonEvent0AA4376C": Object { + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536": Object { "DependsOn": Array [ - "CustomResourceProviderframeworkonEventServiceRoleDefaultPolicy93CD1647", - "CustomResourceProviderframeworkonEventServiceRole7EBC5835", + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF", + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265", ], "Properties": Object { "Code": Object { "S3Bucket": Object { "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}", }, - "S3Key": "e8fea7e029780f03a78580d41b7ffbc4551d6e7d6caa190a451880191c166189.zip", + "S3Key": "c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762.zip", }, - "Description": "AWS CDK resource provider framework - onEvent (S3StaticWebsiteStack/CustomResourceProvider)", "Environment": Object { "Variables": Object { - "USER_ON_EVENT_FUNCTION_ARN": Object { - "Fn::GetAtt": Array [ - "copyObjHandlerDA1C4669", - "Arn", - ], - }, + "AWS_CA_BUNDLE": "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", }, }, - "Handler": "framework.onEvent", + "Handler": "index.handler", + "Layers": Array [ + Object { + "Ref": "DeployWebsiteAwsCliLayer17DBC421", + }, + ], "Role": Object { "Fn::GetAtt": Array [ - "CustomResourceProviderframeworkonEventServiceRole7EBC5835", + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265", "Arn", ], }, - "Runtime": "nodejs14.x", + "Runtime": "python3.11", "Timeout": 900, }, "Type": "AWS::Lambda::Function", }, - "CustomResourceProviderframeworkonEventServiceRole7EBC5835": Object { + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265": Object { "Properties": Object { "AssumeRolePolicyDocument": Object { "Statement": Array [ @@ -494,114 +674,33 @@ Object { }, "Type": "AWS::IAM::Role", }, - "CustomResourceProviderframeworkonEventServiceRoleDefaultPolicy93CD1647": Object { + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF": Object { "Properties": Object { "PolicyDocument": Object { "Statement": Array [ Object { - "Action": "lambda:InvokeFunction", + "Action": Array [ + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*", + ], "Effect": "Allow", "Resource": Array [ - Object { - "Fn::GetAtt": Array [ - "copyObjHandlerDA1C4669", - "Arn", - ], - }, Object { "Fn::Join": Array [ "", Array [ + "arn:", Object { - "Fn::GetAtt": Array [ - "copyObjHandlerDA1C4669", - "Arn", - ], + "Ref": "AWS::Partition", + }, + ":s3:::", + Object { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}", }, - ":*", ], ], }, - ], - }, - ], - "Version": "2012-10-17", - }, - "PolicyName": "CustomResourceProviderframeworkonEventServiceRoleDefaultPolicy93CD1647", - "Roles": Array [ - Object { - "Ref": "CustomResourceProviderframeworkonEventServiceRole7EBC5835", - }, - ], - }, - "Type": "AWS::IAM::Policy", - }, - "copyObjHandlerDA1C4669": Object { - "DependsOn": Array [ - "copyObjHandlerServiceRoleDefaultPolicyFCA51C18", - "copyObjHandlerServiceRoleA0ECE649", - ], - "Properties": Object { - "Code": Object { - "S3Bucket": Object { - "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}", - }, - "S3Key": "2a96a41ef8e6db639865e8dc7826848e60ba75ebdb553c6c9bf2f961ef503deb.zip", - }, - "Handler": "copy_s3_objects.on_event", - "Role": Object { - "Fn::GetAtt": Array [ - "copyObjHandlerServiceRoleA0ECE649", - "Arn", - ], - }, - "Runtime": "python3.8", - "Timeout": 300, - }, - "Type": "AWS::Lambda::Function", - }, - "copyObjHandlerServiceRoleA0ECE649": Object { - "Properties": Object { - "AssumeRolePolicyDocument": Object { - "Statement": Array [ - Object { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": Object { - "Service": "lambda.amazonaws.com", - }, - }, - ], - "Version": "2012-10-17", - }, - "ManagedPolicyArns": Array [ - Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - ], - ], - }, - ], - }, - "Type": "AWS::IAM::Role", - }, - "copyObjHandlerServiceRoleDefaultPolicyFCA51C18": Object { - "Properties": Object { - "PolicyDocument": Object { - "Statement": Array [ - Object { - "Action": Array [ - "s3:GetObject", - "s3:ListBucket", - ], - "Effect": "Allow", - "Resource": Array [ Object { "Fn::Join": Array [ "", @@ -610,48 +709,46 @@ Object { Object { "Ref": "AWS::Partition", }, - ":s3:::wildrydes-us-east-1", + ":s3:::", + Object { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}", + }, + "/*", ], ], }, - "arn:aws:s3:::wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website/*", ], }, Object { "Action": Array [ - "s3:ListBucket", - "s3:GetObject", + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", "s3:PutObject", - "s3:PutObjectAcl", - "s3:PutObjectVersionAcl", - "s3:DeleteObject", - "s3:DeleteObjectVersion", - "s3:CopyObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging", + "s3:Abort*", ], "Effect": "Allow", "Resource": Array [ Object { - "Fn::Join": Array [ - "", - Array [ - "arn:", - Object { - "Ref": "AWS::Partition", - }, - ":s3:::", - Object { - "Ref": "CloudFrontToS3S3Bucket9CE6AB04", - }, - ], + "Fn::GetAtt": Array [ + "CloudFrontToS3S3Bucket9CE6AB04", + "Arn", ], }, Object { "Fn::Join": Array [ "", Array [ - "arn:aws:s3:::", Object { - "Ref": "CloudFrontToS3S3Bucket9CE6AB04", + "Fn::GetAtt": Array [ + "CloudFrontToS3S3Bucket9CE6AB04", + "Arn", + ], }, "/*", ], @@ -662,15 +759,53 @@ Object { ], "Version": "2012-10-17", }, - "PolicyName": "copyObjHandlerServiceRoleDefaultPolicyFCA51C18", + "PolicyName": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF", "Roles": Array [ Object { - "Ref": "copyObjHandlerServiceRoleA0ECE649", + "Ref": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265", }, ], }, "Type": "AWS::IAM::Policy", }, + "DeployWebsiteAwsCliLayer17DBC421": Object { + "Properties": Object { + "Content": Object { + "S3Bucket": Object { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}", + }, + "S3Key": "eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip", + }, + "Description": "/opt/awscli/aws", + }, + "Type": "AWS::Lambda::LayerVersion", + }, + "DeployWebsiteCustomResourceD116527B": Object { + "DeletionPolicy": "Delete", + "Properties": Object { + "DestinationBucketName": Object { + "Ref": "CloudFrontToS3S3Bucket9CE6AB04", + }, + "OutputObjectKeys": true, + "Prune": true, + "ServiceToken": Object { + "Fn::GetAtt": Array [ + "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536", + "Arn", + ], + }, + "SourceBucketNames": Array [ + Object { + "Fn::Sub": "cdk-hnb659fds-assets-\${AWS::AccountId}-\${AWS::Region}", + }, + ], + "SourceObjectKeys": Array [ + "6f5c32400d603de86159284615f67a25ad94edc9cdc783b54cb4b1bf2396ea49.zip", + ], + }, + "Type": "Custom::CDKBucketDeployment", + "UpdateReplacePolicy": "Delete", + }, }, "Rules": Object { "CheckBootstrapVersion": Object { diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.assets.json b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.assets.json index 886dc9e37..ca9997ac8 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.assets.json +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.assets.json @@ -1,28 +1,28 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { - "3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961": { + "eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9": { "source": { - "path": "asset.3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip", + "path": "asset.eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip", + "objectKey": "eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00": { + "c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762": { "source": { - "path": "asset.e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00", + "path": "asset.c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00.zip", + "objectKey": "c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -40,7 +40,7 @@ } } }, - "5bf02694146cda9b595f3dad3c11c8d777a8e86ac67578a06dcb00bde7edc58a": { + "4b406450d85ec81adc53bfc7d211afcd4fe9bc6721ca45a8ed23856b7afd88e4": { "source": { "path": "StaticWebsiteStack.template.json", "packaging": "file" @@ -48,7 +48,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "5bf02694146cda9b595f3dad3c11c8d777a8e86ac67578a06dcb00bde7edc58a.json", + "objectKey": "4b406450d85ec81adc53bfc7d211afcd4fe9bc6721ca45a8ed23856b7afd88e4.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.template.json b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.template.json index f3a70d817..cb4007c93 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.template.json +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStack.template.json @@ -217,7 +217,11 @@ "Fn::Join": [ "", [ - "arn:aws:cloudfront::", + "arn:", + { + "Ref": "AWS::Partition" + }, + ":cloudfront::", { "Ref": "AWS::AccountId" }, @@ -288,13 +292,6 @@ } ] }, - "OwnershipControls": { - "Rules": [ - { - "ObjectOwnership": "ObjectWriter" - } - ] - }, "PublicAccessBlockConfiguration": { "BlockPublicAcls": true, "BlockPublicPolicy": true, @@ -591,7 +588,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip" + "S3Key": "eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip" }, "Description": "/opt/awscli/aws" } @@ -616,7 +613,8 @@ "DestinationBucketName": { "Ref": "CloudFrontToS3S3Bucket9CE6AB04" }, - "Prune": true + "Prune": true, + "OutputObjectKeys": true }, "UpdateReplacePolicy": "Delete", "DeletionPolicy": "Delete" @@ -753,7 +751,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00.zip" + "S3Key": "c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762.zip" }, "Environment": { "Variables": { @@ -772,7 +770,7 @@ "Arn" ] }, - "Runtime": "python3.9", + "Runtime": "python3.11", "Timeout": 900 }, "DependsOn": [ diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStackIntegDefaultTestDeployAssertD6A7B854.assets.json b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStackIntegDefaultTestDeployAssertD6A7B854.assets.json index 3c1bbf266..edf7996de 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStackIntegDefaultTestDeployAssertD6A7B854.assets.json +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/StaticWebsiteStackIntegDefaultTestDeployAssertD6A7B854.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00/index.py b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762/index.py similarity index 92% rename from source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00/index.py rename to source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762/index.py index 4015927d9..8a7928a4c 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00/index.py +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762/index.py @@ -5,6 +5,7 @@ import shutil import subprocess import tempfile +import urllib.parse from urllib.request import Request, urlopen from uuid import uuid4 from zipfile import ZipFile @@ -30,7 +31,8 @@ def handler(event, context): def cfn_error(message=None): - logger.error("| cfn_error: %s" % message) + if message: + logger.error("| cfn_error: %s" % message.encode()) cfn_send(event, context, CFN_FAILED, reason=message, physicalResourceId=event.get('PhysicalResourceId', None)) @@ -62,6 +64,7 @@ def cfn_error(message=None): exclude = props.get('Exclude', []) include = props.get('Include', []) sign_content = props.get('SignContent', 'false').lower() == 'true' + output_object_keys = props.get('OutputObjectKeys', 'true') == 'true' # backwards compatibility - if "SourceMarkers" is not specified, # assume all sources have an empty market map @@ -99,8 +102,8 @@ def cfn_error(message=None): if old_s3_dest == "s3:///": old_s3_dest = None - logger.info("| s3_dest: %s" % s3_dest) - logger.info("| old_s3_dest: %s" % old_s3_dest) + logger.info("| s3_dest: %s" % sanitize_message(s3_dest)) + logger.info("| old_s3_dest: %s" % sanitize_message(old_s3_dest)) # if we are creating a new resource, allocate a physical id for it # otherwise, we expect physical id to be relayed by cloudformation @@ -108,7 +111,7 @@ def cfn_error(message=None): physical_id = "aws.cdk.s3deployment.%s" % str(uuid4()) else: if not physical_id: - cfn_error("invalid request: request type is '%s' but 'PhysicalResourceId' is not defined" % {request_type}) + cfn_error("invalid request: request type is '%s' but 'PhysicalResourceId' is not defined" % request_type) return # delete or create/update (only if "retain_on_delete" is false) @@ -133,7 +136,7 @@ def cfn_error(message=None): cfn_send(event, context, CFN_SUCCESS, physicalResourceId=physical_id, responseData={ # Passing through the ARN sequences dependencees on the deployment 'DestinationBucketArn': props.get('DestinationBucketArn'), - 'SourceObjectKeys': props.get('SourceObjectKeys'), + **({'SourceObjectKeys': props.get('SourceObjectKeys')} if output_object_keys else {'SourceObjectKeys': []}) }) except KeyError as e: cfn_error("invalid request. Missing key %s" % str(e)) @@ -141,6 +144,20 @@ def cfn_error(message=None): logger.exception(e) cfn_error(str(e)) +#--------------------------------------------------------------------------------------------------- +# Sanitize the message to mitigate CWE-117 and CWE-93 vulnerabilities +def sanitize_message(message): + if not message: + return message + + # Sanitize the message to prevent log injection and HTTP response splitting + sanitized_message = message.replace('\n', '').replace('\r', '') + + # Encode the message to handle special characters + encoded_message = urllib.parse.quote(sanitized_message) + + return encoded_message + #--------------------------------------------------------------------------------------------------- # populate all files from s3_source_zips to a destination bucket def s3_deploy(s3_source_zips, s3_dest, user_metadata, system_metadata, prune, exclude, include, source_markers, extract): @@ -317,4 +334,3 @@ def replace_markers(filename, markers): # # delete the original file and rename the new one to the original os.remove(filename) os.rename(outfile, filename) - \ No newline at end of file diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip similarity index 67% rename from source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip rename to source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip index f624b92c6..454a254f4 100644 Binary files a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip and b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/asset.eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip differ diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/cdk.out b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/cdk.out index 1f0068d32..c6e612584 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/cdk.out +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.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/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/integ.json b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/integ.json index 1ed3909f5..92b6c31ae 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/integ.json +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "testCases": { "StaticWebsiteStack/Integ/DefaultTest": { "stacks": [ diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/manifest.json b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/manifest.json index 8ee13c378..38ae657ff 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/manifest.json +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "38.0.1", "artifacts": { "StaticWebsiteStackIntegDefaultTestDeployAssertD6A7B854.assets": { "type": "cdk:asset-manifest", @@ -16,6 +16,7 @@ "templateFile": "StaticWebsiteStackIntegDefaultTestDeployAssertD6A7B854.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": "StaticWebsiteStack.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}/5bf02694146cda9b595f3dad3c11c8d777a8e86ac67578a06dcb00bde7edc58a.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4b406450d85ec81adc53bfc7d211afcd4fe9bc6721ca45a8ed23856b7afd88e4.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -160,6 +162,16 @@ "data": "DeployWebsiteCustomResourceD116527B" } ], + "/StaticWebsiteStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C": [ + { + "type": "aws:cdk:is-custom-resource-handler-singleton", + "data": true + }, + { + "type": "aws:cdk:is-custom-resource-handler-runtime-family", + "data": 2 + } + ], "/StaticWebsiteStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/tree.json b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/tree.json index 29a9d2f12..0ab15330c 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/tree.json +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.js.snapshot/tree.json @@ -44,7 +44,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.118.0" + "version": "2.163.1" } }, "Policy": { @@ -139,19 +139,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.118.0" + "version": "2.163.1" } }, "S3Bucket": { @@ -210,7 +210,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.118.0" + "version": "2.163.1" } }, "Policy": { @@ -270,7 +270,11 @@ "Fn::Join": [ "", [ - "arn:aws:cloudfront::", + "arn:", + { + "Ref": "AWS::Partition" + }, + ":cloudfront::", { "Ref": "AWS::AccountId" }, @@ -309,19 +313,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.118.0" + "version": "2.163.1" } }, "SetHttpSecurityHeaders": { @@ -345,13 +349,13 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_cloudfront.CfnFunction", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_cloudfront.Function", - "version": "2.118.0" + "version": "2.163.1" } }, "CloudfrontLoggingBucketAccessLog": { @@ -373,13 +377,6 @@ } ] }, - "ownershipControls": { - "rules": [ - { - "objectOwnership": "ObjectWriter" - } - ] - }, "publicAccessBlockConfiguration": { "blockPublicAcls": true, "blockPublicPolicy": true, @@ -393,7 +390,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.118.0" + "version": "2.163.1" } }, "Policy": { @@ -488,19 +485,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.118.0" + "version": "2.163.1" } }, "CloudfrontLoggingBucket": { @@ -547,7 +544,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucket", - "version": "2.118.0" + "version": "2.163.1" } }, "Policy": { @@ -606,19 +603,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.CfnBucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.Bucket", - "version": "2.118.0" + "version": "2.163.1" } }, "CloudFrontOac": { @@ -658,7 +655,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_cloudfront.CfnOriginAccessControl", - "version": "2.118.0" + "version": "2.163.1" } }, "CloudFrontDistribution": { @@ -670,7 +667,7 @@ "path": "StaticWebsiteStack/CloudFrontToS3/CloudFrontDistribution/Origin1", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "Resource": { @@ -729,19 +726,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_cloudfront.CfnDistribution", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_cloudfront.Distribution", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "@aws-solutions-constructs/aws-cloudfront-s3.CloudFrontToS3", - "version": "2.51.0" + "version": "2.74.0" } }, "DeployWebsite": { @@ -761,7 +758,7 @@ "path": "StaticWebsiteStack/DeployWebsite/AwsCliLayer/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.118.0" + "version": "2.163.1" } }, "AssetBucket": { @@ -769,13 +766,13 @@ "path": "StaticWebsiteStack/DeployWebsite/AwsCliLayer/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.118.0" + "version": "2.163.1" } }, "Resource": { @@ -788,20 +785,20 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "3322b7049fb0ed2b7cbb644a2ada8d1116ff80c32dca89e6ada846b5de26f961.zip" + "s3Key": "eafa2d6c6a55bda16b1603003f1721e2f66a024c0c31d6665ee1c5ff59b565d9.zip" }, "description": "/opt/awscli/aws" } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnLayerVersion", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.lambda_layer_awscli.AwsCliLayer", - "version": "2.118.0" + "version": "2.163.1" } }, "CustomResourceHandler": { @@ -809,7 +806,7 @@ "path": "StaticWebsiteStack/DeployWebsite/CustomResourceHandler", "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.SingletonFunction", - "version": "2.118.0" + "version": "2.163.1" } }, "Asset1": { @@ -821,7 +818,7 @@ "path": "StaticWebsiteStack/DeployWebsite/Asset1/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.118.0" + "version": "2.163.1" } }, "AssetBucket": { @@ -829,13 +826,13 @@ "path": "StaticWebsiteStack/DeployWebsite/Asset1/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.118.0" + "version": "2.163.1" } }, "CustomResource": { @@ -847,19 +844,19 @@ "path": "StaticWebsiteStack/DeployWebsite/CustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.CustomResource", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_deployment.BucketDeployment", - "version": "2.118.0" + "version": "2.163.1" } }, "Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C": { @@ -875,7 +872,7 @@ "path": "StaticWebsiteStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/ImportServiceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", - "version": "2.118.0" + "version": "2.163.1" } }, "Resource": { @@ -914,7 +911,7 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "2.118.0" + "version": "2.163.1" } }, "DefaultPolicy": { @@ -1020,19 +1017,19 @@ }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Policy", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "2.118.0" + "version": "2.163.1" } }, "Code": { @@ -1044,7 +1041,7 @@ "path": "StaticWebsiteStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Code/Stage", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", - "version": "2.118.0" + "version": "2.163.1" } }, "AssetBucket": { @@ -1052,13 +1049,13 @@ "path": "StaticWebsiteStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Code/AssetBucket", "constructInfo": { "fqn": "aws-cdk-lib.aws_s3.BucketBase", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_s3_assets.Asset", - "version": "2.118.0" + "version": "2.163.1" } }, "Resource": { @@ -1071,7 +1068,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "e976a796f036a5efbf44b99e44cfb5a961df08d8dbf7cd37e60bf216fb982a00.zip" + "s3Key": "c6358465bf49dfae556bb430bf9c81fa578c221b82c308e3707901b1dd654762.zip" }, "environment": { "variables": { @@ -1090,19 +1087,19 @@ "Arn" ] }, - "runtime": "python3.9", + "runtime": "python3.11", "timeout": 900 } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.CfnFunction", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.aws_lambda.Function", - "version": "2.118.0" + "version": "2.163.1" } }, "websiteURL": { @@ -1110,7 +1107,7 @@ "path": "StaticWebsiteStack/websiteURL", "constructInfo": { "fqn": "aws-cdk-lib.CfnOutput", - "version": "2.118.0" + "version": "2.163.1" } }, "Integ": { @@ -1126,7 +1123,7 @@ "path": "StaticWebsiteStack/Integ/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } }, "DeployAssert": { @@ -1138,7 +1135,7 @@ "path": "StaticWebsiteStack/Integ/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.118.0" + "version": "2.163.1" } }, "CheckBootstrapVersion": { @@ -1146,25 +1143,25 @@ "path": "StaticWebsiteStack/Integ/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "2.118.0-alpha.0" + "version": "2.163.1-alpha.0" } } }, "constructInfo": { "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "2.118.0-alpha.0" + "version": "2.163.1-alpha.0" } }, "BootstrapVersion": { @@ -1172,7 +1169,7 @@ "path": "StaticWebsiteStack/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", - "version": "2.118.0" + "version": "2.163.1" } }, "CheckBootstrapVersion": { @@ -1180,13 +1177,13 @@ "path": "StaticWebsiteStack/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", - "version": "2.118.0" + "version": "2.163.1" } } }, "constructInfo": { "fqn": "aws-cdk-lib.Stack", - "version": "2.118.0" + "version": "2.163.1" } }, "Tree": { @@ -1194,13 +1191,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.3.0" + "version": "10.4.2" } } }, "constructInfo": { "fqn": "aws-cdk-lib.App", - "version": "2.118.0" + "version": "2.163.1" } } } \ No newline at end of file diff --git a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.ts b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.ts index a83a198b9..23e5d845e 100644 --- a/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.ts +++ b/source/use_cases/aws-s3-static-website/test/integ.basic-deployment.ts @@ -10,6 +10,7 @@ * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * and limitations under the License. */ + import 'source-map-support/register'; import { App } from 'aws-cdk-lib'; import { S3StaticWebsiteStack } from '../lib/s3-static-site-stack'; diff --git a/source/use_cases/aws-s3-static-website/test/s3-static-site-stack.test.ts b/source/use_cases/aws-s3-static-website/test/s3-static-site-stack.test.ts index 6d16ae0b6..dddc838d7 100644 --- a/source/use_cases/aws-s3-static-website/test/s3-static-site-stack.test.ts +++ b/source/use_cases/aws-s3-static-website/test/s3-static-site-stack.test.ts @@ -66,8 +66,9 @@ test('check CR lambda function permissions', () => { "Statement": [ { "Action": [ - "s3:GetObject", - "s3:ListBucket" + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*" ], "Effect": "Allow", "Resource": [ @@ -79,26 +80,13 @@ test('check CR lambda function permissions', () => { { "Ref": "AWS::Partition" }, - ":s3:::wildrydes-us-east-1" + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + } ] ] }, - "arn:aws:s3:::wildrydes-us-east-1/WebApplication/1_StaticWebHosting/website/*" - ] - }, - { - "Action": [ - "s3:ListBucket", - "s3:GetObject", - "s3:PutObject", - "s3:PutObjectAcl", - "s3:PutObjectVersionAcl", - "s3:DeleteObject", - "s3:DeleteObjectVersion", - "s3:CopyObject" - ], - "Effect": "Allow", - "Resource": [ { "Fn::Join": [ "", @@ -109,18 +97,44 @@ test('check CR lambda function permissions', () => { }, ":s3:::", { - "Ref": "CloudFrontToS3S3Bucket9CE6AB04" - } + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/*" ] ] + } + ] + }, + { + "Action": [ + "s3:GetObject*", + "s3:GetBucket*", + "s3:List*", + "s3:DeleteObject*", + "s3:PutObject", + "s3:PutObjectLegalHold", + "s3:PutObjectRetention", + "s3:PutObjectTagging", + "s3:PutObjectVersionTagging", + "s3:Abort*" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::GetAtt": [ + "CloudFrontToS3S3Bucket9CE6AB04", + "Arn" + ] }, { "Fn::Join": [ "", [ - "arn:aws:s3:::", { - "Ref": "CloudFrontToS3S3Bucket9CE6AB04" + "Fn::GetAtt": [ + "CloudFrontToS3S3Bucket9CE6AB04", + "Arn" + ] }, "/*" ] @@ -128,14 +142,13 @@ test('check CR lambda function permissions', () => { } ] } -] + ] }, - PolicyName: "copyObjHandlerServiceRoleDefaultPolicyFCA51C18", - Roles: [ + PolicyName: "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF", + "Roles": [ { - Ref: "copyObjHandlerServiceRoleA0ECE649" + "Ref": "CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265" } ] - }); }); - +});