Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @zowe/zosmf-for-zowe-sdk

z/OS Management Facility Package

Contains APIs to interact with the z/OS Management Facility (using z/OSMF REST endpoints).

API Examples

Check z/OSMF status

import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
         CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession, CheckStatus, IZosmfInfoResponse } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-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."});
    }

    const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
    let response: IZosmfInfoResponse;
    response = await CheckStatus.getZosmfInfo(session);
    console.log(response);
    process.exit(0);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

List systems defined to z/OSMF

import { IProfile, Session, Logger, LoggingConfigurer, ImperativeError,
         CredentialManagerFactory } from "@zowe/imperative";
import { ZosmfSession, ListDefinedSystems, IZosmfListDefinedSystemsResponse } from "@zowe/zosmf-for-zowe-sdk";
import { getDefaultProfile } from "@zowe/core-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."});
    }

    const session: Session = ZosmfSession.createBasicZosmfSession(defaultZosmfProfile);
    let response: IZosmfListDefinedSystemsResponse;
    response = await ListDefinedSystems.listDefinedSystems(session);
    console.log(response);
    process.exit(0);
})().catch((err) => {
    console.error(err);
    process.exit(1);
});

Index

Object literals

Const ZosmfConstants

ZosmfConstants: object

Constants to be used by the z/OSMF API

INFO

INFO: string = "/info"

indicator for get info request

RESOURCE

RESOURCE: string = "/zosmf"

Specifies the z/OS data set and file REST interface

SYSTEMS

SYSTEMS: string = "/systems"

indicator for get defined systems in zosmf

TOPOLOGY

TOPOLOGY: string = "/resttopology"

indicator for get topology services

ERROR_CODES

ERROR_CODES: object

Known error codes return by the API

BAD_HOST_NAME

BAD_HOST_NAME: string = "ENOTFOUND"

Error code when unable to connect to host

BAD_PORT

BAD_PORT: string = "ECONNREFUSED"

Error code when unable to connect to port

SELF_SIGNED_CERT_IN_CHAIN

SELF_SIGNED_CERT_IN_CHAIN: string = "SELF_SIGNED_CERT_IN_CHAIN"

Error code when self signed certificate in chain

UNABLE_TO_VERIFY_LEAF_SIGNATURE

UNABLE_TO_VERIFY_LEAF_SIGNATURE: string = "UNABLE_TO_VERIFY_LEAF_SIGNATURE"

Error code when unable to verify the first certificate

Const ZosmfMessages

ZosmfMessages: object

Messages to be used as detail display error message when gathering z/OSMF information

improperRejectUnauthorized

improperRejectUnauthorized: object

Message indicate that the rejectUnauthorized flag was not set properly

message

message: string = "A self-signed certificate was used ({{causeMsg}}),and your reject-unauthorized option is '{{rejectUnauthorized}}'."

invalidHostName

invalidHostName: object

Message indicate that unable to connect to specified host name

message

message: string = "Unable to establish connection to host "

invalidPort

invalidPort: object

Message indicate that unable to establish connection with specified port number

message

message: string = "Unable to establish connection at port "

missingSession

missingSession: object

Message indicate that input session object is invalid

message

message: string = "Missing profile session information."

Generated using TypeDoc