This commit is contained in:
joshbirk 2018-06-04 16:37:38 -05:00
Родитель 3cdb83df49
Коммит f302ffd9eb
2 изменённых файлов: 43 добавлений и 0 удалений

29
AWSConnector/index.js Normal file
Просмотреть файл

@ -0,0 +1,29 @@
var jsforce = require('jsforce');
var conn = new jsforce.Connection({
oauth2 : {
clientId : process.env.clientId,
clientSecret : process.env.clientSecret,
redirectUri : process.env.redirectUri,
},
instanceUrl : process.env.instanceUrl,
accessToken : process.env.accessToken,
refreshToken : process.env.refreshToken
});
conn.oauth2.refreshToken(conn.refreshToken, (err, results) => {
if (err) return reject(err);
console.log('OAUTH2' + JSON.stringify(results));
});
exports.handler = function(event, context) {
conn.sobject("Dolphin__e").create(
{ ID__c : event.ID,
cleaningCycles__c : event.cleaningCycles,
state__c : event.state
}
,
function(err, rets) {
if (err) { return console.error(err); }
console.log('SUCCESS' + JSON.stringify(rets));
});
};

14
AWSConnector/package.json Normal file
Просмотреть файл

@ -0,0 +1,14 @@
{
"name": "awsconnector",
"version": "1.0.0",
"description": "0. Prerequisite",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"jsforce": "^1.8.4"
}
}