@zosconnect/zosconnect-zowe-cli
Version:
z/OS Connect EE Plugin for Zowe CLI
128 lines • 5.52 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 IBM 2019
*
*/
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 });
exports.ZosConnectService = void 0;
const connection_1 = require("../../connection");
const Service_1 = require("./Service");
class ZosConnectService {
/**
* Get a list of the Services installed in the server.
*
* @param session The session to use for connection information.
*/
static list(session) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const services = yield zosConn.getServices();
const resultsObj = [];
for (const service of services) {
resultsObj.push(new Service_1.Service(service.getName(), service.getDescription(), service.getServiceProvider()));
}
return resultsObj;
});
}
/**
* Install a new service into the Server.
*
* @param session The session to use for connection information.
* @param sarFile The SAR file to install.
*/
static install(session, sarFile) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const service = yield zosConn.createService(sarFile);
return new Service_1.Service(service.getName(), service.getDescription(), service.getServiceProvider());
});
}
/**
* Update the named Service.
*
* @param session The Isession to use for connection information.
* @param serviceName The name of the Service to update.
* @param sarFile The SAR file containing the new Service information.
*/
static update(session, serviceName, sarFile) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const service = yield zosConn.getService(serviceName);
yield service.update(sarFile);
return new Service_1.Service(service.getName(), service.getDescription(), service.getServiceProvider());
});
}
/**
* Delete the named Service from the server.
*
* @param session The Isession to use for connection information.
* @param serviceName The name of the Service to delete.
* @param force Whether the Service should be deleted regardless of status.
*/
static delete(session, serviceName, force) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const service = yield zosConn.getService(serviceName);
if (force) {
yield service.stop();
}
yield service.delete();
});
}
/**
* Set a Service as Started.
*
* @param session The ZosConnectSession to use for connection information.
* @param serviceName The name of the Service.
*/
static start(session, serviceName) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const service = yield zosConn.getService(serviceName);
yield service.start();
});
}
/**
* Set a Service as Stopped.
*
* @param session The ZosConnectSession to use for connection information.
* @param serviceName The name of the Service.
*/
static stop(session, serviceName) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const service = yield zosConn.getService(serviceName);
yield service.stop();
});
}
/**
* Get detailed information about a Service.
*
* @param session The ZosConnectSession to use for connection information.
* @param serviceName The name of the Service.
*/
static info(session, serviceName) {
return __awaiter(this, void 0, void 0, function* () {
const zosConn = connection_1.ConnectionUtil.getConnection(session);
const service = yield zosConn.getService(serviceName);
return new Service_1.Service(service.getName(), service.getDescription(), service.getServiceProvider(), yield service.getServiceInvokeUrl(), yield service.getStatus());
});
}
}
exports.ZosConnectService = ZosConnectService;
//# sourceMappingURL=ZosConnectService.js.map