in source/services/helper/index.ts [381:414]
async function deleteDestination(destinationName: string, regions: string[]) {
logger.info({
label: "helper/deleteDestination",
message: `deleting cw logs destinations `,
});
await Promise.allSettled(
regions.map(async (region) => {
const cwLogs = new CloudWatchLogs({
apiVersion: awsClients.cwLogs,
region: region,
customUserAgent: process.env.CUSTOM_SDK_USER_AGENT,
});
await cwLogs
.deleteDestination({ destinationName: destinationName })
.promise()
.then(() => {
logger.debug({
label: "helper/deleteDestination",
message: `cw logs destination deleted in ${region}`,
});
})
.catch((e) => {
logger.warn({
label: `helper/deleteDestination`,
message: `${region}: ${(e as Error).message}`,
});
});
})
);
logger.info({
label: "helper/deleteDestinations",
message: `All cw logs destinations deleted`,
});
}