UNPKG

@apillon/sdk

Version:

▶◀ Apillon SDK for NodeJS ▶◀

51 lines 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CloudFunctionJob = void 0; const apillon_api_1 = require("../../lib/apillon-api"); const apillon_1 = require("../../lib/apillon"); const apillon_logger_1 = require("../../lib/apillon-logger"); const cloud_functions_1 = require("../../types/cloud-functions"); class CloudFunctionJob extends apillon_1.ApillonModel { constructor(uuid, data) { super(uuid); /** * Unique identifier of the cloud function. */ this.functionUuid = null; /** * Name of the job. */ this.name = null; /** * CID of the script to be executed by the job. */ this.scriptCid = null; /** * Number of processors to use for the job. */ this.slots = null; /** * Status of the job. */ this.jobStatus = null; this.API_PREFIX = `/cloud-functions/jobs/${uuid}`; this.populate(data); } /** * Deletes a specific job. * @returns {Promise<void>} */ async delete() { await apillon_api_1.ApillonApi.delete(this.API_PREFIX); apillon_logger_1.ApillonLogger.log(`Job with UUID: ${this.uuid} successfully deleted`); } serializeFilter(key, value) { const serialized = super.serializeFilter(key, value); const enums = { jobStatus: cloud_functions_1.JobStatus[value], }; return Object.keys(enums).includes(key) ? enums[key] : serialized; } } exports.CloudFunctionJob = CloudFunctionJob; //# sourceMappingURL=cloud-function-job.js.map