mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-22 06:57:48 +00:00
Implement device enableDeviceUrl/disableDeviceUrl/hasDeviceUrl/getDeviceUrl
This commit is contained in:
parent
a70e38ef12
commit
3adb8f19bd
@ -135,6 +135,58 @@ limitations under the License.
|
||||
}
|
||||
};
|
||||
|
||||
exports.enableDeviceUrl = {
|
||||
signature: 'device enableDeviceUrl <uuid>',
|
||||
description: 'enable device URL for a device',
|
||||
help: 'Use this command to enable device URL for a device\n\nExamples:\n\n $ resin device enableDeviceUrl 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 disableDeviceUrl <uuid>',
|
||||
description: 'disable device URL for a device',
|
||||
help: 'Use this command to disable device URL for a device\n\nExamples:\n\n $ resin device disableDeviceUrl 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 getDeviceUrl <uuid>',
|
||||
description: 'gets the device URL of a device',
|
||||
help: 'Use this command to get the device URL of a device\n\nExamples:\n\n $ resin device getDeviceUrl 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 hasDeviceUrl <uuid>',
|
||||
description: 'Returns true if device URL is enabled for a device',
|
||||
help: 'Use this command to determine if device URL is enabled for a device\n\nExamples:\n\n $ resin device hasDeviceUrl 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 <uuid> [newName]',
|
||||
description: 'rename a resin device',
|
||||
|
@ -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);
|
||||
|
@ -186,6 +186,70 @@ exports.reboot =
|
||||
resin = require('resin-sdk')
|
||||
resin.models.device.reboot(params.uuid).nodeify(done)
|
||||
|
||||
exports.enableDeviceUrl =
|
||||
signature: 'device enableDeviceUrl <uuid>'
|
||||
description: 'enable device URL for a device'
|
||||
help: '''
|
||||
Use this command to enable device URL for a device
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device enableDeviceUrl 23c73a1
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin = require('resin-sdk')
|
||||
resin.models.device.enableDeviceUrl(params.uuid).nodeify(done)
|
||||
|
||||
exports.disableDeviceUrl =
|
||||
signature: 'device disableDeviceUrl <uuid>'
|
||||
description: 'disable device URL for a device'
|
||||
help: '''
|
||||
Use this command to disable device URL for a device
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device disableDeviceUrl 23c73a1
|
||||
'''
|
||||
permission: 'user'
|
||||
action: (params, options, done) ->
|
||||
resin = require('resin-sdk')
|
||||
resin.models.device.disableDeviceUrl(params.uuid).nodeify(done)
|
||||
|
||||
exports.getDeviceUrl =
|
||||
signature: 'device getDeviceUrl <uuid>'
|
||||
description: 'gets the device URL of a device'
|
||||
help: '''
|
||||
Use this command to get the device URL of a device
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device getDeviceUrl 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 hasDeviceUrl <uuid>'
|
||||
description: 'Returns true if device URL is enabled for a device'
|
||||
help: '''
|
||||
Use this command to determine if device URL is enabled for a device
|
||||
|
||||
Examples:
|
||||
|
||||
$ resin device hasDeviceUrl 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 <uuid> [newName]'
|
||||
description: 'rename a resin device'
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user