EndemolShineGroup/serverless-test-utils

View on GitHub
src/aws/cloudWatch/putCloudWatchEvents.ts

Summary

Maintainability
A
0 mins
Test Coverage
import AWS from 'aws-sdk';

export default (sources: string[]) => {
  const cloudwatchEvents = new AWS.CloudWatchEvents();
  const entries = sources.map((source) => {
    return {
      Detail: '{ "key1": "value1" }',
      DetailType: 'serverlessDetailType',
      Source: source,
    };
  });

  const params = {
    Entries: entries,
  };

  return cloudwatchEvents.putEvents(params).promise();
};