@izara_project/izara-market-library-service-schemas 1.0.65 → 1.0.67
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/package.json +3 -3
- package/src/GenerateCodeLibs/src/Consts.js +7 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +11 -1
- package/src/MainLibs/src/Consts.js +64 -25
- package/src/MainLibs/src/GenerateCodeUtils.js +6 -6
- package/src/reStructure/GenerateCode.js +2 -1
- package/src/reStructure/TemplateData/EndpointPerService/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +20 -4
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +49 -5
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +3 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +3 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +14 -0
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/flowStep/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +4 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +9 -9
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +24 -24
- package/src/reStructure/TemplateData/generateRole/data.js +38 -24
- package/src/reStructure/TemplateData/generateRole/template.ejs +5 -7
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +4 -4
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/api/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +136 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/inv/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +11 -11
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +159 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +158 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/generateTemplateData.js +131 -88
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +158 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +160 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/apiTemplate.ejs +172 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/dsqTemplate.ejs +218 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/invTemplate.ejs +161 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/sqsTemplate.ejs +197 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +386 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/data.js +121 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/template.ejs +129 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/data.js +56 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/template.ejs +159 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-in-sqs/template.ejs +46 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +164 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +8 -7
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +36 -30
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +3 -3
|
@@ -0,0 +1,159 @@
|
|
|
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
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
20
|
+
|
|
21
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
|
+
const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
|
|
23
|
+
const snsSharedLib = require("@izara_project/izara-core-library-sns");
|
|
24
|
+
const dynamodbSharedLib = require("@izara_project/izara-core-library-dynamodb");
|
|
25
|
+
const asyncFlowSharedLib = require("@izara_project/izara-core-library-asynchronous-flow");
|
|
26
|
+
|
|
27
|
+
const sns = require("@izara_project/izara-core-library-external-request").sns;
|
|
28
|
+
const NoRetryError = require("@izara_project/izara-core-library-core/src/NoRetryError");
|
|
29
|
+
|
|
30
|
+
const { explodedObjectTypeId, explodedRelationshipTypeId, createLinkTypeId } = require('@izara_project/izara-core-library-service-schemas/src/Utils')
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
34
|
+
TOPIC_NAME_GRAPH_HANDLER,
|
|
35
|
+
PREFIX
|
|
36
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
37
|
+
|
|
38
|
+
//(<optionalRequire>)
|
|
39
|
+
//(</optionalRequire>)
|
|
40
|
+
|
|
41
|
+
module.exports.<%- functionName %> = async (
|
|
42
|
+
_izContext,
|
|
43
|
+
returnValue,
|
|
44
|
+
status,
|
|
45
|
+
errorsFound,
|
|
46
|
+
graphServiceTag,
|
|
47
|
+
passBackProperties = {},
|
|
48
|
+
|
|
49
|
+
) => {
|
|
50
|
+
try {
|
|
51
|
+
_izContext.logger.debug("Function:<%- functionName %>", {
|
|
52
|
+
returnValue: returnValue,
|
|
53
|
+
status: status,
|
|
54
|
+
errorsFound: errorsFound,
|
|
55
|
+
graphServiceTag: graphServiceTag,
|
|
56
|
+
passBackProperties: passBackProperties,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// start create awaitingStepId
|
|
60
|
+
const linkTypeId = createLinkTypeId(
|
|
61
|
+
_izContext,
|
|
62
|
+
returnValue.requestParams.firstObject.objType,
|
|
63
|
+
returnValue.requestParams.secondObject.objType,
|
|
64
|
+
returnValue.requestParams.relType,
|
|
65
|
+
returnValue.requestParams.relationshipProperties,
|
|
66
|
+
returnValue.requestParams.relationshipDirection,
|
|
67
|
+
returnValue.requestParams.moveObject,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
71
|
+
hash({
|
|
72
|
+
linkTypeId,
|
|
73
|
+
graphServiceTag: graphServiceTag,
|
|
74
|
+
callingFlowProperties: passBackProperties.passBackProperties.parentPassBackProperties.callingFlowProperties || {},
|
|
75
|
+
firstObject: returnValue.requestParams.firstObject,
|
|
76
|
+
secondObject: returnValue.requestParams.secondObject,
|
|
77
|
+
relType: returnValue.requestParams.relType,
|
|
78
|
+
relationshipProperties: returnValue.requestParams.relationshipProperties,
|
|
79
|
+
relationshipDirection: returnValue.requestParams.relationshipDirection,
|
|
80
|
+
moveObject: returnValue.requestParams.moveObject,
|
|
81
|
+
}), // hash id
|
|
82
|
+
PREFIX.changeRel // prefix, use constant further
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
let moveRelPendingObjects = await dynamodbSharedLib.query(
|
|
87
|
+
_izContext,
|
|
88
|
+
await dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleSteps"),
|
|
89
|
+
{
|
|
90
|
+
awaitingStepId: awaitingStepId
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
_izContext.logger.debug("record of moveRelPendingObjects ::", moveRelPendingObjects);
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
await Promise.all(
|
|
98
|
+
moveRelPendingObjects.Items.map(async ({ pendingStepId }) => {
|
|
99
|
+
if (await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
100
|
+
_izContext,
|
|
101
|
+
pendingStepId, // task waiting
|
|
102
|
+
awaitingStepId,
|
|
103
|
+
errorsFound
|
|
104
|
+
)) {
|
|
105
|
+
_izContext.logger.debug("finished all awaitingStep");
|
|
106
|
+
|
|
107
|
+
let moveRelCompleteMsg = {
|
|
108
|
+
firstObject: returnValue.requestParams.firstObject,
|
|
109
|
+
secondObject: returnValue.requestParams.secondObject,
|
|
110
|
+
relType: returnValue.requestParams.relType,
|
|
111
|
+
relationshipProperties: returnValue.requestParams.relationshipProperties,
|
|
112
|
+
relationshipDirection: returnValue.requestParams.relationshipDirection,
|
|
113
|
+
moveObject: returnValue.requestParams.moveObject,
|
|
114
|
+
status: status,
|
|
115
|
+
errorsFound: errorsFound
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
moveRelCompleteMsg = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, moveRelCompleteMsg);
|
|
119
|
+
_izContext.logger.debug("After addCallingFlowToSnsResponseMessageObject", moveRelCompleteMsg);
|
|
120
|
+
|
|
121
|
+
let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {});
|
|
122
|
+
_izContext.logger.debug("After addCallingFlowToSnsResponseMessageAttributes", moveRelCompleteMsg);
|
|
123
|
+
|
|
124
|
+
let sendMessageToOutMoveRelationshipComplete = {
|
|
125
|
+
Message: JSON.stringify(moveRelCompleteMsg),
|
|
126
|
+
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
127
|
+
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, TOPIC_NAME_GENERATE_CODE.outMoveRelComplete)
|
|
128
|
+
};
|
|
129
|
+
_izContext.logger.debug("Send message to OutCreateRelationshipComplete :::>", sendMessageToOutMoveRelationshipComplete);
|
|
130
|
+
await sns.publishAsync(_izContext, sendMessageToOutMoveRelationshipComplete);
|
|
131
|
+
|
|
132
|
+
//(<afterCheckAwaitingStep>)
|
|
133
|
+
//(</afterCheckAwaitingStep>)
|
|
134
|
+
} // check pendingStepId finished
|
|
135
|
+
|
|
136
|
+
// remove awaitingMultipleStep after finished
|
|
137
|
+
await asyncFlowSharedLib.removeAwaitingMultipleStep(
|
|
138
|
+
_izContext,
|
|
139
|
+
awaitingStepId,
|
|
140
|
+
pendingStepId,
|
|
141
|
+
errorsFound
|
|
142
|
+
);
|
|
143
|
+
}) // end per pendingStep
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
//(<afterCheckAllAwaitingStep>)
|
|
147
|
+
//(</afterCheckAllAwaitingStep>)
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
returnValue,
|
|
151
|
+
status,
|
|
152
|
+
errorsFound
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
} catch (err) {
|
|
156
|
+
_izContext.logger.error('error createRelationshipComplete:', err)
|
|
157
|
+
throw (err)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 {
|
|
23
|
+
// HANDLER,
|
|
24
|
+
// STORAGE_TYPES
|
|
25
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const STORAGE_TYPES = {
|
|
29
|
+
dynamoDB: "dynamoDB",
|
|
30
|
+
graph: "graph"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const templatePath = path.join(__dirname, './template.ejs');
|
|
34
|
+
const { SOURCE_PATH, FUNCTION_NAME, SAVE_FILE_NAME } = require('../../../../../../MainLibs/index.js').consts;
|
|
35
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/index.js").utils;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
40
|
+
* return array of dynamoDb data
|
|
41
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} _izContext
|
|
44
|
+
* @param {String} saveFilePath
|
|
45
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
function createDataForDefaultSnsInSqs(_izContext, srcPath) {
|
|
49
|
+
let createCreateRelationCompleteQueue = [];
|
|
50
|
+
const createRelationshipCompleteQueues = [
|
|
51
|
+
{
|
|
52
|
+
queueName: upperCase(FUNCTION_NAME.moveRelComplete)
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
for (let createRelationshipCompleteQueue of createRelationshipCompleteQueues) {
|
|
56
|
+
createCreateRelationCompleteQueue.push({
|
|
57
|
+
templatePath: templatePath,
|
|
58
|
+
templateData: createRelationshipCompleteQueue,
|
|
59
|
+
setting: {
|
|
60
|
+
initialData: "Resources:\n",
|
|
61
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
62
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
63
|
+
fileExtension: ".yml",
|
|
64
|
+
isAppend: true
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
return createCreateRelationCompleteQueue
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = createDataForDefaultSnsInSqs;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
##===== [Queue]
|
|
2
|
+
<%- queueName %>:
|
|
3
|
+
Type: "AWS::SQS::Queue"
|
|
4
|
+
Properties:
|
|
5
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
6
|
+
RedrivePolicy:
|
|
7
|
+
deadLetterTargetArn:
|
|
8
|
+
# !GetAtt
|
|
9
|
+
Fn::GetAtt:
|
|
10
|
+
- <%- queueName %>DLQ
|
|
11
|
+
- Arn
|
|
12
|
+
maxReceiveCount: 3
|
|
13
|
+
VisibilityTimeout: 120
|
|
14
|
+
##==== [QueueDLQ]
|
|
15
|
+
<%- queueName %>DLQ:
|
|
16
|
+
Type: AWS::SQS::Queue
|
|
17
|
+
Properties:
|
|
18
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
19
|
+
##==== [QueuePolicy]
|
|
20
|
+
<%- queueName %>Policy:
|
|
21
|
+
Type: AWS::SQS::QueuePolicy
|
|
22
|
+
Properties:
|
|
23
|
+
PolicyDocument:
|
|
24
|
+
Version: "2012-10-17"
|
|
25
|
+
Statement:
|
|
26
|
+
- Sid: "allow-sns-messages"
|
|
27
|
+
Effect: Allow
|
|
28
|
+
Principal: "*"
|
|
29
|
+
Resource:
|
|
30
|
+
# !GetAtt
|
|
31
|
+
Fn::GetAtt:
|
|
32
|
+
- <%- queueName %>
|
|
33
|
+
- Arn
|
|
34
|
+
Action: "SQS:SendMessage"
|
|
35
|
+
Queues:
|
|
36
|
+
- Ref: <%- queueName %>
|
|
37
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
38
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
<%_ function firstLetterUpperCase(text){
|
|
42
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
43
|
+
} _%>
|
|
44
|
+
<%_ function firstLetterLowerCase(str) {
|
|
45
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
46
|
+
} _%>
|
package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/data.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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 {
|
|
23
|
+
// HANDLER,
|
|
24
|
+
// STORAGE_TYPES
|
|
25
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const STORAGE_TYPES = {
|
|
29
|
+
dynamoDB: "dynamoDB",
|
|
30
|
+
graph: "graph"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/index.js").utils;
|
|
34
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../../../MainLibs/index.js").consts;
|
|
35
|
+
const templatePath = path.join(__dirname, './template.ejs')
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
39
|
+
* return array of dynamoDb data
|
|
40
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} _izContext
|
|
43
|
+
* @param {String} saveFilePath
|
|
44
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
function createDefaultSnsOut(_izContext, srcPath) {
|
|
48
|
+
const createSourceParams = createParamsForCreateSource(_izContext, srcPath)
|
|
49
|
+
// console.log("createSourceParamsCreateRelationshipComplete", createSourceParams)
|
|
50
|
+
|
|
51
|
+
return [createSourceParams]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function createParamsForCreateSource(_izContext, srcPath) {
|
|
55
|
+
let queueName = FUNCTION_NAME.moveRelComplete;
|
|
56
|
+
return {
|
|
57
|
+
templatePath: templatePath,
|
|
58
|
+
templateData: {
|
|
59
|
+
queueName: upperCase(queueName)
|
|
60
|
+
},
|
|
61
|
+
setting: {
|
|
62
|
+
initialData: 'Resources:\n',
|
|
63
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
64
|
+
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
65
|
+
fileExtension: '.yml',
|
|
66
|
+
isAppend: true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = createDefaultSnsOut
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
##--------- [Create Topic Out]
|
|
2
|
+
Out<%- firstLetterUpperCase(queueName) %>:
|
|
3
|
+
Type: AWS::SNS::Topic
|
|
4
|
+
Properties:
|
|
5
|
+
DisplayName: "SNS Message out"
|
|
6
|
+
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- firstLetterUpperCase(queueName) %>_Out
|
|
7
|
+
|
|
8
|
+
<%_ function firstLetterUpperCase(text) {
|
|
9
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
+
} _%>
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js
CHANGED
|
@@ -126,8 +126,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
126
126
|
handlerType,
|
|
127
127
|
additionalResourcePermission,
|
|
128
128
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
129
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handlerType)),
|
|
130
|
-
|
|
129
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateRel)) + upperCase(shortNameHandler(handlerType)),
|
|
130
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
131
131
|
},
|
|
132
132
|
setting: {
|
|
133
133
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
firstLetterLowerCase: lowerCase,
|
|
25
|
+
firstLetterUpperCase: upperCase,
|
|
26
|
+
getLocalConfig
|
|
27
|
+
} = require("../../../../../../MainLibs/src/Utils.js");
|
|
28
|
+
const {
|
|
29
|
+
DEFAULT_HANDLER_PER_ACTION,
|
|
30
|
+
DYNAMO_RESOURCE,
|
|
31
|
+
FUNCTION_NAME,
|
|
32
|
+
RESOURCE_CLASSES,
|
|
33
|
+
SAVE_FILE_NAME,
|
|
34
|
+
SHORT_FUNCTION_NAME,
|
|
35
|
+
SNS_RESOURCE,
|
|
36
|
+
SOURCE_PATH,
|
|
37
|
+
SQS_RESOURCE,
|
|
38
|
+
awaitingMultipleStepsRole,
|
|
39
|
+
createIamRole,
|
|
40
|
+
defaultIamRolePerAction,
|
|
41
|
+
resourceNames,
|
|
42
|
+
shortNameHandler,
|
|
43
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
44
|
+
checkDynamoTypeRelationship,
|
|
45
|
+
createDynamoDbComponentByLinks,
|
|
46
|
+
} = require("../../../../../../MainLibs/src/Consts.js");
|
|
47
|
+
|
|
48
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
49
|
+
const apiTemplate = path.join(__dirname, "././templateByHandler/apiTemplate.ejs")
|
|
50
|
+
const dsqTemplate = path.join(__dirname, "././templateByHandler/dsqTemplate.ejs")
|
|
51
|
+
const invTemplate = path.join(__dirname, "././templateByHandler/invTemplate.ejs")
|
|
52
|
+
const sqsTemplate = path.join(__dirname, "././templateByHandler/sqsTemplate.ejs")
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* receive objectSchema
|
|
56
|
+
* create data for updateRelationshipSchema
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} objectSchema
|
|
59
|
+
* @return {{ templatePath, templateData, setting } }
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
63
|
+
let createSourceArray = [];
|
|
64
|
+
for (const handlerType of Object.values(HANDLER)) {
|
|
65
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, handlerType, srcPath);
|
|
66
|
+
createSourceArray.push(createSourceParam);
|
|
67
|
+
}
|
|
68
|
+
return createSourceArray
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
function createParamForCreateSource(allObjectRelationships, handlerType, srcPath) {
|
|
73
|
+
|
|
74
|
+
let functionName = FUNCTION_NAME.updateRel
|
|
75
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
76
|
+
|
|
77
|
+
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
78
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
79
|
+
additionalResourcePermission.push(
|
|
80
|
+
createIamRole(
|
|
81
|
+
{
|
|
82
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
83
|
+
SQS_RESOURCE.deleteMessage,
|
|
84
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
85
|
+
SQS_RESOURCE.receiveMessage,
|
|
86
|
+
SQS_RESOURCE.sendMessage,
|
|
87
|
+
SQS_RESOURCE.getQueueUrl,
|
|
88
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
[
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
94
|
+
]
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
100
|
+
additionalResourcePermission.push(
|
|
101
|
+
createIamRole(
|
|
102
|
+
{
|
|
103
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
104
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage]
|
|
105
|
+
},
|
|
106
|
+
[
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
108
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
109
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
110
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
111
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
112
|
+
]
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (const relationship of allObjectRelationships) {
|
|
118
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
119
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
120
|
+
for (const link of links) {
|
|
121
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
122
|
+
additionalResourcePermission.push(
|
|
123
|
+
createIamRole(
|
|
124
|
+
{
|
|
125
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
126
|
+
},
|
|
127
|
+
[
|
|
128
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
129
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
130
|
+
]
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
templatePath: templatePath,
|
|
139
|
+
templateData: {
|
|
140
|
+
functionName,
|
|
141
|
+
handlerType,
|
|
142
|
+
additionalResourcePermission,
|
|
143
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
144
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateRel)) + upperCase(shortNameHandler(handlerType)),
|
|
145
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
|
|
146
|
+
serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
|
|
147
|
+
apiTemplate,
|
|
148
|
+
dsqTemplate,
|
|
149
|
+
invTemplate,
|
|
150
|
+
sqsTemplate
|
|
151
|
+
},
|
|
152
|
+
setting: {
|
|
153
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
154
|
+
saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
|
|
155
|
+
fileExtension: '.yml',
|
|
156
|
+
isAppend: true
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
module.exports = data;
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js
CHANGED
|
@@ -149,8 +149,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
149
149
|
handlerType,
|
|
150
150
|
additionalResourcePermission,
|
|
151
151
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
152
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handlerType)),
|
|
153
|
-
|
|
152
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateRel)) + upperCase(shortNameHandler(handlerType)),
|
|
153
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
154
154
|
},
|
|
155
155
|
setting: {
|
|
156
156
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js
CHANGED
|
@@ -145,8 +145,8 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
145
145
|
handlerType,
|
|
146
146
|
additionalResourcePermission,
|
|
147
147
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
148
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handlerType)),
|
|
149
|
-
|
|
148
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateRel)) + upperCase(shortNameHandler(handlerType)),
|
|
149
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
150
150
|
|
|
151
151
|
},
|
|
152
152
|
setting: {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js
CHANGED
|
@@ -145,7 +145,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
145
145
|
handlerType,
|
|
146
146
|
additionalResourcePermission,
|
|
147
147
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
148
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.updateRel) + upperCase(shortNameHandler(handlerType)),
|
|
148
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateRel)) + upperCase(shortNameHandler(handlerType)),
|
|
149
149
|
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
150
150
|
},
|
|
151
151
|
setting: {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/template.ejs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% if (handlerType === "hdrApi") { %>
|
|
2
|
+
<%- include(apiTemplate),{ functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName, serviceTag } %>
|
|
3
|
+
<% } else if (handlerType === "hdrDsq") { %>
|
|
4
|
+
<%- include(dsqTemplate), { functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName } %>
|
|
5
|
+
<% } else if (handlerType === "hdrInv") { %>
|
|
6
|
+
<%- include(invTemplate), { functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName } %>
|
|
7
|
+
<% } else if (handlerType === "hdrSqs") { %>
|
|
8
|
+
<%- include(sqsTemplate),{ functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName } %>
|
|
9
|
+
<% } %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- http:
|
|
7
|
+
path: /<%- serviceTag %>/<%- firstLetterLowerCase(functionName) %>/<%- functionName %>/
|
|
8
|
+
method: put
|
|
9
|
+
cors: true
|
|
10
|
+
#<#Authorizer#>
|
|
11
|
+
#<#/Authorizer#>
|
|
12
|
+
role: <%- roleName %>Role
|
|
13
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
14
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
15
|
+
<%_ function firstLetterUpperCase(text){
|
|
16
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
17
|
+
} _%>
|
|
18
|
+
<%_ function firstLetterLowerCase(str) {
|
|
19
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
20
|
+
} _%>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
role: <%- roleName %>Role
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
|
+
<%_ function firstLetterUpperCase(text){
|
|
13
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
|
+
} _%>
|
|
15
|
+
<%_ function firstLetterLowerCase(str) {
|
|
16
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
17
|
+
} _%>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
role: <%- roleName %>Role
|
|
6
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
7
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
8
|
+
<%_ function firstLetterUpperCase(text){
|
|
9
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
+
} _%>
|
|
11
|
+
<%_ function firstLetterLowerCase(str) {
|
|
12
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
13
|
+
} _%>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
role: <%- roleName %>Role
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
|
+
<%_ function firstLetterUpperCase(text){
|
|
13
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
|
+
} _%>
|
|
15
|
+
<%_ function firstLetterLowerCase(str) {
|
|
16
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
17
|
+
} _%>
|