-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
81 lines (77 loc) · 2.34 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
const { handler } = require("./output/S3EventSource");
const apiGatewayEvent = {
version: "2.0",
routeKey: "ANY /nodejs-apig-function-1G3XMPLZXVXYI",
rawPath: "/default/nodejs-apig-function-1G3XMPLZXVXYI",
rawQueryString: "",
cookies: [
"s_fid=7AABXMPL1AFD9BBF-0643XMPL09956DE2",
"regStatus=pre-register",
],
headers: {
accept:
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"accept-encoding": "gzip, deflate, br",
},
requestContext: {
accountId: "123456789012",
apiId: "r3pmxmplak",
domainName: "r3pmxmplak.execute-api.us-east-2.amazonaws.com",
domainPrefix: "r3pmxmplak",
http: {
method: "GET",
path: "/default/nodejs-apig-function-1G3XMPLZXVXYI",
protocol: "HTTP/1.1",
sourceIp: "205.255.255.176",
userAgent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36",
},
requestId: "JKJaXmPLvHcESHA=",
routeKey: "ANY /nodejs-apig-function-1G3XMPLZXVXYI",
stage: "default",
time: "10/Mar/2020:05:16:23 +0000",
timeEpoch: 1583817383220,
},
isBase64Encoded: true,
};
// handler({ id: 1, message: "Yo Dawg" }).then((r) => console.log(r));
//handler({ id2: 1, text: "Yo" }).then((r) => console.log(r));
handler({
Records: [
{
eventVersion: "2.0",
eventSource: "aws:s3",
awsRegion: "ap-southeast-2",
eventTime: "1970-01-01T00:00:00.000Z",
eventName: "ObjectCreated:Put",
userIdentity: {
principalId: "EXAMPLE",
},
requestParameters: {
sourceIPAddress: "127.0.0.1",
},
responseElements: {
"x-amz-request-id": "EXAMPLE123456789",
"x-amz-id-2":
"EXAMPLE123/5678abcdefghijklambdaisawesome/mnopqrstuvwxyzABCDEFGH",
},
s3: {
s3SchemaVersion: "1.0",
configurationId: "testConfigRule",
bucket: {
name: "example-bucket",
ownerIdentity: {
principalId: "EXAMPLE",
},
arn: "arn:aws:s3:::example-bucket",
},
object: {
key: "test/key",
size: 1024,
eTag: "0123456789abcdef0123456789abcdef",
sequencer: "0A1B2C3D4E5F678901",
},
},
},
],
}).then((r) => console.log(r));