ibm-iis-commons v0.7.3
README
Objective of this module is to provide re-usable functionality and utilities for interacting with an IBM Information Server environment using NodeJS.
Utilities
createInfoSvrAuthFile.js
Creates an authorisation file for use with connecting to an Information Server environment. Usage:
node ./createInfoSvrAuthFile.js
-u <user>
[-f <file>]
[-p <password>]
By default (if not specified using the optional parameters), will create a file under ~/.infosvrauth
and will prompt the user to enter the password on the command-line. The utility makes use of Information Server's encrypt.sh
script, so this should be run from an Information Server node (a tier with .../ASBNode/bin/encrypt.sh
). Once created, the authorisation file can then be copied to any other system and used from any other system to provide the connectivity details necessary to connect remotely to the Information Server environment.
If executing the script on the Information Server system itself is not an option, but you still want to create an authorisation file, your best bet is to manually create one using the following format:
user=isadmin
password=
domain=is-server.ibm.com:9445
server=IS-SERVER.IBM.COM
The password can be left blank (most utilities that make use of this authorisation file request the password to be provided separately anyway, either as another parameter or via a command-line prompt). Ensure, however, that the domain
property refers to the correct FQDN of your domain-tier host as well as the port, and that the server
property refers to your engine tier's FQDN.
API
ibm-iis-commons
Re-usable functions for inferring properties of and interacting with an IBM InfoSphere Information Server environment
RestConnection
RestConnection class -- for handling connectivity to REST APIs
Parameters
username
password
host
port
maxSockets
Examples
const commons = require('ibm-iis-commons');
const restConnect = new commons.RestConnection('isadmin', 'isadmin-password', 'localhost', '9445');
const igcrest = require('ibm-igc-rest');
igcrest.setConnection(restConnect);
constructor
Sets up a REST API connection
Parameters
username
string username to use when authenticating to REST APIpassword
string password to use when authenticating to REST APIhost
string hostname of the domain tierport
int port number of the domain tiermaxSockets
int? the maximum number of sockets to support concurrently on the host
auth
Get the authentication object for a REST connection
Returns Object a hash of 'user' and 'pass' basic authentication details
host
Get the hostname for the REST connection
Returns string
port
Get the port for the REST connection
Returns string
connection
Get the qualified connection details for the REST connection (host:port)
Returns string
baseURL
Get the fully-qualified base SSL URL for the REST connection
Returns string
agent
Get the https.Agent object for the REST connection
Returns Object
sessionStatus
Retrieves indication of whether a session is open (true) or not (false)
Returns boolean
markSessionOpen
Marks that a session has been opened
markSessionClosed
Marks that the session has been closed
EnvironmentContext
EnvironmentContext class -- for encapsulating the context of an Information Server environment (NOTE: always run from Engine tier)
Parameters
installLocation
authFile
Examples
const commons = require('ibm-iis-commons');
const envCtx = new commons.EnvironmentContext();
console.log("Host details: " + envCtx.domainHost + ":" + envCtx.domainPort);
console.log("Version : " + envCtx.currentVersion);
console.log("Patches : " + envCtx.installedPatches);
console.loc("$DSHOME : " + envCtx.dshome);
constructor
Sets up everything we can determine about the environment from the current system
Parameters
installLocation
string? specifies the root of the installation ('/opt/IBM/InformationServer' by default)authFile
string? specifies the location of an authorisation file from which information can be retrieved (if available)
ishome
Get the installation location of Information Server
Returns string
dshome
Get the installation location of DataStage
Returns string
asbhome
Get the installation location of the ASBNode
Returns string
istool
Get the fully-qualified location of the istool command
Returns string
currentVersion
Get the version of the Information Server installation
Returns string
installedPatches
Get an array of installed patches on the Information Server environment
domainHost
Get the hostname of the Information Server domain (services) tier
Returns string
domainPort
Get the port number of the Information Server domain (services) tier
Returns string
domain
Get fully-qualified Information Server domain (services) tier information -- host:port
Returns string
engine
Get the hostname of the Information Server engine tier
Returns string
createAuthFileFromParams
Creates an authorisation file that can be used with most Information Server CLI tools (so that passwords are not shown in-the-clear on the command line) -- based on the values provided NOTE: this must be run from the Information Server environment directly (cannot be run remotely)
Parameters
username
string username to use for authenticationpassword
string password to use for authenticationfile
string file into which to store the details
addRemoteConnectionDetailsToAuthFile
Adds remote connection details to an existing authorisation file, that can then be used for connecting to an Information Server system remotely (requires SSH and key-based authentication to be pre-configured, or a local Docker container)
Parameters
file
string authorisation file into which to append the remote connection detailsaccessType
string type of access, either DOCKER or SSHusername
string OS username used for remote accessprivateKey
string SSH private key file used for authenticationhostOrContainer
string hostname (or IP) of the remote Information Server system (when accessType is SSH), or container name (when accessType is DOCKER)port
string? SSH port number for the remote Information Server system
authFile
Get the fully-qualified location of the authorisation file (if any)
Returns string
authFile
Set the location of the authorisation file
Parameters
file
{string}
username
Get the username, from the authorisation file if needed
Returns string
password
Get the user's password, from the authorisation file if needed
Returns string
remoteConnectionString
Get the remote connection string, from the authorisation file if needed
Returns string
remoteCopyString
Get the remote copy string, from the authorisation file if needed
Returns string
getRestConnection
- See: module:ibm-iis-commons~RestConnection
Get a RestConnection object allowing REST API's to connect to this environment
Parameters
password
string unencrypted password to use for REST connection (other details taken from authorisation file automatically)maxSockets
int? the maximum number of sockets to support concurrently on the host
Returns RestConnection
runInfoSvrCommand
Run the provided command on the Information Server environment
Parameters
command
string
copyFile
Copy the provided source file to the target location on the Information Server environment
Parameters
removeFile
Remove the specified file from the Information Server environment
Parameters