From 087e7c3af05ae70b9859271ce56732ca60ab1a27 Mon Sep 17 00:00:00 2001 From: Joe Roberts Date: Wed, 5 Jul 2017 10:19:44 +0100 Subject: [PATCH 1/2] Deprecate edge device type Change-type: major --- docs/dependent-apps.md | 23 +++++++++++++---------- src/proxyvisor.coffee | 8 +++++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/dependent-apps.md b/docs/dependent-apps.md index c7abf35d..5e5fabdb 100644 --- a/docs/dependent-apps.md +++ b/docs/dependent-apps.md @@ -57,14 +57,12 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/dependent-apps?apikey=$RESIN_SUPERVISOR [ { "id": 13015, - "device_type": "edge", "name": "edgeApp1", "commit": "d43bea5e16658e653088ce4b9a91b6606c3c2a0d", "config": {} }, { "id": 13016, - "device_type": "edge", "name": "edgeApp2", "commit": "d0f6624d6410fa079159fa3ebe0d3af46753d75d", "config": {} @@ -110,7 +108,7 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KE "id": 1, "uuid": "5ae8cf6e062c033ea38435498ad9b487bcc714e9eab0fed0404ee56e397790", "appId": 13015, - "device_type": "edge", + "device_type": "generic-amd64", "logs_channel": "69f961abffaad1ff66031b29f712be4fb19e1bfabf1fee7a9ebfb5fa75a1fbdb", "deviceId": "47270", "is_online": null, @@ -128,7 +126,7 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KE "id": 3, "uuid": "8dc608765fd32665d49d218a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da", "appId": 13015, - "device_type": "edge", + "device_type": "generic-amd64", "logs_channel": "d0244a90e8cd6e9a1ab410d3d599dea7f15110a6fe37b2a8fd69bb6ee0bce043", "deviceId": "47318", "is_online": null, @@ -148,10 +146,15 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KE ### POST /v1/devices Dependent Device Provision +The `device_type` parameter is optional, defaulting to `generic-amd64`. You +should only set this if you need to provision a dependent device to an +application with the deprecated `edge` device type. + **Example** ```bash -curl -H "Content-Type: application/json" -X POST --data '{"appId": }' / +curl -H "Content-Type: application/json" -X POST --data '{"appId": , +"device_type": "edge"}' / $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KEY ``` @@ -162,10 +165,10 @@ $RESIN_SUPERVISOR_ADDRESS/v1/devices?apikey=$RESIN_SUPERVISOR_API_KEY ```javascript { "id": 47318, - "uuid": "8dc608765fd32665d49a268a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da", - "name": "wild-paper", + "uuid": "8dc608765fd32665d49a268a7eb4657bc2ab8a56db06d2c57ef7c7e9a115da", + "name": "wild-paper", "note": null, - "device_type": "edge", + "device_type": "edge" } ``` @@ -186,7 +189,7 @@ curl -X GET $RESIN_SUPERVISOR_ADDRESS/v1/devices/?apikey=$RESIN_SUPERVISOR "id": 1, "uuid": "5ae8cf6e062c033ea57837498ad9b487bfc714e9eab0fed0404ee56e397790", "appId": 13015, - "device_type": "edge", + "device_type": "generic-amd64", "logs_channel": "69f961abffaad2ff00031b29f718be4fb19e1bfabf1fee7a9ebfb5fa75a1fbdb", "deviceId": "47270", "is_online": null, @@ -219,7 +222,7 @@ $RESIN_SUPERVISOR_ADDRESS/v1/devices/?apikey=$RESIN_SUPERVISOR_API_KEY "id": 1, "uuid": "5ae8cf6e062c033ea38437498ad9b482bcc714e9eab0fed0404ee56e397790", "appId": 13015, - "device_type": "edge", + "device_type": "generic-amd64", "logs_channel": "69f961abffaad2ff66031b29f712be4fb19e1bfabf1fee7a9ebfb5fa05a1fbdb", "deviceId": "47270", "is_online": true, diff --git a/src/proxyvisor.coffee b/src/proxyvisor.coffee index 111fed5c..f720fdb1 100644 --- a/src/proxyvisor.coffee +++ b/src/proxyvisor.coffee @@ -42,10 +42,13 @@ router.get '/v1/devices', (req, res) -> res.status(503).send(err?.message or err or 'Unknown error') router.post '/v1/devices', (req, res) -> - appId = req.body.appId + { appId, device_type } = req.body + if !appId? or _.isNaN(parseInt(appId)) or parseInt(appId) <= 0 res.status(400).send('appId must be a positive integer') return + device_type = 'generic-amd64' if !device_type? + Promise.join( utils.getConfig('apiKey') utils.getConfig('userId') @@ -57,7 +60,7 @@ router.post '/v1/devices', (req, res) -> user: userId application: req.body.appId uuid: uuid - device_type: 'edge' + device_type: device_type device: deviceId registered_at: Math.floor(Date.now() / 1000) logs_channel: logsChannel @@ -203,7 +206,6 @@ router.get '/v1/dependent-apps', (req, res) -> return { id: parseInt(app.appId) commit: app.commit - device_type: 'edge' name: app.name config: JSON.parse(app.config ? '{}') } From 9b72451b4ccec96e9020cd72ca0a6b0f2e14d4b6 Mon Sep 17 00:00:00 2001 From: "resin-io-versionbot[bot]" Date: Fri, 7 Jul 2017 18:03:13 +0000 Subject: [PATCH 2/2] v6.0.0 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d34c3b0..2177963b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! This project adheres to [Semantic Versioning](http://semver.org/). +## v6.0.0 - 2017-07-07 + +* Deprecate edge device type [Joe Roberts] + ## v5.1.1 - 2017-07-04 * Fix semver comparison for OS version when determining if the device has deviceApiKey support [Pablo Carranza Velez] diff --git a/package.json b/package.json index c493223d..36537b74 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "resin-supervisor", "description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.", - "version": "5.1.1", + "version": "6.0.0", "license": "Apache-2.0", "repository": { "type": "git",