@zowe/cli
Version:
Zowe CLI is a command line interface (CLI) that provides a simple and streamlined way to interact with IBM z/OS.
73 lines • 3.62 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.
*
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const imperative_1 = require("@zowe/imperative");
const path_1 = require("path");
const rest_1 = require("../../../../../rest");
const ZosFiles_constants_1 = require("../../constants/ZosFiles.constants");
const ZosFiles_messages_1 = require("../../constants/ZosFiles.messages");
/**
* This class holds helper functions that are used to recall files through the
* z/OSMF APIs.
*/
class HMigrate {
/**
*
* @param {AbstractSession} session z/OSMF connection info
* @param {string} dataSetName The name of the data set to recall
*
* @returns {Promise<IZosFilesResponse>} A response indicating the status of the recalling
*
* @throws {ImperativeError} Data set name must be specified as a non-empty string
* @throws {Error} When the {@link ZosmfRestClient} throws an error
*
* @see https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.izua700/IZUHPINFO_API_PutDataSetMemberUtilities.htm
*/
static dataSet(session, dataSetName, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
imperative_1.ImperativeExpect.toNotBeNullOrUndefined(dataSetName, ZosFiles_messages_1.ZosFilesMessages.missingDatasetName.message);
imperative_1.ImperativeExpect.toNotBeEqual(dataSetName, "", ZosFiles_messages_1.ZosFilesMessages.missingDatasetName.message);
try {
const endpoint = path_1.posix.join(ZosFiles_constants_1.ZosFilesConstants.RESOURCE, ZosFiles_constants_1.ZosFilesConstants.RES_DS_FILES, dataSetName);
imperative_1.Logger.getAppLogger().debug(`Endpoint: ${endpoint}`);
const payload = { request: "hmigrate" };
if (options.wait != null) {
payload.wait = options.wait;
}
const headers = [
imperative_1.Headers.APPLICATION_JSON,
{ "Content-Length": JSON.stringify(payload).length.toString() },
];
yield rest_1.ZosmfRestClient.putExpectString(session, endpoint, headers, payload);
return {
success: true,
commandResponse: ZosFiles_messages_1.ZosFilesMessages.datasetMigratedSuccessfully.message,
};
}
catch (error) {
imperative_1.Logger.getAppLogger().error(error);
throw error;
}
});
}
}
exports.HMigrate = HMigrate;
//# sourceMappingURL=HMigrate.js.map