@meyicloud/meyi-insight-server 1.0.0

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 (389) hide show
  1. package/dist/constants/incidentCategories.d.ts +18 -0
  2. package/dist/constants/incidentCategories.d.ts.map +1 -0
  3. package/dist/constants/incidentCategories.js +36 -0
  4. package/dist/constants/incidentCategories.js.map +1 -0
  5. package/dist/controllers/alert.controller.d.ts +12 -0
  6. package/dist/controllers/alert.controller.d.ts.map +1 -0
  7. package/dist/controllers/alert.controller.js +89 -0
  8. package/dist/controllers/alert.controller.js.map +1 -0
  9. package/dist/controllers/incident.controller.d.ts +16 -0
  10. package/dist/controllers/incident.controller.d.ts.map +1 -0
  11. package/dist/controllers/incident.controller.js +215 -0
  12. package/dist/controllers/incident.controller.js.map +1 -0
  13. package/dist/controllers/notification-provider.controller.d.ts +10 -0
  14. package/dist/controllers/notification-provider.controller.d.ts.map +1 -0
  15. package/dist/controllers/notification-provider.controller.js +59 -0
  16. package/dist/controllers/notification-provider.controller.js.map +1 -0
  17. package/dist/controllers/settings.controller.d.ts +7 -0
  18. package/dist/controllers/settings.controller.d.ts.map +1 -0
  19. package/dist/controllers/settings.controller.js +27 -0
  20. package/dist/controllers/settings.controller.js.map +1 -0
  21. package/dist/controllers/sop.controller.d.ts +11 -0
  22. package/dist/controllers/sop.controller.d.ts.map +1 -0
  23. package/dist/controllers/sop.controller.js +89 -0
  24. package/dist/controllers/sop.controller.js.map +1 -0
  25. package/dist/controllers/source.controller.d.ts +26 -0
  26. package/dist/controllers/source.controller.d.ts.map +1 -0
  27. package/dist/controllers/source.controller.js +333 -0
  28. package/dist/controllers/source.controller.js.map +1 -0
  29. package/dist/controllers/sourceDatadog.controller.d.ts +17 -0
  30. package/dist/controllers/sourceDatadog.controller.d.ts.map +1 -0
  31. package/dist/controllers/sourceDatadog.controller.js +169 -0
  32. package/dist/controllers/sourceDatadog.controller.js.map +1 -0
  33. package/dist/controllers/tenant.controller.d.ts +7 -0
  34. package/dist/controllers/tenant.controller.d.ts.map +1 -0
  35. package/dist/controllers/tenant.controller.js +33 -0
  36. package/dist/controllers/tenant.controller.js.map +1 -0
  37. package/dist/controllers/webhook.controller.d.ts +6 -0
  38. package/dist/controllers/webhook.controller.d.ts.map +1 -0
  39. package/dist/controllers/webhook.controller.js +83 -0
  40. package/dist/controllers/webhook.controller.js.map +1 -0
  41. package/dist/controllers/workflow.controller.d.ts +18 -0
  42. package/dist/controllers/workflow.controller.d.ts.map +1 -0
  43. package/dist/controllers/workflow.controller.js +118 -0
  44. package/dist/controllers/workflow.controller.js.map +1 -0
  45. package/dist/database/index.d.ts +7 -0
  46. package/dist/database/index.d.ts.map +1 -0
  47. package/dist/database/index.js +12 -0
  48. package/dist/database/index.js.map +1 -0
  49. package/dist/database/schema.d.ts +5358 -0
  50. package/dist/database/schema.d.ts.map +1 -0
  51. package/dist/database/schema.js +516 -0
  52. package/dist/database/schema.js.map +1 -0
  53. package/dist/features/sources/cloudtrail/controller.d.ts +38 -0
  54. package/dist/features/sources/cloudtrail/controller.d.ts.map +1 -0
  55. package/dist/features/sources/cloudtrail/controller.js +421 -0
  56. package/dist/features/sources/cloudtrail/controller.js.map +1 -0
  57. package/dist/features/sources/cloudtrail/routes.d.ts +6 -0
  58. package/dist/features/sources/cloudtrail/routes.d.ts.map +1 -0
  59. package/dist/features/sources/cloudtrail/routes.js +8 -0
  60. package/dist/features/sources/cloudtrail/routes.js.map +1 -0
  61. package/dist/features/sources/cloudtrail/schema.d.ts +2 -0
  62. package/dist/features/sources/cloudtrail/schema.d.ts.map +1 -0
  63. package/dist/features/sources/cloudtrail/schema.js +26 -0
  64. package/dist/features/sources/cloudtrail/schema.js.map +1 -0
  65. package/dist/features/sources/cloudtrail/stackTemplates.d.ts +3 -0
  66. package/dist/features/sources/cloudtrail/stackTemplates.d.ts.map +1 -0
  67. package/dist/features/sources/cloudtrail/stackTemplates.js +548 -0
  68. package/dist/features/sources/cloudtrail/stackTemplates.js.map +1 -0
  69. package/dist/features/sources/cloudtrail/template.d.ts +21 -0
  70. package/dist/features/sources/cloudtrail/template.d.ts.map +1 -0
  71. package/dist/features/sources/cloudtrail/template.js +1230 -0
  72. package/dist/features/sources/cloudtrail/template.js.map +1 -0
  73. package/dist/features/sources/cloudwatch/controller.d.ts +13 -0
  74. package/dist/features/sources/cloudwatch/controller.d.ts.map +1 -0
  75. package/dist/features/sources/cloudwatch/controller.js +514 -0
  76. package/dist/features/sources/cloudwatch/controller.js.map +1 -0
  77. package/dist/features/sources/cloudwatch/eventbridgeTemplate.d.ts +7 -0
  78. package/dist/features/sources/cloudwatch/eventbridgeTemplate.d.ts.map +1 -0
  79. package/dist/features/sources/cloudwatch/eventbridgeTemplate.js +230 -0
  80. package/dist/features/sources/cloudwatch/eventbridgeTemplate.js.map +1 -0
  81. package/dist/features/sources/cloudwatch/service.d.ts +50 -0
  82. package/dist/features/sources/cloudwatch/service.d.ts.map +1 -0
  83. package/dist/features/sources/cloudwatch/service.js +269 -0
  84. package/dist/features/sources/cloudwatch/service.js.map +1 -0
  85. package/dist/features/sources/cloudwatch/template.d.ts +26 -0
  86. package/dist/features/sources/cloudwatch/template.d.ts.map +1 -0
  87. package/dist/features/sources/cloudwatch/template.js +335 -0
  88. package/dist/features/sources/cloudwatch/template.js.map +1 -0
  89. package/dist/features/sources/cloudwatch/types.d.ts +26 -0
  90. package/dist/features/sources/cloudwatch/types.d.ts.map +1 -0
  91. package/dist/features/sources/cloudwatch/types.js +2 -0
  92. package/dist/features/sources/cloudwatch/types.js.map +1 -0
  93. package/dist/features/sources/grafana/controller.d.ts +18 -0
  94. package/dist/features/sources/grafana/controller.d.ts.map +1 -0
  95. package/dist/features/sources/grafana/controller.js +183 -0
  96. package/dist/features/sources/grafana/controller.js.map +1 -0
  97. package/dist/features/sources/grafana/routes.d.ts +6 -0
  98. package/dist/features/sources/grafana/routes.d.ts.map +1 -0
  99. package/dist/features/sources/grafana/routes.js +6 -0
  100. package/dist/features/sources/grafana/routes.js.map +1 -0
  101. package/dist/features/sources/grafana/schema.d.ts +2 -0
  102. package/dist/features/sources/grafana/schema.d.ts.map +1 -0
  103. package/dist/features/sources/grafana/schema.js +24 -0
  104. package/dist/features/sources/grafana/schema.js.map +1 -0
  105. package/dist/features/sources/grafana/service.d.ts +33 -0
  106. package/dist/features/sources/grafana/service.d.ts.map +1 -0
  107. package/dist/features/sources/grafana/service.js +215 -0
  108. package/dist/features/sources/grafana/service.js.map +1 -0
  109. package/dist/features/sources/index.d.ts +29 -0
  110. package/dist/features/sources/index.d.ts.map +1 -0
  111. package/dist/features/sources/index.js +47 -0
  112. package/dist/features/sources/index.js.map +1 -0
  113. package/dist/features/sources/observability/controller.d.ts +6 -0
  114. package/dist/features/sources/observability/controller.d.ts.map +1 -0
  115. package/dist/features/sources/observability/controller.js +16 -0
  116. package/dist/features/sources/observability/controller.js.map +1 -0
  117. package/dist/features/sources/observability/routes.d.ts +4 -0
  118. package/dist/features/sources/observability/routes.d.ts.map +1 -0
  119. package/dist/features/sources/observability/routes.js +8 -0
  120. package/dist/features/sources/observability/routes.js.map +1 -0
  121. package/dist/features/sources/observability/schema.d.ts +3 -0
  122. package/dist/features/sources/observability/schema.d.ts.map +1 -0
  123. package/dist/features/sources/observability/schema.js +44 -0
  124. package/dist/features/sources/observability/schema.js.map +1 -0
  125. package/dist/features/sources/observability/service.d.ts +36 -0
  126. package/dist/features/sources/observability/service.d.ts.map +1 -0
  127. package/dist/features/sources/observability/service.js +127 -0
  128. package/dist/features/sources/observability/service.js.map +1 -0
  129. package/dist/features/sources/prometheus/controller.d.ts +9 -0
  130. package/dist/features/sources/prometheus/controller.d.ts.map +1 -0
  131. package/dist/features/sources/prometheus/controller.js +359 -0
  132. package/dist/features/sources/prometheus/controller.js.map +1 -0
  133. package/dist/features/sources/prometheus/templates.d.ts +18 -0
  134. package/dist/features/sources/prometheus/templates.d.ts.map +1 -0
  135. package/dist/features/sources/prometheus/templates.js +244 -0
  136. package/dist/features/sources/prometheus/templates.js.map +1 -0
  137. package/dist/index.d.ts +7 -0
  138. package/dist/index.d.ts.map +1 -0
  139. package/dist/index.js +7 -0
  140. package/dist/index.js.map +1 -0
  141. package/dist/migrations/0007_pipeline_yaml_definitions.d.ts +3 -0
  142. package/dist/migrations/0007_pipeline_yaml_definitions.d.ts.map +1 -0
  143. package/dist/migrations/0007_pipeline_yaml_definitions.js +19 -0
  144. package/dist/migrations/0007_pipeline_yaml_definitions.js.map +1 -0
  145. package/dist/migrations/0008_tenant_isolation.d.ts +3 -0
  146. package/dist/migrations/0008_tenant_isolation.d.ts.map +1 -0
  147. package/dist/migrations/0008_tenant_isolation.js +42 -0
  148. package/dist/migrations/0008_tenant_isolation.js.map +1 -0
  149. package/dist/migrations/run.d.ts +6 -0
  150. package/dist/migrations/run.d.ts.map +1 -0
  151. package/dist/migrations/run.js +1262 -0
  152. package/dist/migrations/run.js.map +1 -0
  153. package/dist/models/alarm-group.model.d.ts +42 -0
  154. package/dist/models/alarm-group.model.d.ts.map +1 -0
  155. package/dist/models/alarm-group.model.js +98 -0
  156. package/dist/models/alarm-group.model.js.map +1 -0
  157. package/dist/models/alert.model.d.ts +54 -0
  158. package/dist/models/alert.model.d.ts.map +1 -0
  159. package/dist/models/alert.model.js +119 -0
  160. package/dist/models/alert.model.js.map +1 -0
  161. package/dist/models/dedup-config.model.d.ts +53 -0
  162. package/dist/models/dedup-config.model.d.ts.map +1 -0
  163. package/dist/models/dedup-config.model.js +157 -0
  164. package/dist/models/dedup-config.model.js.map +1 -0
  165. package/dist/models/grouping-config.model.d.ts +70 -0
  166. package/dist/models/grouping-config.model.d.ts.map +1 -0
  167. package/dist/models/grouping-config.model.js +174 -0
  168. package/dist/models/grouping-config.model.js.map +1 -0
  169. package/dist/models/incident-comment.model.d.ts +14 -0
  170. package/dist/models/incident-comment.model.d.ts.map +1 -0
  171. package/dist/models/incident-comment.model.js +38 -0
  172. package/dist/models/incident-comment.model.js.map +1 -0
  173. package/dist/models/incident-event.model.d.ts +16 -0
  174. package/dist/models/incident-event.model.d.ts.map +1 -0
  175. package/dist/models/incident-event.model.js +31 -0
  176. package/dist/models/incident-event.model.js.map +1 -0
  177. package/dist/models/incident.model.d.ts +47 -0
  178. package/dist/models/incident.model.d.ts.map +1 -0
  179. package/dist/models/incident.model.js +201 -0
  180. package/dist/models/incident.model.js.map +1 -0
  181. package/dist/models/normalization-config.model.d.ts +44 -0
  182. package/dist/models/normalization-config.model.d.ts.map +1 -0
  183. package/dist/models/normalization-config.model.js +153 -0
  184. package/dist/models/normalization-config.model.js.map +1 -0
  185. package/dist/models/notification-provider.model.d.ts +12 -0
  186. package/dist/models/notification-provider.model.d.ts.map +1 -0
  187. package/dist/models/notification-provider.model.js +48 -0
  188. package/dist/models/notification-provider.model.js.map +1 -0
  189. package/dist/models/pipeline-event.model.d.ts +15 -0
  190. package/dist/models/pipeline-event.model.d.ts.map +1 -0
  191. package/dist/models/pipeline-event.model.js +32 -0
  192. package/dist/models/pipeline-event.model.js.map +1 -0
  193. package/dist/models/settings.model.d.ts +8 -0
  194. package/dist/models/settings.model.d.ts.map +1 -0
  195. package/dist/models/settings.model.js +30 -0
  196. package/dist/models/settings.model.js.map +1 -0
  197. package/dist/models/sop.model.d.ts +58 -0
  198. package/dist/models/sop.model.d.ts.map +1 -0
  199. package/dist/models/sop.model.js +138 -0
  200. package/dist/models/sop.model.js.map +1 -0
  201. package/dist/models/source.model.d.ts +177 -0
  202. package/dist/models/source.model.d.ts.map +1 -0
  203. package/dist/models/source.model.js +794 -0
  204. package/dist/models/source.model.js.map +1 -0
  205. package/dist/models/tenant.model.d.ts +13 -0
  206. package/dist/models/tenant.model.d.ts.map +1 -0
  207. package/dist/models/tenant.model.js +28 -0
  208. package/dist/models/tenant.model.js.map +1 -0
  209. package/dist/models/workflow.model.d.ts +36 -0
  210. package/dist/models/workflow.model.d.ts.map +1 -0
  211. package/dist/models/workflow.model.js +136 -0
  212. package/dist/models/workflow.model.js.map +1 -0
  213. package/dist/pipeline/AlarmPipelineWorker.d.ts +18 -0
  214. package/dist/pipeline/AlarmPipelineWorker.d.ts.map +1 -0
  215. package/dist/pipeline/AlarmPipelineWorker.js +342 -0
  216. package/dist/pipeline/AlarmPipelineWorker.js.map +1 -0
  217. package/dist/pipeline/CanonicalAlarm.d.ts +59 -0
  218. package/dist/pipeline/CanonicalAlarm.d.ts.map +1 -0
  219. package/dist/pipeline/CanonicalAlarm.js +81 -0
  220. package/dist/pipeline/CanonicalAlarm.js.map +1 -0
  221. package/dist/pipeline/DedupService.d.ts +29 -0
  222. package/dist/pipeline/DedupService.d.ts.map +1 -0
  223. package/dist/pipeline/DedupService.js +172 -0
  224. package/dist/pipeline/DedupService.js.map +1 -0
  225. package/dist/pipeline/GroupFlushWorker.d.ts +16 -0
  226. package/dist/pipeline/GroupFlushWorker.d.ts.map +1 -0
  227. package/dist/pipeline/GroupFlushWorker.js +196 -0
  228. package/dist/pipeline/GroupFlushWorker.js.map +1 -0
  229. package/dist/pipeline/GroupingService.d.ts +27 -0
  230. package/dist/pipeline/GroupingService.d.ts.map +1 -0
  231. package/dist/pipeline/GroupingService.js +338 -0
  232. package/dist/pipeline/GroupingService.js.map +1 -0
  233. package/dist/pipeline/NormalizationRuleEngine.d.ts +5 -0
  234. package/dist/pipeline/NormalizationRuleEngine.d.ts.map +1 -0
  235. package/dist/pipeline/NormalizationRuleEngine.js +86 -0
  236. package/dist/pipeline/NormalizationRuleEngine.js.map +1 -0
  237. package/dist/pipeline/NormalizationService.d.ts +29 -0
  238. package/dist/pipeline/NormalizationService.d.ts.map +1 -0
  239. package/dist/pipeline/NormalizationService.js +275 -0
  240. package/dist/pipeline/NormalizationService.js.map +1 -0
  241. package/dist/pipeline/alarmQueue.d.ts +66 -0
  242. package/dist/pipeline/alarmQueue.d.ts.map +1 -0
  243. package/dist/pipeline/alarmQueue.js +254 -0
  244. package/dist/pipeline/alarmQueue.js.map +1 -0
  245. package/dist/pipeline/defaults/ensureDefaults.d.ts +3 -0
  246. package/dist/pipeline/defaults/ensureDefaults.d.ts.map +1 -0
  247. package/dist/pipeline/defaults/ensureDefaults.js +124 -0
  248. package/dist/pipeline/defaults/ensureDefaults.js.map +1 -0
  249. package/dist/pipeline/defaults/pipelineDefaults.d.ts +13 -0
  250. package/dist/pipeline/defaults/pipelineDefaults.d.ts.map +1 -0
  251. package/dist/pipeline/defaults/pipelineDefaults.js +266 -0
  252. package/dist/pipeline/defaults/pipelineDefaults.js.map +1 -0
  253. package/dist/pipeline/yaml/DedupYaml.d.ts +33 -0
  254. package/dist/pipeline/yaml/DedupYaml.d.ts.map +1 -0
  255. package/dist/pipeline/yaml/DedupYaml.js +25 -0
  256. package/dist/pipeline/yaml/DedupYaml.js.map +1 -0
  257. package/dist/pipeline/yaml/GroupingYaml.d.ts +49 -0
  258. package/dist/pipeline/yaml/GroupingYaml.d.ts.map +1 -0
  259. package/dist/pipeline/yaml/GroupingYaml.js +39 -0
  260. package/dist/pipeline/yaml/GroupingYaml.js.map +1 -0
  261. package/dist/pipeline/yaml/NormalizationYaml.d.ts +54 -0
  262. package/dist/pipeline/yaml/NormalizationYaml.d.ts.map +1 -0
  263. package/dist/pipeline/yaml/NormalizationYaml.js +23 -0
  264. package/dist/pipeline/yaml/NormalizationYaml.js.map +1 -0
  265. package/dist/pipeline/yaml/pipelineYaml.d.ts +11 -0
  266. package/dist/pipeline/yaml/pipelineYaml.d.ts.map +1 -0
  267. package/dist/pipeline/yaml/pipelineYaml.js +49 -0
  268. package/dist/pipeline/yaml/pipelineYaml.js.map +1 -0
  269. package/dist/realtime/events.d.ts +11 -0
  270. package/dist/realtime/events.d.ts.map +1 -0
  271. package/dist/realtime/events.js +21 -0
  272. package/dist/realtime/events.js.map +1 -0
  273. package/dist/routes/alert.routes.d.ts +4 -0
  274. package/dist/routes/alert.routes.d.ts.map +1 -0
  275. package/dist/routes/alert.routes.js +15 -0
  276. package/dist/routes/alert.routes.js.map +1 -0
  277. package/dist/routes/dedup-config.routes.d.ts +4 -0
  278. package/dist/routes/dedup-config.routes.d.ts.map +1 -0
  279. package/dist/routes/dedup-config.routes.js +82 -0
  280. package/dist/routes/dedup-config.routes.js.map +1 -0
  281. package/dist/routes/grouping-config.routes.d.ts +4 -0
  282. package/dist/routes/grouping-config.routes.d.ts.map +1 -0
  283. package/dist/routes/grouping-config.routes.js +82 -0
  284. package/dist/routes/grouping-config.routes.js.map +1 -0
  285. package/dist/routes/incident.routes.d.ts +4 -0
  286. package/dist/routes/incident.routes.d.ts.map +1 -0
  287. package/dist/routes/incident.routes.js +21 -0
  288. package/dist/routes/incident.routes.js.map +1 -0
  289. package/dist/routes/index.d.ts +47 -0
  290. package/dist/routes/index.d.ts.map +1 -0
  291. package/dist/routes/index.js +83 -0
  292. package/dist/routes/index.js.map +1 -0
  293. package/dist/routes/normalization-config.routes.d.ts +4 -0
  294. package/dist/routes/normalization-config.routes.d.ts.map +1 -0
  295. package/dist/routes/normalization-config.routes.js +199 -0
  296. package/dist/routes/normalization-config.routes.js.map +1 -0
  297. package/dist/routes/notification-provider.routes.d.ts +4 -0
  298. package/dist/routes/notification-provider.routes.d.ts.map +1 -0
  299. package/dist/routes/notification-provider.routes.js +13 -0
  300. package/dist/routes/notification-provider.routes.js.map +1 -0
  301. package/dist/routes/pipeline.routes.d.ts +8 -0
  302. package/dist/routes/pipeline.routes.d.ts.map +1 -0
  303. package/dist/routes/pipeline.routes.js +243 -0
  304. package/dist/routes/pipeline.routes.js.map +1 -0
  305. package/dist/routes/settings.routes.d.ts +4 -0
  306. package/dist/routes/settings.routes.d.ts.map +1 -0
  307. package/dist/routes/settings.routes.js +10 -0
  308. package/dist/routes/settings.routes.js.map +1 -0
  309. package/dist/routes/sop.routes.d.ts +4 -0
  310. package/dist/routes/sop.routes.d.ts.map +1 -0
  311. package/dist/routes/sop.routes.js +14 -0
  312. package/dist/routes/sop.routes.js.map +1 -0
  313. package/dist/routes/source.routes.d.ts +9 -0
  314. package/dist/routes/source.routes.d.ts.map +1 -0
  315. package/dist/routes/source.routes.js +31 -0
  316. package/dist/routes/source.routes.js.map +1 -0
  317. package/dist/routes/tenant.routes.d.ts +4 -0
  318. package/dist/routes/tenant.routes.d.ts.map +1 -0
  319. package/dist/routes/tenant.routes.js +10 -0
  320. package/dist/routes/tenant.routes.js.map +1 -0
  321. package/dist/routes/workflow.routes.d.ts +4 -0
  322. package/dist/routes/workflow.routes.d.ts.map +1 -0
  323. package/dist/routes/workflow.routes.js +18 -0
  324. package/dist/routes/workflow.routes.js.map +1 -0
  325. package/dist/server.d.ts +22 -0
  326. package/dist/server.d.ts.map +1 -0
  327. package/dist/server.js +76 -0
  328. package/dist/server.js.map +1 -0
  329. package/dist/service.d.ts +159 -0
  330. package/dist/service.d.ts.map +1 -0
  331. package/dist/service.js +156 -0
  332. package/dist/service.js.map +1 -0
  333. package/dist/services/alert.service.d.ts +76 -0
  334. package/dist/services/alert.service.d.ts.map +1 -0
  335. package/dist/services/alert.service.js +688 -0
  336. package/dist/services/alert.service.js.map +1 -0
  337. package/dist/services/connector.service.d.ts +65 -0
  338. package/dist/services/connector.service.d.ts.map +1 -0
  339. package/dist/services/connector.service.js +28 -0
  340. package/dist/services/connector.service.js.map +1 -0
  341. package/dist/services/incident.service.d.ts +108 -0
  342. package/dist/services/incident.service.d.ts.map +1 -0
  343. package/dist/services/incident.service.js +325 -0
  344. package/dist/services/incident.service.js.map +1 -0
  345. package/dist/services/notification-provider.service.d.ts +12 -0
  346. package/dist/services/notification-provider.service.d.ts.map +1 -0
  347. package/dist/services/notification-provider.service.js +25 -0
  348. package/dist/services/notification-provider.service.js.map +1 -0
  349. package/dist/services/settings.service.d.ts +8 -0
  350. package/dist/services/settings.service.d.ts.map +1 -0
  351. package/dist/services/settings.service.js +14 -0
  352. package/dist/services/settings.service.js.map +1 -0
  353. package/dist/services/sop.service.d.ts +60 -0
  354. package/dist/services/sop.service.d.ts.map +1 -0
  355. package/dist/services/sop.service.js +66 -0
  356. package/dist/services/sop.service.js.map +1 -0
  357. package/dist/services/source.service.d.ts +162 -0
  358. package/dist/services/source.service.d.ts.map +1 -0
  359. package/dist/services/source.service.js +124 -0
  360. package/dist/services/source.service.js.map +1 -0
  361. package/dist/services/tenant.service.d.ts +11 -0
  362. package/dist/services/tenant.service.d.ts.map +1 -0
  363. package/dist/services/tenant.service.js +22 -0
  364. package/dist/services/tenant.service.js.map +1 -0
  365. package/dist/services/workflow.service.d.ts +32 -0
  366. package/dist/services/workflow.service.d.ts.map +1 -0
  367. package/dist/services/workflow.service.js +291 -0
  368. package/dist/services/workflow.service.js.map +1 -0
  369. package/dist/standalone.d.ts +2 -0
  370. package/dist/standalone.d.ts.map +1 -0
  371. package/dist/standalone.js +55 -0
  372. package/dist/standalone.js.map +1 -0
  373. package/dist/tenancy.d.ts +5 -0
  374. package/dist/tenancy.d.ts.map +1 -0
  375. package/dist/tenancy.js +35 -0
  376. package/dist/tenancy.js.map +1 -0
  377. package/dist/utils/notificationTemplates.d.ts +98 -0
  378. package/dist/utils/notificationTemplates.d.ts.map +1 -0
  379. package/dist/utils/notificationTemplates.js +227 -0
  380. package/dist/utils/notificationTemplates.js.map +1 -0
  381. package/dist/utils/secretCrypto.d.ts +3 -0
  382. package/dist/utils/secretCrypto.d.ts.map +1 -0
  383. package/dist/utils/secretCrypto.js +40 -0
  384. package/dist/utils/secretCrypto.js.map +1 -0
  385. package/dist/utils/workflowYaml.d.ts +53 -0
  386. package/dist/utils/workflowYaml.d.ts.map +1 -0
  387. package/dist/utils/workflowYaml.js +269 -0
  388. package/dist/utils/workflowYaml.js.map +1 -0
  389. package/package.json +73 -0
