mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Merge pull request #15075 from nexus-uw/aws-lambda-s3add-event
added S3 lambda event definition
This commit is contained in:
@@ -12,11 +12,50 @@ var context: AWSLambda.Context;
|
||||
var identity: AWSLambda.CognitoIdentity;
|
||||
var proxyResult: AWSLambda.ProxyResult;
|
||||
var snsEvt: AWSLambda.SNSEvent;
|
||||
var snsEvtRecs: Array<AWSLambda.SNSEventRecord>;
|
||||
var snsEvtRecs: AWSLambda.SNSEventRecord[];
|
||||
var snsEvtRec: AWSLambda.SNSEventRecord;
|
||||
var snsMsg: AWSLambda.SNSMessage;
|
||||
var snsMsgAttr: AWSLambda.SNSMessageAttribute;
|
||||
var snsMsgAttrs: AWSLambda.SNSMessageAttributes;
|
||||
var S3CreateEvent: AWSLambda.S3CreateEvent = {
|
||||
Records: [{
|
||||
eventVersion: 'string',
|
||||
eventSource: 'string',
|
||||
awsRegion: 'string',
|
||||
eventTime: 'string',
|
||||
eventName: 'string',
|
||||
userIdentity: {
|
||||
principalId: 'string'
|
||||
},
|
||||
requestParameters: {
|
||||
sourceIPAddress: 'string'
|
||||
},
|
||||
responseElements: {
|
||||
'x-amz-request-id': 'string',
|
||||
'x-amz-id-2': 'string'
|
||||
},
|
||||
s3: {
|
||||
s3SchemaVersion: 'string',
|
||||
configurationId: 'string',
|
||||
bucket: {
|
||||
name: 'string',
|
||||
ownerIdentity: {
|
||||
principalId: 'string'
|
||||
},
|
||||
arn: 'string'
|
||||
},
|
||||
object: {
|
||||
key: 'string',
|
||||
size: 1,
|
||||
eTag: 'string',
|
||||
versionId: 'string',
|
||||
sequencer: 'string'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
/* API Gateway Event */
|
||||
str = apiGwEvt.body;
|
||||
@@ -78,7 +117,7 @@ num = proxyResult.statusCode;
|
||||
proxyResult.headers["example"] = str;
|
||||
proxyResult.headers["example"] = b;
|
||||
proxyResult.headers["example"] = num;
|
||||
str = proxyResult.body
|
||||
str = proxyResult.body;
|
||||
|
||||
/* Context */
|
||||
b = context.callbackWaitsForEmptyEventLoop;
|
||||
@@ -142,5 +181,5 @@ context.fail(error);
|
||||
context.fail(str);
|
||||
|
||||
/* Handler */
|
||||
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => {};
|
||||
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => {};
|
||||
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
|
||||
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
|
||||
|
||||
Vendored
+44
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AWS Lambda
|
||||
// Project: http://docs.aws.amazon.com/lambda
|
||||
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>
|
||||
// Definitions by: James Darbyshire <https://github.com/darbio/aws-lambda-typescript>, Michael Skarum <https://github.com/skarum>, Stef Heyenrath <https://github.com/StefH/DefinitelyTyped>, Toby Hede <https://github.com/tobyhede>, Rich Buggy <https://github.com/buggy>, Simon Ramsay <https://github.com/nexus-uw>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// API Gateway "event"
|
||||
@@ -74,6 +74,49 @@ interface SNSEvent {
|
||||
Records: Array<SNSEventRecord>;
|
||||
}
|
||||
|
||||
/**
|
||||
* S3Create event
|
||||
* https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html
|
||||
*/
|
||||
interface S3CreateEvent {
|
||||
Records: [{
|
||||
eventVersion: string;
|
||||
eventSource: string;
|
||||
awsRegion: string
|
||||
eventTime: string;
|
||||
eventName: string;
|
||||
userIdentity: {
|
||||
principalId: string;
|
||||
},
|
||||
requestParameters: {
|
||||
sourceIPAddress: string;
|
||||
},
|
||||
responseElements: {
|
||||
'x-amz-request-id': string;
|
||||
'x-amz-id-2': string;
|
||||
},
|
||||
s3: {
|
||||
s3SchemaVersion: string;
|
||||
configurationId: string;
|
||||
bucket: {
|
||||
name: string;
|
||||
ownerIdentity: {
|
||||
principalId: string;
|
||||
},
|
||||
arn: string;
|
||||
},
|
||||
object: {
|
||||
key: string;
|
||||
size: number;
|
||||
eTag: string;
|
||||
versionId: string;
|
||||
sequencer: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
// Context
|
||||
// http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-context.html
|
||||
interface Context {
|
||||
|
||||
Reference in New Issue
Block a user