@izara_project/izara-core-generate-service-code 1.0.68 → 1.0.70

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.
Files changed (129) hide show
  1. package/package.json +1 -1
  2. package/scripts/format-ejs.js +36 -32
  3. package/src/compile/compileProject.js +26 -10
  4. package/src/compile/loadSchemas.js +122 -59
  5. package/src/emit/coreFunction/emitCoreFunctionArtifacts.js +163 -0
  6. package/src/emit/coreFunction/templates/CoreFunction_Yaml.ejs +38 -0
  7. package/src/emit/coreFunction/templates/CoreResource_Yaml.ejs +235 -0
  8. package/src/emit/coreFunction/templates/GenerateSeedDataDynamo_HdrInv.ejs +16 -0
  9. package/src/emit/coreFunction/templates/GenerateSeedDataDynamo_Main.ejs +38 -0
  10. package/src/emit/coreFunction/templates/GenerateSeedDataGraphData_HdrInv.ejs +16 -0
  11. package/src/emit/coreFunction/templates/GenerateSeedDataGraphData_Main.ejs +32 -0
  12. package/src/emit/coreFunction/templates/GenerateSeedDataGraphSchema_HdrInv.ejs +16 -0
  13. package/src/emit/coreFunction/templates/GenerateSeedDataGraphSchema_Main.ejs +71 -0
  14. package/src/emit/coreFunction/templates/GeneratedGraphNodeSchemas.ejs +47 -0
  15. package/src/emit/coreFunction/templates/GeneratedGraphRelSchemas.ejs +27 -0
  16. package/src/emit/coreFunction/templates/GeneratedTableConfigs.ejs +34 -0
  17. package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +108 -0
  18. package/src/emit/coreFunction/templates/InitialSetup_HdrInv.ejs +12 -0
  19. package/src/emit/coreFunction/templates/InitialSetup_Main.ejs +51 -0
  20. package/src/emit/coreFunction/templates/RemoveSeedDataDynamo_HdrInv.ejs +16 -0
  21. package/src/emit/coreFunction/templates/RemoveSeedDataDynamo_Main.ejs +31 -0
  22. package/src/emit/coreFunction/templates/UploadSchema_HdrInv.ejs +37 -0
  23. package/src/emit/coreFunction/templates/UploadSchema_Main.ejs +52 -0
  24. package/src/emit/crud/emitCrudApplicationArtifacts.js +194 -41
  25. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +34 -17
  26. package/src/emit/crud/generateCrudApplicationArtifacts.js +14 -6
  27. package/src/emit/crud/generateDynamicCrudFlowSchemas.js +4 -1
  28. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +1 -1
  29. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +1 -1
  30. package/src/emit/crud/templates/GetEndpoint_Main.ejs +2 -2
  31. package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +1 -1
  32. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +1 -1
  33. package/src/emit/custom/customFlows.js +23 -13
  34. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +535 -114
  35. package/src/emit/custom/generateCustomFlowApplicationArtifacts.js +28 -8
  36. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +2 -2
  37. package/src/emit/custom/templates/FlowStep_Main.ejs +1 -1
  38. package/src/emit/custom/templates/s3/CreateObject_Main.ejs +1 -1
  39. package/src/emit/custom/templates/s3/FlowHandler_HdrS3.ejs +2 -2
  40. package/src/emit/custom/templates/s3/ReservedLimit_HdrSqs.ejs +1 -1
  41. package/src/emit/custom/templates/s3/ReservedLimit_Main.ejs +1 -1
  42. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +4 -4
  43. package/src/emit/function/functionYamlArtifact.js +273 -97
  44. package/src/emit/function/templates/ApiFunction_Yaml.ejs +7 -0
  45. package/src/emit/function/templates/EventBridgeFunction_Yaml.ejs +6 -0
  46. package/src/emit/function/templates/InvFunction_Yaml.ejs +5 -0
  47. package/src/emit/function/templates/S3Function_Yaml.ejs +16 -0
  48. package/src/emit/function/templates/SqsFunction_Yaml.ejs +10 -0
  49. package/src/emit/function/templates/WbsFunction_Yaml.ejs +10 -0
  50. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +28 -30
  51. package/src/emit/rbac/emitRbacApplicationArtifacts.js +6 -6
  52. package/src/emit/rbac/generateCreateTargetRoleHandler.js +6 -4
  53. package/src/emit/rbac/generateDynamicRbacFlowSchemas.js +8 -2
  54. package/src/emit/rbac/rbacFlowTag.js +3 -1
  55. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +1 -1
  56. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +26 -10
  57. package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +189 -37
  58. package/src/emit/relationship/generateDynamicRelationshipFlowSchemas.js +8 -2
  59. package/src/emit/relationship/generateRelationshipApplicationArtifacts.js +15 -6
  60. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +1 -1
  61. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +1 -1
  62. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +1 -1
  63. package/src/emit/relationship/templates/GetRelationship_Main.ejs +1 -1
  64. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +1 -1
  65. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +1 -1
  66. package/src/emit/resource/emitResourceArtifacts.js +249 -123
  67. package/src/emit/resource/generateResourceArtifacts.js +15 -6
  68. package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +18 -18
  69. package/src/emit/resource/templates/FlowOut_Yaml.ejs +5 -5
  70. package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +10 -9
  71. package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +44 -44
  72. package/src/emit/resource/templates/ResourceSqsYaml.ejs +36 -36
  73. package/src/emit/resource/templates/ResourceYaml.ejs +48 -48
  74. package/src/emit/resource/templates/S3Subscription_Yaml.ejs +7 -0
  75. package/src/emit/resource/templates/SharedResource_Yaml.ejs +11 -11
  76. package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +122 -105
  77. package/src/emit/resource/templates/WebSocketSubscription_Yaml.ejs +7 -0
  78. package/src/emit/shared/templates/FindData_HdrSqs.ejs +120 -0
  79. package/src/emit/shared/templates/FindData_Main.ejs +345 -0
  80. package/src/emit/{crud → shared}/templates/FlowHandler_HdrApi.ejs +1 -1
  81. package/src/emit/{relationship → shared}/templates/FlowHandler_HdrDsq.ejs +4 -4
  82. package/src/emit/{crud → shared}/templates/FlowHandler_HdrInv.ejs +1 -1
  83. package/src/emit/{crud → shared}/templates/FlowHandler_HdrSqs.ejs +4 -4
  84. package/src/emit/shared/templates/PaginateProcessLogical_HdrDsq.ejs +162 -0
  85. package/src/emit/shared/templates/PaginateProcessLogical_HdrSqs.ejs +140 -0
  86. package/src/emit/shared/templates/PaginateProcessLogical_Main.ejs +268 -0
  87. package/src/emit/{relationship/templates/FlowHandler_HdrSqs.ejs → shared/templates/ProcessLogical_HdrSqs.ejs} +40 -55
  88. package/src/emit/shared/templates/ProcessLogical_Main.ejs +448 -0
  89. package/src/emit/system/emitSystemFindDataArtifacts.js +266 -0
  90. package/src/emit/system/emitSystemWebSocketArtifacts.js +61 -165
  91. package/src/emit/system/templates/WebSocketComplete_HdrSqs.ejs +48 -0
  92. package/src/emit/system/templates/WebSocketComplete_Main.ejs +91 -0
  93. package/src/emit/system/templates/WebSocketComplete_Yaml.ejs +19 -0
  94. package/src/emit/system/templates/WebSocketConnect.ejs +45 -0
  95. package/src/emit/system/templates/WebSocketConnect_Yaml.ejs +11 -0
  96. package/src/generate.js +166 -36
  97. package/src/generateIntTest.js +76 -28
  98. package/src/generateResourceIntTest.js +35 -12
  99. package/src/generateResources/IntTest/generateResources/generateResources.js +5 -2
  100. package/src/generateResources/IntTest/generateResources/templateResources.ejs +18 -30
  101. package/src/generateResources/IntTest/generateTests/events/events.js +1 -1
  102. package/src/generateResources/IntTest/generateTests/events/templateEvents.ejs +13 -10
  103. package/src/generateResources/IntTest/generateTests/generateTemplate.js +2 -2
  104. package/src/generateResources/IntTest/generateTests/pathIntTest/pathIntTest.js +2 -1
  105. package/src/generateResources/IntTest/generateTests/pathIntTest/template.ejs +1 -3
  106. package/src/generateResources/IntTest/generateTests/tests/templateTests.ejs +1 -1
  107. package/src/generateResources/IntTest/generateTests/tests/tests.js +7 -3
  108. package/src/generateResources/IntTest/libs/{libs.js → IntTestGenerateLib.js} +34 -23
  109. package/src/generateResources/IntTest/upload/uploadIntTest.js +33 -19
  110. package/src/intTestGeneratorShared.js +15 -10
  111. package/src/output/commitArtifacts.js +99 -39
  112. package/src/output/mergeHooks.js +34 -21
  113. package/src/output/validateArtifacts.js +37 -27
  114. package/src/plan/buildGenerationPlan.js +24 -13
  115. package/test/core.test.js +117 -58
  116. package/test/createTargetRoleHandler.test.js +1 -1
  117. package/test/crudApplicationArtifacts.test.js +132 -31
  118. package/test/customFlowApplicationArtifacts.test.js +353 -71
  119. package/test/dynamicCrudFlowSchemas.test.js +74 -26
  120. package/test/dynamicRbacFlowSchemas.test.js +61 -14
  121. package/test/dynamicRelationshipFlowSchemas.test.js +65 -18
  122. package/test/functionYamlArtifact.test.js +67 -10
  123. package/test/intTestApi.test.js +9 -10
  124. package/test/publicApi.test.js +178 -36
  125. package/test/relationshipApplicationArtifacts.test.js +90 -19
  126. package/test/resourceArtifacts.test.js +173 -33
  127. package/src/emit/relationship/dynamicRelationshipFlowSchemaTemplate.js +0 -11
  128. package/src/emit/relationship/templates/FlowHandler_HdrApi.ejs +0 -59
  129. package/src/emit/relationship/templates/FlowHandler_HdrInv.ejs +0 -47
@@ -2,7 +2,10 @@ import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
2
2
  import { commitArtifacts } from '../../output/commitArtifacts.js';
3
3
  import { compileProject } from '../../compile/compileProject.js';
4
4
  import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
5
- import { emitResourceArtifacts, resourceArtifactPaths } from './emitResourceArtifacts.js';
5
+ import {
6
+ emitResourceArtifacts,
7
+ resourceArtifactPaths
8
+ } from './emitResourceArtifacts.js';
6
9
 
7
10
  export async function generateResourceArtifacts(rootPath, options = {}) {
8
11
  const project = compileProject({ ...options, rootPath });
@@ -11,10 +14,16 @@ export async function generateResourceArtifacts(rootPath, options = {}) {
11
14
  loadLocalSchemaDirectory(project, 'RelationshipSchemas'),
12
15
  loadLocalSchemaDirectory(project, 'FlowSchemas')
13
16
  ]);
14
- const artifacts = await emitResourceArtifacts({ objects, relationships, flows });
15
- const files = await commitArtifacts(buildGenerationPlan(project, artifacts, {
16
- managedPaths: resourceArtifactPaths,
17
- managedScope: 'shared-resources'
18
- }));
17
+ const artifacts = await emitResourceArtifacts({
18
+ objects,
19
+ relationships,
20
+ flows
21
+ });
22
+ const files = await commitArtifacts(
23
+ buildGenerationPlan(project, artifacts, {
24
+ managedPaths: resourceArtifactPaths,
25
+ managedScope: 'shared-resources'
26
+ })
27
+ );
19
28
  return { project, files };
