Skip to content

Commit

Permalink
Release of Version 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aws committed Nov 25, 2019
1 parent 71d3565 commit 77c1d98
Show file tree
Hide file tree
Showing 25 changed files with 1,835 additions and 1,740 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ The environment where Greengrass is running on needs to be able to run NodeJS 8.
* When you untar the package downloaded from NodeJS website, you will find `node` file under `bin` directory.
* Copy the file to _**/usr/bin**_ or _**/usr/local/bin**_ folder.
* Rename the file to _**nodejs8.10**_
* Make sure the file is not a symlink.

## Getting Started - Hello World

Expand Down Expand Up @@ -105,12 +104,28 @@ As new features are added to AWS Greengrass, previous versions of the Greengrass

</tr>

<tr>

<td>1.10.x</td>

<td>1.0.x-1.5.x</td>

</tr>

</tbody>

</table>

</div>

<div class="Section" id="1.5.0updates">

## 1.5.0 Updates[](#1.5.0updates "Permalink to this headline")

Added support for publish() parameter queueFullPolicy which can be set to 'AllOrError' to enforce that the published message is either delivered to all subscription destinations or delivered to no destinations and returns an error when Greengrass Core's internal work queue is full.

</div>

<div class="Section" id="1.4.0updates">

## 1.4.0 Updates[](#1.4.0updates "Permalink to this headline")
Expand Down
2 changes: 1 addition & 1 deletion aws-greengrass-core-sdk/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*/
exports.GreengrassInterfaceVersion = '1.3';
exports.GreengrassInterfaceVersion = '1.4';
exports.Lambda = require('./lambda');
exports.IotData = require('./iotdata');
exports.SecretsManager = require('./secretsmanager');
31 changes: 25 additions & 6 deletions aws-greengrass-core-sdk/iotdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class IotData {
* @param {object} params object contains parameters for the call
* REQUIRED: 'thingName' the name of the thing
*/
const thingName = Util.getRequiredParameter(params, 'thingName');
const thingName = Util.getParameter(params, 'thingName');
if (thingName === undefined) {
callback(new Error('"thingName" is a required parameter.'), null);
return;
Expand All @@ -41,13 +41,13 @@ class IotData {
* REQUIRED: 'thingName' the name of the thing
* 'payload' the state information in JSON format
*/
const thingName = Util.getRequiredParameter(params, 'thingName');
const thingName = Util.getParameter(params, 'thingName');
if (thingName === undefined) {
callback(new Error('"thingName" is a required parameter.'), null);
return;
}

const payload = Util.getRequiredParameter(params, 'payload');
const payload = Util.getParameter(params, 'payload');
if (payload === undefined) {
callback(new Error('"payload" is a required parameter.'), null);
return;
Expand All @@ -62,7 +62,7 @@ class IotData {
* @param {object} params object contains parameters for the call
* REQUIRED: 'thingName' the name of the thing
*/
const thingName = Util.getRequiredParameter(params, 'thingName');
const thingName = Util.getParameter(params, 'thingName');
if (thingName === undefined) {
callback(new Error('"thingName" is a required parameter.'), null);
return;
Expand All @@ -78,26 +78,45 @@ class IotData {
* @param {object} params object contains parameters for the call
* REQUIRED: 'topic' the topic name to be published
* 'payload' the state information in JSON format
* OPTIONAL: 'queueFullPolicy' the policy for GGC to take when its internal queue is full
*/
const topic = Util.getRequiredParameter(params, 'topic');
const topic = Util.getParameter(params, 'topic');
if (topic === undefined) {
callback(new Error('"topic" is a required parameter'), null);
return;
}

const payload = Util.getRequiredParameter(params, 'payload');
const payload = Util.getParameter(params, 'payload');
if (payload === undefined) {
callback(new Error('"payload" is a required parameter'), null);
return;
}

// this is an optional parameter
const queueFullPolicy = Util.getParameter(params, 'queueFullPolicy');

const context = {
custom: {
source: MY_FUNCTION_ARN,
subject: topic,
queueFullPolicy: '',
},
};

switch (queueFullPolicy) {
case 'BestEffort':
case 'AllOrError':
context.custom.queueFullPolicy = queueFullPolicy;
break;
case '':
case undefined:
case null:
break;
default:
callback(new Error(`queueFullPolicy "${queueFullPolicy}" is not supported`), null);
break;
}

const buff = Buffer.from(JSON.stringify(context));
const clientContext = buff.toString('base64');

Expand Down
2 changes: 1 addition & 1 deletion aws-greengrass-core-sdk/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Lambda {
}

invoke(params, callback) {
const functionName = Util.getRequiredParameter(params, 'FunctionName');
const functionName = Util.getParameter(params, 'FunctionName');
if (functionName === undefined) {
callback(new Error('"FunctionName" is a required parameter'), null);
return;
Expand Down
6 changes: 3 additions & 3 deletions aws-greengrass-core-sdk/secretsmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class SecretsManager {
}

getSecretValue(params, callback) {
const secretId = Util.getRequiredParameter(params, KEY_SECRET_ID);
const versionId = Util.getRequiredParameter(params, KEY_VERSION_ID);
const versionStage = Util.getRequiredParameter(params, KEY_VERSION_STAGE);
const secretId = Util.getParameter(params, KEY_SECRET_ID);
const versionId = Util.getParameter(params, KEY_VERSION_ID);
const versionStage = Util.getParameter(params, KEY_VERSION_STAGE);

if (secretId === undefined) {
callback(new Error(`"${KEY_SECRET_ID}" is a required parameter`), null);
Expand Down
6 changes: 3 additions & 3 deletions aws-greengrass-core-sdk/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
const qualifierRegex = /(|[a-zA-Z0-9$_-]+)/;

exports.getRequiredParameter = function _getRequiredParameter(params, requiredParam) {
if (!Object.prototype.hasOwnProperty.call(params, requiredParam)) {
exports.getParameter = function _getParameter(params, desiredParam) {
if (!Object.prototype.hasOwnProperty.call(params, desiredParam)) {
return;
}
return params[requiredParam];
return params[desiredParam];
};

exports.isValidJSON = function _isValidJSON(str) {
Expand Down
Empty file added docs/.nojekyll
Empty file.
Loading

0 comments on commit 77c1d98

Please sign in to comment.