@@ -0,0 +1,1230 @@
1
+ /**
2
+ * Unified Stack CloudFormation template for CloudTrail security monitoring.
3
+ *
4
+ * The raw YAML is embedded here verbatim from meyi-security-monitoring.yaml.
5
+ * Two server-side substitutions are applied at serve time:
6
+ * __MEYI_WEBHOOK_URL__ → the source's authenticated webhook URL
7
+ * __MEYI_DEPLOYMENT_STATUS_URL__ → the deployment-status callback URL (token-gated)
8
+ * __MEYI_WEBHOOK_AUTH_TOKEN__ → webhook auth token
9
+ */
10
+ export const ALL_AWS_ACTIVE_REGIONS = [
11
+ 'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2',
12
+ 'ca-central-1',
13
+ 'eu-west-1', 'eu-west-2', 'eu-west-3',
14
+ 'eu-central-1',
15
+ 'eu-north-1',
16
+ 'ap-south-1',
17
+ 'ap-southeast-1', 'ap-southeast-2',
18
+ 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3',
19
+ 'sa-east-1',
20
+ ].join(',');
21
+ const CENTRAL_STACK_YAML = `
22
+ AWSTemplateFormatVersion: '2010-09-09'
23
+ Description: |
24
+ MeyiConnect Security Monitoring — Unified Stack.
25
+ Deploys the StackSet across customer accounts/regions AND notifies
26
+ the MeyiConnect backend via EventBridge API Destinations when deployment completes.
27
+ Deploy this ONCE in the MeyiConnect management account (primary region).
28
+
29
+ Metadata:
30
+ AWS::CloudFormation::Interface:
31
+ ParameterGroups:
32
+ - Label:
33
+ default: "Deployment Targets"
34
+ Parameters:
35
+ - DeploymentMode
36
+ - CreateIAMRoles
37
+ - TargetOUs
38
+ - TargetAccounts
39
+ - TargetRegions
40
+ - Label:
41
+ default: "CloudTrail Settings"
42
+ Parameters:
43
+ - CreateCloudTrail
44
+ - PrimaryRegion
45
+ - Label:
46
+ default: "Template"
47
+ Parameters:
48
+ - TemplateUrl
49
+ - GlobalTemplateUrl
50
+ - Label:
51
+ default: "MeyiConnect Backend"
52
+ Parameters:
53
+ - BackendUrl
54
+ - WebhookAuthToken
55
+ ParameterLabels:
56
+ WebhookUrl:
57
+ default: "MeyiConnect Security Alerts Webhook URL"
58
+ DeploymentMode:
59
+ default: "Deployment Mode"
60
+ CreateIAMRoles:
61
+ default: "Create StackSet IAM Roles?"
62
+ TargetOUs:
63
+ default: "Target Organizational Unit IDs (comma separated)"
64
+ TargetAccounts:
65
+ default: "Optional: Target AWS Account IDs to filter (comma separated)"
66
+ TargetRegions:
67
+ default: "Target Regions (comma separated)"
68
+ CreateCloudTrail:
69
+ default: "Create Multi-Region CloudTrail?"
70
+ PrimaryRegion:
71
+ default: "Primary Region (for CloudTrail)"
72
+ BackendUrl:
73
+ default: "MeyiConnect Backend Notification URL"
74
+ WebhookAuthToken:
75
+ default: "MeyiConnect Webhook Authorization Token"
76
+
77
+ Parameters:
78
+
79
+ WebhookUrl:
80
+ Type: String
81
+ Description: MeyiConnect webhook URL for security alerts.
82
+ Default: "__MEYI_WEBHOOK_URL__"
83
+
84
+ DeploymentMode:
85
+ Type: String
86
+ Default: '__MEYI_DEPLOYMENT_MODE__'
87
+ AllowedValues:
88
+ - 'Organizations'
89
+ - 'Standalone'
90
+ Description: "Deploy via Organizations (Service-Managed) or Standalone account (Self-Managed)."
91
+
92
+ CreateIAMRoles:
93
+ Type: String
94
+ Default: '__MEYI_CREATE_IAM_ROLES__'
95
+ AllowedValues:
96
+ - 'true'
97
+ - 'false'
98
+ Description: "Create standard AWSCloudFormationStackSetAdministrationRole and AWSCloudFormationStackSetExecutionRole? Only used in Standalone mode."
99
+
100
+ TargetOUs:
101
+ Type: CommaDelimitedList
102
+ __MEYI_TARGET_OUS_DEFAULT__
103
+ Description: AWS Organizational Unit IDs (OUs) to deploy security monitoring (comma separated). To deploy to all accounts, enter your Organization Root ID (e.g., r-xxxx). Leave empty for Standalone mode.
104
+ Default: "ou-0gey-xp0hksbc"
105
+
106
+ TargetAccounts:
107
+ Type: CommaDelimitedList
108
+ __MEYI_TARGET_ACCOUNTS_DEFAULT__
109
+ Description: Optional AWS Account IDs to restrict deployment (comma separated). Leave blank to deploy to all accounts in targeted OUs.
110
+
111
+ TargetRegions:
112
+ Type: CommaDelimitedList
113
+ Description: AWS Regions to deploy security monitoring (comma separated).
114
+ Default: '__MEYI_TARGET_REGIONS__'
115
+
116
+ CreateCloudTrail:
117
+ Type: String
118
+ Default: 'true'
119
+ AllowedValues:
120
+ - 'true'
121
+ - 'false'
122
+ Description: Set to false if the customer already has a CloudTrail.
123
+
124
+ PrimaryRegion:
125
+ Type: String
126
+ Default: '__MEYI_PRIMARY_REGION__'
127
+ Description: Primary region where the multi-region CloudTrail and S3 bucket will be created.
128
+
129
+ BackendUrl:
130
+ Type: String
131
+ Default: '__MEYI_DEPLOYMENT_STATUS_URL__'
132
+ Description: MeyiConnect internal backend URL to receive deployment status notifications.
133
+
134
+ WebhookAuthToken:
135
+ Type: String
136
+ NoEcho: true
137
+ Default: '__MEYI_WEBHOOK_AUTH_TOKEN__'
138
+ Description: MeyiConnect Webhook Authorization Token.
139
+
140
+ Conditions:
141
+ HasTargetOUs: !Not [ !Equals [ !Join [ "", !Ref TargetOUs ], "" ] ]
142
+ HasTargetAccounts: !Not [ !Equals [ !Join [ "", !Ref TargetAccounts ], "" ] ]
143
+ IsServiceManaged: !Equals [ !Ref DeploymentMode, 'Organizations' ]
144
+ IsSelfManaged: !Equals [ !Ref DeploymentMode, 'Standalone' ]
145
+ ShouldCreateRoles: !And [ !Equals [ !Ref DeploymentMode, 'Standalone' ], !Equals [ !Ref CreateIAMRoles, 'true' ] ]
146
+ ShouldCreateStackInstances: !Or [ !Condition IsSelfManaged, !Condition HasTargetOUs ]
147
+
148
+ Resources:
149
+
150
+ # ============================================================
151
+ # IAM ROLES FOR SELF-MANAGED STACKSETS (STANDALONE MODE)
152
+ # ============================================================
153
+
154
+ StackSetAdministrationRole:
155
+ Type: AWS::IAM::Role
156
+ Condition: ShouldCreateRoles
157
+ Properties:
158
+ RoleName: AWSCloudFormationStackSetAdministrationRole
159
+ AssumeRolePolicyDocument:
160
+ Version: '2012-10-17'
161
+ Statement:
162
+ - Effect: Allow
163
+ Principal:
164
+ Service: cloudformation.amazonaws.com
165
+ Action: sts:AssumeRole
166
+ Policies:
167
+ - PolicyName: AssumeRole-AWSCloudFormationStackSetExecutionRole
168
+ PolicyDocument:
169
+ Version: '2012-10-17'
170
+ Statement:
171
+ - Effect: Allow
172
+ Action: sts:AssumeRole
173
+ Resource: !GetAtt StackSetExecutionRole.Arn
174
+
175
+ StackSetExecutionRole:
176
+ Type: AWS::IAM::Role
177
+ Condition: ShouldCreateRoles
178
+ Properties:
179
+ RoleName: AWSCloudFormationStackSetExecutionRole
180
+ AssumeRolePolicyDocument:
181
+ Version: '2012-10-17'
182
+ Statement:
183
+ - Effect: Allow
184
+ Principal:
185
+ AWS: !Ref AWS::AccountId
186
+ Action: sts:AssumeRole
187
+ Policies:
188
+ - PolicyName: !Sub "\${AWS::StackName}-StackSetExecutionPolicy"
189
+ PolicyDocument:
190
+ Version: '2012-10-17'
191
+ Statement:
192
+ - Sid: CloudFormationOperations
193
+ Effect: Allow
194
+ Action:
195
+ - cloudformation:CreateStack
196
+ - cloudformation:UpdateStack
197
+ - cloudformation:DeleteStack
198
+ - cloudformation:DescribeStacks
199
+ - cloudformation:DescribeStackEvents
200
+ - cloudformation:DescribeStackResource
201
+ - cloudformation:GetTemplate
202
+ - cloudformation:GetTemplateSummary
203
+ - cloudformation:ListStackResources
204
+ Resource: !Sub "arn:aws:cloudformation:*:\${AWS::AccountId}:stack/StackSet-\${AWS::StackName}-SecurityMonitoring*"
205
+ - Sid: S3Operations
206
+ Effect: Allow
207
+ Action:
208
+ - s3:CreateBucket
209
+ - s3:DeleteBucket
210
+ - s3:GetBucketLocation
211
+ - s3:GetBucketPolicy
212
+ - s3:PutBucketPolicy
213
+ - s3:DeleteBucketPolicy
214
+ - s3:GetBucketVersioning
215
+ - s3:PutBucketVersioning
216
+ - s3:GetEncryptionConfiguration
217
+ - s3:PutEncryptionConfiguration
218
+ - s3:GetBucketPublicAccessBlock
219
+ - s3:PutBucketPublicAccessBlock
220
+ - s3:GetBucketTagging
221
+ - s3:PutBucketTagging
222
+ Resource: "arn:aws:s3:::*"
223
+ - Sid: CloudTrailOperations
224
+ Effect: Allow
225
+ Action:
226
+ - cloudtrail:CreateTrail
227
+ - cloudtrail:UpdateTrail
228
+ - cloudtrail:DeleteTrail
229
+ - cloudtrail:GetTrail
230
+ - cloudtrail:GetTrailStatus
231
+ - cloudtrail:StartLogging
232
+ - cloudtrail:StopLogging
233
+ - cloudtrail:ListTags
234
+ - cloudtrail:AddTags
235
+ - cloudtrail:RemoveTags
236
+ Resource: !Sub "arn:aws:cloudtrail:*:\${AWS::AccountId}:trail/\${AWS::StackName}-SecurityTrail"
237
+ - Sid: SNSOperations
238
+ Effect: Allow
239
+ Action:
240
+ - sns:CreateTopic
241
+ - sns:DeleteTopic
242
+ - sns:GetTopicAttributes
243
+ - sns:SetTopicAttributes
244
+ - sns:Subscribe
245
+ - sns:Unsubscribe
246
+ - sns:TagResource
247
+ - sns:UntagResource
248
+ - sns:ListTagsForResource
249
+ Resource:
250
+ - !Sub "arn:aws:sns:*:\${AWS::AccountId}:*"
251
+ - Sid: EventBridgeOperations
252
+ Effect: Allow
253
+ Action:
254
+ - events:PutRule
255
+ - events:DeleteRule
256
+ - events:DescribeRule
257
+ - events:PutTargets
258
+ - events:RemoveTargets
259
+ - events:ListTargetsByRule
260
+ - events:TagResource
261
+ - events:UntagResource
262
+ - events:ListTagsForResource
263
+ Resource: !Sub "arn:aws:events:*:\${AWS::AccountId}:rule/\${AWS::StackName}-*"
264
+
265
+ # ============================================================
266
+ # STACKSET
267
+ # Deploys central-stack.yaml across target accounts and regions
268
+ # ============================================================
269
+
270
+ SecurityMonitoringStackSet:
271
+ Type: AWS::CloudFormation::StackSet
272
+ DependsOn:
273
+ - StackSetApiDestination
274
+ - StackSetOperationRule
275
+ Properties:
276
+ StackSetName: !Sub "\${AWS::StackName}-SecurityMonitoring"
277
+ Description: !Sub "\${AWS::StackName} Security Monitoring (regional logs)"
278
+ TemplateBody: |
279
+ AWSTemplateFormatVersion: '2010-09-09'
280
+ Description: |
281
+ Meyi Connect Security Monitoring - Central Stack. Deploys local regional security alerting rules via EventBridge API Destinations (Serverless / Raw Event Payload), and an optional multi-region CloudTrail.
282
+ Reports deployment status back to Meyi Connect.
283
+
284
+ Metadata:
285
+ AWS::CloudFormation::Interface:
286
+ ParameterGroups:
287
+ - Label:
288
+ default: "Naming & Context"
289
+ Parameters:
290
+ - ParentStackName
291
+ - Label:
292
+ default: "CloudTrail Deployment Settings"
293
+ Parameters:
294
+ - CreateCloudTrail
295
+ - PrimaryRegion
296
+ - Label:
297
+ default: "Alert Settings"
298
+ Parameters:
299
+ - WebhookUrl
300
+ - WebhookAuthToken
301
+ ParameterLabels:
302
+ ParentStackName:
303
+ default: "Parent Stack Name Prefix"
304
+ CreateCloudTrail:
305
+ default: "Create Multi-Region CloudTrail?"
306
+ PrimaryRegion:
307
+ default: "Primary Region (Only used if 'Create Multi-Region CloudTrail?' is true)"
308
+ WebhookUrl:
309
+ default: "MeyiConnect Webhook URL"
310
+ WebhookAuthToken:
311
+ default: "MeyiConnect Webhook Authorization Token"
312
+
313
+ Parameters:
314
+
315
+ ParentStackName:
316
+ Type: String
317
+ Default: 'MeyiConnect'
318
+ Description: Parent stack name prefix used for naming resources.
319
+
320
+ WebhookUrl:
321
+ Type: String
322
+ Description: MeyiConnect webhook URL for security alerts.
323
+
324
+ WebhookAuthToken:
325
+ Type: String
326
+ NoEcho: true
327
+ Default: '28e3b2faf28d48f28ef74759f8a40fefbd4be6ccce2544f1aeb63ddcbdebe8d4'
328
+ Description: MeyiConnect Webhook Authorization Token.
329
+
330
+ CreateCloudTrail:
331
+ Type: String
332
+ Default: 'true'
333
+ AllowedValues:
334
+ - 'true'
335
+ - 'false'
336
+ Description: Whether to create a new multi-region CloudTrail and S3 bucket. Set to 'false' if you already have a trail.
337
+
338
+ PrimaryRegion:
339
+ Type: String
340
+ Default: 'us-west-2'
341
+ Description: The primary region where the multi-region CloudTrail and its S3 bucket should be created.
342
+
343
+ Conditions:
344
+ CreateNewTrail: !And
345
+ - !Equals [ !Ref CreateCloudTrail, 'true' ]
346
+ - !Equals [ !Ref 'AWS::Region', !Ref PrimaryRegion ]
347
+
348
+ Resources:
349
+
350
+ # ============================================================
351
+ # S3 BUCKET FOR CLOUDTRAIL
352
+ # ============================================================
353
+
354
+ CloudTrailS3Bucket:
355
+ Type: AWS::S3::Bucket
356
+ Condition: CreateNewTrail
357
+ DeletionPolicy: Retain
358
+ Properties:
359
+ Tags:
360
+ - Key: Project
361
+ Value: MeyiConnect
362
+ - Key: Created_for
363
+ Value: L1 Security
364
+ - Key: aws-apn-id
365
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
366
+ VersioningConfiguration:
367
+ Status: Enabled
368
+ PublicAccessBlockConfiguration:
369
+ BlockPublicAcls: true
370
+ BlockPublicPolicy: true
371
+ IgnorePublicAcls: true
372
+ RestrictPublicBuckets: true
373
+ BucketEncryption:
374
+ ServerSideEncryptionConfiguration:
375
+ - ServerSideEncryptionByDefault:
376
+ SSEAlgorithm: AES256
377
+
378
+ CloudTrailS3BucketPolicy:
379
+ Type: AWS::S3::BucketPolicy
380
+ Condition: CreateNewTrail
381
+ Properties:
382
+ Bucket: !Ref CloudTrailS3Bucket
383
+ PolicyDocument:
384
+ Version: '2012-10-17'
385
+ Statement:
386
+ - Sid: AWSCloudTrailAclCheck
387
+ Effect: Allow
388
+ Principal:
389
+ Service: cloudtrail.amazonaws.com
390
+ Action: s3:GetBucketAcl
391
+ Resource: !Sub arn:aws:s3:::\${CloudTrailS3Bucket}
392
+ - Sid: AWSCloudTrailWrite
393
+ Effect: Allow
394
+ Principal:
395
+ Service: cloudtrail.amazonaws.com
396
+ Action: s3:PutObject
397
+ Resource: !Sub arn:aws:s3:::\${CloudTrailS3Bucket}/AWSLogs/\${AWS::AccountId}/*
398
+ Condition:
399
+ StringEquals:
400
+ s3:x-amz-acl: bucket-owner-full-control
401
+
402
+ # ============================================================
403
+ # CLOUDTRAIL
404
+ # ============================================================
405
+
406
+ CloudTrail:
407
+ Type: AWS::CloudTrail::Trail
408
+ Condition: CreateNewTrail
409
+ DependsOn: CloudTrailS3BucketPolicy
410
+ Properties:
411
+ Tags:
412
+ - Key: Project
413
+ Value: MeyiConnect
414
+ - Key: Created_for
415
+ Value: L1 Security
416
+ - Key: aws-apn-id
417
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
418
+ TrailName: !Sub "\${ParentStackName}-SecurityTrail"
419
+ S3BucketName: !Ref CloudTrailS3Bucket
420
+ IsLogging: true
421
+ IsMultiRegionTrail: true
422
+ IncludeGlobalServiceEvents: true
423
+ EnableLogFileValidation: true
424
+ IsOrganizationTrail: false
425
+ EventSelectors:
426
+ - ReadWriteType: All
427
+ IncludeManagementEvents: true
428
+
429
+ # ============================================================
430
+ # EVENTBRIDGE API DESTINATION & CONNECTION
431
+ # ============================================================
432
+
433
+ SecurityApiConnection:
434
+ Type: AWS::Events::Connection
435
+ Properties:
436
+ Name: !Sub "\${ParentStackName}-ApiConn-\${AWS::Region}"
437
+ Description: API Connection for MeyiConnect regional security alerts with Bearer Token auth
438
+ AuthorizationType: API_KEY
439
+ AuthParameters:
440
+ ApiKeyAuthParameters:
441
+ ApiKeyName: Authorization
442
+ ApiKeyValue: !Sub "Bearer \${WebhookAuthToken}"
443
+
444
+ SecurityApiDestination:
445
+ Type: AWS::Events::ApiDestination
446
+ Properties:
447
+ Name: !Sub "\${ParentStackName}-ApiDest-\${AWS::Region}"
448
+ Description: API Destination for MeyiConnect regional security alerts
449
+ ConnectionArn: !GetAtt SecurityApiConnection.Arn
450
+ InvocationEndpoint: !Ref WebhookUrl
451
+ HttpMethod: POST
452
+ InvocationRateLimitPerSecond: 100
453
+
454
+ EventBridgeApiDestinationRole:
455
+ Type: AWS::IAM::Role
456
+ Properties:
457
+ RoleName: !Sub "\${ParentStackName}-EbRole-\${AWS::Region}"
458
+ AssumeRolePolicyDocument:
459
+ Version: '2012-10-17'
460
+ Statement:
461
+ - Effect: Allow
462
+ Principal:
463
+ Service: events.amazonaws.com
464
+ Action: sts:AssumeRole
465
+ Policies:
466
+ - PolicyName: InvokeApiDestinationPolicy
467
+ PolicyDocument:
468
+ Version: '2012-10-17'
469
+ Statement:
470
+ - Effect: Allow
471
+ Action:
472
+ - events:InvokeApiDestination
473
+ Resource: !GetAtt SecurityApiDestination.Arn
474
+ Tags:
475
+ - Key: Project
476
+ Value: MeyiConnect
477
+ - Key: Created_for
478
+ Value: L1 Security
479
+ - Key: aws-apn-id
480
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
481
+
482
+ # ============================================================
483
+ # EVENTBRIDGE RULES ON DEFAULT BUS
484
+ # ============================================================
485
+
486
+ DataAndInfrastructureSecurityRule:
487
+ Type: AWS::Events::Rule
488
+ DependsOn: SecurityApiDestination
489
+ Properties:
490
+ Tags:
491
+ - Key: Project
492
+ Value: MeyiConnect
493
+ - Key: Created_for
494
+ Value: L1 Security
495
+ - Key: aws-apn-id
496
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
497
+ Name: !Sub "\${ParentStackName}-DataInfraRule"
498
+ Description: EC2, VPC, network, S3, and RDS configuration changes in the deployment region
499
+ EventPattern:
500
+ source:
501
+ - aws.ec2
502
+ - aws.s3
503
+ - aws.rds
504
+ detail-type:
505
+ - AWS API Call via CloudTrail
506
+ detail:
507
+ eventSource:
508
+ - ec2.amazonaws.com
509
+ - s3.amazonaws.com
510
+ - rds.amazonaws.com
511
+ eventName:
512
+ # EC2 & Network Events
513
+ - StopInstances
514
+ - RunInstances
515
+ - RebootInstances
516
+ - StartInstances
517
+ - TerminateInstances
518
+ - CreateCustomerGateway
519
+ - DeleteCustomerGateway
520
+ - AttachInternetGateway
521
+ - CreateInternetGateway
522
+ - DeleteInternetGateway
523
+ - DetachInternetGateway
524
+ - CreateNetworkAcl
525
+ - DeleteNetworkAcl
526
+ - CreateNetworkAclEntry
527
+ - DeleteNetworkAclEntry
528
+ - ReplaceNetworkAclEntry
529
+ - ReplaceNetworkAclAssociation
530
+ - AuthorizeSecurityGroupIngress
531
+ - AuthorizeSecurityGroupEgress
532
+ - RevokeSecurityGroupIngress
533
+ - RevokeSecurityGroupEgress
534
+ - CreateSecurityGroup
535
+ - DeleteSecurityGroup
536
+ - CreateVpc
537
+ - DeleteVpc
538
+ - ModifyVpcAttribute
539
+ - AcceptVpcPeeringConnection
540
+ - CreateVpcPeeringConnection
541
+ - DeleteVpcPeeringConnection
542
+ - RejectVpcPeeringConnection
543
+ - AttachClassicLinkVpc
544
+ - DetachClassicLinkVpc
545
+ - DisableVpcClassicLink
546
+ - EnableVpcClassicLink
547
+ - ModifyImageAttribute
548
+ - ModifySnapshotAttribute
549
+ - ModifyInstanceAttribute
550
+ - ImportKeyPair
551
+ - CreateKeyPair
552
+ - DisableEbsEncryptionByDefault
553
+ - DeleteFlowLogs
554
+ # S3 Events
555
+ - PutBucketPublicAccessBlock
556
+ - DeletePublicAccessBlock
557
+ - PutBucketPolicy
558
+ - DeleteBucketPolicy
559
+ - PutBucketAcl
560
+ - PutBucketEncryption
561
+ - DeleteBucketEncryption
562
+ - DeleteBucket
563
+ # RDS Events
564
+ - ModifyDBInstance
565
+ - ModifyDBSnapshotAttribute
566
+ - DeleteDBInstance
567
+ - DeleteDBClusterSnapshot
568
+ - RestoreDBInstanceFromDBSnapshot
569
+ State: ENABLED
570
+ Targets:
571
+ - Id: ApiDestinationTarget
572
+ Arn: !GetAtt SecurityApiDestination.Arn
573
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
574
+
575
+ OperationsAndSecretsSecurityRule:
576
+ Type: AWS::Events::Rule
577
+ DependsOn: SecurityApiDestination
578
+ Properties:
579
+ Tags:
580
+ - Key: Project
581
+ Value: MeyiConnect
582
+ - Key: Created_for
583
+ Value: L1 Security
584
+ - Key: aws-apn-id
585
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
586
+ Name: !Sub "\${ParentStackName}-OpsSecretsRule"
587
+ Description: Lambda, SSM, Secrets Manager, and KMS configuration/management events
588
+ EventPattern:
589
+ source:
590
+ - aws.lambda
591
+ - aws.ssm
592
+ - aws.secretsmanager
593
+ - aws.kms
594
+ detail-type:
595
+ - AWS API Call via CloudTrail
596
+ detail:
597
+ eventSource:
598
+ - lambda.amazonaws.com
599
+ - ssm.amazonaws.com
600
+ - secretsmanager.amazonaws.com
601
+ - kms.amazonaws.com
602
+ eventName:
603
+ # Lambda, SSM, Secrets Manager
604
+ - AddPermission
605
+ - CreateFunction
606
+ - UpdateFunctionCode
607
+ - CreateEventSourceMapping
608
+ - SendCommand
609
+ - StartSession
610
+ - PutParameter
611
+ - DeleteParameter
612
+ - DeleteSecret
613
+ - PutResourcePolicy
614
+ # KMS
615
+ - ScheduleKeyDeletion
616
+ - DisableKey
617
+ - DisableKeyRotation
618
+ - PutKeyPolicy
619
+ - DeleteAlias
620
+ - CancelKeyDeletion
621
+ State: ENABLED
622
+ Targets:
623
+ - Id: ApiDestinationTarget
624
+ Arn: !GetAtt SecurityApiDestination.Arn
625
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
626
+
627
+ AuditAndTamperingSecurityRule:
628
+ Type: AWS::Events::Rule
629
+ DependsOn: SecurityApiDestination
630
+ Properties:
631
+ Tags:
632
+ - Key: Project
633
+ Value: MeyiConnect
634
+ - Key: Created_for
635
+ Value: L1 Security
636
+ - Key: aws-apn-id
637
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
638
+ Name: !Sub "\${ParentStackName}-AuditRule"
639
+ Description: CloudTrail, GuardDuty, Security Hub, and Config auditing or tampering events
640
+ EventPattern:
641
+ source:
642
+ - aws.cloudtrail
643
+ - aws.securityhub
644
+ - aws.guardduty
645
+ - aws.config
646
+ detail-type:
647
+ - AWS API Call via CloudTrail
648
+ detail:
649
+ eventSource:
650
+ - cloudtrail.amazonaws.com
651
+ - securityhub.amazonaws.com
652
+ - guardduty.amazonaws.com
653
+ - config.amazonaws.com
654
+ eventName:
655
+ # CloudTrail
656
+ - CreateTrail
657
+ - UpdateTrail
658
+ - DeleteTrail
659
+ - StartLogging
660
+ - StopLogging
661
+ - PutEventSelectors
662
+ - DeleteEventDataStore
663
+ # Security Services Tampering
664
+ - BatchDisableStandards
665
+ - DeleteMembers
666
+ - DisassociateMembers
667
+ - DeleteDetector
668
+ - UpdateDetector
669
+ - CreateFilter
670
+ - StopMonitoringMembers
671
+ - DisableSecurityHub
672
+ - StopConfigurationRecorder
673
+ - DeleteConfigurationRecorder
674
+ - DeleteDeliveryChannel
675
+ State: ENABLED
676
+ Targets:
677
+ - Id: ApiDestinationTarget
678
+ Arn: !GetAtt SecurityApiDestination.Arn
679
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
680
+
681
+ ControlTowerManagedRule:
682
+ Type: AWS::Events::Rule
683
+ DependsOn: SecurityApiDestination
684
+ Properties:
685
+ Tags:
686
+ - Key: Project
687
+ Value: MeyiConnect
688
+ - Key: Created_for
689
+ Value: L1 Security
690
+ - Key: aws-apn-id
691
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
692
+ Name: !Sub "\${ParentStackName}-CtrlTowerRule"
693
+ Description: Security Hub findings imported by AWS Control Tower
694
+ EventPattern:
695
+ source:
696
+ - aws.securityhub
697
+ detail-type:
698
+ - Security Hub Findings - Imported
699
+ detail:
700
+ findings:
701
+ Compliance:
702
+ AssociatedStandards:
703
+ StandardsId:
704
+ - prefix: standards/service-managed-aws-control-tower
705
+ State: ENABLED
706
+ Targets:
707
+ - Id: ApiDestinationTarget
708
+ Arn: !GetAtt SecurityApiDestination.Arn
709
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
710
+
711
+ Outputs:
712
+ CloudTrailMode:
713
+ Description: CloudTrail deployment mode
714
+ Value: !If
715
+ - CreateNewTrail
716
+ - Created new CloudTrail
717
+ - Reusing existing CloudTrail
718
+
719
+ CloudTrailBucket:
720
+ Description: S3 Bucket used for CloudTrail
721
+ Value: !If
722
+ - CreateNewTrail
723
+ - !Ref CloudTrailS3Bucket
724
+ - N/A - reusing existing CloudTrail
725
+ PermissionModel: !If [ IsServiceManaged, 'SERVICE_MANAGED', 'SELF_MANAGED' ]
726
+ AdministrationRoleARN: !If
727
+ - IsSelfManaged
728
+ - !If
729
+ - ShouldCreateRoles
730
+ - !GetAtt StackSetAdministrationRole.Arn
731
+ - !Sub "arn:aws:iam::\${AWS::AccountId}:role/AWSCloudFormationStackSetAdministrationRole"
732
+ - !Ref "AWS::NoValue"
733
+ ExecutionRoleName: !If [ IsSelfManaged, 'AWSCloudFormationStackSetExecutionRole', !Ref "AWS::NoValue" ]
734
+ AutoDeployment: !If
735
+ - IsServiceManaged
736
+ - Enabled: true
737
+ RetainStacksOnAccountRemoval: false
738
+ - !Ref "AWS::NoValue"
739
+ Parameters:
740
+ - ParameterKey: ParentStackName
741
+ ParameterValue: !Ref "AWS::StackName"
742
+ - ParameterKey: WebhookUrl
743
+ ParameterValue: !Ref WebhookUrl
744
+ - ParameterKey: WebhookAuthToken
745
+ ParameterValue: !Ref WebhookAuthToken
746
+ - ParameterKey: CreateCloudTrail
747
+ ParameterValue: !Ref CreateCloudTrail
748
+ - ParameterKey: PrimaryRegion
749
+ ParameterValue: !Ref PrimaryRegion
750
+ StackInstancesGroup: !If
751
+ - ShouldCreateStackInstances
752
+ - - DeploymentTargets:
753
+ OrganizationalUnitIds: !If [ HasTargetOUs, !Ref TargetOUs, !Ref "AWS::NoValue" ]
754
+ Accounts: !If
755
+ - IsSelfManaged
756
+ - - !Ref AWS::AccountId
757
+ - !If [ HasTargetAccounts, !Ref TargetAccounts, !Ref "AWS::NoValue" ]
758
+ AccountFilterType: !If [ IsServiceManaged, !If [ HasTargetAccounts, INTERSECTION, !Ref "AWS::NoValue" ], !Ref "AWS::NoValue" ]
759
+ Regions: !Ref TargetRegions
760
+ - !Ref "AWS::NoValue"
761
+ OperationPreferences:
762
+ MaxConcurrentPercentage: 50
763
+ FailureToleranceCount: 1
764
+ RegionConcurrencyType: PARALLEL
765
+ Capabilities:
766
+ - CAPABILITY_NAMED_IAM
767
+ Tags:
768
+ - Key: Project
769
+ Value: MeyiConnectSecurityMonitoring
770
+ - Key: Created_for
771
+ Value: L1 Security
772
+ - Key: aws-apn-id
773
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
774
+
775
+ GlobalSecurityMonitoringStackSet:
776
+ Type: AWS::CloudFormation::StackSet
777
+ DependsOn:
778
+ - StackSetApiDestination
779
+ - StackSetOperationRule
780
+ Properties:
781
+ StackSetName: !Sub "\${AWS::StackName}-SecurityMonitoring-Global"
782
+ Description: !Sub "\${AWS::StackName} Global Security Monitoring (us-east-1 only)"
783
+ TemplateBody: |
784
+ AWSTemplateFormatVersion: '2010-09-09'
785
+ Description: |
786
+ Meyi Connect Security Monitoring - Global Events Stack (us-east-1). Fully independent of
787
+ the regional Central Stack. Captures IAM, Root Login, Console Login Failure, and AWS Health
788
+ events (all global services that only fire in us-east-1) and delivers them directly to the
789
+ Meyi Connect webhook via EventBridge API Destinations (Serverless / Raw Event Payload). No cross-region forwarding,
790
+ no shared resources with any other stack.
791
+
792
+ Parameters:
793
+ ParentStackName:
794
+ Type: String
795
+ Default: "MeyiConnect"
796
+ Description: Parent stack name prefix used for naming resources.
797
+
798
+ WebhookUrl:
799
+ Type: String
800
+ Description: MeyiConnect webhook URL for global security alerts.
801
+
802
+ WebhookAuthToken:
803
+ Type: String
804
+ NoEcho: true
805
+ Default: '28e3b2faf28d48f28ef74759f8a40fefbd4be6ccce2544f1aeb63ddcbdebe8d4'
806
+ Description: MeyiConnect Webhook Authorization Token.
807
+
808
+ CreateCloudTrail:
809
+ Type: String
810
+ Default: 'false'
811
+ Description: Dummy parameter for compatibility with meyi-security-monitoring.yaml.
812
+
813
+ PrimaryRegion:
814
+ Type: String
815
+ Default: 'us-east-1'
816
+ Description: Dummy parameter for compatibility with meyi-security-monitoring.yaml.
817
+
818
+ Resources:
819
+
820
+ # ============================================================
821
+ # EVENTBRIDGE API DESTINATION & CONNECTION
822
+ # ============================================================
823
+
824
+ GlobalSecurityApiConnection:
825
+ Type: AWS::Events::Connection
826
+ Properties:
827
+ Name: !Sub "\${ParentStackName}-GlApiConn-\${AWS::Region}"
828
+ Description: API Connection for MeyiConnect Global Security alerts with Bearer Token auth
829
+ AuthorizationType: API_KEY
830
+ AuthParameters:
831
+ ApiKeyAuthParameters:
832
+ ApiKeyName: Authorization
833
+ ApiKeyValue: !Sub "Bearer \${WebhookAuthToken}"
834
+
835
+ GlobalSecurityApiDestination:
836
+ Type: AWS::Events::ApiDestination
837
+ Properties:
838
+ Name: !Sub "\${ParentStackName}-GlApiDest-\${AWS::Region}"
839
+ Description: API Destination for MeyiConnect Global Security alerts
840
+ ConnectionArn: !GetAtt GlobalSecurityApiConnection.Arn
841
+ InvocationEndpoint: !Ref WebhookUrl
842
+ HttpMethod: POST
843
+ InvocationRateLimitPerSecond: 100
844
+
845
+ EventBridgeApiDestinationRole:
846
+ Type: AWS::IAM::Role
847
+ Properties:
848
+ RoleName: !Sub "\${ParentStackName}-GlEbRole-\${AWS::Region}"
849
+ AssumeRolePolicyDocument:
850
+ Version: '2012-10-17'
851
+ Statement:
852
+ - Effect: Allow
853
+ Principal:
854
+ Service: events.amazonaws.com
855
+ Action: sts:AssumeRole
856
+ Policies:
857
+ - PolicyName: InvokeApiDestinationPolicy
858
+ PolicyDocument:
859
+ Version: '2012-10-17'
860
+ Statement:
861
+ - Effect: Allow
862
+ Action:
863
+ - events:InvokeApiDestination
864
+ Resource: !GetAtt GlobalSecurityApiDestination.Arn
865
+ Tags:
866
+ - Key: Project
867
+ Value: MeyiConnect
868
+ - Key: Created_for
869
+ Value: L1 Security
870
+ - Key: aws-apn-id
871
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
872
+
873
+ # ============================================================
874
+ # EVENTBRIDGE RULES - GLOBAL EVENTS
875
+ # ============================================================
876
+
877
+ IAMAndOrganizationsSecurityEventsRule:
878
+ Type: AWS::Events::Rule
879
+ DependsOn: GlobalSecurityApiDestination
880
+ Properties:
881
+ Tags:
882
+ - Key: Project
883
+ Value: MeyiConnect
884
+ - Key: Created_for
885
+ Value: L1 Security
886
+ - Key: aws-apn-id
887
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
888
+ Name: !Sub "\${ParentStackName}-GlobalIAMRule"
889
+ Description: IAM and Organizations security configuration changes
890
+ EventPattern:
891
+ source:
892
+ - aws.iam
893
+ - aws.organizations
894
+ detail-type:
895
+ - AWS API Call via CloudTrail
896
+ detail:
897
+ eventName:
898
+ # IAM events
899
+ - CreateUser
900
+ - DeleteUser
901
+ - CreateAccessKey
902
+ - UpdateAccessKey
903
+ - DeleteAccessKey
904
+ - AttachRolePolicy
905
+ - DetachRolePolicy
906
+ - PutUserPolicy
907
+ - PutRolePolicy
908
+ - UpdateAssumeRolePolicy
909
+ - DeactivateMFADevice
910
+ - CreateLoginProfile
911
+ - UpdateLoginProfile
912
+ - DeleteLoginProfile
913
+ - CreateAccountAlias
914
+ - DeleteAccountAlias
915
+ - UpdateAccountPasswordPolicy
916
+ - DeleteAccountPasswordPolicy
917
+ - DeleteGroupPolicy
918
+ - PutGroupPolicy
919
+ - CreatePolicy
920
+ - DeletePolicy
921
+ - CreatePolicyVersion
922
+ - DeletePolicyVersion
923
+ - AttachUserPolicy
924
+ - DetachUserPolicy
925
+ - AttachGroupPolicy
926
+ - DetachGroupPolicy
927
+ - CreateRole
928
+ - DeleteRole
929
+ - CreateSAMLProvider
930
+ - UpdateSAMLProvider
931
+ - CreateOpenIDConnectProvider
932
+ - UpdateOpenIDConnectProvider
933
+ - CreateServiceSpecificCredential
934
+ # Organizations events
935
+ - LeaveOrganization
936
+ - RemoveAccountFromOrganization
937
+ - DeletePolicy
938
+ - DetachPolicy
939
+ - DisablePolicyType
940
+ - UpdatePolicy
941
+ - CreateAccount
942
+ - InviteAccountToOrganization
943
+ State: ENABLED
944
+ Targets:
945
+ - Id: ApiDestinationTarget
946
+ Arn: !GetAtt GlobalSecurityApiDestination.Arn
947
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
948
+
949
+ ConsoleLoginRule:
950
+ Type: AWS::Events::Rule
951
+ DependsOn: GlobalSecurityApiDestination
952
+ Properties:
953
+ Tags:
954
+ - Key: Project
955
+ Value: MeyiConnect
956
+ - Key: Created_for
957
+ Value: L1 Security
958
+ - Key: aws-apn-id
959
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
960
+ Name: !Sub "\${ParentStackName}-GlobalLoginRule"
961
+ Description: Root login and failed console logins
962
+ EventPattern:
963
+ detail-type:
964
+ - AWS Console Sign In via CloudTrail
965
+ detail:
966
+ eventName:
967
+ - ConsoleLogin
968
+ \$or:
969
+ - userIdentity:
970
+ type:
971
+ - Root
972
+ responseElements:
973
+ ConsoleLogin:
974
+ - Success
975
+ - responseElements:
976
+ ConsoleLogin:
977
+ - Failure
978
+ State: ENABLED
979
+ Targets:
980
+ - Id: ApiDestinationTarget
981
+ Arn: !GetAtt GlobalSecurityApiDestination.Arn
982
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
983
+
984
+ HealthEventsRule:
985
+ Type: AWS::Events::Rule
986
+ DependsOn: GlobalSecurityApiDestination
987
+ Properties:
988
+ Tags:
989
+ - Key: Project
990
+ Value: MeyiConnect
991
+ - Key: Created_for
992
+ Value: L1 Security
993
+ - Key: aws-apn-id
994
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
995
+ Name: !Sub "\${ParentStackName}-GlobalHealthRule"
996
+ Description: AWS Health notifications
997
+ EventPattern:
998
+ source:
999
+ - aws.health
1000
+ detail-type:
1001
+ - AWS Health Event
1002
+ State: ENABLED
1003
+ Targets:
1004
+ - Id: ApiDestinationTarget
1005
+ Arn: !GetAtt GlobalSecurityApiDestination.Arn
1006
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
1007
+
1008
+ RootAPICallsRule:
1009
+ Type: AWS::Events::Rule
1010
+ DependsOn: GlobalSecurityApiDestination
1011
+ Properties:
1012
+ Tags:
1013
+ - Key: Project
1014
+ Value: MeyiConnect
1015
+ - Key: Created_for
1016
+ Value: L1 Security
1017
+ - Key: aws-apn-id
1018
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
1019
+ Name: !Sub "\${ParentStackName}-GlobalRootRule"
1020
+ Description: Capture any API call made by the Root user account in us-east-1
1021
+ EventPattern:
1022
+ detail-type:
1023
+ - AWS API Call via CloudTrail
1024
+ detail:
1025
+ userIdentity:
1026
+ type:
1027
+ - Root
1028
+ State: ENABLED
1029
+ Targets:
1030
+ - Id: ApiDestinationTarget
1031
+ Arn: !GetAtt GlobalSecurityApiDestination.Arn
1032
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
1033
+
1034
+ Outputs:
1035
+ GlobalSecurityApiConnectionArn:
1036
+ Description: Global security alerts EventBridge Connection ARN
1037
+ Value: !GetAtt GlobalSecurityApiConnection.Arn
1038
+
1039
+ GlobalSecurityApiDestinationArn:
1040
+ Description: Global security alerts EventBridge API Destination ARN
1041
+ Value: !GetAtt GlobalSecurityApiDestination.Arn
1042
+ PermissionModel: !If [ IsServiceManaged, 'SERVICE_MANAGED', 'SELF_MANAGED' ]
1043
+ AdministrationRoleARN: !If
1044
+ - IsSelfManaged
1045
+ - !If
1046
+ - ShouldCreateRoles
1047
+ - !GetAtt StackSetAdministrationRole.Arn
1048
+ - !Sub "arn:aws:iam::\${AWS::AccountId}:role/AWSCloudFormationStackSetAdministrationRole"
1049
+ - !Ref "AWS::NoValue"
1050
+ ExecutionRoleName: !If [ IsSelfManaged, 'AWSCloudFormationStackSetExecutionRole', !Ref "AWS::NoValue" ]
1051
+ AutoDeployment: !If
1052
+ - IsServiceManaged
1053
+ - Enabled: true
1054
+ RetainStacksOnAccountRemoval: false
1055
+ - !Ref "AWS::NoValue"
1056
+ Parameters:
1057
+ - ParameterKey: ParentStackName
1058
+ ParameterValue: !Ref "AWS::StackName"
1059
+ - ParameterKey: WebhookUrl
1060
+ ParameterValue: !Ref WebhookUrl
1061
+ - ParameterKey: WebhookAuthToken
1062
+ ParameterValue: !Ref WebhookAuthToken
1063
+ - ParameterKey: CreateCloudTrail
1064
+ ParameterValue: !Ref CreateCloudTrail
1065
+ - ParameterKey: PrimaryRegion
1066
+ ParameterValue: !Ref PrimaryRegion
1067
+ StackInstancesGroup: !If
1068
+ - ShouldCreateStackInstances
1069
+ - - DeploymentTargets:
1070
+ OrganizationalUnitIds: !If [ HasTargetOUs, !Ref TargetOUs, !Ref "AWS::NoValue" ]
1071
+ Accounts: !If
1072
+ - IsSelfManaged
1073
+ - - !Ref AWS::AccountId
1074
+ - !If [ HasTargetAccounts, !Ref TargetAccounts, !Ref "AWS::NoValue" ]
1075
+ AccountFilterType: !If [ IsServiceManaged, !If [ HasTargetAccounts, INTERSECTION, !Ref "AWS::NoValue" ], !Ref "AWS::NoValue" ]
1076
+ Regions:
1077
+ - us-east-1
1078
+ - !Ref "AWS::NoValue"
1079
+ OperationPreferences:
1080
+ MaxConcurrentPercentage: 50
1081
+ FailureToleranceCount: 1
1082
+ RegionConcurrencyType: PARALLEL
1083
+ Capabilities:
1084
+ - CAPABILITY_NAMED_IAM
1085
+ Tags:
1086
+ - Key: Project
1087
+ Value: MeyiConnectSecurityMonitoring
1088
+ - Key: Created_for
1089
+ Value: L1 Security
1090
+ - Key: aws-apn-id
1091
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
1092
+
1093
+ # ============================================================
1094
+ # EVENTBRIDGE API DESTINATION & CONNECTION (PARENT STACKSET STATUS)
1095
+ # ============================================================
1096
+
1097
+ StackSetApiConnection:
1098
+ Type: AWS::Events::Connection
1099
+ Properties:
1100
+ Name: !Sub "\${AWS::StackName}-SsApiConn-\${AWS::Region}"
1101
+ Description: API Connection for MeyiConnect StackSet status notifications
1102
+ AuthorizationType: API_KEY
1103
+ AuthParameters:
1104
+ ApiKeyAuthParameters:
1105
+ ApiKeyName: Authorization
1106
+ ApiKeyValue: !Sub "Bearer \${WebhookAuthToken}"
1107
+
1108
+ StackSetApiDestination:
1109
+ Type: AWS::Events::ApiDestination
1110
+ Properties:
1111
+ Name: !Sub "\${AWS::StackName}-SsApiDest-\${AWS::Region}"
1112
+ Description: API Destination for StackSet status notification webhooks
1113
+ ConnectionArn: !GetAtt StackSetApiConnection.Arn
1114
+ InvocationEndpoint: !Ref BackendUrl
1115
+ HttpMethod: POST
1116
+ InvocationRateLimitPerSecond: 100
1117
+
1118
+ EventBridgeApiDestinationRole:
1119
+ Type: AWS::IAM::Role
1120
+ Properties:
1121
+ RoleName: !Sub "\${AWS::StackName}-SsEbRole-\${AWS::Region}"
1122
+ AssumeRolePolicyDocument:
1123
+ Version: '2012-10-17'
1124
+ Statement:
1125
+ - Effect: Allow
1126
+ Principal:
1127
+ Service: events.amazonaws.com
1128
+ Action: sts:AssumeRole
1129
+ Policies:
1130
+ - PolicyName: InvokeApiDestinationPolicy
1131
+ PolicyDocument:
1132
+ Version: '2012-10-17'
1133
+ Statement:
1134
+ - Effect: Allow
1135
+ Action:
1136
+ - events:InvokeApiDestination
1137
+ Resource: !GetAtt StackSetApiDestination.Arn
1138
+ Tags:
1139
+ - Key: Project
1140
+ Value: MeyiConnect
1141
+ - Key: Created_for
1142
+ Value: L1 Security
1143
+ - Key: aws-apn-id
1144
+ Value: pc:eyl8vo7kcwv8k9qctzbathhiq
1145
+
1146
+ # ============================================================
1147
+ # EVENTBRIDGE RULE (PARENTS STACKSET STATUS)
1148
+ # Forwards native raw StackSet & StackInstance status change events
1149
+ # ============================================================
1150
+
1151
+ StackSetOperationRule:
1152
+ Type: AWS::Events::Rule
1153
+ Properties:
1154
+ Name: !Sub "\${AWS::StackName}-SsNotifier"
1155
+ Description: !Sub Triggers API Destination when StackSet operations occur for customer.
1156
+ EventPattern:
1157
+ source:
1158
+ - aws.cloudformation
1159
+ \$or:
1160
+ - detail-type:
1161
+ - CloudFormation StackSet Status Change
1162
+ detail:
1163
+ stack-set-arn:
1164
+ - prefix: !Sub "arn:aws:cloudformation:\${AWS::Region}:\${AWS::AccountId}:stackset/\${AWS::StackName}-SecurityMonitoring"
1165
+ - detail-type:
1166
+ - CloudFormation StackSet StackInstance Status Change
1167
+ detail:
1168
+ stack-set-arn:
1169
+ - prefix: !Sub "arn:aws:cloudformation:\${AWS::Region}:\${AWS::AccountId}:stackset/\${AWS::StackName}-SecurityMonitoring"
1170
+ status-details:
1171
+ detailed-status:
1172
+ - SUCCEEDED
1173
+ - FAILED
1174
+ - CANCELLED
1175
+ State: ENABLED
1176
+ Targets:
1177
+ - Id: MeyiConnectNotifierTarget
1178
+ Arn: !GetAtt StackSetApiDestination.Arn
1179
+ RoleArn: !GetAtt EventBridgeApiDestinationRole.Arn
1180
+
1181
+ # ============================================================
1182
+ # OUTPUTS
1183
+ # ============================================================
1184
+
1185
+ Outputs:
1186
+
1187
+ StackSetName:
1188
+ Description: Name of the deployed StackSet
1189
+ Value: !Ref SecurityMonitoringStackSet
1190
+
1191
+ StackSetApiConnectionArn:
1192
+ Description: EventBridge Connection ARN for StackSet notifications
1193
+ Value: !GetAtt StackSetApiConnection.Arn
1194
+
1195
+ StackSetApiDestinationArn:
1196
+ Description: EventBridge API Destination ARN for StackSet notifications
1197
+ Value: !GetAtt StackSetApiDestination.Arn
1198
+
1199
+ EventBridgeRuleName:
1200
+ Description: EventBridge rule monitoring StackSet operations
1201
+ Value: !Ref StackSetOperationRule
1202
+
1203
+ DeploymentSummary:
1204
+ Description: Deployment summary
1205
+ Value: !Sub |
1206
+ StackSet: \${AWS::StackName}-SecurityMonitoring
1207
+ Backend: \${BackendUrl}
1208
+
1209
+ `;
1210
+ export function buildCloudTrailCentralStackTemplate(input) {
1211
+ const mode = input.deploymentMode ?? 'Standalone';
1212
+ const createIAMRoles = mode === 'Standalone' ? 'true' : 'false';
1213
+ const targetOUs = input.targetOUs ?? '';
1214
+ const targetAccounts = input.targetAccounts ?? '';
1215
+ const resolvedRegions = (input.targetRegions ?? '').trim() || ALL_AWS_ACTIVE_REGIONS;
1216
+ const primaryRegion = resolvedRegions.split(',')[0].trim() || 'us-east-1';
1217
+ const createCloudTrailDefault = input.createCloudTrail ? "true" : "false";
1218
+ return CENTRAL_STACK_YAML
1219
+ .replace(/__MEYI_WEBHOOK_URL__/g, input.webhookUrl)
1220
+ .replace(/__MEYI_WEBHOOK_AUTH_TOKEN__/g, input.webhookAuthToken || '')
1221
+ .replace(/__MEYI_DEPLOYMENT_STATUS_URL__/g, input.deploymentStatusUrl)
1222
+ .replace(/__MEYI_CREATE_CLOUDTRAIL_DEFAULT__/g, createCloudTrailDefault)
1223
+ .replace(/__MEYI_DEPLOYMENT_MODE__/g, mode)
1224
+ .replace(/__MEYI_CREATE_IAM_ROLES__/g, createIAMRoles)
1225
+ .replace(/__MEYI_TARGET_OUS_DEFAULT__/g, targetOUs ? ` Default: "${targetOUs}"` : "")
1226
+ .replace(/__MEYI_TARGET_ACCOUNTS_DEFAULT__/g, targetAccounts ? ` Default: "${targetAccounts}"` : "")
1227
+ .replace(/__MEYI_TARGET_REGIONS__/g, resolvedRegions)
1228
+ .replace(/__MEYI_PRIMARY_REGION__/g, primaryRegion);
1229
+ }
1230
+ //# sourceMappingURL=template.js.map