Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
move from s3 to sns
Browse files Browse the repository at this point in the history
  • Loading branch information
ste-xx committed Jun 3, 2018
1 parent d53ab3d commit cc0190f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 48 deletions.
16 changes: 7 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ let s3Api = test ? require('./test/s3ApiMock.js') : require('./s3Api.js');
exports.handler = async (event) => {

let {
Records: [{
s3: {
bucket: {
name: bucketName
},
object: {
key: key
}
MessageAttributes: {
bucket: {
Value: bucketName
},
key: {
Value: key
}
}]
}
} = event;

let fbFn = {
Expand Down
38 changes: 0 additions & 38 deletions test/s3EventData.json

This file was deleted.

21 changes: 21 additions & 0 deletions test/snsEventData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Type": "Notification",
"MessageId": "38c6d7ad-31ea-5dfa-ab09-84234e60df79",
"TopicArn": "arn:aws:sns:eu-west-1:029902516270:s2t-base-s2tNewFile-1SSWKUD35MW0J",
"Message": "not_empty",
"Timestamp": "2018-06-03T23:44:10.678Z",
"SignatureVersion": "1",
"Signature": "dlsQQtE23X1QBzN5SqHzTiSrpGxMnNCe3Eu5fYfVS+b2Y6uLpc9E27bTKFqTBf/XuvLiKYv/gba1KF5+dZk3inxkwE82cU0kZmULVRmPgylpdcdCjVURskCYugWoI6SmRY1mN2/0hb7bdNmt4KW3hnAUWKSiqcrIQNHURn4t9WUuhCMvqarTmc9j0G5XgO4wKQCrqTYSRreHe0qHdoAoM+ab1htptqCpCUKX8cs1nfwUqf7bPttJhaxUlIIyDTDo4NbS3i+LHxO1OLbTm9BkpDJBDKXBXIPLSkLMtZhQi94b5M6XXANOFls8gCIxHZlQzdU+EsjeXdFAq2MswpCY5Q==",
"SigningCertURL": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-eaea6120e66ea12e88dcd8bcbddca752.pem",
"UnsubscribeURL": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:eu-west-1:029902516270:s2t-base-s2tNewFile-1SSWKUD35MW0J:fa2b8a09-b038-4c79-b49d-b0d4eb71b5d2",
"MessageAttributes": {
"bucket": {
"Type": "String",
"Value": "s2t-base-s2tbucket-19xbw73dypb0s"
},
"key": {
"Type": "String",
"Value": "gcp/not-transcoded/sugr1km8s6/f423fbfb-6381-11e8-a23f-c7cbebde15f2.ogg"
}
}
}
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require('dotenv').config({
const expect = require('chai').expect;

const fs = require('fs');
const event = JSON.parse(fs.readFileSync('test/s3EventData.json', 'utf8'));
const event = JSON.parse(fs.readFileSync('test/snsEventData.json', 'utf8'));

describe('eventhandler', () => {

Expand Down

0 comments on commit cc0190f

Please sign in to comment.