UNPKG

balena-cli

Version:

The official balena Command Line Interface

46 lines (44 loc) 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const cf = require("../../utils/common-flags"); const lazy_1 = require("../../utils/lazy"); class DeviceDeactivateCmd extends core_1.Command { async run() { const { args: params, flags: options } = await this.parse(DeviceDeactivateCmd); const balena = (0, lazy_1.getBalenaSdk)(); const patterns = await Promise.resolve().then(() => require('../../utils/patterns')); const uuid = params.uuid; const deactivationWarning = ` Warning! Deactivating a device will charge a fee equivalent to the normal monthly cost for the device (e.g. $1 for an essentials device); the device will not be charged again until it comes online. `; const warning = `Are you sure you want to deactivate device ${uuid} ?`; console.error(deactivationWarning); await patterns.confirm(options.yes, warning); await balena.models.device.deactivate(uuid); } } DeviceDeactivateCmd.description = (0, lazy_1.stripIndent) ` Deactivate a device. Deactivate a device. Note this command asks for confirmation interactively. You can avoid this by passing the \`--yes\` option. `; DeviceDeactivateCmd.examples = [ '$ balena device deactivate 7cf02a6', '$ balena device deactivate 7cf02a6 --yes', ]; DeviceDeactivateCmd.args = { uuid: core_1.Args.string({ description: 'the UUID of the device to be deactivated', required: true, }), }; DeviceDeactivateCmd.flags = { yes: cf.yes, }; DeviceDeactivateCmd.authenticated = true; exports.default = DeviceDeactivateCmd; //# sourceMappingURL=deactivate.js.map