3scale-lambda 中文文档教程
3scale Lambda generator
该模块生成 Lambda 函数以将 AWS API Gateway 与 3scale 集成。 需要身份验证作为 user_key
查询参数。
Prerequisites
在您的 AWS API 网关终端节点中创建以下映射模板:
{
"user_key": "$input.params('user_key')",
"resourcePath": "$context.resourcePath",
"httpMethod": "$context.httpMethod",
"body": "$input.json('$')"
}
映射模板的Content-Type
应该是application/json
。
Method names
对于每个 API 端点,您应该在 3scale 中创建相应的方法。 这样您就可以跟踪 API 的总体使用情况以及每个端点的细分情况。
请务必按照以下模式在 3scale 中创建方法名称:
- Endpoint HTTP method: GET
- Endpoint path: /api/words
- 3scale method name: apiwordsGET
Using it programatically
var generator = require('3scale-lambda');
var params = {
providerKey: '3SCALE_PROVIDER_KEY',
serviceId: '3SCALE_SERVICE_ID'
};
generator(params, '/output/path/');
这将在 /output/path/3scale-lambda-auth.zip
中创建一个 zip 文件。 该 zip 是包含 Lambda 函数及其所有依赖项的包,可以上传到 AWS。
3scale Lambda generator
This module generates a Lambda function to integrate the AWS API Gateway with 3scale. Authentication will be required as a user_key
query parameter.
Prerequisites
Create the following Mapping Template in your AWS API Gateway endpoint:
{
"user_key": "$input.params('user_key')",
"resourcePath": "$context.resourcePath",
"httpMethod": "$context.httpMethod",
"body": "$input.json('$')"
}
The Content-Type
of the mapping template should be application/json
.
Method names
For each API endpoint you should create the corresponding method in 3scale. That way you will be able to keep track of the aggregate usage of your API as well as the breakdown per endpoint.
It is important that you create the method names in 3scale following this pattern:
- Endpoint HTTP method: GET
- Endpoint path: /api/words
- 3scale method name: apiwordsGET
Using it programatically
var generator = require('3scale-lambda');
var params = {
providerKey: '3SCALE_PROVIDER_KEY',
serviceId: '3SCALE_SERVICE_ID'
};
generator(params, '/output/path/');
This will create a zip file at /output/path/3scale-lambda-auth.zip
. That zip is the bundle containing the Lambda function and all its dependencies, ready to be uploaded to AWS.
你可能也喜欢
- @0x-lerna-fork/package 中文文档教程
- @168496714/create-react-component 中文文档教程
- @1f8/eslint-config-typescript-nodejs 中文文档教程
- @1onlinesolution/dws-models 中文文档教程
- @36node/bus-chart-sdk 中文文档教程
- @36node/redux-cron 中文文档教程
- @3dr/potree 中文文档教程
- @_nu/react-toast 中文文档教程
- @aaa3032/executor-of-cmd-commands 中文文档教程
- @aadhyarupam/ail-elements-lib 中文文档教程