import { ZosmfRestClient , nozOSMFVersion } from "@zowe/core-for-zowe-sdk" ; import { AbstractSession , Headers } from "@zowe/imperative" ; import { ProvisioningValidator } from "./ProvisioningValidator" ; import { noActionName , noInstanceId , ProvisioningConstants } from "./ProvisioningConstants" ; import { IPerformActionResponse } from "./doc/zosmf/IPerformActionResponse" ; export class export class PerformAction { param { AbstractSession } session param { string } zOSMFVersion param { string } instanceId param { string } actionName returns { Promise < IPerformActionResponse > } see { IPerformActionResponse } memberof public static async doProvisioningActionCommon ( session , zOSMFVersion , instanceId , actionName ) { ProvisioningValidator . validateSession ( session ) ; ProvisioningValidator . validateNotEmptyString ( zOSMFVersion , nozOSMFVersion . message ) ; ProvisioningValidator . validateNotEmptyString ( instanceId , noInstanceId . message ) ; ProvisioningValidator . validateNotEmptyString ( actionName , noActionName . message ) ; const resourcesQuery = this . getResourcesQuery ( zOSMFVersion , instanceId , actionName ) ; return ZosmfRestClient . postExpectJSON < IPerformActionResponse > ( session , resourcesQuery , [ Headers . APPLICATION_JSON ] ) ; } param { string } zOSMFVersion param { string } instanceId param { string } actionName returns { string } memberof public static getResourcesQuery ( zOSMFVersion , instanceId , actionName ) { let resourcesQuery = `${ ProvisioningConstants . RESOURCE }/${ zOSMFVersion }/` ; resourcesQuery += `${ ProvisioningConstants . INSTANCES_RESOURCE }/${ instanceId }/` ; resourcesQuery += `${ ProvisioningConstants . ACTIONS_RESOURCES }/${ actionName }` ; return resourcesQuery ; } }