json - AWS Lambda Handler extend S3event -


i have following pipeline:

a file uploaded s3, triggers lambda (let's call l1) runs , processing.

so @ moment, entry point looks this:

public response handlerequest(s3event event, context context) {   .... } 

now, s3event json looks this:

        {             "records": [                 {                     "awsregion": "xxxxx",                     "eventname": "objectcreated:put",                     "eventsource": "aws:s3",                     "eventtime": "2017-09-12t09:27:59.471z",                     "eventversion": "2.0",                     "requestparameters": {                         "sourceipaddress": "xxxxxx"                     },                     "responseelements": {                         "x-amz-id-2": "xxxxxx",                         "x-amz-request-id": "xxxx"                     },                     "s3": {                         "configurationid": "xxxxxx1",                         "bucket": {                             "name": "xxxxx",                             "owneridentity": {                                 "principalid": "xxxxx"                             },                             "arn": "xxx"                         },                         "object": {                             "key": "xxx",                             "size": xxx,                             "etag": "xxxx",                             "versionid": null,                             "sequencer": "xxx",                             "urldecodedkey": "xxx"                         },                         "s3schemaversion": "1.0"                     },                     "useridentity": {                         "principalid": "xxxx"                     }                 }             ],         } 

if pass json in "test" section, succeed.

now, point: wish add information json, this:

        {             "records": [                 {                     "awsregion": "xxxxx",                     "eventname": "objectcreated:put",                     "eventsource": "aws:s3",                     "eventtime": "2017-09-12t09:27:59.471z",                     "eventversion": "2.0",                     "requestparameters": {                         "sourceipaddress": "xxxxxx"                     },                     "responseelements": {                         "x-amz-id-2": "xxxxxx",                         "x-amz-request-id": "xxxx"                     },                     "s3": {                         "configurationid": "xxxxxx1",                         "bucket": {                             "name": "xxxxx",                             "owneridentity": {                                 "principalid": "xxxxx"                             },                             "arn": "xxx"                         },                         "object": {                             "key": "xxx",                             "size": xxx,                             "etag": "xxxx",                             "versionid": null,                             "sequencer": "xxx",                             "urldecodedkey": "xxx"                         },                         "s3schemaversion": "1.0"                     },                     "useridentity": {                         "principalid": "xxxx"                     }                 }             ],               "myerrormessage":                 {                 "envelopeerrors": [                     {                         "envelopeerrortrace": "stacktrace",                         "envelopeerrorpositions": 1,                         "envelopeerrorlength": 2                     },                     {                         "envelopeerrortrace": "secondtrace",                         "envelopeerrorpositions": 3,                         "envelopeerrorlength": 4                     }                 ],                 }         } 

notice s3event json bit more data.

my question problem following: want have custom input works when pure s3event called.

 public response handlerequest(mys3event event, context context) {     ....  } 

however, have not been able achieve this.

i have tried custom pojo not work when upload s3 file. tried extend s3eventnotification class (from s3event extends), again no success.

is possible trying do?

what can have lambda (l1) call (asynchronously) sending new, modified event similar how recursive functions work.

just careful though. have put limit how deep want keep recursing. don't want end infinite calls. not sure if aws guards against this.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -