This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handler=void 0;const AWS=require("aws-sdk");async function createLogGroupSafe(logGroupName,region,options){let retryCount=options?.maxRetries==null?10:options.maxRetries;const delay=options?.retryOptions?.base==null?10:options.retryOptions.base;do try{await new AWS.CloudWatchLogs({apiVersion:"2014-03-28",region,...options}).createLogGroup({logGroupName}).promise();return}catch(error){if(error.code==="ResourceAlreadyExistsException")return;if(error.code==="OperationAbortedException")if(retryCount>0){retryCount--,await new Promise(resolve=>setTimeout(resolve,delay));continue}else throw new Error("Out of attempts to create a logGroup");throw error}while(!0)}async function setRetentionPolicy(logGroupName,region,options,retentionInDays){let retryCount=options?.maxRetries==null?10:options.maxRetries;const delay=options?.retryOptions?.base==null?10:options.retryOptions.base;do try{const cloudwatchlogs=new AWS.CloudWatchLogs({apiVersion:"2014 |