[@types/aws-lambda]: Add extractedFields optional field (#27670)

* [@types/aws-lambda]: Add extractedFields optional field

Added an undocumented optional field to a datatype which is sent zipped and base64 encoded. This field is only available if users select certain options when creating a subscription filter.

You can see the field used if you create a subscription filter to elasticsearch and look at the source for the builtin lambda. I couldn't find any documentation for this field except in the terms "fields extracted" [here](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html) and found some amazon code referencing it [here](https://github.com/amazon-archives/cloudwatch-logs-subscription-consumer/blob/master/src/test/resources/aws-lambda-log-example.json#L14).

I nearly went insane tracking this down.

* Narrow the type of extracted fields to string:string

* Add test for extracted fields
This commit is contained in:
David J. Felix
2018-08-06 14:34:23 -04:00
committed by Sheetal Nandi
parent c1b7e33e7f
commit efe7ba616a
2 changed files with 2 additions and 0 deletions

View File

@@ -479,6 +479,7 @@ str = cloudwatchLogsDecodedData.messageType;
str = cloudwatchLogsDecodedData.logEvents[0].id;
num = cloudwatchLogsDecodedData.logEvents[0].timestamp;
str = cloudwatchLogsDecodedData.logEvents[0].message;
str = cloudwatchLogsDecodedData.logEvents[0].extractedFields!["example"];
/* ClientContext */
clientContextClient = clientCtx.client;

View File

@@ -371,6 +371,7 @@ export interface CloudWatchLogsLogEvent {
id: string;
timestamp: number;
message: string;
extractedFields?: {[key: string]: string};
}
// Context