Class: IotData

aws-greengrass-core-sdk~IotData()

Constructs a service interface object. Each API operation is exposed as a function on service.

Constructor

new IotData()

Constructs a service object. This object has one method for each API operation.
Source:
Example

Constructing a IotData object

var iotdata = new GG.IotData();

Methods

deleteThingShadow(params, callback)

Call shadow lambda to delete the shadow state.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
thingName String The name of the thing whose shadow should be deleted.
callback iotDataCallback The callback.
Source:

getThingShadow(params, callback)

Gets the thing shadow for the specified thing.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
thingName String The name of the thing.
callback iotDataCallback The callback.
Source:
Example

Calling the getThingShadow operation

var params = {
  thingName: 'STRING_VALUE' // required
};
iotdata.getThingShadow(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

publish(params, callback)

Publishes a message within Greengrass.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
topic String The name of the MQTT topic.
payload Buffer | TypedArray | Blob | String The payload to be sent.
queueFullPolicy 'AllOrError' | 'BestEffort' Specify whether to enforce message delivery to all destinations. Options are 'AllOrError' and 'BestEffort'. Defaults to 'BestEffort' when omitted.
callback iotDataCallback The callback.
Source:
Example

Calling the publish operation

var params = {
  topic: 'STRING_VALUE', // required
  payload: new Buffer('...') || 'STRING_VALUE',
  queueFullPolicy: 'AllOrError' || 'BestEffort'
};
iotdata.publish(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

updateThingShadow(params, callback)

Updates the thing shadow for the specified thing.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
thingName String The name of the thing.
payload String The state information as a JSON string.
callback iotDataCallback The callback.
Source:
Example

Calling the updateThingShadow operation

var params = {
  payload: 'Proper JSON data', // required
  thingName: 'STRING_VALUE' // required
};
iotdata.updateThingShadow(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});