in source/services/deployments/lib/addDeployment.js [293:356]
createdAt: moment()
.utc()
.format(),
updatedAt: moment()
.utc()
.format()
};
return _savedDeployment;
});
} else {
console.log('Device is NOT a greengrass device, or at least not detected as one. OR the deviceBlueprint/deviceType combination is not for a Greengrass device');
_savedDeployment = {
thingId: _device.thingId,
deploymentId: uuid.v4(),
spec: _newSpec,
type: _deviceType.type,
greengrassGroup: {},
createdAt: moment()
.utc()
.format(),
updatedAt: moment()
.utc()
.format()
};
return _savedDeployment;
}
}).then(params => {
const newDeployment = {
TableName: process.env.TABLE_DEPLOYMENTS,
Item: _savedDeployment
};
return documentClient.put(newDeployment).promise();
}).then(deployment => {
const updateParams = {
TableName: process.env.TABLE_DEVICES,
Key: {
thingId: _device.thingId
},
UpdateExpression: 'set #ua = :ua, #l = :l',
ExpressionAttributeNames: {
'#ua': 'updatedAt',
'#l': 'lastDeploymentId'
},
ExpressionAttributeValues: {
':ua': moment()
.utc()
.format(),
':l': _savedDeployment.deploymentId
}
};
return documentClient.update(updateParams).promise();
}).then(device => {
if (JSON.stringify(_newShadow) !== '{}') {
return iot.describeEndpoint().promise().then(endpoint => {
const iotdata = new AWS.IotData({