How to use the @cumulus/ingest/aws.invoke function in @cumulus/ingest

To help you get started, we’ve selected a few @cumulus/ingest 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 / models / rules.js View on Github external
if (re.test(item.name)) {
      throw new Error('Names may only contain letters, numbers, and underscores.');
    }

    // Initialize new rule object
    let newRuleItem = cloneDeep(item);

    // the default state is 'ENABLED'
    if (!item.state) {
      newRuleItem.state = 'ENABLED';
    }

    const payload = await Rule.buildPayload(newRuleItem);
    switch (newRuleItem.rule.type) {
    case 'onetime': {
      await invoke(process.env.invoke, payload);
      break;
    }
    case 'scheduled': {
      await this.addRule(newRuleItem, payload);
      break;
    }
    case 'kinesis': {
      const ruleArns = await this.addKinesisEventSources(newRuleItem);
      newRuleItem = this.updateKinesisRuleArns(newRuleItem, ruleArns);
      break;
    }
    case 'sns': {
      if (newRuleItem.state === 'ENABLED') {
        const snsSubscriptionArn = await this.addSnsTrigger(newRuleItem);
        newRuleItem = this.updateSnsRuleArn(newRuleItem, snsSubscriptionArn);
      }
github nasa / cumulus / packages / api / models / granules.js View on Github external
workflow,
      payload: {
        granules: [g]
      },
      provider: g.provider,
      collection: {
        name,
        version
      },
      queueName,
      asyncOperationId
    });

    await this.updateStatus({ granuleId: g.granuleId }, 'running');

    await aws.invoke(process.env.invoke, lambdaPayload);
  }
github nasa / cumulus / packages / api / models / rules.js View on Github external
static async invoke(item) {
    const payload = await Rule.buildPayload(item);
    await invoke(process.env.invoke, payload);
  }
github nasa / cumulus / packages / api / models / granules.js View on Github external
reingestGranule: true,
          forceDuplicateOverwrite: true
        }
      },
      payload: originalMessage.payload,
      provider: granule.provider,
      collection: {
        name,
        version
      },
      queueName: granule.queueName
    });

    await this.updateStatus({ granuleId: granule.granuleId }, 'running');

    return aws.invoke(process.env.invoke, lambdaPayload);
  }
github nasa / cumulus / packages / api / endpoints / reconciliation-reports.js View on Github external
async function post(req, res) {
  const data = await invoke(process.env.invokeReconcileLambda, {});
  return res.send({ message: 'Report is being generated', status: data.StatusCode });
}
github nasa / cumulus / daac-ops-api / lib / utils.js View on Github external
payload: {
      granules: [{
        granuleId: granule.granuleId,
        files: granule.files
      }]
    }
  });

  await partialRecordUpdate(
    null,
    granule.granuleId,
    'granule',
    { status: 'running' },
    granule.collectionId
  );
  await invoke(process.env.invoke, payload);
  return {
    granuleId: granule.granuleId,
    action: 'reingest',
    status: 'SUCCESS'
  };
}
github nasa / cumulus / packages / api / models / granules.js View on Github external
const originalMessage = JSON.parse(status.execution.input);

    const payload = await Rule.buildPayload({
      workflow: 'IngestGranule',
      provider: g.provider,
      collection: {
        name,
        version
      },
      meta: originalMessage.meta,
      payload: originalMessage.payload
    });

    await this.updateStatus({ granuleId: g.granuleId }, 'running');

    await aws.invoke(process.env.invoke, payload);
    return {
      granuleId: g.granuleId,
      action: 'reingest',
      status: 'SUCCESS'
    };
  }