@zowe/provisioning-for-zowe-sdk
Version:
Zowe SDK to interact with the z/OS provisioning APIs
65 lines • 3.66 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 });
exports.ListTemplateInfo = void 0;
const core_for_zowe_sdk_1 = require("@zowe/core-for-zowe-sdk");
const ProvisioningValidator_1 = require("./ProvisioningValidator");
const ProvisioningConstants_1 = require("./ProvisioningConstants");
/**
* Get info about a template.
* @export
* @class ListTemplateInfo
*/
class ListTemplateInfo {
/**
* This operation retrieves a published software service template from the catalog.
* @param {AbstractSession} session - z/OSMF connection info
* @param {string} zOSMFVersion - the URI path variable that identifies the version of the z/OSMF software services template service.
* The following value is valid: 1.0.
* @param {string} templateName - the name of published software service template in the catalog.
* @returns {Promise<IPublishedTemplateInfo>} z/OSMF response object, @see {IPublishedTemplateInfo}
* @memberof ListTemplateInfo
*/
static listTemplateCommon(session, zOSMFVersion, templateName) {
return __awaiter(this, void 0, void 0, function* () {
ProvisioningValidator_1.ProvisioningValidator.validateSession(session);
ProvisioningValidator_1.ProvisioningValidator.validateNotEmptyString(zOSMFVersion, core_for_zowe_sdk_1.nozOSMFVersion.message);
ProvisioningValidator_1.ProvisioningValidator.validateNotEmptyString(templateName, ProvisioningConstants_1.noTemplateName.message);
const listTemplateInfoResources = this.getResourcesQuery(zOSMFVersion, templateName);
return core_for_zowe_sdk_1.ZosmfRestClient.getExpectJSON(session, listTemplateInfoResources);
});
}
/**
* Builds a resources query from passed parameters which is needed for z/OSMF api URI.
* @param {string} zOSMFVersion is the URI path variable that identifies the version of the z/OSMF software services template service.
* The following value is valid: 1.0.
* @param {string} templateName is the name of published software service template in the catalog.
* @returns {string} URI for z/OSMF REST call
* @memberof ListTemplateInfo
*/
static getResourcesQuery(zOSMFVersion, templateName) {
let resourcesQuery = `${ProvisioningConstants_1.ProvisioningConstants.RESOURCE}/${zOSMFVersion}/`;
resourcesQuery += `${ProvisioningConstants_1.ProvisioningConstants.TEMPLATES_RESOURCES}/${templateName}`;
return resourcesQuery;
}
}
exports.ListTemplateInfo = ListTemplateInfo;
//# sourceMappingURL=ListTemplateInfo.js.map