UNPKG

azure-cli

Version:

Microsoft Azure Cross Platform Command Line tool

729 lines (336 loc) 37.2 kB
/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb,__catch=__rt.__catch,__tryCatch=__rt.__tryCatch; var __ = require("underscore"); var fs = require("fs"); var util = require("util"); var batchUtil = require("./batch.util"); var batchShowUtil = require("./batch.showUtil"); var utils = require("../../util/utils"); var startProgress = batchUtil.startProgress; var endProgress = batchUtil.endProgress; var $ = utils.getLocaleString; exports.init = function(cli) { batchUtil.init(cli); var batch = cli.category("batch"); var logger = cli.output; var interaction = cli.interaction; var jobSchedule = batch.category("job-schedule").description($("Commands to manage your Batch job schedules")); jobSchedule.command("create [json-file]").description($("Adds a job schedule to the specified account")).option("-f, --json-file <json-file>", $("the file containing the job schedule object to create in JSON format; if this parameter is specified, all other job schedule parameters are ignored.")).option("-i, --id <jobScheduleId>", $("the Batch job schedule id")).option("-p, --pool-id <poolId>", $("the id of an existing pool; all the tasks of jobs created under this schedule will run on the speicfied pool")).option("--priority <priority>", $("the priority of the jobs created under this schedule, ranging from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority; the default value is 0.")).option("--max-wall-clock-time <max-wall-clock-time>", $("the maximum elapsed time that a job created under this schedule may run, in ISO 8601 duration formation")).option("--max-task-retry-count <max-task-retry-count>", $("the maximum number of times each task may be retried")).option("--do-not-run-until <do-not-run-until>", $("the earliest time at which any ob may be created under this job schedule; if you do not specify a time, the scheudle becomes ready to create jobs immediately.")).option("--do-not-run-after <do-not-run-after>", $("the time after which no job will be created under this job schedule; if you do not specify a time, and you are creating a recurring job schedule, the job schedule will remain active until you explicitly terminate it.")).option("--start-window <start-window>", $("the time interval, starting from the time at which the schedule indicates a job should be created, within which a job must be created, specified in ISO 8601 duration format.")).option("--recurrence-interval <recurrence-interval>", $("the time interval between the start times of two successive jobs under the job schedule, specified in ISO 8601 duration format; the default is that the schedule does not recur.")).option("--metadata <--metadata>", $("the semicolon separated list of name-value pairs associated with the job schedule as metadata, ex: name1=value1;name2=value2")).appendBatchAccountOption().execute(createJobSchedule); jobSchedule.command("list").description($("Lists all of the job schedules in the specified account")).appendODataFilterOption(true, true, true).appendBatchAccountOption().execute(listJobSchedules); jobSchedule.command("show [jobScheduleId]").description($("Show information about the specified job schedule")).option("-i, --id <jobScheduleId>", $("the id of the job schedule to get")).appendODataFilterOption(true, false, true).appendCommonHeaderFilterOption(true, true).appendBatchAccountOption().execute(showJobSchedule); jobSchedule.command("delete [jobScheduleId]").description($("Deletes a job schedule from the specified account")).option("-i, --id <jobScheduleId>", $("the id of the job schedule to delete")).option("-q, --quiet", $("remove the specified job schedule without confirmation")).appendCommonHeaderFilterOption(true, true).appendBatchAccountOption().execute(deleteJobSchedule); jobSchedule.command("set [jobScheduleId] [json-file]").description($("Patch/Update the properties of the specified job schedule")).option("-i, --id <jobScheduleId>", $("the id of the job schedule to patch/update")).option("-p, --pool-id <poolId>", $("the id of an existing pool; all the tasks of jobs created under this schedule will run on the speicfied pool")).option("--priority <priority>", $("the priority of the jobs created under this schedule, ranging from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority; the default value is 0.")).option("--max-wall-clock-time <max-wall-clock-time>", $("the maximum elapsed time that a job created under this schedule may run, in ISO 8601 duration formation")).option("--max-task-retry-count <max-task-retry-count>", $("the maximum number of times each task may be retried")).option("--do-not-run-until <do-not-run-until>", $("the earliest time at which any ob may be created under this job schedule; if you do not specify a time, the scheudle becomes ready to create jobs immediately.")).option("--do-not-run-after <do-not-run-after>", $("the time after which no job will be created under this job schedule; if you do not specify a time, and you are creating a recurring job schedule, the job schedule will remain active until you explicitly terminate it.")).option("--start-window <start-window>", $("the time interval, starting from the time at which the schedule indicates a job should be created, within which a job must be created, specified in ISO 8601 duration format.")).option("--recurrence-interval <recurrence-interval>", $("the time interval between the start times of two successive jobs under the job schedule, specified in ISO 8601 duration format; the default is that the schedule does not recur.")).option("-f, --json-file <json-file>", $("the file containing the job schedule properties to patch/update in JSON format; if this parameter is specified, all other job schedule parameters are ignored.")).option("-r, --replace", $("uses update instead of patch")).appendCommonHeaderFilterOption(true, true).appendBatchAccountOption().execute(updateJobSchedule); jobSchedule.command("enable <jobScheduleId>").description($("Enables the specified job schedule, allowing jobs to be created according to its schedule")).appendCommonHeaderFilterOption(true, true).appendBatchAccountOption().execute(enableJobSchedule); jobSchedule.command("disable <jobScheduleId>").description($("Disables the specified job schedule. Disabled schedules do not create new jobs, but may be re-enabled later.")).appendCommonHeaderFilterOption(true, true).appendBatchAccountOption().execute(disableJobSchedule); jobSchedule.command("stop <jobScheduleId>").description($("Terminates the specified job schedule")).appendCommonHeaderFilterOption(true, true).appendBatchAccountOption().execute(terminateJobSchedule); function createJobSchedule(jsonFile, options, _) { var parsedJson, jobSpecJson, poolId, constraintsJson, scheduleJson, objJson, client, addJobSchedule, resultMapper, tips, batchOptions; var __frame = { name: "createJobSchedule", line: 131 }; return __func(_, this, arguments, createJobSchedule, 2, __frame, function __$createJobSchedule() { if (!jsonFile) { jsonFile = options.jsonFile; } ; parsedJson = { }; return (function __$createJobSchedule(__then) { if (!jsonFile) { return (function __$createJobSchedule(__then) { if (!options.id) { return interaction.promptIfNotGiven($("JSON file name: "), jsonFile, __cb(_, __frame, 8, 31, function ___(__0, __1) { jsonFile = __1; __then(); }, true)); } else { parsedJson = { id: options.id }; jobSpecJson = { }; poolId = options.poolId; return (function __$createJobSchedule(__then) { if (!poolId) { return cli.interaction.promptIfNotGiven($("Pool id: "), poolId, __cb(_, __frame, 15, 35, function ___(__0, __2) { poolId = __2; __then(); }, true)); } else { __then(); } ; })(function __$createJobSchedule() { __.extend(jobSpecJson, { poolInfo: { poolId: poolId } }); if (options.priority) { __.extend(jobSpecJson, { priority: Number(options.priority) }); } ; constraintsJson = { }; if (options.maxWallClockTime) { __.extend(constraintsJson, { maxWallClockTime: options.maxWallClockTime }); } ; if (options.maxTaskRetryCount) { __.extend(constraintsJson, { maxTaskRetryCount: Number(options.maxTaskRetryCount) }); } ; __.extend(jobSpecJson, { constraints: constraintsJson }); scheduleJson = { }; if (options.doNotRunUntil) { __.extend(scheduleJson, { doNotRunUntil: options.doNotRunUntil }); } ; if (options.doNotRunAfter) { __.extend(scheduleJson, { doNotRunAfter: options.doNotRunAfter }); } ; if (options.startWindow) { __.extend(scheduleJson, { startWindow: options.startWindow }); } ; if (options.recurrenceInterval) { __.extend(scheduleJson, { recurrenceInterval: options.recurrenceInterval }); } ; __.extend(parsedJson, { jobSpecification: jobSpecJson }); __.extend(parsedJson, { schedule: scheduleJson }); if (options.metadata) { ref = []; options.metadata.split(";").forEach(function(entry) { var item = entry.split("="); ref.push({ name: item[0], value: item[1] }); }); __.extend(parsedJson, { metadata: ref }); } ; __then(); }); } ; })(__then); } else { __then(); } ; })(function __$createJobSchedule() { if (jsonFile) { objJson = fs.readFileSync(jsonFile).toString(); parsedJson = JSON.parse(objJson); } ; client = batchUtil.createBatchServiceClient(options); addJobSchedule = null; if (((parsedJson !== null) && (parsedJson !== undefined))) { resultMapper = new client.models["JobScheduleAddParameter"]().mapper(); addJobSchedule = client.deserialize(resultMapper, parsedJson, "result"); } ; tips = $("Creating Batch job schedule"); batchOptions = { }; batchOptions.jobScheduleAddOptions = batchUtil.getBatchOperationDefaultOption(); startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$createJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$createJobSchedule() { return client.jobSchedule.add(addJobSchedule, batchOptions, __cb(_, __frame, 85, 25, __then, true)); }); })(function ___(err, __result) { __catch(function __$createJobSchedule() { if (err) { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$createJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$createJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$createJobSchedule() { logger.verbose(util.format($("Job schedule %s has been created successfully"), addJobSchedule.id)); return showJobSchedule(addJobSchedule.id, options, __cb(_, __frame, 100, 4, function __$createJobSchedule() { _(); }, true)); }); }); }); }); }; function showJobSchedule(jobScheduleId, options, _) { var client, tips, batchOptions, jobSchedule; var __frame = { name: "showJobSchedule", line: 240 }; return __func(_, this, arguments, showJobSchedule, 2, __frame, function __$showJobSchedule() { client = batchUtil.createBatchServiceClient(options); if (!jobScheduleId) { jobScheduleId = options.id; } ; return interaction.promptIfNotGiven($("Job schedule id: "), jobScheduleId, __cb(_, __frame, 5, 32, function ___(__0, __1) { jobScheduleId = __1; tips = $("Getting Batch job schedule information"); batchOptions = { }; batchOptions.jobScheduleGetOptions = batchUtil.getBatchOperationDefaultOption(); if (options.selectClause) { batchOptions.jobScheduleGetOptions.select = options.selectClause; } ; if (options.expandClause) { batchOptions.jobScheduleGetOptions.expand = options.expandClause; } ; if (options.ifMatch) { batchOptions.jobScheduleGetOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobScheduleGetOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobScheduleGetOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobScheduleGetOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; jobSchedule = null; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$showJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$showJobSchedule() { return client.jobSchedule.get(jobScheduleId, batchOptions, __cb(_, __frame, 35, 39, function ___(__0, __2) { jobSchedule = __2; __then(); }, true)); }); })(function ___(e, __result) { __catch(function __$showJobSchedule() { if (e) { if (batchUtil.isNotFoundException(e)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (e.message) { if ((typeof e.message === "object")) { e.message = e.message.value; } ; } ; return _(e); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$showJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$showJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$showJobSchedule() { batchShowUtil.showCloudJobSchedule(jobSchedule, cli.output); _(); }); }); }, true)); }); }; function listJobSchedules(options, _) { var client, tips, batchOptions, jobSchedules, nextLink; var __frame = { name: "listJobSchedules", line: 300 }; return __func(_, this, arguments, listJobSchedules, 1, __frame, function __$listJobSchedules() { client = batchUtil.createBatchServiceClient(options); tips = $("Listing Batch job schedules"); batchOptions = { }; batchOptions.jobScheduleListOptions = batchUtil.getBatchOperationDefaultOption(); if (options.selectClause) { batchOptions.jobScheduleListOptions.select = options.selectClause; } ; if (options.expandClause) { batchOptions.jobScheduleListOptions.expand = options.expandClause; } ; if (options.filterClause) { batchOptions.jobScheduleListOptions.filter = options.filterClause; } ; jobSchedules = []; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$listJobSchedules() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$listJobSchedules() { return client.jobSchedule.list(batchOptions, __cb(_, __frame, 20, 34, function ___(__0, __1) { result = __1; result.forEach(function(jobSchedule) { jobSchedules.push(jobSchedule); }); nextLink = result.odatanextLink; return (function ___(__break) { var __more; var __loop = __cb(_, __frame, 0, 0, function __$listJobSchedules() { __more = false; var __4 = nextLink; if (__4) { batchOptions = batchUtil.getBatchOperationDefaultOption(); options.jobScheduleListOptions = batchOptions; return client.jobSchedule.listNext(nextLink, batchOptions, __cb(_, __frame, 29, 36, function ___(__0, __2) { result = __2; result.forEach(function(jobSchedule) { jobSchedules.push(jobSchedule); }); nextLink = result.odatanextLink; while (__more) { __loop(); }; __more = true; }, true)); } else { __break(); } ; }); do { __loop(); } while (__more); __more = true; })(__then); }, true)); }); })(function ___(err, __result) { __catch(function __$listJobSchedules() { if (err) { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$listJobSchedules() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$listJobSchedules() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$listJobSchedules() { cli.interaction.formatOutput(jobSchedules, function(outputData) { if ((outputData.length === 0)) { logger.info($("No job schedule found")); } else { logger.table(outputData, function(row, item) { row.cell($("Id"), item.id); row.cell($("State"), item.state); }); } ; }); _(); }); }); }); }; function deleteJobSchedule(jobScheduleId, options, _) { var client, tips, batchOptions; var __frame = { name: "deleteJobSchedule", line: 366 }; return __func(_, this, arguments, deleteJobSchedule, 2, __frame, function __$deleteJobSchedule() { client = batchUtil.createBatchServiceClient(options); if (!jobScheduleId) { jobScheduleId = options.id; } ; return interaction.promptIfNotGiven($("Job schedule id: "), jobScheduleId, __cb(_, __frame, 5, 32, function ___(__0, __1) { jobScheduleId = __1; tips = util.format($("Deleting job schedule %s"), jobScheduleId); batchOptions = { }; batchOptions.jobScheduleDeleteMethodOptions = batchUtil.getBatchOperationDefaultOption(); if (options.ifMatch) { batchOptions.jobScheduleDeleteMethodOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobScheduleDeleteMethodOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobScheduleDeleteMethodOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobScheduleDeleteMethodOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; return (function __$deleteJobSchedule(__then) { if (!options.quiet) { return interaction.confirm(util.format($("Do you want to delete job schedule %s? [y/n]: "), jobScheduleId), __cb(_, __frame, 24, 23, function ___(__0, __3) { var __2 = !__3; return (function __$deleteJobSchedule(__then) { if (__2) { return _(null); } else { __then(); } ; })(__then); }, true)); } else { __then(); } ; })(function __$deleteJobSchedule() { startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$deleteJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$deleteJobSchedule() { return client.jobSchedule.deleteMethod(jobScheduleId, batchOptions, __cb(_, __frame, 32, 25, __then, true)); }); })(function ___(err, __result) { __catch(function __$deleteJobSchedule() { if (err) { if (batchUtil.isNotFoundException(err)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$deleteJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$deleteJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$deleteJobSchedule() { logger.info(util.format($("Job schedule %s has been deleted successfully"), jobScheduleId)); _(); }); }); }); }, true)); }); }; function updateJobSchedule(jobScheduleId, jsonFile, options, _) { var parsedJson, jobSpecJson, constraintsJson, scheduleJson, objJson, client, resultMapper, tips, batchOptions; var __frame = { name: "updateJobSchedule", line: 425 }; return __func(_, this, arguments, updateJobSchedule, 3, __frame, function __$updateJobSchedule() { if (!jobScheduleId) { jobScheduleId = options.id; } ; return interaction.promptIfNotGiven($("Job schedule id: "), jobScheduleId, __cb(_, __frame, 4, 32, function ___(__0, __1) { jobScheduleId = __1; if (!jsonFile) { jsonFile = options.jsonFile; } ; parsedJson = { }; return (function __$updateJobSchedule(__then) { if (!jsonFile) { return (function __$updateJobSchedule(__then) { if ((((((((!options.poolId && !options.priority) && !options.maxWallClockTime) && !options.maxTaskRetryCount) && !options.doNotRunUntil) && !options.doNotRunAfter) && !options.startWindow) && !options.recurrenceInterval)) { return interaction.promptIfNotGiven($("JSON file name: "), jsonFile, __cb(_, __frame, 14, 31, function ___(__0, __2) { jsonFile = __2; __then(); }, true)); } else { jobSpecJson = { }; if (options.poolId) { __.extend(jobSpecJson, { poolInfo: { poolId: options.poolId } }); } ; if (options.priority) { __.extend(jobSpecJson, { priority: Number(options.priority) }); } ; constraintsJson = { }; if (options.maxWallClockTime) { __.extend(constraintsJson, { maxWallClockTime: options.maxWallClockTime }); } ; if (options.maxTaskRetryCount) { __.extend(constraintsJson, { maxTaskRetryCount: Number(options.maxTaskRetryCount) }); } ; __.extend(jobSpecJson, { constraints: constraintsJson }); scheduleJson = { }; if (options.doNotRunUntil) { __.extend(scheduleJson, { doNotRunUntil: options.doNotRunUntil }); } ; if (options.doNotRunAfter) { __.extend(scheduleJson, { doNotRunAfter: options.doNotRunAfter }); } ; if (options.startWindow) { __.extend(scheduleJson, { startWindow: options.startWindow }); } ; if (options.recurrenceInterval) { __.extend(scheduleJson, { recurrenceInterval: options.recurrenceInterval }); } ; __.extend(parsedJson, { jobSpecification: jobSpecJson }); __.extend(parsedJson, { schedule: scheduleJson }); __then(); } ; })(__then); } else { __then(); } ; })(function __$updateJobSchedule() { if (jsonFile) { objJson = fs.readFileSync(jsonFile).toString(); parsedJson = JSON.parse(objJson); } ; client = batchUtil.createBatchServiceClient(options); batchOptions = { }; return (function __$updateJobSchedule(__then) { if (options.replace) { if (((parsedJson !== null) && (parsedJson !== undefined))) { resultMapper = new client.models["JobScheduleUpdateParameter"]().mapper(); updateJobScheduleParam = client.deserialize(resultMapper, parsedJson, "result"); } ; tips = util.format($("Updating job schedule %s"), jobScheduleId); batchOptions.jobScheduleUpdateOptions = batchUtil.getBatchOperationDefaultOption(); if (options.ifMatch) { batchOptions.jobScheduleUpdateOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobScheduleUpdateOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobScheduleUpdateOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobScheduleUpdateOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$updateJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$updateJobSchedule() { return client.jobSchedule.update(jobScheduleId, updateJobScheduleParam, batchOptions, __cb(_, __frame, 96, 27, __then, true)); }); })(function ___(err, __result) { __catch(function __$updateJobSchedule() { if (err) { if (batchUtil.isNotFoundException(err)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$updateJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$updateJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, __then); }); } else { if (((parsedJson !== null) && (parsedJson !== undefined))) { resultMapper = new client.models["JobSchedulePatchParameter"]().mapper(); updateJobScheduleParam = client.deserialize(resultMapper, parsedJson, "result"); } ; tips = util.format($("Patching job schedule %s"), jobScheduleId); batchOptions.jobSchedulePatchOptions = batchUtil.getBatchOperationDefaultOption(); if (options.ifMatch) { batchOptions.jobSchedulePatchOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobSchedulePatchOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobSchedulePatchOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobSchedulePatchOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$updateJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$updateJobSchedule() { return client.jobSchedule.patch(jobScheduleId, updateJobScheduleParam, batchOptions, __cb(_, __frame, 137, 27, __then, true)); }); })(function ___(err, __result) { __catch(function __$updateJobSchedule() { if (err) { if (batchUtil.isNotFoundException(err)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$updateJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$updateJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, __then); }); } ; })(function __$updateJobSchedule() { logger.verbose(util.format($("Job schedule %s has been updated/patched successfully"), jobScheduleId)); return showJobSchedule(jobScheduleId, options, __cb(_, __frame, 156, 4, function __$updateJobSchedule() { _(); }, true)); }); }); }, true)); }); }; function enableJobSchedule(jobScheduleId, options, _) { var client, tips, batchOptions; var __frame = { name: "enableJobSchedule", line: 590 }; return __func(_, this, arguments, enableJobSchedule, 2, __frame, function __$enableJobSchedule() { client = batchUtil.createBatchServiceClient(options); tips = util.format($("Enabling job schedule %s"), jobScheduleId); batchOptions = { }; batchOptions.jobScheduleEnableOptions = batchUtil.getBatchOperationDefaultOption(); if (options.ifMatch) { batchOptions.jobScheduleEnableOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobScheduleEnableOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobScheduleEnableOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobScheduleEnableOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$enableJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$enableJobSchedule() { return client.jobSchedule.enable(jobScheduleId, batchOptions, __cb(_, __frame, 23, 25, __then, true)); }); })(function ___(err, __result) { __catch(function __$enableJobSchedule() { if (err) { if (batchUtil.isNotFoundException(err)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$enableJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$enableJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$enableJobSchedule() { logger.info(util.format($("Job schedule %s has been enabled"), jobScheduleId)); _(); }); }); }); }; function disableJobSchedule(jobScheduleId, options, _) { var client, tips, batchOptions; var __frame = { name: "disableJobSchedule", line: 639 }; return __func(_, this, arguments, disableJobSchedule, 2, __frame, function __$disableJobSchedule() { client = batchUtil.createBatchServiceClient(options); tips = util.format($("Disabling job schedule %s"), jobScheduleId); batchOptions = { }; batchOptions.jobScheduleDisableOptions = batchUtil.getBatchOperationDefaultOption(); if (options.ifMatch) { batchOptions.jobScheduleDisableOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobScheduleDisableOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobScheduleDisableOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobScheduleDisableOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$disableJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$disableJobSchedule() { return client.jobSchedule.disable(jobScheduleId, batchOptions, __cb(_, __frame, 23, 25, __then, true)); }); })(function ___(err, __result) { __catch(function __$disableJobSchedule() { if (err) { if (batchUtil.isNotFoundException(err)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$disableJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$disableJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$disableJobSchedule() { logger.info(util.format($("Job schedule %s has been disabled"), jobScheduleId)); _(); }); }); }); }; function terminateJobSchedule(jobScheduleId, options, _) { var client, tips, batchOptions; var __frame = { name: "terminateJobSchedule", line: 688 }; return __func(_, this, arguments, terminateJobSchedule, 2, __frame, function __$terminateJobSchedule() { client = batchUtil.createBatchServiceClient(options); tips = util.format($("Terminating job schedule %s"), jobScheduleId); batchOptions = { }; batchOptions.jobScheduleTerminateOptions = batchUtil.getBatchOperationDefaultOption(); if (options.ifMatch) { batchOptions.jobScheduleTerminateOptions.ifMatch = options.ifMatch; } ; if (options.ifNoneMatch) { batchOptions.jobScheduleTerminateOptions.ifNoneMatch = options.ifNoneMatch; } ; if (options.ifModifiedSince) { batchOptions.jobScheduleTerminateOptions.ifModifiedSince = options.ifModifiedSince; } ; if (options.ifUnmodifiedSince) { batchOptions.jobScheduleTerminateOptions.ifUnmodifiedSince = options.ifUnmodifiedSince; } ; startProgress(tips); return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$terminateJobSchedule() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$terminateJobSchedule() { return client.jobSchedule.terminate(jobScheduleId, batchOptions, __cb(_, __frame, 23, 25, __then, true)); }); })(function ___(err, __result) { __catch(function __$terminateJobSchedule() { if (err) { if (batchUtil.isNotFoundException(err)) { return _(new Error(util.format($("Job schedule %s does not exist"), jobScheduleId))); } else { if (err.message) { if ((typeof err.message === "object")) { err.message = err.message.value; } ; } ; return _(err); } ; __then(); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$terminateJobSchedule() { _(null, null, true); }); }); }); })(function ___(__e, __r, __cont) { (function ___(__then) { __tryCatch(_, function __$terminateJobSchedule() { endProgress(); __then(); }); })(function ___() { __tryCatch(_, function ___() { if (__cont) { __then(); } else { _(__e, __r); }; }); }); }); })(function ___() { __tryCatch(_, function __$terminateJobSchedule() { logger.info(util.format($("Job schedule %s has been terminated"), jobScheduleId)); _(); }); }); }); };};