@apillon/cli
Version:
▶◀ Apillon CLI tools ▶◀
67 lines • 3.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCloudFunctionsCommands = void 0;
const cloud_functions_service_1 = require("./cloud-functions.service");
const options_1 = require("../../lib/options");
function createCloudFunctionsCommands(cli) {
const cloudFunctions = cli
.command('cloud-functions')
.description('Commands for managing cloud functions on Apillon platform');
// CLOUD FUNCTIONS
const listCloudFunctionsCommand = cloudFunctions
.command('list')
.description('List all cloud functions')
.action(async function () {
await (0, cloud_functions_service_1.listCloudFunctions)(this.optsWithGlobals());
});
(0, options_1.addPaginationOptions)(listCloudFunctionsCommand);
cloudFunctions
.command('get')
.description('Get details of a specific cloud function')
.requiredOption('--uuid <cloud-function-uuid>', 'Cloud Function UUID')
.action(async function () {
await (0, cloud_functions_service_1.getCloudFunction)(this.optsWithGlobals());
});
cloudFunctions
.command('create')
.description('Create a new cloud function')
.requiredOption('--name <name>', 'Name of the cloud function')
.option('--description <description>', 'Description of the cloud function')
.action(async function () {
await (0, cloud_functions_service_1.createCloudFunction)(this.optsWithGlobals());
});
// JOBS
cloudFunctions
.command('create-job')
.description('Create a job for a cloud function from a script file')
.requiredOption('--uuid <cloud-function-uuid>', 'Cloud Function UUID')
.requiredOption('--name <job-name>', 'Name of the job')
.requiredOption('--script <path>', 'Path to the script file')
.action(async function () {
await (0, cloud_functions_service_1.createCloudFunctionJob)(this.optsWithGlobals());
});
cloudFunctions
.command('set-environment')
.description('Set environment variables for a cloud function')
.requiredOption('--uuid <cloud-function-uuid>', 'Cloud Function UUID')
.requiredOption('--variables <variables>', 'Environment variables in key=value format, separated by commas')
.action(async function () {
await (0, cloud_functions_service_1.setCloudFunctionEnvironment)(this.optsWithGlobals());
});
cloudFunctions
.command('list-jobs')
.description('List all jobs for a specific cloud function')
.requiredOption('--uuid <cloud-function-uuid>', 'Cloud Function UUID')
.action(async function () {
await (0, cloud_functions_service_1.listCloudFunctionJobs)(this.optsWithGlobals());
});
cloudFunctions
.command('delete-job')
.description('Delete a job from a cloud function')
.requiredOption('-j, --job-uuid <job-uuid>', 'Job UUID to delete')
.action(async function () {
await (0, cloud_functions_service_1.deleteCloudFunctionJob)(this.optsWithGlobals());
});
}
exports.createCloudFunctionsCommands = createCloudFunctionsCommands;
//# sourceMappingURL=cloud-functions.commands.js.map