diff --git a/build/actions/device.js b/build/actions/device.js index a5f6187f..d096b414 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -135,6 +135,58 @@ limitations under the License. } }; + exports.enableDeviceUrl = { + signature: 'device public-url enable ', + description: 'enable public URL for a device', + help: 'Use this command to enable public URL for a device\n\nExamples:\n\n $ resin device public-url enable 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.enableDeviceUrl(params.uuid).nodeify(done); + } + }; + + exports.disableDeviceUrl = { + signature: 'device public-url disable ', + description: 'disable public URL for a device', + help: 'Use this command to disable public URL for a device\n\nExamples:\n\n $ resin device public-url disable 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.disableDeviceUrl(params.uuid).nodeify(done); + } + }; + + exports.getDeviceUrl = { + signature: 'device public-url ', + description: 'gets the public URL of a device', + help: 'Use this command to get the public URL of a device\n\nExamples:\n\n $ resin device public-url 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.getDeviceUrl(params.uuid).then(function(url) { + return console.log(url); + }).nodeify(done); + } + }; + + exports.hasDeviceUrl = { + signature: 'device public-url status ', + description: 'Returns true if public URL is enabled for a device', + help: 'Use this command to determine if public URL is enabled for a device\n\nExamples:\n\n $ resin device public-url status 23c73a1', + permission: 'user', + action: function(params, options, done) { + var resin; + resin = require('resin-sdk'); + return resin.models.device.hasDeviceUrl(params.uuid).then(function(hasDeviceUrl) { + return console.log(hasDeviceUrl); + }).nodeify(done); + } + }; + exports.rename = { signature: 'device rename [newName]', description: 'rename a resin device', diff --git a/build/app.js b/build/app.js index cb58bf90..aca40f7b 100644 --- a/build/app.js +++ b/build/app.js @@ -95,6 +95,14 @@ limitations under the License. capitano.command(actions.device.reboot); + capitano.command(actions.device.enableDeviceUrl); + + capitano.command(actions.device.disableDeviceUrl); + + capitano.command(actions.device.getDeviceUrl); + + capitano.command(actions.device.hasDeviceUrl); + capitano.command(actions.device.register); capitano.command(actions.device.move); diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index d11032f5..1b91261e 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -186,6 +186,70 @@ exports.reboot = resin = require('resin-sdk') resin.models.device.reboot(params.uuid).nodeify(done) +exports.enableDeviceUrl = + signature: 'device public-url enable ' + description: 'enable public URL for a device' + help: ''' + Use this command to enable public URL for a device + + Examples: + + $ resin device public-url enable 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.enableDeviceUrl(params.uuid).nodeify(done) + +exports.disableDeviceUrl = + signature: 'device public-url disable ' + description: 'disable public URL for a device' + help: ''' + Use this command to disable public URL for a device + + Examples: + + $ resin device public-url disable 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.disableDeviceUrl(params.uuid).nodeify(done) + +exports.getDeviceUrl = + signature: 'device public-url ' + description: 'gets the public URL of a device' + help: ''' + Use this command to get the public URL of a device + + Examples: + + $ resin device public-url 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.getDeviceUrl(params.uuid).then (url) -> + console.log(url) + .nodeify(done) + +exports.hasDeviceUrl = + signature: 'device public-url status ' + description: 'Returns true if public URL is enabled for a device' + help: ''' + Use this command to determine if public URL is enabled for a device + + Examples: + + $ resin device public-url status 23c73a1 + ''' + permission: 'user' + action: (params, options, done) -> + resin = require('resin-sdk') + resin.models.device.hasDeviceUrl(params.uuid).then (hasDeviceUrl) -> + console.log(hasDeviceUrl) + .nodeify(done) + exports.rename = signature: 'device rename [newName]' description: 'rename a resin device' diff --git a/lib/app.coffee b/lib/app.coffee index a31c9870..fec89988 100644 --- a/lib/app.coffee +++ b/lib/app.coffee @@ -75,6 +75,10 @@ capitano.command(actions.device.init) capitano.command(actions.device.remove) capitano.command(actions.device.identify) capitano.command(actions.device.reboot) +capitano.command(actions.device.enableDeviceUrl) +capitano.command(actions.device.disableDeviceUrl) +capitano.command(actions.device.getDeviceUrl) +capitano.command(actions.device.hasDeviceUrl) capitano.command(actions.device.register) capitano.command(actions.device.move) capitano.command(actions.device.info)