import { AbstractSession , ImperativeExpect } from "@zowe/imperative" ; import { ZosmfRestClient , ZosmfHeaders } from "@zowe/core-for-zowe-sdk" ; import { ZosFilesConstants } from "../../constants/ZosFiles.constants" ; import { ZosFilesMessages } from "../../constants/ZosFiles.messages" ; import { IZosFilesResponse } from "../../doc/IZosFilesResponse" ; import { IZosFilesOptions } from "../../doc/IZosFilesOptions" ; /**
 * This class holds helper functions that are used to unmount file systems through the z/OS MF APIs
 */ export class Unmount { param { AbstractSession } session param { string } fileSystemName param { IZosFilesOptions } options returns { Promise < IZosFilesResponse > } throws throws {Error} When the  ZosmfRestClient throws an error
     *
     *  see https public static async fs ( session , fileSystemName , options ? ) { ImperativeExpect . toNotBeNullOrUndefined ( fileSystemName , ZosFilesMessages . missingFileSystemName . message ) ; ImperativeExpect . toNotBeEqual ( fileSystemName , "" , ZosFilesMessages . missingFileSystemName . message ) ; const endpoint = ZosFilesConstants . RESOURCE + ZosFilesConstants . RES_MFS + "/" + fileSystemName ; const jsonContent = JSON . stringify ( { action : "unmount" } ) ; const headers = [ { "Content-Length" : jsonContent . length } , ZosmfHeaders . ACCEPT_ENCODING ] ; if ( options && options . responseTimeout ) { headers . push ( { [ ZosmfHeaders . X_IBM_RESPONSE_TIMEOUT ] : options . responseTimeout . toString ( ) } ) ; } const data = await ZosmfRestClient . putExpectString ( session , endpoint , headers , jsonContent ) ; return { success : true , commandResponse : ZosFilesMessages . fsUnmountedSuccessfully . message , apiResponse : data } ; } }