@izara_project/izara-market-library-service-schemas 1.0.3 → 1.0.5
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 +5 -5
- package/src/GenerateCodeLibs/src/Consts.js +46 -0
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +69 -8
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +111 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +132 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +110 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +132 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/data.js +59 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/template.ejs +338 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/data.js +58 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +120 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +60 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +167 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/data.js +60 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/template.ejs +107 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +60 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +146 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/request.json +30 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/sns-in-sqs/data.js +80 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/data.js +133 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +62 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/template.ejs +125 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/data.js +56 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/template.ejs +137 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/data.js +72 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/template.ejs +47 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/data.js +72 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/request.json +0 -0
- package/src/TemplateManager/src/GenerateCode.js +176 -43
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/data.js +7 -23
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/data.js +10 -24
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/data.js +6 -23
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/data.js +14 -33
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +2 -16
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +3 -17
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +3 -16
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +4 -17
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +0 -15
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +28 -30
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/testParam.json +5 -0
- package/src/TemplateManager/src/ResourceYaml/dynamodb/awaitingMultipleStepData.js +95 -0
- package/src/TemplateManager/src/ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +7 -29
- package/src/TemplateManager/src/ResourceYaml/dynamodb/processLogicalAndFindData.js +5 -8
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +3 -6
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/snsAndSqsPerActiondata.js +6 -6
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/sqsTemplate.ejs +1 -0
- package/src/TemplateManager/src/ResourceYaml/sns-out/data.js +89 -0
- package/src/TemplateManager/src/ResourceYaml/sns-out/request.json +3 -0
- package/src/TemplateManager/src/ResourceYaml/sns-out/template.ejs +10 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +135 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/data.js +62 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/request.json +0 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/template.ejs +127 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/data.js +56 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/request.json +1 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/template.ejs +140 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/data.js +72 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/template.ejs +46 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js +71 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +112 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/request.json +0 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +33 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +128 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/request.json +0 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +110 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/request.json +0 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +131 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/request.json +0 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/data.js +65 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/request.json +1 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +331 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/data.js +59 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/request.json +7 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/template.ejs +120 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/data.js +59 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/request.json +7 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +167 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +62 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/request.json +5 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/template.ejs +126 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +59 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/request.json +7 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +146 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/request.json +30 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/data.js +90 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-out/data.js +70 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-out/request.json +3 -0
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +72 -25
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +8 -3
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +51 -3
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/request.json +12 -0
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +10 -14
- package/src/TemplateManager/src/libs/Consts.js +52 -23
- package/src/TemplateManager/src/MainResourcesYaml/CreateSourceData.js +0 -76
- package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Data/MainDynamoDbYamlData.js +0 -155
- package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.ejs +0 -31
- package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.exampleData.js +0 -12
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/request.json +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/template.ejs +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/request.json +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/template.ejs +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/example req.js +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/request.json +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/template.ejs +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/request.json +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
|
|
23
|
+
// const {
|
|
24
|
+
// HANDLER,
|
|
25
|
+
// STORAGE_TYPES
|
|
26
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const STORAGE_TYPES = {
|
|
30
|
+
dynamoDB: "dynamoDB",
|
|
31
|
+
graph: "graph"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const templatePath = path.join(__dirname, './template.ejs');
|
|
35
|
+
const { SOURCE_PATH, FUNCTION_NAME, SAVE_FILE_NAME } = require('../../../libs/Consts')
|
|
36
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
41
|
+
* return array of dynamoDb data
|
|
42
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} _izContext
|
|
45
|
+
* @param {String} saveFilePath
|
|
46
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
function createDataForDefaultSnsInSqs(_izContext, srcPath) {
|
|
50
|
+
let createUpdateRelationshipQueue = [];
|
|
51
|
+
let updateRelationshipCompleteQueues = [
|
|
52
|
+
{
|
|
53
|
+
queueName: upperCase(FUNCTION_NAME.updateRelComplete)
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
for (let updateRelationshipCompleteQueue of updateRelationshipCompleteQueues) {
|
|
57
|
+
createUpdateRelationshipQueue.push({
|
|
58
|
+
templatePath,
|
|
59
|
+
templateData: updateRelationshipCompleteQueue,
|
|
60
|
+
setting: {
|
|
61
|
+
initialData: "Resources:\n",
|
|
62
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
63
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
64
|
+
fileExtension: ".yml",
|
|
65
|
+
isAppend: true
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
return createUpdateRelationshipQueue
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
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/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/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
|
+
|
|
23
|
+
// const {
|
|
24
|
+
// HANDLER,
|
|
25
|
+
// STORAGE_TYPES
|
|
26
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const STORAGE_TYPES = {
|
|
30
|
+
dynamoDB: "dynamoDB",
|
|
31
|
+
graph: "graph"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils")
|
|
35
|
+
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../libs/Consts");
|
|
36
|
+
const templatePath = path.join(__dirname, '../../../ResourceYaml/sns-out/template.ejs')
|
|
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 createDefaultSnsOut(_izContext, srcPath) {
|
|
49
|
+
const createSourceParams = createParamsForCreateSource(_izContext, srcPath)
|
|
50
|
+
console.log("createSourceParamUpdateRelationshipComplete", createSourceParams)
|
|
51
|
+
return [createSourceParams]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function createParamsForCreateSource(_izContext, srcPath) {
|
|
55
|
+
let queueName = FUNCTION_NAME.updateRelComplete;
|
|
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,112 @@
|
|
|
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
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
26
|
+
|
|
27
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
|
+
|
|
29
|
+
function defaultIamRolePerAction() {
|
|
30
|
+
|
|
31
|
+
let defaultIamRole = [];
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
defaultIamRole.push(
|
|
35
|
+
createIamRole(
|
|
36
|
+
{
|
|
37
|
+
[RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
|
|
38
|
+
},
|
|
39
|
+
[
|
|
40
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
|
|
41
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
|
|
42
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
defaultIamRole.push(
|
|
48
|
+
createIamRole(
|
|
49
|
+
{ [RESOURCE_CLASSES.s3]: ["ListBucket"] },
|
|
50
|
+
[
|
|
51
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return defaultIamRole
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* receive objectSchema
|
|
61
|
+
* create data for updateRelationshipSchema
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} objectSchema
|
|
64
|
+
* @return {{ templatePath, templateData, setting } }
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
function data(_izContext, srcPath) {
|
|
68
|
+
let createSourceArray = [];
|
|
69
|
+
|
|
70
|
+
const createSourceParam = createParamForCreateSource(srcPath);
|
|
71
|
+
createSourceArray.push(createSourceParam);
|
|
72
|
+
return createSourceArray
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function createParamForCreateSource(srcPath) {
|
|
77
|
+
|
|
78
|
+
let handlerType = HANDLER.hdrApi
|
|
79
|
+
let functionName = FUNCTION_NAME.updateRel
|
|
80
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
81
|
+
|
|
82
|
+
additionalResourcePermission.push(
|
|
83
|
+
createIamRole(
|
|
84
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: ["PutItem"] },
|
|
85
|
+
[
|
|
86
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
87
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
88
|
+
]
|
|
89
|
+
))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
templatePath: templatePath,
|
|
94
|
+
templateData: {
|
|
95
|
+
functionName,
|
|
96
|
+
handlerType,
|
|
97
|
+
additionalResourcePermission,
|
|
98
|
+
resourceLocation: SOURCE_PATH.resourceLocationUpdateRelationshipSchema
|
|
99
|
+
},
|
|
100
|
+
setting: {
|
|
101
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
102
|
+
saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
|
|
103
|
+
fileExtension: '.yml',
|
|
104
|
+
isAppend: true
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
module.exports = data;
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>:
|
|
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: <%- objectType %>/<%- firstLetterUpperCase(action) %>
|
|
8
|
+
method: <%- event %>
|
|
9
|
+
cors: true
|
|
10
|
+
#<#Authorizer#>
|
|
11
|
+
#<#/Authorizer#>
|
|
12
|
+
iamRoleStatements:
|
|
13
|
+
<%_ additionalResourcePermission.forEach(resourcePermission => { _%>
|
|
14
|
+
- Effect: <%- resourcePermission.effect %>
|
|
15
|
+
Action:
|
|
16
|
+
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
17
|
+
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
18
|
+
- <%- resourcePerAction %>:<%- permission %>
|
|
19
|
+
<%_}) _%>
|
|
20
|
+
<%_ }) _%>
|
|
21
|
+
Resource:
|
|
22
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
23
|
+
- <%- resource %>
|
|
24
|
+
<%_ }) _%>
|
|
25
|
+
<%_}) _%>
|
|
26
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
27
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
28
|
+
<%_ function firstLetterUpperCase(text){
|
|
29
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
30
|
+
} _%>
|
|
31
|
+
<%_ function firstLetterLowerCase(str) {
|
|
32
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
33
|
+
} _%>
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
26
|
+
|
|
27
|
+
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs')
|
|
28
|
+
|
|
29
|
+
function defaultIamRolePerAction() {
|
|
30
|
+
|
|
31
|
+
let defaultIamRole = [];
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
defaultIamRole.push(
|
|
35
|
+
createIamRole(
|
|
36
|
+
{
|
|
37
|
+
[RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
|
|
38
|
+
},
|
|
39
|
+
[
|
|
40
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
|
|
41
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
|
|
42
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
defaultIamRole.push(
|
|
48
|
+
createIamRole(
|
|
49
|
+
{ [RESOURCE_CLASSES.s3]: ["ListBucket"] },
|
|
50
|
+
[
|
|
51
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return defaultIamRole
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* receive objectSchema
|
|
61
|
+
* create data for updateRelationshipSchema
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} objectSchema
|
|
64
|
+
* @return {{ templatePath, templateData, setting } }
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
function data(_izContext, srcPath) {
|
|
68
|
+
let createSourceArray = [];
|
|
69
|
+
|
|
70
|
+
const createSourceParam = createParamForCreateSource(srcPath);
|
|
71
|
+
createSourceArray.push(createSourceParam);
|
|
72
|
+
return createSourceArray
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function createParamForCreateSource(srcPath) {
|
|
77
|
+
|
|
78
|
+
let handlerType = HANDLER.hdrDsq
|
|
79
|
+
let functionName = FUNCTION_NAME.updateRel
|
|
80
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
81
|
+
|
|
82
|
+
additionalResourcePermission.push(
|
|
83
|
+
createIamRole(
|
|
84
|
+
{
|
|
85
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
86
|
+
SQS_RESOURCE.deleteMessage,
|
|
87
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
88
|
+
SQS_RESOURCE.receiveMessage,
|
|
89
|
+
SQS_RESOURCE.sendMessage,
|
|
90
|
+
SQS_RESOURCE.deleteMessageBatch,
|
|
91
|
+
SQS_RESOURCE.getQueueUrl
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
[
|
|
95
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
|
|
96
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ")
|
|
97
|
+
]
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
additionalResourcePermission.push(
|
|
102
|
+
createIamRole(
|
|
103
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: ["PutItem"] },
|
|
104
|
+
[
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
107
|
+
]
|
|
108
|
+
))
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
templatePath: templatePath,
|
|
112
|
+
templateData: {
|
|
113
|
+
functionName,
|
|
114
|
+
handlerType,
|
|
115
|
+
additionalResourcePermission,
|
|
116
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction
|
|
117
|
+
},
|
|
118
|
+
setting: {
|
|
119
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
120
|
+
saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
|
|
121
|
+
fileExtension: '.yml',
|
|
122
|
+
isAppend: true
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
module.exports = data;
|
|
File without changes
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
26
|
+
|
|
27
|
+
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrInv/template.ejs')
|
|
28
|
+
|
|
29
|
+
function defaultIamRolePerAction() {
|
|
30
|
+
|
|
31
|
+
let defaultIamRole = [];
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
defaultIamRole.push(
|
|
35
|
+
createIamRole(
|
|
36
|
+
{
|
|
37
|
+
[RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
|
|
38
|
+
},
|
|
39
|
+
[
|
|
40
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
|
|
41
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
|
|
42
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
defaultIamRole.push(
|
|
48
|
+
createIamRole(
|
|
49
|
+
{ [RESOURCE_CLASSES.s3]: ["ListBucket"] },
|
|
50
|
+
[
|
|
51
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return defaultIamRole
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* receive objectSchema
|
|
61
|
+
* create data for updateRelationshipSchema
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} objectSchema
|
|
64
|
+
* @return {{ templatePath, templateData, setting } }
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
function data(_izContext, srcPath) {
|
|
68
|
+
let createSourceArray = [];
|
|
69
|
+
|
|
70
|
+
const createSourceParam = createParamForCreateSource(srcPath);
|
|
71
|
+
createSourceArray.push(createSourceParam);
|
|
72
|
+
return createSourceArray
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function createParamForCreateSource(srcPath) {
|
|
77
|
+
|
|
78
|
+
let handlerType = HANDLER.hdrInv
|
|
79
|
+
let functionName = FUNCTION_NAME.updateRel
|
|
80
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
81
|
+
|
|
82
|
+
additionalResourcePermission.push(
|
|
83
|
+
createIamRole(
|
|
84
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: ["PutItem"] },
|
|
85
|
+
[
|
|
86
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
87
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
88
|
+
]
|
|
89
|
+
))
|
|
90
|
+
return {
|
|
91
|
+
templatePath: templatePath,
|
|
92
|
+
templateData: {
|
|
93
|
+
functionName,
|
|
94
|
+
handlerType,
|
|
95
|
+
additionalResourcePermission,
|
|
96
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction
|
|
97
|
+
},
|
|
98
|
+
setting: {
|
|
99
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
100
|
+
saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
|
|
101
|
+
fileExtension: '.yml',
|
|
102
|
+
isAppend: true
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
module.exports = data;
|
|
File without changes
|