@1mill/lambda 中文文档教程

发布于 3年前 浏览 28 项目主页 更新于 3年前

lambda

@aws-sdk/client-lambda 库的简单包装器,用于使用 Cloudevents 调用 AWS Lambda 函数。

Usage

Node

<script src="https://unpkg.com/@1mill/lambda@0.4/dist/index.umd.js"></script>

或者

npm install @1mill/lambda
const { Lambda } = require('@1mill/lambda') // CommonJS
import { Lambda } from '@1mill/lambda' // EMS

const lambda = new Lambda({
  accessKeyId: 'required' || process.env.MILL_LAMBDA_AWS_ACCESS_KEY_ID,
  endpoint: 'optional' || process.env.MILL_LAMBDA_AWS_ENDPOINT,
  region: 'required' || process.env.MILL_LAMBDA_AWS_REGION,
  secretAccessKey: 'required' || process.env.MILL_LAMBDA_AWS_SECRET_ACCESS_KEY,
})
RequiredDefaultNotes
accessKeyIdyesprocess.env.MILLLAMBDAAWSACCESSKEY_ID
endpointprocess.env.MILLLAMBDAAWS_ENDPOINTGood for local development environment when using Localstack (or other AWS simulators)
regionyesprocess.env.MILLLAMBDAAWS_REGION
secretAccessKeyyesprocess.env.MILLLAMBDAAWSSECRETACCESS_KEY
const lambda = new Lambda({...})

await lambda.invoke({
  cloudevent,
  functionName: 'required-my-lambda-arn',
  invocationType: 'optional' || 'Event',
})
RequiredDefaultNotes
cloudeventyes@1mill/cloudevents
functionnameyes
invocationType'Event'Options are 'Event' or 'RequestResponse'

lambda

Simple wrapper around the @aws-sdk/client-lambda library to invoke AWS Lambda functions with Cloudevents.

Usage

Node

<script src="https://unpkg.com/@1mill/lambda@0.4/dist/index.umd.js"></script>

or

npm install @1mill/lambda
const { Lambda } = require('@1mill/lambda') // CommonJS
import { Lambda } from '@1mill/lambda' // EMS

const lambda = new Lambda({
  accessKeyId: 'required' || process.env.MILL_LAMBDA_AWS_ACCESS_KEY_ID,
  endpoint: 'optional' || process.env.MILL_LAMBDA_AWS_ENDPOINT,
  region: 'required' || process.env.MILL_LAMBDA_AWS_REGION,
  secretAccessKey: 'required' || process.env.MILL_LAMBDA_AWS_SECRET_ACCESS_KEY,
})
RequiredDefaultNotes
accessKeyIdyesprocess.env.MILLLAMBDAAWSACCESSKEY_ID
endpointprocess.env.MILLLAMBDAAWS_ENDPOINTGood for local development environment when using Localstack (or other AWS simulators)
regionyesprocess.env.MILLLAMBDAAWS_REGION
secretAccessKeyyesprocess.env.MILLLAMBDAAWSSECRETACCESS_KEY
const lambda = new Lambda({...})

await lambda.invoke({
  cloudevent,
  functionName: 'required-my-lambda-arn',
  invocationType: 'optional' || 'Event',
})
RequiredDefaultNotes
cloudeventyes@1mill/cloudevents
functionnameyes
invocationType'Event'Options are 'Event' or 'RequestResponse'
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文