Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxatX committed Jun 23, 2018
1 parent 2e9acc6 commit 35edbc4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions appState.json
Original file line number Diff line number Diff line change
@@ -0,0 +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}}
19 changes: 19 additions & 0 deletions dynamoapp01/lambda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB.DocumentClient();
exports.handler = function (event, context, callback) {

ddb.put({
TableName: 'usr',
Item: {
'usrid': '1'
}
}, function (err, data) {
if (err) {
//handle error
} else {
//your logic goes here
}
});

callback(null, 'Successfully executed');
}
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "dynamoapp01",
"version": "1.0.0",
"dependencies": {
"aws-sdk": "2.176.0"
}
}

0 comments on commit 35edbc4

Please sign in to comment.