liveperson-functions-cli
Version:
LivePerson Functions CLI
52 lines • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Schedule = void 0;
const core_1 = require("@oclif/core");
const create_controller_1 = require("../../controller/create.controller");
class Schedule extends core_1.Command {
constructor() {
super(...arguments);
this.createController = new create_controller_1.CreateController();
}
/**
* Runs the create command and parses the passed functions
* @returns {Promise<void>} - create command
* @memberof Schedule
*/
async run() {
try {
const { flags: { functionName, cronExpression }, } = await this.parse(Schedule);
await this.createController.createSchedule({
functionName,
cronExpression,
});
}
catch (error) {
this.exit(1);
}
}
}
exports.Schedule = Schedule;
Schedule.flags = {
help: core_1.Flags.help({
char: 'h',
description: 'Show help for the create command',
}),
functionName: core_1.Flags.string({
char: 'f',
description: 'name of (deployed) function which will be scheduled',
}),
cronExpression: core_1.Flags.string({
char: 'c',
description: 'Cron Expression',
}),
};
Schedule.description = 'Creates schedules on currently logged-in account';
Schedule.strict = false;
Schedule.examples = [
'> <%= config.bin %> create:schedule',
'> <%= config.bin %> create:schedule -f exampleFunction',
'> <%= config.bin %> create:schedule -f exampleFunction -c "* * * * *"',
'> <%= config.bin %> create:schedule -f exampleFunction -c "*/3 * * 0-12 *"',
];
//# sourceMappingURL=schedule.js.map