@izara_project/izara-market-library-service-schemas 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -2
- package/package.json +2 -2
- package/src/GenerateCodeLibs/index.js +1 -0
- package/src/MainLibs/index.js +2 -1
- package/src/MainLibs/src/Consts.js +485 -0
- package/src/MainLibs/src/GenerateCodeUtils.js +59 -0
- package/src/TemplateManager/src/ProcessLogical/Handler/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogical/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +1 -2
- package/src/reStructure/GenerateCode.js +151 -0
- package/src/reStructure/TemplateConfig.js +31 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/data.js +162 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/template.ejs +14 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/templateIntTesting.ejs +31 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/templateYaml.ejs +10 -0
- package/src/reStructure/TemplateData/externalService/generateTemplateData.js +59 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +435 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/request.json +18 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +57 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +177 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/request.json +12 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +28 -0
- package/src/reStructure/TemplateData/findData/GetByStorage/getByDynamo.ejs +53 -0
- package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +100 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +195 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/template.ejs +14 -0
- package/src/reStructure/TemplateData/findData/generateTemplateData.js +65 -0
- package/src/reStructure/TemplateData/findData/handler/data.js +63 -0
- package/src/reStructure/TemplateData/findData/handler/template.ejs +140 -0
- package/src/reStructure/TemplateData/findData/mainFunction/data.js +297 -0
- package/src/reStructure/TemplateData/findData/mainFunction/template.ejs +151 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/data.js +76 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/template.ejs +37 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/data.js +46 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/template.ejs +103 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/mainFunction/data.js +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/data.js +35 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +118 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +56 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/template.ejs +126 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +51 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +121 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/queue/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/queue/template.ejs +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +140 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/template.ejs +37 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +74 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +120 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +54 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +133 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +115 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +70 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/template.ejs +103 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +86 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +72 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/template.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/data.js +93 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateAsyncHandler.ejs +110 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateSyncHandler.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/hookLogic/data.js +43 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/data.js +65 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/template.ejs +7 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/data.js +72 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/functionYaml/data.js +102 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/functionYaml/template.ejs +27 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/template.ejs +120 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/data.js +51 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/template.ejs +164 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/sqs/data.js +65 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/sqs/template.ejs +53 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +131 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +126 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +54 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +254 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/queue/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/queue/template.ejs +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrDsq/data.js +87 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml → reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml}/HdrDsq/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +127 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml → reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3}/template.ejs +11 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerDsq/data.js +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerDsq/template.ejs +151 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/template.ejs +68 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +392 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/data.js +77 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/dsqTemplatePath.ejs +32 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/s3Template.ejs +59 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/data.js +51 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/template.ejs +13 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +42 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +137 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +73 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +29 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +54 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +68 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/ReservedTableData.js +62 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/WebSocketTaskData.js +62 -0
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +210 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/data.js +101 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/template.ejs +43 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/data.js +93 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateAsyncHandler.ejs +110 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateSyncHandler.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/hookLogic/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/data.js +66 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/data.js +124 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +276 -0
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +58 -0
- package/src/reStructure/TemplateData/perActionComplete/create/handler/data.js +69 -0
- package/src/reStructure/TemplateData/perActionComplete/create/handler/template.ejs +130 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +172 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/data.js +65 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +170 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-in-sqs/data.js +69 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-out/data.js +73 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +130 -0
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/handler/data.js +66 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +93 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/sns-in-sqs/data.js +62 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/sns-out/data.js +69 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +124 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/generateTemplateData.js +126 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js → reStructure/TemplateData/perActionComplete/get/handler/data.js} +20 -14
- package/src/reStructure/TemplateData/perActionComplete/get/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/data.js +52 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +130 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns → reStructure/TemplateData/perActionComplete/get/sns-in-sqs}/data.js +12 -12
- package/src/reStructure/TemplateData/perActionComplete/get/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/get/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +105 -0
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/update/handler/data.js +65 -0
- package/src/reStructure/TemplateData/perActionComplete/update/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/data.js +58 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +130 -0
- package/src/reStructure/TemplateData/perActionComplete/update/sns-in-sqs/data.js +66 -0
- package/src/reStructure/TemplateData/perActionComplete/update/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/update/sns-out/data.js +73 -0
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +132 -0
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionEndpoint/generateTemplateData.js +101 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/data.js +93 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/template.ejs +76 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/data.js +95 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/template.ejs +127 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/data.js +88 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/template.ejs +81 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/data.js +94 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/template.ejs +130 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocket/data.js +75 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocket/template.ejs +141 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocketConnect/data.js +55 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocketConnect/template.ejs +55 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction → reStructure/TemplateData/perActionEndpoint/libs}/data.js +25 -13
- package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +46 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/data.js +74 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/request.json +0 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +629 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/data.js +74 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +192 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/data.js +76 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/request.json +5 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/template.ejs +265 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/testParam.json +5 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/data.js +70 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/request.json +0 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +351 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/data.js +198 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/request.json +14 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/dsq/data.js +207 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/dsq/request.json +19 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/data.js +189 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/example req.js +15 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/request.json +14 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/sqs/data.js +208 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/sqs/request.json +19 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/wbs/data.js +170 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/wbs/request.json +19 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs → reStructure/TemplateData/perActionEndpoint/yaml/wbs}/template.ejs +2 -3
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/webSocketConnect/data.js +59 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/webSocketConnect/template.ejs +10 -0
- package/src/reStructure/TemplateData/processLogical/generateTemplateData.js +57 -0
- package/src/reStructure/TemplateData/processLogical/handler/data.js +50 -0
- package/src/reStructure/TemplateData/processLogical/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/processLogical/mainFunction/data.js +47 -0
- package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +429 -0
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +160 -0
- package/src/reStructure/TemplateData/processLogical/yaml/template.ejs +12 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sns-out → reStructure/TemplateData/processLogicalPagination/DsqYaml}/data.js +16 -13
- package/src/reStructure/TemplateData/processLogicalPagination/DsqYaml/template.ejs +32 -0
- package/src/reStructure/TemplateData/processLogicalPagination/generateTemplateData.js +64 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/dsq/data.js +48 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/dsq/template.ejs +163 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/sqs/data.js +48 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/sqs/template.ejs +146 -0
- package/src/reStructure/TemplateData/processLogicalPagination/mainFunction/data.js +48 -0
- package/src/reStructure/TemplateData/processLogicalPagination/mainFunction/template.ejs +212 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +154 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/template.ejs +12 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +157 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/template.ejs +12 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +98 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +111 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +97 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +110 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/data.js +57 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +138 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq → reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq}/data.js +18 -20
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +184 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/template.ejs +126 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs → reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs}/data.js +16 -16
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +163 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +380 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs → reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml}/data.js +48 -29
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +125 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +141 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +98 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +111 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +97 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +111 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/data.js +57 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +138 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/data.js +58 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +184 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/template.ejs +126 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +162 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +337 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq → reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml}/data.js +49 -30
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +125 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +140 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/data.js +70 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/data.js +72 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/generateTemplateData.js +238 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +120 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +131 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +124 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +135 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/request.json +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +140 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/data.js +75 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/request.json +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +184 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/request.json +5 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +145 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/data.js +74 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/request.json +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +163 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/data.js +72 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/request.json +1 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +340 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/data.js +92 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-out/data.js +70 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-out/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +110 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/data.js +61 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs +127 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/data.js +63 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/request.json +1 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +143 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/template.ejs +46 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/data.js +70 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/resourceYaml/CreateSourceData.js +73 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +146 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +178 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/request.json +7 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/template.ejs +31 -0
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +99 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +96 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/request.json +4 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsAndSqsPerActionData.js +108 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/data.js +88 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +75 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/request.json +3 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/template.ejs +10 -0
- package/src/reStructure/test.bash +192 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +0 -94
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/template.ejs +0 -192
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +0 -299
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/template.ejs +0 -155
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/template.ejs +0 -163
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/data.js +0 -61
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +0 -145
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/dynamoDb/data.js +0 -120
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/sns-sqs/data.js +0 -75
- package/src/TemplateManager/src/reStructureExample/GenerateCodeTest.js +0 -31
- package/src/TemplateManager/src/reStructureExample/TemplateConfig.js +0 -15
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generateCodeShared.js +0 -1
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generatePerAction.js +0 -12
- /package/src/{TemplateManager/src/reStructureExample/TemplateData/perAction → reStructure/TemplateData/flowSchema/components/schema/inProcess/mainFunction}/template.ejs +0 -0
- /package/src/{TemplateManager/src/reStructureExample/TemplateData/perAction/data.js → reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/template.ejs} +0 -0
- /package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/template.ejs → reStructure/TemplateData/flowSchema/components/upload/hook/queue/sqsTemplate.ejs} +0 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require('path');
|
|
21
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const {
|
|
23
|
+
getGraphServiceNameFromGraphServerTagWithCache,
|
|
24
|
+
getGraphServiceTagWithCache
|
|
25
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
26
|
+
|
|
27
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
|
|
28
|
+
const {
|
|
29
|
+
DEFAULT_HANDLER_PER_ACTION,
|
|
30
|
+
createIamRole,
|
|
31
|
+
RESOURCE_CLASSES,
|
|
32
|
+
SOURCE_PATH,
|
|
33
|
+
externalResourceName,
|
|
34
|
+
getGraphServiceNameFromAllRelSchema,
|
|
35
|
+
SAVE_FILE_NAME,
|
|
36
|
+
LAMBDA_RESOURCE,
|
|
37
|
+
SNS_RESOURCE,
|
|
38
|
+
getGraphServiceNameFromObjectSchema,
|
|
39
|
+
shortNameHandler,
|
|
40
|
+
SHORT_FUNCTION_NAME,
|
|
41
|
+
defaultIamRolePerAction,
|
|
42
|
+
resourceNames,
|
|
43
|
+
SOURCE_GENERATE_IAM_ROLE
|
|
44
|
+
} = require("../../../../MainLibs/src/Consts");
|
|
45
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
46
|
+
const { getAllLocalRelationshipSchema } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
47
|
+
const { EXTERNAL_SERVICE_NAME } = require("../../../../GenerateCodeLibs/src/Consts");
|
|
48
|
+
|
|
49
|
+
const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas, allLocalFlowSchemas, srcPath) => {
|
|
50
|
+
const allRelationshipSchemas = getAllLocalRelationshipSchema(_izContext, srcPath)
|
|
51
|
+
// console.log("allRelationshipSchemas", allRelationshipSchemas);
|
|
52
|
+
const externalLambdaIamRoleArray = [];
|
|
53
|
+
for (const objectSchema of allObjSchemas) {
|
|
54
|
+
|
|
55
|
+
// per action external lambda role
|
|
56
|
+
for (const action of Object.values(ACTIONS)) {
|
|
57
|
+
if (objectSchema.overWriteHandlers?.[action]) {
|
|
58
|
+
for (const handler of objectSchema.overWriteHandlers[action]) {
|
|
59
|
+
const externalLambdaIamRole = await externalLambdaIamRoleDataPerAction(_izContext, objectSchema, action, handler)
|
|
60
|
+
externalLambdaIamRole && externalLambdaIamRoleArray.push(externalLambdaIamRole);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
} else {
|
|
64
|
+
for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
|
|
65
|
+
const externalLambdaIamRole = await externalLambdaIamRoleDataPerAction(_izContext, objectSchema, action, handler)
|
|
66
|
+
externalLambdaIamRole && externalLambdaIamRoleArray.push(externalLambdaIamRole);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// validate relationship in ObjectRelationship
|
|
74
|
+
if (allRelationshipSchemas.length) {
|
|
75
|
+
|
|
76
|
+
// updateRelationship external lambda role
|
|
77
|
+
for (const handler of Object.values(HANDLER)) {
|
|
78
|
+
const externalLambdaIamRoleUpdateRelationship = await externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, allRelSchemas, handler);
|
|
79
|
+
externalLambdaIamRoleUpdateRelationship && externalLambdaIamRoleArray.push(externalLambdaIamRoleUpdateRelationship)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// CreateRelationship external lambda role
|
|
83
|
+
for (const handler of Object.values(HANDLER)) {
|
|
84
|
+
const externalLambdaIamRoleCreateRelationship = await externalLambdaIamRoleDataCreateRelationshipSchema(_izContext, allRelSchemas, handler);
|
|
85
|
+
externalLambdaIamRoleCreateRelationship && externalLambdaIamRoleArray.push(externalLambdaIamRoleCreateRelationship)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
for (const handler of Object.values(HANDLER)) {
|
|
89
|
+
const externalLambdaIamRoleDeleteRelationship = await externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, allRelSchemas, handler);
|
|
90
|
+
externalLambdaIamRoleDeleteRelationship && externalLambdaIamRoleArray.push(externalLambdaIamRoleDeleteRelationship)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// findData external lambda role
|
|
94
|
+
const externalLambdaIamRoleFindData = externalLambdaIamRoleDataFindData(_izContext);
|
|
95
|
+
externalLambdaIamRoleFindData && externalLambdaIamRoleArray.push(externalLambdaIamRoleFindData)
|
|
96
|
+
|
|
97
|
+
// updateRelationshipComplete external lambda role
|
|
98
|
+
|
|
99
|
+
// ... another external lambda role data
|
|
100
|
+
|
|
101
|
+
// ProcessLogical
|
|
102
|
+
const externalLambdaIamRoleProcessLogical = await externalLambdaIamRoleDataProcessLogical(_izContext, allObjSchemas);
|
|
103
|
+
externalLambdaIamRoleProcessLogical && externalLambdaIamRoleArray.push(externalLambdaIamRoleProcessLogical)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (allLocalFlowSchemas) {
|
|
107
|
+
for (const localFlowSchema of allLocalFlowSchemas) {
|
|
108
|
+
if (localFlowSchema.hasOwnProperty("uploadS3") && localFlowSchema.uploadS3 === true) {
|
|
109
|
+
const externalLambdaIamRoleGetPresignUrl = await externalLambdaIamRoleDataGetPresignUrl(_izContext);
|
|
110
|
+
externalLambdaIamRoleGetPresignUrl && externalLambdaIamRoleArray.push(externalLambdaIamRoleGetPresignUrl);
|
|
111
|
+
|
|
112
|
+
const externalLambdaIamRoleReservedLimitComplete = await externalLambdaIamRoleDataReservedLimitComplete(_izContext);
|
|
113
|
+
externalLambdaIamRoleReservedLimitComplete && externalLambdaIamRoleArray.push(externalLambdaIamRoleReservedLimitComplete);
|
|
114
|
+
|
|
115
|
+
const externalLambdaIamRoleProcessAfterUpload = await externalLambdaIamRoleDataProcessAfterUpload(_izContext);
|
|
116
|
+
externalLambdaIamRoleProcessAfterUpload && externalLambdaIamRoleArray.push(externalLambdaIamRoleProcessAfterUpload);
|
|
117
|
+
|
|
118
|
+
const externalLambdaIamRoleConfirmReservedAfterUpload = await externalLambdaIamRoleDataConfirmReservedAfterUpload(_izContext);
|
|
119
|
+
externalLambdaIamRoleConfirmReservedAfterUpload && externalLambdaIamRoleArray.push(externalLambdaIamRoleConfirmReservedAfterUpload);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// console.log("externalLambdaIamRoleArray", externalLambdaIamRoleArray)
|
|
125
|
+
// console.log("createSourceArrayIamRole", JSON.stringify(externalLambdaIamRoleArray))
|
|
126
|
+
// return externalLambdaIamRoleArray
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
templatePath: templatePath,
|
|
130
|
+
templateData: { datas: externalLambdaIamRoleArray },
|
|
131
|
+
setting: {
|
|
132
|
+
savePath: path.join(srcPath, SOURCE_PATH.externalService),
|
|
133
|
+
saveFileName: SAVE_FILE_NAME.externalLambdaRole,
|
|
134
|
+
fileExtension: ".js",
|
|
135
|
+
isAppend: false
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function externalLambdaIamRoleDataPerAction(_izContext, objectSchema, action, handler) {
|
|
141
|
+
const objectType = objectSchema?.shortNameObjectType ? objectSchema?.shortNameObjectType : objectSchema.objectType;
|
|
142
|
+
const additionalResourcePermission = [];
|
|
143
|
+
const graphServiceNames = [];
|
|
144
|
+
for (const storgaeResource of Object.values(objectSchema.storageResources)) {
|
|
145
|
+
if (storgaeResource.storageType === STORAGE_TYPES.graph) {
|
|
146
|
+
let getGraphServiceName = await getGraphServiceTagWithCache(_izContext, storgaeResource.graphServerTag)
|
|
147
|
+
if (!graphServiceNames.includes(getGraphServiceName)) {
|
|
148
|
+
getGraphServiceName && graphServiceNames.push(getGraphServiceName)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
// let functionName = upperCase(objectType) + upperCase(action) + upperCase(shortNameHandler(handler));
|
|
155
|
+
let functionName = upperCase(objectType) + upperCase(action) + upperCase(shortNameHandler(handler));
|
|
156
|
+
|
|
157
|
+
if (!graphServiceNames.length) {
|
|
158
|
+
return
|
|
159
|
+
} else {
|
|
160
|
+
if (action === ACTIONS.get) {
|
|
161
|
+
additionalResourcePermission.push(
|
|
162
|
+
createIamRole(
|
|
163
|
+
{ [RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction] },
|
|
164
|
+
graphServiceNames.map(graphServiceName =>
|
|
165
|
+
externalResourceName(RESOURCE_CLASSES.lambda, "GetNodeV2HdrInv", graphServiceName),
|
|
166
|
+
)
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
// }
|
|
170
|
+
} else if (action === ACTIONS.update) {
|
|
171
|
+
additionalResourcePermission.push(
|
|
172
|
+
createIamRole(
|
|
173
|
+
{
|
|
174
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
175
|
+
},
|
|
176
|
+
graphServiceNames.map(graphServiceName =>
|
|
177
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InUpdateNode", graphServiceName)
|
|
178
|
+
)
|
|
179
|
+
)
|
|
180
|
+
)
|
|
181
|
+
// }
|
|
182
|
+
} else if (action === ACTIONS.create) {
|
|
183
|
+
additionalResourcePermission.push(
|
|
184
|
+
createIamRole(
|
|
185
|
+
{
|
|
186
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
187
|
+
},
|
|
188
|
+
graphServiceNames.map(graphServiceName =>
|
|
189
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InCreateNodeV2", graphServiceName)
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
// }
|
|
194
|
+
} else if (action === ACTIONS.delete) {
|
|
195
|
+
return
|
|
196
|
+
// additionalResourcePermission.push(
|
|
197
|
+
// createIamRole(
|
|
198
|
+
// {
|
|
199
|
+
// [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
200
|
+
// },
|
|
201
|
+
// graphServiceNames.map(graphServiceName =>
|
|
202
|
+
// externalResourceSns("InDeleteNode", graphServiceName)
|
|
203
|
+
// )
|
|
204
|
+
// )
|
|
205
|
+
// )
|
|
206
|
+
} else {
|
|
207
|
+
throw new error("Invalid action")
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
objectType: upperCase(objectType),
|
|
214
|
+
functionName: functionName,
|
|
215
|
+
action: action,
|
|
216
|
+
additionalResourcePermission
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
// update Relationship
|
|
222
|
+
async function externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, allRelSchemas, handler) {
|
|
223
|
+
const functionName = upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handler));
|
|
224
|
+
const additionalResourcePermission = [];
|
|
225
|
+
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
226
|
+
const objectType = SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
227
|
+
|
|
228
|
+
additionalResourcePermission.push(
|
|
229
|
+
createIamRole(
|
|
230
|
+
{
|
|
231
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
232
|
+
},
|
|
233
|
+
graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
|
|
234
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InUpdateRelationship", graphServiceName)
|
|
235
|
+
)
|
|
236
|
+
)
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
functionName,
|
|
241
|
+
additionalResourcePermission,
|
|
242
|
+
objectType
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
// create relationship
|
|
248
|
+
|
|
249
|
+
async function externalLambdaIamRoleDataCreateRelationshipSchema(_izContext, allRelSchemas, handler) {
|
|
250
|
+
const functionName = upperCase(SHORT_FUNCTION_NAME.createRel) + upperCase(shortNameHandler(handler));
|
|
251
|
+
const additionalResourcePermission = [];
|
|
252
|
+
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
253
|
+
const objectType = SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
254
|
+
|
|
255
|
+
additionalResourcePermission.push(
|
|
256
|
+
createIamRole(
|
|
257
|
+
{
|
|
258
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
259
|
+
},
|
|
260
|
+
graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
|
|
261
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InCreateRelationshipV2", graphServiceName)
|
|
262
|
+
)
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
return {
|
|
266
|
+
functionName,
|
|
267
|
+
additionalResourcePermission,
|
|
268
|
+
objectType
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// delete Relationship
|
|
273
|
+
async function externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, allRelSchemas, handler) {
|
|
274
|
+
const functionName = upperCase(SHORT_FUNCTION_NAME.deleteRel) + upperCase(shortNameHandler(handler))
|
|
275
|
+
const additionalResourcePermission = [];
|
|
276
|
+
const graphServiceNamesFromAllRelSchemas = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas);
|
|
277
|
+
const objectType = SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
278
|
+
|
|
279
|
+
additionalResourcePermission.push(
|
|
280
|
+
createIamRole(
|
|
281
|
+
{
|
|
282
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
283
|
+
},
|
|
284
|
+
graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
|
|
285
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InDeleteRelationshipV2", graphServiceName)
|
|
286
|
+
)
|
|
287
|
+
)
|
|
288
|
+
)
|
|
289
|
+
return {
|
|
290
|
+
functionName,
|
|
291
|
+
additionalResourcePermission,
|
|
292
|
+
objectType
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function externalLambdaIamRoleDataFindData(_izContext) {
|
|
297
|
+
let functionName = upperCase(SHORT_FUNCTION_NAME.findData) + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
298
|
+
let additionalResourcePermission = [];
|
|
299
|
+
let objectType = SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
300
|
+
additionalResourcePermission.push(
|
|
301
|
+
createIamRole(
|
|
302
|
+
{
|
|
303
|
+
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction]
|
|
304
|
+
},
|
|
305
|
+
[
|
|
306
|
+
externalResourceName(RESOURCE_CLASSES.lambda, "GetNodeV2HdrInv", "GraphHandler")
|
|
307
|
+
]
|
|
308
|
+
)
|
|
309
|
+
)
|
|
310
|
+
// console.log("findData template data:", { functionName, additionalResourcePermission })
|
|
311
|
+
return {
|
|
312
|
+
functionName,
|
|
313
|
+
additionalResourcePermission,
|
|
314
|
+
objectType
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
async function externalLambdaIamRoleDataProcessLogical(_izContext, allObjectSchemas) {
|
|
320
|
+
let functionName = upperCase(SHORT_FUNCTION_NAME.processLogical) + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
321
|
+
let additionalResourcePermission = [];
|
|
322
|
+
let graphServiceNames = await getGraphServiceNameFromObjectSchema(_izContext, allObjectSchemas)
|
|
323
|
+
let objectType = SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
324
|
+
|
|
325
|
+
// console.log("graphServiceNameFromProcessLogical::", graphServiceNames)
|
|
326
|
+
additionalResourcePermission.push(
|
|
327
|
+
createIamRole(
|
|
328
|
+
{
|
|
329
|
+
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction]
|
|
330
|
+
},
|
|
331
|
+
graphServiceNames.map(graphServiceName => (
|
|
332
|
+
externalResourceName(RESOURCE_CLASSES.lambda, "GetNodeV2HdrInv", graphServiceName)
|
|
333
|
+
))
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
return {
|
|
337
|
+
functionName,
|
|
338
|
+
additionalResourcePermission,
|
|
339
|
+
objectType
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function externalLambdaIamRoleDataGetPresignUrl(_izContext) {
|
|
344
|
+
let functionName = "GetPresignUrl" + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
345
|
+
let additionalResourcePermission = [];
|
|
346
|
+
|
|
347
|
+
additionalResourcePermission.push(
|
|
348
|
+
createIamRole(
|
|
349
|
+
{
|
|
350
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
351
|
+
},
|
|
352
|
+
[
|
|
353
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InReservedDynamicUsage", EXTERNAL_SERVICE_NAME.accountLimits)
|
|
354
|
+
]
|
|
355
|
+
),
|
|
356
|
+
createIamRole(
|
|
357
|
+
{
|
|
358
|
+
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction]
|
|
359
|
+
},
|
|
360
|
+
[
|
|
361
|
+
externalResourceName(RESOURCE_CLASSES.lambda, "StaticLimitProcessHdrInv", EXTERNAL_SERVICE_NAME.accountLimits)
|
|
362
|
+
]
|
|
363
|
+
)
|
|
364
|
+
)
|
|
365
|
+
// console.log("additionalResourcePermission GetPresignUrl::", JSON.stringify(additionalResourcePermission))
|
|
366
|
+
return {
|
|
367
|
+
functionName,
|
|
368
|
+
additionalResourcePermission
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function externalLambdaIamRoleDataReservedLimitComplete(_izContext) {
|
|
373
|
+
let functionName = "ReservedLimitComp" + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
374
|
+
let additionalResourcePermission = [];
|
|
375
|
+
|
|
376
|
+
additionalResourcePermission.push(
|
|
377
|
+
createIamRole(
|
|
378
|
+
{
|
|
379
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
380
|
+
},
|
|
381
|
+
[
|
|
382
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InCancelUsage", EXTERNAL_SERVICE_NAME.accountLimits)
|
|
383
|
+
]
|
|
384
|
+
)
|
|
385
|
+
)
|
|
386
|
+
return {
|
|
387
|
+
functionName,
|
|
388
|
+
additionalResourcePermission
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function externalLambdaIamRoleDataConfirmReservedAfterUpload(_izContext) {
|
|
393
|
+
let functionName = "ConfirmNewReserved" + upperCase(shortNameHandler(HANDLER.hdrSqs));
|
|
394
|
+
let additionalResourcePermission = []
|
|
395
|
+
|
|
396
|
+
additionalResourcePermission.push(
|
|
397
|
+
createIamRole(
|
|
398
|
+
{
|
|
399
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
400
|
+
},
|
|
401
|
+
[
|
|
402
|
+
externalResourceName(RESOURCE_CLASSES.sns, "OutReservedDynamicUsageComplet", EXTERNAL_SERVICE_NAME.accountLimits),
|
|
403
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InConfirmUsage", EXTERNAL_SERVICE_NAME.accountLimits)
|
|
404
|
+
]
|
|
405
|
+
),
|
|
406
|
+
)
|
|
407
|
+
return {
|
|
408
|
+
functionName,
|
|
409
|
+
additionalResourcePermission
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function externalLambdaIamRoleDataProcessAfterUpload(_izContext) {
|
|
414
|
+
let functionName = "ProcessAfterUploadS3" + shortNameHandler(upperCase("HdrS3"));
|
|
415
|
+
let additionalResourcePermission = []
|
|
416
|
+
|
|
417
|
+
additionalResourcePermission.push(
|
|
418
|
+
createIamRole(
|
|
419
|
+
{
|
|
420
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
421
|
+
},
|
|
422
|
+
[
|
|
423
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InCancelUsage", EXTERNAL_SERVICE_NAME.accountLimits),
|
|
424
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InConfirmUsage", EXTERNAL_SERVICE_NAME.accountLimits),
|
|
425
|
+
externalResourceName(RESOURCE_CLASSES.sns, "InReservedDynamicUsage", EXTERNAL_SERVICE_NAME.accountLimits),
|
|
426
|
+
]
|
|
427
|
+
)
|
|
428
|
+
)
|
|
429
|
+
return {
|
|
430
|
+
functionName,
|
|
431
|
+
additionalResourcePermission
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
module.exports = createExternalLambdaRole;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const Logger = require('@izara_project/izara-core-library-logger')
|
|
21
|
+
const izaraShared = require('@izara_project/izara-shared')
|
|
22
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib
|
|
23
|
+
const lambdaSharedLib = izaraShared.lambdaSharedLib
|
|
24
|
+
const snsSharedLib = izaraShared.snsSharedLib
|
|
25
|
+
const initialSetupConfig = require('../../config/Config') // config external serviceName
|
|
26
|
+
const basicNodeSchemaLib = require('@izara_project/izara-attribute-tree').basicNodeSchemaLib
|
|
27
|
+
const _izContext = {logger : Logger}
|
|
28
|
+
|
|
29
|
+
module.exports.generatedLambdaRole = async () => {
|
|
30
|
+
let externalLambdaRole = [ <%_ datas.forEach((data,dataIndex) => { %>
|
|
31
|
+
{
|
|
32
|
+
roleName: "<%- data.objectType %>",
|
|
33
|
+
statement: [
|
|
34
|
+
<%_ data.additionalResourcePermission.forEach((resourcePermission, resourceIdx) => { _%>
|
|
35
|
+
{
|
|
36
|
+
"Sid": "<%- data.functionName %>Test<%- resourceIdx %>",
|
|
37
|
+
"Effect": "<%- resourcePermission.effect %>",
|
|
38
|
+
"Action":
|
|
39
|
+
[
|
|
40
|
+
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
41
|
+
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
42
|
+
"<%- resourcePerAction %>:<%- permission %>",
|
|
43
|
+
],
|
|
44
|
+
"Resource":[
|
|
45
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
46
|
+
`<%- resource _%>`,
|
|
47
|
+
<%_ }) _%>
|
|
48
|
+
]
|
|
49
|
+
<%_ }) _%>
|
|
50
|
+
<%_ }) _%>
|
|
51
|
+
}<% if(resourceIdx < data.additionalResourcePermission.length-1) {_%>, <%_} %>
|
|
52
|
+
<%_ }) _%>
|
|
53
|
+
]
|
|
54
|
+
}, <%_ }) %>
|
|
55
|
+
]
|
|
56
|
+
return externalLambdaRole
|
|
57
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require('path');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
const { getGraphServiceNameFromGraphServerTagWithCache, getServiceNameWithCache } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
|
|
25
|
+
const {
|
|
26
|
+
DEFAULT_HANDLER_PER_ACTION,
|
|
27
|
+
createIamRole,
|
|
28
|
+
resourceNames,
|
|
29
|
+
RESOURCE_CLASSES,
|
|
30
|
+
DEFAULT_LAMBDA_ROLE_PER_ACTION,
|
|
31
|
+
SOURCE_PATH,
|
|
32
|
+
externalResourceName,
|
|
33
|
+
getGraphServiceNameFromAllRelSchema,
|
|
34
|
+
FUNCTION_NAME,
|
|
35
|
+
SAVE_FILE_NAME,
|
|
36
|
+
getGraphServiceNameFromObjectSchema
|
|
37
|
+
} = require("../../../../MainLibs/src/Consts");
|
|
38
|
+
const {
|
|
39
|
+
TOPIC_NAME_GRAPH_HANDLER,
|
|
40
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
41
|
+
EXTERNAL_SERVICE_NAME,
|
|
42
|
+
TOPIC_NAME_EXTERNAL_SERVICE
|
|
43
|
+
} = require('../../../../GenerateCodeLibs/src/Consts');
|
|
44
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const createExternalSnsSubscriptions = async (_izContext, allObjSchemas, allRelSchemas, allLocalFlowSchemas, srcPath) => {
|
|
48
|
+
const snsServiceConfigArray = [];
|
|
49
|
+
|
|
50
|
+
const snsServiceConfigUpdateRelationshipComplete = await snsSubScriptionUpdateRelationshipComplete(_izContext, allRelSchemas)
|
|
51
|
+
snsServiceConfigUpdateRelationshipComplete && snsServiceConfigArray.push(snsServiceConfigUpdateRelationshipComplete)
|
|
52
|
+
|
|
53
|
+
const snsServiceConfigCreateRelationshipComplete = await snsSubscriptionCreateRelationshipComplete(_izContext, allRelSchemas)
|
|
54
|
+
snsServiceConfigCreateRelationshipComplete && snsServiceConfigArray.push(snsServiceConfigCreateRelationshipComplete)
|
|
55
|
+
|
|
56
|
+
const snsServiceConfigDeleteRelationshipComplete = await snsSubscriptionDeleteRelatipnshipComplete(_izContext, allRelSchemas)
|
|
57
|
+
snsServiceConfigDeleteRelationshipComplete && snsServiceConfigArray.push(snsServiceConfigDeleteRelationshipComplete);
|
|
58
|
+
|
|
59
|
+
const snsServiceConfigUpdateNodeComplete = await snsSubscriptionOutUpdateNodeComplete(_izContext, allObjSchemas)
|
|
60
|
+
snsServiceConfigUpdateNodeComplete && snsServiceConfigArray.push(snsServiceConfigUpdateNodeComplete)
|
|
61
|
+
|
|
62
|
+
const snsServiceConfigCreateNodeComplete = await snsSubscriptionCreateNodeComplete(_izContext, allObjSchemas)
|
|
63
|
+
snsServiceConfigCreateNodeComplete && snsServiceConfigArray.push(snsServiceConfigCreateNodeComplete);
|
|
64
|
+
|
|
65
|
+
const snsServiceConfigDeleteNodeComplete = await snsSubscriptionDeleteNodeComplate(_izContext, allObjSchemas)
|
|
66
|
+
snsServiceConfigDeleteNodeComplete && snsServiceConfigArray.push(snsServiceConfigDeleteNodeComplete);
|
|
67
|
+
|
|
68
|
+
if (allLocalFlowSchemas) {
|
|
69
|
+
for (const flowSchema of allLocalFlowSchemas) {
|
|
70
|
+
if (flowSchema.hasOwnProperty("uploadS3") && flowSchema.uploadS3 === true) {
|
|
71
|
+
const snsServiceConfigForReservedDynamicUsage = await snsSubscriptionReservedLimitCompleteForReservedDynamicUsage(_izContext);
|
|
72
|
+
snsServiceConfigForReservedDynamicUsage && snsServiceConfigArray.push(snsServiceConfigForReservedDynamicUsage);
|
|
73
|
+
|
|
74
|
+
const snsServiceConfigForConfirmReserved = await snsSubscriptionConfirmReserved(_izContext);
|
|
75
|
+
snsServiceConfigForConfirmReserved && snsServiceConfigArray.push(snsServiceConfigForConfirmReserved);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
console.log("snsServiceConfigArray::", snsServiceConfigArray)
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
templatePath: templatePath,
|
|
83
|
+
templateData: { datas: snsServiceConfigArray },
|
|
84
|
+
setting: {
|
|
85
|
+
savePath: path.join(srcPath, SOURCE_PATH.externalService),
|
|
86
|
+
saveFileName: SAVE_FILE_NAME.snsSubscription,
|
|
87
|
+
fileExtension: ".js",
|
|
88
|
+
isAppend: true
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
// update Relationship
|
|
95
|
+
async function snsSubScriptionUpdateRelationshipComplete(_izContext, allRelSchemas) {
|
|
96
|
+
let serviceNames = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas)
|
|
97
|
+
|
|
98
|
+
return {
|
|
99
|
+
serviceNames: serviceNames,
|
|
100
|
+
topicName: TOPIC_NAME_GRAPH_HANDLER.outUpdateRel, // external service
|
|
101
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.updateRelComplete // in service
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// create Relationship
|
|
106
|
+
async function snsSubscriptionCreateRelationshipComplete(_izContext, allRelSchemas) {
|
|
107
|
+
let serviceNames = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas)
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
serviceNames: serviceNames,
|
|
111
|
+
topicName: TOPIC_NAME_GRAPH_HANDLER.outCreateRel,
|
|
112
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.createRelComplete
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// topic not create yet will return error when initialSetup
|
|
117
|
+
// create topic for OutUpdateNodeComplete
|
|
118
|
+
async function snsSubscriptionOutUpdateNodeComplete(_izContext, allObjSchemas) {
|
|
119
|
+
let serviceNames = await getGraphServiceNameFromObjectSchema(_izContext, allObjSchemas)
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
serviceNames: serviceNames,
|
|
123
|
+
topicName: TOPIC_NAME_GRAPH_HANDLER.outUpdateNode,
|
|
124
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.updateNodeComplete
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function snsSubscriptionCreateNodeComplete(_izContext, allObjectSchemas) {
|
|
129
|
+
let serviceNames = await getGraphServiceNameFromObjectSchema(_izContext, allObjectSchemas)
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
serviceNames: serviceNames,
|
|
133
|
+
topicName: TOPIC_NAME_GRAPH_HANDLER.outCreateNode,
|
|
134
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.createNodeComplete
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function snsSubscriptionDeleteNodeComplate(_izContext, allObjectSchemas) {
|
|
139
|
+
// let serviceNames = await getGraphServiceNameFromAllRelSchema(_izContext, allObjectSchemas)
|
|
140
|
+
|
|
141
|
+
// return {
|
|
142
|
+
// serviceNames: serviceNames,
|
|
143
|
+
// topicName: "OutDeleteNode",
|
|
144
|
+
// sqsEndpoint: "DeleteNodeComplete"
|
|
145
|
+
// }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function snsSubscriptionDeleteRelatipnshipComplete(_izContext, allRelSchemas) {
|
|
149
|
+
let serviceNames = await getGraphServiceNameFromAllRelSchema(_izContext, allRelSchemas)
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
serviceNames: serviceNames,
|
|
153
|
+
topicName: TOPIC_NAME_GRAPH_HANDLER.outDeleteRel,
|
|
154
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.deleteRelComplete
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function snsSubscriptionReservedLimitCompleteForReservedDynamicUsage(_izContext) {
|
|
159
|
+
let serviceNames = [EXTERNAL_SERVICE_NAME.accountLimits]
|
|
160
|
+
return {
|
|
161
|
+
serviceNames: serviceNames,
|
|
162
|
+
topicName: TOPIC_NAME_EXTERNAL_SERVICE.reservedDynamicUsageComplete,
|
|
163
|
+
sqsEndpoint: TOPIC_NAME_GENERATE_CODE.reservedLimitComplete + upperCase(HANDLER.hdrSqs)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
function snsSubscriptionConfirmReserved(_izContext) {
|
|
169
|
+
let serviceNames = [EXTERNAL_SERVICE_NAME.accountLimits];
|
|
170
|
+
return {
|
|
171
|
+
serviceNames: serviceNames,
|
|
172
|
+
topicName: TOPIC_NAME_EXTERNAL_SERVICE.reservedDynamicUsageComplete,
|
|
173
|
+
sqsEndpoint: "ConfirmNewReserved" + upperCase(HANDLER.hdrSqs)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
module.exports = createExternalSnsSubscriptions;
|