@zowe/cli
Version:
Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.
44 lines • 2.08 kB
JavaScript
;
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
const rest_1 = require("../../../rest");
const imperative_1 = require("@zowe/imperative");
const WorkflowConstants_1 = require("./WorkflowConstants");
const WorkflowValidator_1 = require("./WorkflowValidator");
/**
* Class to handle archiving the workflow instance in z/OSMF
*
* @export
* @class ArchiveWorkflow
*/
class ArchiveWorkflow {
/**
* Archives the workflow based on the workflow key
*
* @static
* @param {AbstractSession} session z/OSMF session
* @param {string} workflowKey Workflow key of the workflow to be archived
* @param {string} [zOSMFVersion=WorkflowConstants.ZOSMF_VERSION] z/OSMF REST API version
* @returns {Promise<IArchivedWorkflow>} Promise of the output of the workflow archiving
* @memberof ArchiveWorkflow
*/
static archiveWorfklowByKey(session, workflowKey, zOSMFVersion = WorkflowConstants_1.WorkflowConstants.ZOSMF_VERSION) {
WorkflowValidator_1.WorkflowValidator.validateSession(session);
WorkflowValidator_1.WorkflowValidator.validateNotEmptyString(workflowKey, WorkflowConstants_1.noWorkflowKey.message);
WorkflowValidator_1.WorkflowValidator.validateNotEmptyString(zOSMFVersion, WorkflowConstants_1.nozOSMFVersion.message);
let query = `${WorkflowConstants_1.WorkflowConstants.RESOURCE}/${zOSMFVersion}/${WorkflowConstants_1.WorkflowConstants.WORKFLOW_RESOURCE}`;
query += `/${workflowKey}/${WorkflowConstants_1.WorkflowConstants.ARCHIVE_WORKFLOW}`;
return rest_1.ZosmfRestClient.postExpectJSON(session, query, [imperative_1.Headers.APPLICATION_JSON], null);
}
}
exports.ArchiveWorkflow = ArchiveWorkflow;
//# sourceMappingURL=ArchiveWorkflow.js.map