-
Notifications
You must be signed in to change notification settings - Fork 85
/
ListCatalogTemplates.ts
41 lines (37 loc) · 1.77 KB
/
ListCatalogTemplates.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* 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.
*
*/
import { ZosmfRestClient, nozOSMFVersion } from "@zowe/core-for-zowe-sdk";
import { AbstractSession } from "@zowe/imperative";
import { ProvisioningValidator } from "./ProvisioningValidator";
import { ProvisioningConstants } from "./ProvisioningConstants";
import { IPublishedTemplates } from "./doc/zosmf/IPublishedTemplates";
/**
* Get info about all published templates.
* @export
* @class ListCatalogTemplates
*/
export class ListCatalogTemplates {
/**
* This operation returns the catalog of published software service templates.
* @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.
* @returns {Promise<IPublishedTemplates>} z/OSMF response object, @see {IPublishedTemplates}
* @memberof ListCatalogTemplates
*/
public static async listCatalogCommon(session: AbstractSession, zOSMFVersion: string) {
ProvisioningValidator.validateSession(session);
ProvisioningValidator.validateNotEmptyString(zOSMFVersion, nozOSMFVersion.message);
let listTemplatesResources: string = `${ProvisioningConstants.RESOURCE}/${zOSMFVersion}`;
listTemplatesResources += `/${ProvisioningConstants.TEMPLATES_RESOURCES}/`;
return ZosmfRestClient.getExpectJSON<IPublishedTemplates>(session, listTemplatesResources);
}
}