balena-cli
Version:
The official balena Command Line Interface
37 lines (35 loc) • 1.25 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const lazy_1 = require("../../utils/lazy");
class RevokeCmd extends core_1.Command {
async run() {
const { args: params } = await this.parse(RevokeCmd);
const apiKeyIds = params.ids.split(',');
if (apiKeyIds.filter((apiKeyId) => !apiKeyId.match(/^\d+$/)).length > 0) {
console.log('API key ids must be positive integers');
return;
}
await Promise.all(apiKeyIds.map(async (id) => await (0, lazy_1.getBalenaSdk)().models.apiKey.revoke(Number(id))));
console.log('Successfully revoked the given API keys');
}
}
RevokeCmd.description = (0, lazy_1.stripIndent) `
Revoke balenaCloud API keys.
Revoke balenaCloud API keys with the given
comma-separated list of ids.
The given balenaCloud API keys will no longer be usable.
`;
RevokeCmd.examples = [
'$ balena api-key revoke 123',
'$ balena api-key revoke 123,124,456',
];
RevokeCmd.args = {
ids: core_1.Args.string({
description: 'the API key ids',
required: true,
}),
};
RevokeCmd.authenticated = true;
exports.default = RevokeCmd;
//# sourceMappingURL=revoke.js.map
;