@lifeomic/cli
Version:
CLI for interacting with the LifeOmic PHC API.
21 lines (17 loc) • 525 B
JavaScript
;
const { put } = require('../../api');
const print = require('../../print');
const read = require('../../read');
exports.command = 'update <name>';
exports.desc = 'Update a policy. The policy is read from stdin';
exports.builder = yargs => {
yargs.positional('name', {
describe: 'The policy name.',
type: 'string'
});
};
exports.handler = async argv => {
const policy = await read(argv);
const response = await put(argv, `/v1/policies/${argv.name}`, policy);
print(response.data, argv);
};