20
29
  }
@@ -1,20 +1,20 @@
1
1
  ##===== [DynamoDB Table: <%- tableName %>]
2
- <%- tableName %>Table:
3
- Type: AWS::DynamoDB::Table
4
- Properties:
5
- TableName: ${self:custom.iz_resourcePrefix}<%- tableName %>
6
- BillingMode: PAY_PER_REQUEST
7
- AttributeDefinitions:
8
- - AttributeName: '<%- pk %>'
9
- AttributeType: 'S'
10
- <% if (sk) { %>
11
- - AttributeName: '<%- sk %>'
12
- AttributeType: 'S'
13
- <% } %>
14
- KeySchema:
15
- - AttributeName: '<%- pk %>'
16
- KeyType: 'HASH'
17
- <% if (sk) { %>
18
- - AttributeName: '<%- sk %>'
19
- KeyType: 'RANGE'
2
+ <%- tableName %>Table:
3
+ Type: AWS::DynamoDB::Table
4
+ Properties:
5
+ TableName: ${self:custom.iz_resourcePrefix}<%- tableName %>
6
+ BillingMode: PAY_PER_REQUEST
7
+ AttributeDefinitions:
8
+ - AttributeName: "<%- pk %>"
9
+ AttributeType: "S"
10
+ <% if (sk) { %>
11
+ - AttributeName: "<%- sk %>"
12
+ AttributeType: "S"
13
+ <% } %>
14
+ KeySchema:
15
+ - AttributeName: "<%- pk %>"
16
+ KeyType: "HASH"
17
+ <% if (sk) { %>
18
+ - AttributeName: "<%- sk %>"
19
+ KeyType: "RANGE"
20
20
  <% } %>
@@ -1,6 +1,6 @@
1
1
  ##===== [Topic Out]
2
- Out<%- topicName %>:
3
- Type: AWS::SNS::Topic
4
- Properties:
5
- DisplayName: 'SNS Message out'
6
- TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- topicName %>_Out
2
+ Out<%- topicName %>:
3
+ Type: AWS::SNS::Topic
4
+ Properties:
5
+ DisplayName: "SNS Message out"
6
+ TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- topicName %>_Out
@@ -25,7 +25,7 @@ const _izContext = { logger: Logger };
25
25
 
26
26
  export function generatedLambdaRole() {
27
27
  const externalLambdaRole = [
28
- <% if (crud) { -%>
28
+ <% if (crud) { -%>
29
29
  {
30
30
  roleName: 'FlowObjects',
31
31
  statement: [
@@ -34,7 +34,7 @@ export function generatedLambdaRole() {
34
34
  Effect: 'Allow',
35
35
  Action: ['lambda:InvokeFunction'],
36
36
  Resource: [
37
- `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetNodeHdrInv', 'GraphHandler')}`
37
+ `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetNodeHdrInv' ,'GraphHandler')}`
38
38
  ]
39
39
  },
40
40
 
@@ -59,7 +59,7 @@ export function generatedLambdaRole() {
59
59
  //(</createFlowObjectsRole>)
60
60
  ]
61
61
  },
62
- <% } -%>
62
+ <% } -%>
63
63
 
64
64
  {
65
65
  roleName: 'ProcFindData',
@@ -69,13 +69,13 @@ export function generatedLambdaRole() {
69
69
  Effect: 'Allow',
70
70
  Action: ['lambda:InvokeFunction'],
71
71
  Resource: [
72
- `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetNodeHdrInv', 'GraphHandler')}`
72
+ `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetNodeHdrInv' ,'GraphHandler')}`
73
73
  ]
74
74
  }
75
75
  //(<createProcFindDataRole>)
76
76
  //(</createProcFindDataRole>)
77
77
  ]
78
- } <% if (relationships) { %>,
78
+ }<% if (relationships) { %>,
79
79
 
80
80
  {
81
81
  roleName: 'FlowRelationship',
@@ -85,7 +85,7 @@ export function generatedLambdaRole() {
85
85
  Effect: 'Allow',
86
86
  Action: ['lambda:InvokeFunction'],
87
87
  Resource: [
88
- `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetRelationshipHdrInv', 'GraphHandler')}`
88
+ `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetRelationshipHdrInv' ,'GraphHandler')}`
89
89
  ]
90
90
  },
91
91
 
@@ -104,9 +104,10 @@ export function generatedLambdaRole() {
104
104
  //(<createFlowRelationshipRole>)
105
105
  //(</createFlowRelationshipRole>)
106
106
  ]
107
- } <% } -%>,
107
+ }<% } -%>
108
+ <% s3Flows.forEach(function(flow) { -%>,
108
109
 
109
- <% s3Flows.forEach(function(flow) { -%> {
110
+ {
110
111
  roleName: '<%= flow.roleName %>',
111
112
  statement: [
112
113
  {
@@ -129,7 +130,7 @@ export function generatedLambdaRole() {
129
130
  //(<create<%= flow.roleName %>Role>)
130
131
  //(</create<%= flow.roleName %>Role>)
131
132
  ]
132
- } <% }); %>
133
+ }<% }); %>
133
134
  //(<additionalRole>)
134
135
  //(</additionalRole>)
135
136
  ];
@@ -1,47 +1,47 @@
1
- <%_ flowTags.forEach(flowTag => { _%>
2
- SubscriptionOut<%- flowTag.charAt(0).toUpperCase() + flowTag.slice(1) %>To<%- queueName %>:
3
- Type: AWS::SNS::Subscription
4
- Properties:
5
- TopicArn: !Ref Out<%- flowTag.charAt(0).toUpperCase() + flowTag.slice(1) %>
6
- Endpoint: 'arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs'
7
- Protocol: 'sqs'
8
- <%_ }) _%>
9
- ##===== [Queue]
10
- <%- queueName %>HdrSqs:
11
- Type: 'AWS::SQS::Queue'
12
- Properties:
13
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
14
- RedrivePolicy:
15
- deadLetterTargetArn:
16
- Fn::GetAtt:
17
- - <%- queueName %>HdrSqsDLQ
18
- - Arn
19
- maxReceiveCount: 3
20
- VisibilityTimeout: 120
1
+ <%_ flowTags.forEach(flowTag => { _%>
2
+ SubscriptionOut<%- flowTag.charAt(0).toUpperCase() + flowTag.slice(1) %>To<%- queueName %>:
3
+ Type: AWS::SNS::Subscription
4
+ Properties:
5
+ TopicArn: !Ref Out<%- flowTag.charAt(0).toUpperCase() + flowTag.slice(1) %>
6
+ Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs"
7
+ Protocol: "sqs"
8
+ <%_ }) _%>
9
+ ##===== [Queue]
10
+ <%- queueName %>HdrSqs:
11
+ Type: "AWS::SQS::Queue"
12
+ Properties:
13
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
14
+ RedrivePolicy:
15
+ deadLetterTargetArn:
16
+ Fn::GetAtt:
17
+ - <%- queueName %>HdrSqsDLQ
18
+ - Arn
19
+ maxReceiveCount: 3
20
+ VisibilityTimeout: 120
21
21
 
22
- ##===== [Queue DLQ]
23
- <%- queueName %>HdrSqsDLQ:
24
- Type: AWS::SQS::Queue
25
- Properties:
26
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
22
+ ##===== [Queue DLQ]
23
+ <%- queueName %>HdrSqsDLQ:
24
+ Type: AWS::SQS::Queue
25
+ Properties:
26
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
27
27
 
28
- ##===== [Queue Policy]
29
- <%- queueName %>HdrSqsPolicy:
30
- Type: AWS::SQS::QueuePolicy
31
- Properties:
32
- PolicyDocument:
33
- Version: '2012-10-17'
34
- Statement:
35
- - Sid: 'allow-sns-messages'
36
- Effect: Allow
37
- Principal: '*'
38
- Resource:
39
- Fn::GetAtt:
40
- - <%- queueName %>HdrSqs
41
- - Arn
42
- Action: 'SQS:SendMessage'
43
- Queues:
44
- - Ref: <%- queueName %>HdrSqs
28
+ ##===== [Queue Policy]
29
+ <%- queueName %>HdrSqsPolicy:
30
+ Type: AWS::SQS::QueuePolicy
31
+ Properties:
32
+ PolicyDocument:
33
+ Version: "2012-10-17"
34
+ Statement:
35
+ - Sid: "allow-sns-messages"
36
+ Effect: Allow
37
+ Principal: "*"
38
+ Resource:
39
+ Fn::GetAtt:
40
+ - <%- queueName %>HdrSqs
41
+ - Arn
42
+ Action: "SQS:SendMessage"
43
+ Queues:
44
+ - Ref: <%- queueName %>HdrSqs
45
45
 
46
- #<#<%- queueName %>QueueSetting#>
47
- #<#/<%- queueName %>QueueSetting#>
46
+ #<#<%- queueName %>QueueSetting#>
47
+ #<#/<%- queueName %>QueueSetting#>
@@ -1,39 +1,39 @@
1
- ##===== [Queue]
2
- <%- resourceQueueName || queueName %>:
3
- Type: 'AWS::SQS::Queue'
4
- Properties:
5
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
6
- RedrivePolicy:
7
- deadLetterTargetArn:
8
- Fn::GetAtt:
9
- - <%- resourceQueueName || queueName %>DLQ
10
- - Arn
11
- maxReceiveCount: 3
12
- VisibilityTimeout: 120
1
+ ##===== [Queue]
2
+ <%- resourceQueueName || queueName %>:
3
+ Type: "AWS::SQS::Queue"
4
+ Properties:
5
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
6
+ RedrivePolicy:
7
+ deadLetterTargetArn:
8
+ Fn::GetAtt:
9
+ - <%- resourceQueueName || queueName %>DLQ
10
+ - Arn
11
+ maxReceiveCount: 3
12
+ VisibilityTimeout: 120
13
13
 
14
- ##===== [Queue DLQ]
15
- <%- resourceQueueName || queueName %>DLQ:
16
- Type: AWS::SQS::Queue
17
- Properties:
18
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
14
+ ##===== [Queue DLQ]
15
+ <%- resourceQueueName || queueName %>DLQ:
16
+ Type: AWS::SQS::Queue
17
+ Properties:
18
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
19
19
 
20
- ##===== [Queue Policy]
21
- <%- resourceQueueName || queueName %>Policy:
22
- Type: AWS::SQS::QueuePolicy
23
- Properties:
24
- PolicyDocument:
25
- Version: '2012-10-17'
26
- Statement:
27
- - Sid: 'allow-sns-messages'
28
- Effect: Allow
29
- Principal: '*'
30
- Resource:
31
- Fn::GetAtt:
32
- - <%- resourceQueueName || queueName %>
33
- - Arn
34
- Action: 'SQS:SendMessage'
35
- Queues:
36
- - Ref: <%- resourceQueueName || queueName %>
20
+ ##===== [Queue Policy]
21
+ <%- resourceQueueName || queueName %>Policy:
22
+ Type: AWS::SQS::QueuePolicy
23
+ Properties:
24
+ PolicyDocument:
25
+ Version: "2012-10-17"
26
+ Statement:
27
+ - Sid: "allow-sns-messages"
28
+ Effect: Allow
29
+ Principal: "*"
30
+ Resource:
31
+ Fn::GetAtt:
32
+ - <%- resourceQueueName || queueName %>
33
+ - Arn
34
+ Action: "SQS:SendMessage"
35
+ Queues:
36
+ - Ref: <%- resourceQueueName || queueName %>
37
37
 
38
- #<#<%- queueName %>QueueSetting#>
39
- #<#/<%- queueName %>QueueSetting#>
38
+ #<#<%- queueName %>QueueSetting#>
39
+ #<#/<%- queueName %>QueueSetting#>
@@ -1,54 +1,54 @@
1
1
  ##===== [Create topic in]
2
- In<%- queueName %>:
3
- Type: AWS::SNS::Topic
4
- Properties:
5
- DisplayName: 'SNS Message in'
6
- TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- queueName %>_In
2
+ In<%- queueName %>:
3
+ Type: AWS::SNS::Topic
4
+ Properties:
5
+ DisplayName: "SNS Message in"
6
+ TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- queueName %>_In
7
7
 
8
- ##===== [SNS Subscription - Topic In]
9
- SubscriptionIn<%- queueName %>:
10
- Type: AWS::SNS::Subscription
11
- Properties:
12
- TopicArn: !Ref In<%- queueName %>
13
- Endpoint: 'arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs'
14
- Protocol: 'sqs'
8
+ ##===== [SNS Subscription - Topic In]
9
+ SubscriptionIn<%- queueName %>:
10
+ Type: AWS::SNS::Subscription
11
+ Properties:
12
+ TopicArn: !Ref In<%- queueName %>
13
+ Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs"
14
+ Protocol: "sqs"
15
15
 
16
- ##===== [Queue]
17
- <%- queueName %>HdrSqs:
18
- Type: 'AWS::SQS::Queue'
19
- Properties:
20
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
21
- RedrivePolicy:
22
- deadLetterTargetArn:
23
- Fn::GetAtt:
24
- - <%- queueName %>HdrSqsDLQ
25
- - Arn
26
- maxReceiveCount: 3
27
- VisibilityTimeout: 120
16
+ ##===== [Queue]
17
+ <%- queueName %>HdrSqs:
18
+ Type: "AWS::SQS::Queue"
19
+ Properties:
20
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
21
+ RedrivePolicy:
22
+ deadLetterTargetArn:
23
+ Fn::GetAtt:
24
+ - <%- queueName %>HdrSqsDLQ
25
+ - Arn
26
+ maxReceiveCount: 3
27
+ VisibilityTimeout: 120
28
28
 
29
- ##===== [Queue DLQ]
30
- <%- queueName %>HdrSqsDLQ:
31
- Type: AWS::SQS::Queue
32
- Properties:
33
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
29
+ ##===== [Queue DLQ]
30
+ <%- queueName %>HdrSqsDLQ:
31
+ Type: AWS::SQS::Queue
32
+ Properties:
33
+ QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
34
34
 
35
- ##===== [Queue Policy]
36
- <%- queueName %>HdrSqsPolicy:
37
- Type: AWS::SQS::QueuePolicy
38
- Properties:
39
- PolicyDocument:
40
- Version: '2012-10-17'
41
- Statement:
42
- - Sid: 'allow-sns-messages'
43
- Effect: Allow
44
- Principal: '*'
45
- Resource:
46
- Fn::GetAtt:
47
- - <%- queueName %>HdrSqs
48
- - Arn
49
- Action: 'SQS:SendMessage'
50
- Queues:
51
- - Ref: <%- queueName %>HdrSqs
35
+ ##===== [Queue Policy]
36
+ <%- queueName %>HdrSqsPolicy:
37
+ Type: AWS::SQS::QueuePolicy
38
+ Properties:
39
+ PolicyDocument:
40
+ Version: "2012-10-17"
41
+ Statement:
42
+ - Sid: "allow-sns-messages"
43
+ Effect: Allow
44
+ Principal: "*"
45
+ Resource:
46
+ Fn::GetAtt:
47
+ - <%- queueName %>HdrSqs
48
+ - Arn
49
+ Action: "SQS:SendMessage"
50
+ Queues:
51
+ - Ref: <%- queueName %>HdrSqs
52
52
 
53
- #<#<%- queueName %>QueueSetting#>
54
- #<#/<%- queueName %>QueueSetting#>
53
+ #<#<%- queueName %>QueueSetting#>
54
+ #<#/<%- queueName %>QueueSetting#>
@@ -0,0 +1,7 @@
1
+ ##===== SNS Subscription
2
+ <%- subscriptionName %>:
3
+ Type: AWS::SNS::Subscription
4
+ Properties:
5
+ TopicArn: !Ref <%- topicName %>
6
+ Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>"
7
+ Protocol: "sqs"
@@ -1,15 +1,15 @@
1
1
  Resources:
2
- <% roles.forEach(({ roleName, statements }) => { -%>
2
+ <% roles.forEach(({ roleName, statements }) => { -%>
3
3
  <%- roleName %>:
4
4
  Type: AWS::IAM::Role
5
5
  Properties:
6
6
  RoleName: ${self:custom.iz_resourcePrefix}<%- roleName %>
7
7
  AssumeRolePolicyDocument:
8
- Version: '2012-10-17'
8
+ Version: "2012-10-17"
9
9
  Statement:
10
10
  - Effect: Allow
11
11
  Principal:
12
- Service: 'lambda.amazonaws.com'
12
+ Service: "lambda.amazonaws.com"
13
13
  Action: sts:AssumeRole
14
14
  #<#<%- roleName %>AssumeRoleStatementHookCode#>
15
15
  #<#/<%- roleName %>AssumeRoleStatementHookCode#>
@@ -20,20 +20,20 @@ Resources:
20
20
  Policies:
21
21
  - PolicyName: ${self:custom.iz_resourcePrefix}<%- roleName.replace(/role$/i, '') %>Policy
22
22
  PolicyDocument:
23
- Version: '2012-10-17'
23
+ Version: "2012-10-17"
24
24
  Statement:
25
- <% statements.forEach((stmt) => { -%>
25
+ <% statements.forEach((stmt) => { -%>
26
26
  - Effect: Allow
27
27
  Action:
28
- <% stmt.action.forEach((a) => { -%>
28
+ <% stmt.action.forEach((a) => { -%>
29
29
  - <%- a %>
30
- <% }) -%>
30
+ <% }) -%>
31
31
  Resource:
32
- <% stmt.resource.forEach((r) => { -%>
33
- - '<%- r %>'
32
+ <% stmt.resource.forEach((r) => { -%>
33
+ - "<%- r %>"
34
34
  <% }) -%>
35
35
  <% }) -%>
36
- #<#<%- roleName %>StatementHookCode#>
37
- #<#/<%- roleName %>StatementHookCode#>
36
+ #<#<%- roleName %>StatementHookCode#>
37
+ #<#/<%- roleName %>StatementHookCode#>
38
38
 
39
39
  <% }) -%>