Lambda プロキシ統合での 関数コード例:
exports.handler = async(event) => { const addr = require('./addr.json'); const keywords = event.queryStringParameters.q.replace(/-/, "").trim().split(/\s+/); ... const response = { statusCode: 200, body: JSON.stringify(patterns), }; return response; };メモ
- response.body は文字列で返します。
Lambda プロキシ統合での event 内容例:
{ "resource": "/Yubin2", "path": "/Yubin2", "httpMethod": "GET", "headers": null, "multiValueHeaders": null, "queryStringParameters": { "q": "123" }, "multiValueQueryStringParameters": { "q": [ "123" ] }, "pathParameters": null, "stageVariables": null, "requestContext": { "path": "/Yubin2", "accountId": "ACCOUNT1", "resourceId": "ID1", "stage": "test-invoke-stage", "domainPrefix": "testPrefix", "requestId": "ID2", "identity": { "cognitoIdentityPoolId": null, "cognitoIdentityId": null, "apiKey": "test-invoke-api-key", "cognitoAuthenticationType": null, "userArn": "arn:aws:iam::ACCOUNT1:root", "apiKeyId": "test-invoke-api-key-id", "userAgent": "aws-internal/3 aws-sdk-java/1.11.432 Linux/4.9.124-0.1.ac.198.71.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.181-b13 java/1.8.0_181", "accountId": "ACCOUNT1", "caller": "ACCOUNT1", "sourceIp": "test-invoke-source-ip", "accessKey": "ID5", "cognitoAuthenticationProvider": null, "user": "ACCOUNT1" }, "domainName": "testPrefix.testDomainName", "resourcePath": "/Yubin2", "httpMethod": "GET", "extendedRequestId": "ID3", "apiId": "ID4" }, "body": null, "isBase64Encoded": false }
0 件のコメント:
コメントを投稿