@izara_project/izara-market-library-service-schemas 1.0.28 → 1.0.30
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 +1 -1
- package/src/GenerateCodeLibs/src/Consts.js +10 -9
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +54 -21
- package/src/MainLibs/src/Consts.js +36 -18
- package/src/reStructure/GenerateCode.js +2 -1
- package/src/reStructure/TemplateConfig.js +5 -1
- package/src/reStructure/TemplateData/EndpointPerService/generateTemplateData.js +108 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/data.js +76 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/request.json +7 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +73 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/data.js +81 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/request.json +7 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +125 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/data.js +70 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/request.json +7 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +73 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/data.js +79 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/request.json +7 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +126 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/data.js +53 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +624 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/data.js +52 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +177 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/data.js +56 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +234 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/data.js +56 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +330 -0
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +175 -0
- package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +26 -0
- package/src/reStructure/TemplateData/externalService/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +91 -249
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +10 -8
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +1 -1
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +4 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +3 -29
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -21
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -31
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/functionYaml/data.js +41 -10
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/functionYaml/template.ejs +3 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/{hook/handler/templateAsyncHandler.ejs → preSignUrl/createPresignUrl/handler/template.ejs} +26 -11
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/mainFunction/data.js +10 -7
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +253 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{reservedLimit → createPresignUrl}/queue/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +10 -38
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +0 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +40 -45
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +7 -10
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +100 -190
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → reservedLimit}/sqs/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → reservedLimit}/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +8 -6
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/s3Template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/data.js +5 -2
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +41 -38
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +11 -1
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +35 -44
- package/src/reStructure/TemplateData/perActionComplete/create/sns-out/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +4 -5
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +5 -4
- package/src/reStructure/TemplateData/perActionComplete/generateTemplateData.js +15 -2
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +7 -4
- package/src/reStructure/TemplateData/perActionComplete/update/sns-out/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +5 -4
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +3 -3
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +16 -15
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +18 -16
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/snsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/template.ejs +0 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +16 -15
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +17 -14
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +18 -16
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/snsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +17 -14
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +20 -17
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/sns-in-sqs/snsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-out/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +16 -14
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +19 -18
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/snsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +40 -38
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +6 -12
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsAndSqsPerActionData.js +22 -49
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/sns-out/data.js +8 -24
- package/src/reStructure/TemplateData/resourceYaml/sns-out/template.ejs +1 -1
- package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -5
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/data.js +0 -93
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateSyncHandler.ejs +0 -49
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/hookLogic/data.js +0 -43
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/data.js +0 -65
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/template.ejs +0 -7
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/data.js +0 -72
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/snsTemplate.ejs +0 -59
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/sqsTemplate.ejs +0 -43
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/template.ejs +0 -120
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/template.ejs +0 -163
- /package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{reservedLimit → createPresignUrl}/queue/template.ejs +0 -0
package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs
CHANGED
|
@@ -22,16 +22,12 @@ const middleware = izara.middlewareHandler;
|
|
|
22
22
|
// const AWS = require('aws-sdk');
|
|
23
23
|
// const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
|
|
24
24
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb')
|
|
25
|
-
const callingFlowSharedLib = require('@izara_project/izara-core-calling-flow')
|
|
25
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow')
|
|
26
26
|
const hash = require('object-hash')
|
|
27
27
|
// const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
28
28
|
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
29
29
|
const { postToConnection } = require("../../libs/source/ImportDataLib");
|
|
30
|
-
<% if (hook) { _%>
|
|
31
|
-
const <%- upperCase(hookFunctionName) %> = require("./FlowSchemaHook/HookLogicFunction/source/<%- upperCase(hookFunctionName) %>")
|
|
32
|
-
<% } else { _%>
|
|
33
30
|
const createObject = require('./CreateObjectS3_Main');
|
|
34
|
-
<% } _%>
|
|
35
31
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
36
32
|
|
|
37
33
|
event._izContext.logger.debug('Event:', event);
|
|
@@ -53,7 +49,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
53
49
|
case '$default':
|
|
54
50
|
console.log('Received unknown route:', route);
|
|
55
51
|
break
|
|
56
|
-
case '
|
|
52
|
+
case 'uploadS3':
|
|
57
53
|
console.log("event in route webSocket", event);
|
|
58
54
|
let eventParams = JSON.parse(event.body)
|
|
59
55
|
|
|
@@ -67,25 +63,6 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
67
63
|
)
|
|
68
64
|
|
|
69
65
|
let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
|
|
70
|
-
<% if (hook) { _%>
|
|
71
|
-
<% if (isAsync) { %>
|
|
72
|
-
await <%- upperCase(hookFunctionName) %>(
|
|
73
|
-
event._izContext,
|
|
74
|
-
eventParams,
|
|
75
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
76
|
-
//(<additionalParams>)
|
|
77
|
-
//(</additionalParams>)
|
|
78
|
-
)
|
|
79
|
-
<% } else { %>
|
|
80
|
-
<%- upperCase(hookFunctionName) %>(
|
|
81
|
-
event._izContext,
|
|
82
|
-
eventParams,
|
|
83
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
84
|
-
//(<additionalParams>)
|
|
85
|
-
//(</additionalParams>)
|
|
86
|
-
)
|
|
87
|
-
<% } _%>
|
|
88
|
-
<% } else { _%>
|
|
89
66
|
await createObject.createObject(
|
|
90
67
|
event._izContext,
|
|
91
68
|
eventParams,
|
|
@@ -93,7 +70,6 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
93
70
|
//(<additionalParams>)
|
|
94
71
|
//(</additionalParams>)
|
|
95
72
|
)
|
|
96
|
-
<% } _%>
|
|
97
73
|
|
|
98
74
|
break
|
|
99
75
|
}
|
|
@@ -112,8 +88,4 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
112
88
|
await postToConnection({ message: err.message }, connId);
|
|
113
89
|
return (izara.response.failure(err));
|
|
114
90
|
}
|
|
115
|
-
});
|
|
116
|
-
<%_ const join = require('path').join _%>
|
|
117
|
-
<%_ function upperCase (text) {
|
|
118
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
119
|
-
} _%>
|
|
91
|
+
});
|
|
@@ -67,8 +67,8 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
69
|
[
|
|
70
|
-
resourceNames(RESOURCE_CLASSES.
|
|
71
|
-
resourceNames(RESOURCE_CLASSES.
|
|
70
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
71
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + "DLQ")
|
|
72
72
|
]
|
|
73
73
|
),
|
|
74
74
|
createIamRole(
|
|
@@ -55,7 +55,7 @@ function createDataForDefaultSnsInSqs(_izContext, srcPath) {
|
|
|
55
55
|
defaultSnsInSqsDataList.push(
|
|
56
56
|
{
|
|
57
57
|
queueName: upperCase(FUNCTION_NAME.createObjectS3Complete) + upperCase(HANDLER.hdrSqs),
|
|
58
|
-
subScription: upperCase(
|
|
58
|
+
subScription: "Out" + upperCase(FUNCTION_NAME.updateNodeComplete)
|
|
59
59
|
}
|
|
60
60
|
)
|
|
61
61
|
|
|
@@ -36,7 +36,11 @@ const {
|
|
|
36
36
|
awaitingMultipleStepsRole,
|
|
37
37
|
externalResourceSns,
|
|
38
38
|
externalResourceName,
|
|
39
|
-
|
|
39
|
+
DYNAMO_RESOURCE,
|
|
40
|
+
LAMBDA_RESOURCE,
|
|
41
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
42
|
+
FUNCTION_NAME,
|
|
43
|
+
ACTIONS
|
|
40
44
|
} = require('../../../../../../../../MainLibs/src/Consts');
|
|
41
45
|
|
|
42
46
|
const {
|
|
@@ -55,7 +59,7 @@ function data(_izContext, srcPath) {
|
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
function createSourceParams(_izContext, srcPath) {
|
|
58
|
-
let functionName =
|
|
62
|
+
let functionName = upperCase(FUNCTION_NAME.createPresignUrl);
|
|
59
63
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
60
64
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
61
65
|
|
|
@@ -67,16 +71,43 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
67
71
|
SQS_RESOURCE.sendMessage,
|
|
68
72
|
SQS_RESOURCE.deleteMessage,
|
|
69
73
|
SQS_RESOURCE.getQueueAttributes
|
|
70
|
-
],
|
|
71
|
-
[RESOURCE_CLASSES.sns]: [
|
|
72
|
-
SNS_RESOURCE.publish,
|
|
73
|
-
SNS_RESOURCE.subscribe
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
76
|
[
|
|
77
|
-
resourceNames(RESOURCE_CLASSES.sqs,
|
|
78
|
-
resourceNames(RESOURCE_CLASSES.sqs,
|
|
79
|
-
|
|
77
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
78
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + "DLQ"),
|
|
79
|
+
]
|
|
80
|
+
),
|
|
81
|
+
createIamRole(
|
|
82
|
+
{
|
|
83
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
84
|
+
DYNAMO_RESOURCE.query,
|
|
85
|
+
DYNAMO_RESOURCE.deleteItem,
|
|
86
|
+
DYNAMO_RESOURCE.updateItem,
|
|
87
|
+
DYNAMO_RESOURCE.putItem
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "WebSocketTask"),
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "ReservedDataMain"),
|
|
93
|
+
]
|
|
94
|
+
),
|
|
95
|
+
createIamRole(
|
|
96
|
+
{
|
|
97
|
+
"execute-api": "ManageConnections"
|
|
98
|
+
},
|
|
99
|
+
[
|
|
100
|
+
resourceNames(RESOURCE_CLASSES.webSocket)
|
|
101
|
+
]
|
|
102
|
+
),
|
|
103
|
+
createIamRole(
|
|
104
|
+
{
|
|
105
|
+
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction],
|
|
106
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
107
|
+
},
|
|
108
|
+
[
|
|
109
|
+
resourceNames(RESOURCE_CLASSES.lambda, upperCase(ACTIONS.get) + upperCase(HANDLER.hdrInv)),
|
|
110
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(ACTIONS.update) + "_In")
|
|
80
111
|
]
|
|
81
112
|
)
|
|
82
113
|
)
|
|
@@ -89,7 +120,7 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
89
120
|
functionNameConfig: functionName + upperCase(handlerType),
|
|
90
121
|
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
91
122
|
additionalResourcePermission,
|
|
92
|
-
functionNameConfig: upperCase(
|
|
123
|
+
functionNameConfig: upperCase("ReservedLimitComp") + upperCase(shortNameHandler(handlerType)),
|
|
93
124
|
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
94
125
|
},
|
|
95
126
|
setting: {
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
+
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>"]}}} # functionName of callingFlow
|
|
11
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
9
12
|
role: <%- roleName %>Role
|
|
10
13
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
14
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -22,7 +22,7 @@ const path = require('path');
|
|
|
22
22
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
23
23
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../../MainLibs/src/Utils")
|
|
24
24
|
|
|
25
|
-
const { HANDLER, SOURCE_PATH } = require('../../../../../../../../MainLibs/src/Consts');
|
|
25
|
+
const { HANDLER, SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../../../MainLibs/src/Consts');
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* receive objectSchema
|
|
@@ -36,7 +36,7 @@ function data(_izContext, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createSourceParams(_izContext, srcPath) {
|
|
39
|
-
let functionName =
|
|
39
|
+
let functionName = upperCase(FUNCTION_NAME.createPresignUrl);
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
41
41
|
|
|
42
42
|
return {
|
|
@@ -18,16 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
20
|
// const AWS = require('aws-sdk');
|
|
21
|
-
// const sqs = new AWS.SQS(
|
|
21
|
+
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
22
|
|
|
23
23
|
const izara = require("@izara_project/izara-middleware");
|
|
24
24
|
const middleware = izara.middlewareHandler;
|
|
25
|
-
const recordHandlerSharedLib = require(
|
|
25
|
+
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
26
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
-
const
|
|
28
|
-
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
27
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
29
28
|
|
|
30
|
-
const
|
|
29
|
+
const createPresignUrl = require('./CreatePresignUrl_Main');
|
|
31
30
|
|
|
32
31
|
// validate event properties in body.Message of sqs event
|
|
33
32
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
@@ -53,6 +52,20 @@ let perRecordsValidatorSchema = {
|
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
54
|
|
|
55
|
+
// set schema for record.body.MessageAttributes
|
|
56
|
+
// const messageAttributeValidatorSchema = {
|
|
57
|
+
// type: "object",
|
|
58
|
+
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
59
|
+
// properties: {
|
|
60
|
+
// msgAtrrParam1: {
|
|
61
|
+
// type: "string"
|
|
62
|
+
// },
|
|
63
|
+
// msgAtrrParam2: {
|
|
64
|
+
// type: "object"
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
// };
|
|
68
|
+
|
|
56
69
|
perRecordsValidatorSchema = callingFlowSharedLib.addOptionalPassBackPropertiesToValidatorSchema(perRecordsValidatorSchema)
|
|
57
70
|
|
|
58
71
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
@@ -70,21 +83,23 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
70
83
|
// validate message (and MessageAttributes)
|
|
71
84
|
await recordHandlerSharedLib.validateRecord(
|
|
72
85
|
record, // one record will send to mainFunction
|
|
73
|
-
"
|
|
86
|
+
"ReservedLimitCompleteHdrSqs", // queue name that need to retry or send to dlq
|
|
74
87
|
perRecordsValidatorSchema, // schema for record.Message
|
|
75
88
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
76
89
|
);
|
|
77
90
|
|
|
78
91
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
79
|
-
passOnProperties.push(record.body.Message)
|
|
92
|
+
passOnProperties.push(record.body.Message.returnMessage)
|
|
93
|
+
passOnProperties.push(record.body.Message.errorsFound)
|
|
94
|
+
passOnProperties.push(record.body.Message.passStatus)
|
|
80
95
|
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message))
|
|
81
96
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
82
97
|
|
|
83
98
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
84
99
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
85
100
|
record, // one record will send to mainFunction
|
|
86
|
-
|
|
87
|
-
"
|
|
101
|
+
createPresignUrl.createPresignUrl, // mainFunction that need to invoke.
|
|
102
|
+
"ReservedLimitCompleteHdrSqs", // queue name that need to retry or send to dlq
|
|
88
103
|
passOnProperties, // all parameters that mainFunction needed.
|
|
89
104
|
);
|
|
90
105
|
record._izContext.logger.debug('after recordPromise in handler');
|
|
@@ -104,7 +119,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
104
119
|
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
105
120
|
|
|
106
121
|
} catch (err) {
|
|
107
|
-
Logger.error('Unhandled Error,
|
|
122
|
+
Logger.error('Unhandled Error, ReservedImageLimitCompleteHdrSqs: ', err);
|
|
108
123
|
throw (err);
|
|
109
124
|
}
|
|
110
|
-
});
|
|
125
|
+
});
|
|
@@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
|
|
22
22
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
-
|
|
24
|
-
const { SOURCE_PATH } = require('../../../../../../../../MainLibs/src/Consts');
|
|
23
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../../MainLibs/src/Utils")
|
|
24
|
+
const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../../../MainLibs/src/Consts');
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* receive objectSchema
|
|
@@ -30,15 +30,18 @@ const { SOURCE_PATH } = require('../../../../../../../../MainLibs/src/Consts');
|
|
|
30
30
|
* @return {{ templatePath, templateData, setting } }
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
function data(_izContext, srcPath) {
|
|
34
|
-
return [createSourceParams(_izContext, srcPath)]
|
|
33
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
34
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function createSourceParams(_izContext, srcPath) {
|
|
38
|
-
let functionName =
|
|
37
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
38
|
+
let functionName = upperCase(FUNCTION_NAME.createPresignUrl)
|
|
39
|
+
let bucketName = flowSchema.bucketName
|
|
39
40
|
return {
|
|
40
41
|
templatePath: templatePath,
|
|
41
|
-
templateData: {
|
|
42
|
+
templateData: {
|
|
43
|
+
bucketName
|
|
44
|
+
},
|
|
42
45
|
setting: {
|
|
43
46
|
saveFileName: `${functionName}_Main`,
|
|
44
47
|
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2021 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 asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
21
|
+
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
22
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
|
+
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
24
|
+
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
|
+
|
|
26
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request')
|
|
27
|
+
const lambda = externalRequest.lambda;
|
|
28
|
+
const sns = externalRequest.sns;
|
|
29
|
+
|
|
30
|
+
const { S3Client } = require('@aws-sdk/client-s3');
|
|
31
|
+
const client = new S3Client({ region: 'us-east-2' });
|
|
32
|
+
const { createPresignedPost } = require('@aws-sdk/s3-presigned-post');
|
|
33
|
+
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
34
|
+
|
|
35
|
+
const { postToConnection } = require("../../libs/source/ImportDataLib");
|
|
36
|
+
const hash = require('object-hash');
|
|
37
|
+
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils');
|
|
38
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
39
|
+
const { getNestObject } = require("../../libs/source/ImportDataLib");
|
|
40
|
+
const { EXTERNAL_SERVICE_NAME } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
41
|
+
/**
|
|
42
|
+
* description of function.
|
|
43
|
+
* @param {Object} _izContext
|
|
44
|
+
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
45
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
46
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
47
|
+
* @param {Object} returnMessage - limitValue or limitFound
|
|
48
|
+
* @param {Array} errorsFound - array
|
|
49
|
+
* @param {boolean} passStatus - true || false
|
|
50
|
+
* @param {Object} passBackProperties - identifier
|
|
51
|
+
*
|
|
52
|
+
* @returns {object} returnResponse
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
module.exports.createPresignUrl = async (
|
|
56
|
+
_izContext,
|
|
57
|
+
returnMessage,
|
|
58
|
+
errorsFound,
|
|
59
|
+
passStatus,
|
|
60
|
+
passBackProperties
|
|
61
|
+
) => {
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
|
|
65
|
+
_izContext.logger.debug('----- createPresignUrl event params -----', {
|
|
66
|
+
returnMessage: returnMessage,
|
|
67
|
+
errorsFound: errorsFound,
|
|
68
|
+
passStatus: passStatus,
|
|
69
|
+
passBackProperties: passBackProperties
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const servicePendingId = passBackProperties.passBackProperties.identifier.servicePendingId; // importBatchId
|
|
73
|
+
const reservedDataId = passBackProperties.passBackProperties.identifier.reservedDataId;
|
|
74
|
+
const objType = passBackProperties.passBackProperties.objType
|
|
75
|
+
|
|
76
|
+
const correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID)
|
|
77
|
+
const connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID)
|
|
78
|
+
|
|
79
|
+
// getImportBatchMain from table
|
|
80
|
+
let importBatchMain = await lambda.invokeSync(_izContext,
|
|
81
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "ImportBatchMainGetHdrInv"),
|
|
82
|
+
{
|
|
83
|
+
identifiers: {
|
|
84
|
+
importBatchId: servicePendingId
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
_izContext.logger.debug("importBatchMain", importBatchMain);
|
|
89
|
+
|
|
90
|
+
const {
|
|
91
|
+
importBatchId
|
|
92
|
+
} = importBatchMain.identifiers
|
|
93
|
+
|
|
94
|
+
const {
|
|
95
|
+
importBatchStatus,
|
|
96
|
+
importConfigId,
|
|
97
|
+
fileName,
|
|
98
|
+
fileSize,
|
|
99
|
+
importType,
|
|
100
|
+
startTime,
|
|
101
|
+
submittedByUserId,
|
|
102
|
+
userId
|
|
103
|
+
} = importBatchMain.fields
|
|
104
|
+
|
|
105
|
+
let uniqueIdentify = getNestObject(
|
|
106
|
+
_izContext,
|
|
107
|
+
returnMessage,
|
|
108
|
+
['limitFound', 'runningTotal', 'uniqueIdentify', 'usedTimestampId']
|
|
109
|
+
);
|
|
110
|
+
_izContext.logger.debug("uniqueIdentify", uniqueIdentify);
|
|
111
|
+
|
|
112
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
113
|
+
await dynamodbSharedLib.tableName(_izContext, "ReservedDataMain"),
|
|
114
|
+
{
|
|
115
|
+
servicePendingId: importBatchId, // importBatchId
|
|
116
|
+
reservedDataId: reservedDataId,
|
|
117
|
+
reservedValue: fileSize,
|
|
118
|
+
uniqueIdentify: uniqueIdentify
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (passStatus === false) { // if passStatus false post message to client
|
|
123
|
+
// use correlationId to get connectionId and use connectionId to post message to client
|
|
124
|
+
|
|
125
|
+
_izContext.logger.debug("reserved has reach limit");
|
|
126
|
+
|
|
127
|
+
errorsFound.push("reserved has reach limit")
|
|
128
|
+
// update importBatchMainTable
|
|
129
|
+
let updateImportBatchMainMsg = {
|
|
130
|
+
objInstanceFull: {
|
|
131
|
+
identifiers: {
|
|
132
|
+
importBatchId: importBatchId
|
|
133
|
+
},
|
|
134
|
+
fields: {
|
|
135
|
+
importBatchStatus: "error",
|
|
136
|
+
errorsFound: errorsFound
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let sendMessageToUpdateImportBatch = {
|
|
142
|
+
Message: JSON.stringify(updateImportBatchMainMsg),
|
|
143
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `InImportBatchMainUpdate`)
|
|
144
|
+
}
|
|
145
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
146
|
+
|
|
147
|
+
// cancel reserved
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
let cancelReservedMsg = {
|
|
151
|
+
userId: userId,
|
|
152
|
+
limitTag: returnMessage.limitTag,
|
|
153
|
+
uniqueIdentify: uniqueIdentify
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
let sendMessageToCancelReserved = {
|
|
157
|
+
Message: JSON.stringify(cancelReservedMsg),
|
|
158
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InCancelUsage', EXTERNAL_SERVICE_NAME.accountLimits)
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
_izContext.logger.debug("sendMessageToCancelReserved", sendMessageToCancelReserved);
|
|
162
|
+
await sns.publishAsync(_izContext, sendMessageToCancelReserved);
|
|
163
|
+
|
|
164
|
+
await postToConnection({ message: "reserved has reach limit" }, connectionId)
|
|
165
|
+
// after post message delete websocket task
|
|
166
|
+
await dynamodbSharedLib.deleteItem(_izContext,
|
|
167
|
+
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
168
|
+
{
|
|
169
|
+
taskKey: correlationId,
|
|
170
|
+
connectionId: connectionId
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// store reservedDataId and servicePendingId in ReservedDataMain
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
const Key = `${fileName}.${importType}`
|
|
179
|
+
|
|
180
|
+
const maximumSize = fileSize * 1048576 // convert to byte unit for restrict
|
|
181
|
+
_izContext.logger.debug("maximumSize", maximumSize);
|
|
182
|
+
|
|
183
|
+
// create PresignUrl
|
|
184
|
+
let createPresignUrlParam = {
|
|
185
|
+
Bucket: "generatecodetemplatebas-integration-test",
|
|
186
|
+
Key: Key,
|
|
187
|
+
Conditions: [
|
|
188
|
+
["content-length-range", 0, maximumSize],
|
|
189
|
+
["starts-with", "$Content-Type", "file/csv"],
|
|
190
|
+
["eq", "$x-amz-meta-importBatchId", importBatchId]
|
|
191
|
+
],
|
|
192
|
+
fields: {},
|
|
193
|
+
expires: 86400
|
|
194
|
+
};
|
|
195
|
+
_izContext.logger.debug('createPresignUrlParam', createPresignUrlParam);
|
|
196
|
+
|
|
197
|
+
const uploadUrl = await createPresignedPost(client, createPresignUrlParam);
|
|
198
|
+
|
|
199
|
+
uploadUrl.fields['x-amz-meta-importBatchId'] = importBatchId;
|
|
200
|
+
uploadUrl.fields['Content-Type'] = `file/${importType}`;
|
|
201
|
+
|
|
202
|
+
_izContext.logger.debug('uploadUrlLimitSize: ', uploadUrl) // return as object type = {url, fields}
|
|
203
|
+
|
|
204
|
+
// update to waiting to upload
|
|
205
|
+
if (importBatchStatus === "processing") {
|
|
206
|
+
|
|
207
|
+
let updateImportBatchMainMsg = {
|
|
208
|
+
objInstanceFull: {
|
|
209
|
+
identifiers: {
|
|
210
|
+
importBatchId: importBatchId
|
|
211
|
+
},
|
|
212
|
+
fields: {
|
|
213
|
+
importBatchStatus: "waitingToUpload",
|
|
214
|
+
expiryTimestamp: (startTime + (createPresignUrlParam.expires * 1000))
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
updateImportBatchMainMsg = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
220
|
+
updateImportBatchMainMsg,
|
|
221
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
222
|
+
returnMessage, // resive parent callingFlowConfig.
|
|
223
|
+
callingFlowSharedLib.createCallingFlowConfig( // callinfflow own service
|
|
224
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, `WebSocketTaskComplete`), {}
|
|
225
|
+
)
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
_izContext.logger.debug("after add callingFlow", updateImportBatchMainMsg)
|
|
230
|
+
|
|
231
|
+
let sendMessageToUpdateImportBatch = {
|
|
232
|
+
Message: JSON.stringify(updateImportBatchMainMsg),
|
|
233
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `In${objType.objectType}Update`)
|
|
234
|
+
}
|
|
235
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
236
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatch);
|
|
237
|
+
|
|
238
|
+
await dynamodbSharedLib.updateItem(_izContext,
|
|
239
|
+
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
240
|
+
{
|
|
241
|
+
taskKey: correlationId,
|
|
242
|
+
connectionId: connectionId
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
uploadUrl: uploadUrl
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
}
|
|
249
|
+
} catch (err) {
|
|
250
|
+
_izContext.logger.error('error createPresignUrl: ', err)
|
|
251
|
+
throw (err)
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -36,9 +36,8 @@ const {
|
|
|
36
36
|
awaitingMultipleStepsRole,
|
|
37
37
|
externalResourceSns,
|
|
38
38
|
externalResourceName,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
39
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
40
|
+
FUNCTION_NAME
|
|
42
41
|
} = require('../../../../../../../../MainLibs/src/Consts');
|
|
43
42
|
|
|
44
43
|
const {
|
|
@@ -57,7 +56,7 @@ function data(_izContext, srcPath) {
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
function createSourceParams(_izContext, srcPath) {
|
|
60
|
-
let functionName =
|
|
59
|
+
let functionName = upperCase(FUNCTION_NAME.reservedLimit);
|
|
61
60
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
62
61
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
63
62
|
|
|
@@ -69,43 +68,16 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
69
68
|
SQS_RESOURCE.sendMessage,
|
|
70
69
|
SQS_RESOURCE.deleteMessage,
|
|
71
70
|
SQS_RESOURCE.getQueueAttributes
|
|
71
|
+
],
|
|
72
|
+
[RESOURCE_CLASSES.sns]: [
|
|
73
|
+
SNS_RESOURCE.publish,
|
|
74
|
+
SNS_RESOURCE.subscribe
|
|
72
75
|
]
|
|
73
76
|
},
|
|
74
77
|
[
|
|
75
78
|
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
76
|
-
resourceNames(RESOURCE_CLASSES.sqs, functionName + "DLQ"),
|
|
77
|
-
|
|
78
|
-
),
|
|
79
|
-
createIamRole(
|
|
80
|
-
{
|
|
81
|
-
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
82
|
-
DYNAMO_RESOURCE.query,
|
|
83
|
-
DYNAMO_RESOURCE.deleteItem,
|
|
84
|
-
DYNAMO_RESOURCE.updateItem,
|
|
85
|
-
DYNAMO_RESOURCE.putItem
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
[
|
|
89
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "WebSocketTask"),
|
|
90
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "ReservedDataMain"),
|
|
91
|
-
]
|
|
92
|
-
),
|
|
93
|
-
createIamRole(
|
|
94
|
-
{
|
|
95
|
-
"execute-api": "ManageConnections"
|
|
96
|
-
},
|
|
97
|
-
[
|
|
98
|
-
resourceNames(RESOURCE_CLASSES.webSocket)
|
|
99
|
-
]
|
|
100
|
-
),
|
|
101
|
-
createIamRole(
|
|
102
|
-
{
|
|
103
|
-
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction],
|
|
104
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
105
|
-
},
|
|
106
|
-
[
|
|
107
|
-
resourceNames(RESOURCE_CLASSES.lambda, "ImportBatchMainGetHdrInv"),
|
|
108
|
-
resourceNames(RESOURCE_CLASSES.sns, "InImportBatchMainUpdate")
|
|
79
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + "DLQ"),
|
|
80
|
+
resourceNames(RESOURCE_CLASSES.sns, TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete)
|
|
109
81
|
]
|
|
110
82
|
)
|
|
111
83
|
)
|
|
@@ -118,7 +90,7 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
118
90
|
functionNameConfig: functionName + upperCase(handlerType),
|
|
119
91
|
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
120
92
|
additionalResourcePermission,
|
|
121
|
-
functionNameConfig: upperCase(
|
|
93
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
122
94
|
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
123
95
|
},
|
|
124
96
|
setting: {
|