liveperson-functions-cli
Version:
LivePerson Functions CLI
37 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogsController = void 0;
const errorCodes_1 = require("../shared/errorCodes");
const faasFactory_service_1 = require("../service/faasFactory.service");
class LogsController {
/**
* Gets the logs of the passed function
* @param {ILogsConfig} - lambda function and flags
* @returns {Promise<void>}
* @memberof LogsController
*/
static async getLogs({ lambdaFunction, inputFlags, }) {
const faasService = await faasFactory_service_1.factory.get();
const [currentLambda] = (await faasService.getLambdasByNames([
lambdaFunction,
]));
/* istanbul ignore next */
if (!currentLambda) {
const prettyError = {
message: `Function ${lambdaFunction} were not found on the platform. Please make sure the function with the name ${lambdaFunction} was pushed to the LivePerson Functions platform`,
suggestions: [
'Use "lpf push exampleFunction" to push and "lpf deploy exampleFunction" to deploy a function',
],
ref: 'https://github.com/LivePersonInc/faas-cli#invoke',
code: errorCodes_1.CLIErrorCodes.NoLambdasFound,
};
throw prettyError;
}
await faasService.getLogs({
uuid: currentLambda.uuid,
...inputFlags,
});
}
}
exports.LogsController = LogsController;
//# sourceMappingURL=logs.controller.js.map