Last active
April 29, 2021 18:50
-
-
Save dkelosky/936c5d757ab7527c89fef21e5c508fdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: EPL-2.0 | |
import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError, | |
CredentialManagerFactory } from "@zowe/imperative"; | |
import { ZosmfSession } from "@zowe/zosmf-for-zowe-sdk"; | |
import { getDefaultProfile } from "@zowe/core-for-zowe-sdk"; | |
import { GetJobs, IJob } from "@zowe/zos-jobs-for-zowe-sdk"; | |
(async () => { | |
//Initialize the Imperative Credential Manager Factory and Logger | |
Logger.initLogger(LoggingConfigurer.configureLogger('lib', {name: 'test'})); | |
// Uncommment the below line if the Secure Credential Store is in use | |
// await CredentialManagerFactory.initialize({service: "Zowe-Plugin"}); | |
// Get the default z/OSMF profile and create a z/OSMF session with it | |
let defaultZosmfProfile: IProfile; | |
try { | |
defaultZosmfProfile = await getDefaultProfile("zosmf", true); | |
} catch (err) { | |
throw new ImperativeError({msg: "Failed to get a profile."}); | |
} | |
// Job Options | |
const owner: string = defaultZosmfProfile.user; | |
const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile); | |
let response: IJob[]; | |
// This may take awhile... | |
response = await GetJobs.getJobsByOwner(session, owner); | |
console.log(response); | |
process.exit(0); | |
})().catch((err) => { | |
console.error(err); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment