Skip to content

Commit

Permalink
add event
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxatX committed Jun 23, 2018
1 parent 35edbc4 commit 5396ceb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion appState.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"EDITOR_STATE":{"allProjectFiles":{"265e55c2-c5e0-429c-be6f-011af846b434":{"id":"265e55c2-c5e0-429c-be6f-011af846b434","parent":null,"name":"dynamoapp01","type":"DIRECTORY","isDirectory":true,"children":["f5ccc46c-21b4-431c-8aed-b121e67b0e56"],"isRemovable":false,"filePath":"dynamoapp01"},"f5ccc46c-21b4-431c-8aed-b121e67b0e56":{"id":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","parent":"265e55c2-c5e0-429c-be6f-011af846b434","name":"lambda.js","type":"LAMBDA_FILE","isDirectory":false,"children":[],"isRemovable":true,"filePath":"dynamoapp01/lambda.js","code":"let AWS = require('aws-sdk');\nconst ddb = new AWS.DynamoDB.DocumentClient();\nexports.handler = function (event, context, callback) {\n\n\tddb.put({\n\t\tTableName: 'usr',\n\t\tItem: {\n\t\t\t'usrid': '1'\n\t\t}\n\t}, function (err, data) {\n\t\tif (err) {\n\t\t\t//handle error\n\t\t} else {\n\t\t\t//your logic goes here\n\t\t}\n\t});\n\n\tcallback(null, 'Successfully executed');\n}","triggers":[],"config":{"memory":128,"timeout":60,"runtime":"nodejs8.10"},"version":5,"syncVersion":5,"testCases":{"ac7b383f-2cb8-4c58-afbe-e8c50fc5139d":{"id":"ac7b383f-2cb8-4c58-afbe-e8c50fc5139d","name":"sss","functionId":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","event":"{\n \"key1\": \"value1\",\n \"key2\": \"value2\",\n \"key3\": \"value3\"\n}"}}}},"rootNode":"265e55c2-c5e0-429c-be6f-011af846b434","openFiles":["f5ccc46c-21b4-431c-8aed-b121e67b0e56"],"currentFileId":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","resources":{"ddbusr":{"name":"ddbusr","type":"DynamoDB","config":{"mode":0,"operation":"put","table":{"arn":"","name":"usr","partitionKey":"usrid","partitionKeyType":"S","hasSortKey":false,"sortKey":"","sortKeyType":"S","mode":0},"parameters":{"TableName":"usr","Item":{"usrid":"1"}},"validator":{"validatableFields":{},"validity":true},"valid":true},"globallyEditable":false}},"envVariables":[{"lambdaId":"all","varKey":"SIGMA_AWS_ACC_ID","varValue":null,"shouldPersist":false,"editable":false}],"packageJSON":{"dependencies":{"aws-sdk":{"name":"aws-sdk","version":"2.176.0","notRemovable":true}}},"lambdaId":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","additionalFiles":[]},"PROJECT_META":{"projectName":"dynamoapp01","projectDescription":"dynamodbmx","projectVersion":"1.0.0","projectRegion":"eu-central-1","repoName":"dynamoapp01","repoUrl":"https://github.com/MaxatX/dynamoapp01","lastSave":1529756825758}}
{"EDITOR_STATE":{"allProjectFiles":{"265e55c2-c5e0-429c-be6f-011af846b434":{"id":"265e55c2-c5e0-429c-be6f-011af846b434","parent":null,"name":"dynamoapp01","type":"DIRECTORY","isDirectory":true,"children":["f5ccc46c-21b4-431c-8aed-b121e67b0e56"],"isRemovable":false,"filePath":"dynamoapp01"},"f5ccc46c-21b4-431c-8aed-b121e67b0e56":{"id":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","parent":"265e55c2-c5e0-429c-be6f-011af846b434","name":"lambda.js","type":"LAMBDA_FILE","isDirectory":false,"children":[],"isRemovable":true,"filePath":"dynamoapp01/lambda.js","code":"let AWS = require('aws-sdk');\nconst ddb = new AWS.DynamoDB.DocumentClient();\nexports.handler = function (event, context, callback) {\n\n\tconsole.log(event);\n\tcontext.succeed('hello ' + event.name);\n\n\tddb.put({\n\t\tTableName: 'usr',\n\t\tItem: {\n\t\t\t'usrid': '1'\n\t\t}\n\t}, function (err, data) {\n\t\tif (err) {\n\t\t\t//handle error\n\t\t} else {\n\t\t\t//your logic goes here\n\t\t}\n\t});\n\n\tcallback(null, 'Successfully executed');\n}","triggers":[],"config":{"memory":128,"timeout":60,"runtime":"nodejs8.10"},"version":27,"syncVersion":17,"testCases":{"ac7b383f-2cb8-4c58-afbe-e8c50fc5139d":{"id":"ac7b383f-2cb8-4c58-afbe-e8c50fc5139d","name":"sss","functionId":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","event":"{\n \"key1\": \"value1\",\n \"key2\": \"value2\",\n \"key3\": \"value3\"\n}"}},"references":[]}},"rootNode":"265e55c2-c5e0-429c-be6f-011af846b434","openFiles":["f5ccc46c-21b4-431c-8aed-b121e67b0e56"],"currentFileId":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","resources":{"ddbusr":{"name":"ddbusr","type":"DynamoDB","config":{"mode":0,"operation":"put","table":{"arn":"","name":"usr","partitionKey":"usrid","partitionKeyType":"S","hasSortKey":false,"sortKey":"","sortKeyType":"S","mode":0},"parameters":{"TableName":"usr","Item":{"usrid":"1"}},"validator":{"validatableFields":{},"validity":true},"valid":true},"globallyEditable":false}},"envVariables":[{"lambdaId":"all","varKey":"SIGMA_AWS_ACC_ID","varValue":null,"shouldPersist":false,"editable":false}],"packageJSON":{"dependencies":{"aws-sdk":{"name":"aws-sdk","version":"2.176.0","notRemovable":true}}},"lambdaId":"f5ccc46c-21b4-431c-8aed-b121e67b0e56","additionalFiles":[]},"PROJECT_META":{"projectName":"dynamoapp01","projectDescription":"dynamodbmx","projectVersion":"1.0.0","projectRegion":"eu-central-1","repoName":"dynamoapp01","repoUrl":"https://github.com/MaxatX/dynamoapp01","lastSave":1529758536053}}
3 changes: 3 additions & 0 deletions dynamoapp01/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ let AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB.DocumentClient();
exports.handler = function (event, context, callback) {

console.log(event);
context.succeed('hello ' + event.name);

ddb.put({
TableName: 'usr',
Item: {
Expand Down

0 comments on commit 5396ceb

Please sign in to comment.