How to use the @cumulus/aws-client/services.kinesis function in @cumulus/aws-client

To help you get started, we’ve selected a few @cumulus/aws-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / packages / api / lambdas / manual-consumer.js View on Github external
'use strict';

const awsServices = require('@cumulus/aws-client/services');
const log = require('@cumulus/common/log');

const messageConsumer = require('./message-consumer');

const Kinesis = awsServices.kinesis();
const tallyReducer = (acc, cur) => acc + cur;

/**
 * This function will accept as valid input an event whose `endTimestamp` and `startTimestamp`
 * fields must contain valid input to the `new Date()` constructor if they exist.
 * They will then be populated into `process.env` as ISO strings.
 *
 * @param {Object} event - input object
 */
const configureTimestampEnvs = (event) => {
  if (!process.env.endTimestamp && event.endTimestamp) {
    const dateObj = new Date(event.endTimestamp);
    if (Number.isNaN(dateObj.valueOf())) {
      throw new TypeError(`endTimestamp ${event.endTimestamp} is not a valid input for new Date().`);
    }
    process.env.endTimestamp = dateObj.toISOString();