apiconnect-collective-controller-api
v3.2.1
Published
## Deprecation Notice Since the API Connect Collective Controller has been deprecated, this module is also deprecated. While it may work with Liberty Profile in the future, no guarantees are made about its functionality with those versions.
Downloads
66
Keywords
Readme
apiconnect-collective-controller-api
Deprecation Notice
Since the API Connect Collective Controller has been deprecated, this module is also deprecated. While it may work with Liberty Profile in the future, no guarantees are made about its functionality with those versions.
Overview
Provides a library of functions for deployment and control via a Collective Controller. The primary purpose of this library is to allow the API Connect Toolkit more direct control over a collective controller and its member applications.
This library is intended for internal use only, and is not meant for public consumption. Please refer to the API Reference for help with usage.
API Reference
Modules
Classes
apiconnect-collective-controller-api
Cluster
Kind: global class
- Cluster
- new Cluster()
- .listClusterNames(host, port, username, password)
- .listMembers(host, port, username, password, clusterName)
- .restartCluster(host, port, username, password, clusterName)
- .undeployCluster(host, port, username, password, clusterName)
- .parseMembers(data)
- .undeployMembers(host, port, username, password, members)
- .undeployMember(host, port, username, password, member)
- .disableScalingPolicy(host, port, username, password, clusterName)
- .setScale(clusterName, host, instances, password, port, username)
- .getScale(host, password, port, username)
new Cluster()
Operations for deploying a cluster of applications to a collective.
Cluster.listClusterNames(host, port, username, password)
List all clusters registered to controller.
Kind: static method of Cluster
| Param | Type | Description |
| --- | --- | --- |
| host | string | Hostname of controller. |
| port | string | Port to get to controller. |
| username | string | Admin username for controller. |
| password | string | Admin password for controller. Returns array of members in the form host,userdir,servername
|
Cluster.listMembers(host, port, username, password, clusterName)
Lists all members of a cluster.
Kind: static method of Cluster
| Param | Type | Description |
| --- | --- | --- |
| host | string | Hostname of controller. |
| port | string | Port to get to controller. |
| username | string | Admin username for controller. |
| password | string | Admin password for controller. |
| clusterName | string | Name of cluster. Returns a simple array of strings with members registed to cluster in the form host,userdir,servername
. Example: ['hostname,userdir,servername','hostname,userdir,servername2']. |
Cluster.restartCluster(host, port, username, password, clusterName)
Restarts all members in a cluster.
Kind: static method of Cluster
| Param | Type | Description |
| --- | --- | --- |
| host | string | Hostname of controller. |
| port | string | Port to get to controller. |
| username | string | Admin username for controller. |
| password | string | Admin password for controller. |
| clusterName | string | Name of cluster. Returns array of clusters in the form ["cluster1","cluster2"]
. |
Cluster.undeployCluster(host, port, username, password, clusterName)
Undeploys all members in a cluster.
Kind: static method of Cluster
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller. | | port | string | Port to get to controller. | | username | string | Admin username for controller. | | password | string | Admin password for controller. | | clusterName | string | Name of cluster. Returns err and array of objects consisting of undeploy status, stderr, stdout, and the serverName for the target member. The signature of the returned result: cb(err OR null, [ {"status":"FINISHED","serverName":"someName","stdout":"...", "stderr":""} {"status":"ERROR","serverName":"someName","stdout":"", "stderr":"..."} ]) |
Cluster.parseMembers(data)
Internal function, exposed for unit tests.
Parses the results from listMembers()
and returns an array of objects
formatted with the member properties needed to do an undeploy
Kind: static method of Cluster
| Param | Type | Description |
| --- | --- | --- |
| data | Array.<string> | array of strings from listMembers()
needing to be parsed. Returns array of objects consisting of undeploy memberHost, userDir, and serverName for the target member. The signature of the returned result: [ {memberHost: "something.com", userDir: "/foo/path/bar", serverName: "..."} ] |
Cluster.undeployMembers(host, port, username, password, members)
Internal function, exposed for unit tests.
Undeploys all members, defined in an array.
Kind: static method of Cluster
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller. | | port | string | Port to get to controller. | | username | string | Admin username for controller. | | password | string | Admin password for controller. | | members | object | Array of objects consisting of memberHost, userDir, and serverName. |
Properties
| Name | Type | Description | | --- | --- | --- | | memberHost | string | The member host name | | userDir | string | The WLPN_USER_DIR where the member code lives. | | serverName | string | The name of the server/application instance. |
Cluster.undeployMember(host, port, username, password, member)
Undeploys a member.
Kind: static method of Cluster
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller. | | port | string | Port to get to controller. | | username | string | Admin username for controller. | | password | string | Admin password for controller. | | member | Object.<string, string> | The member to undeploy, is an object consisting of memberHost, userDir, and serverName. |
Cluster.disableScalingPolicy(host, port, username, password, clusterName)
Disables the scalingPolicy for a cluster. Used when undeploying so more members do not get deployed when existing ones go down.
Kind: static method of Cluster
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller. | | port | string | Port to get to controller. | | username | string | Admin username for controller. | | password | string | Admin password for controller. | | clusterName | string | Name of cluster. |
Cluster.setScale(clusterName, host, instances, password, port, username)
Sets the Scaling Policy and overrides the file in the controller.
Kind: static method of Cluster
| Param | Type | Description | | --- | --- | --- | | clusterName | string | is required. | | host | string | Hostname of controller to the collective. | | instances | string | number of instances to set for cluster scaling. | | password | string | Admin password for controller. | | port | string | Port to get to controller. not provided, the other parameters must be passed into the function call | | username | string | Admin username for controller. member. |
Cluster.getScale(host, password, port, username)
Gets the Scaling Policy from controller configDropins/overrides folder.
Kind: static method of Cluster
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller to the collective. | | password | string | Admin password for controller. | | port | string | Port to get to controller. not provided, the other parameters must be passed into the function call | | username | string | Admin username for controller. member. |
FileService
Kind: global class
- FileService
- new FileService()
- .upload([appDir], host, password, port, srcFile, username)
- .deploy(appDir, appPackage, [clusterName], host, [instances], keystorePassword, password, port, serverName, [srcFile], username)
- .undeploy(host, port, username, password, memberHost, userDir, serverName)
- .uploadPackage(host, password, port, srcFile, username)
- .uploadDeployRules(appPackage, [clusterName], host, [instances], keystorePassword, password, port, serverName, username)
- .uploadScalingPolicy(appPackage, [clusterName], host, instances, password, port, username)
new FileService()
Module for handling file uploads and member server deployment with uploaded packages.
FileService.upload([appDir], host, password, port, srcFile, username)
Upload to controller.
Kind: static method of FileService
| Param | Type | Description | | --- | --- | --- | | [appDir] | string | Application directory on controller to place file. | | host | string | Hostname of controller. | | password | string | Admin password for controller. | | port | string | Port to get to controller. | | srcFile | string | local file you are uploading. | | username | string | Admin username for controller. |
FileService.deploy(appDir, appPackage, [clusterName], host, [instances], keystorePassword, password, port, serverName, [srcFile], username)
Deploy to member (creates new member), must have package already uploaded.
Kind: static method of FileService
| Param | Type | Description | | --- | --- | --- | | appDir | string | Application directory on controller to place file. | | appPackage | string | The name of the package being deployed. Should already be on the server in the specified appDir. | | [clusterName] | string | The name of the deployed cluster to affect, also used for file naming for file being uploaded. If no clusterName is specified, will take the filename from package srcFile (if specified) or appPackage, if that is used instead. | | host | string | Hostname of controller. | | [instances] | string | number of instances to set for cluster scaling (both min and max). If not specified, will default to 1. | | keystorePassword | string | Keystore Password for joining new member to the collective. | | password | string | Admin password for controller. | | port | string | Port to get to controller. | | serverName | string | Name of new member. | | [srcFile] | string | local file to upload before deploy. If this is not provided, the appPackage must be passed into the function call. | | username | string | Admin username for controller. |
FileService.undeploy(host, port, username, password, memberHost, userDir, serverName)
Undeploy to member (stops and removes).
Kind: static method of FileService
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller. | | port | string | Port to get to controller. | | username | string | Admin username for controller. | | password | string | Admin password for controller. | | memberHost | string | hostname of member host where member was deployed. | | userDir | string | userDir that member was deployed on member host. | | serverName | string | Name of member to undeploy. |
FileService.uploadPackage(host, password, port, srcFile, username)
Upload Package to controller stackGroup location.
Kind: static method of FileService
| Param | Type | Description | | --- | --- | --- | | host | string | Hostname of controller. | | password | string | Admin password for controller. | | port | string | Port to get to controller. | | srcFile | string | local file to upload before deploy. If this is not provided, the other parameters must be passed into the function call | | username | string | Admin username for controller. member. |
FileService.uploadDeployRules(appPackage, [clusterName], host, [instances], keystorePassword, password, port, serverName, username)
Upload deploy.xml to controller to stackGroup location. This file is used to feed data into the controller's deployRule.xml.
Kind: static method of FileService
| Param | Type | Description | | --- | --- | --- | | appPackage | string | The name of the package being deployed. Should already be on the server in the specified appDir. If an appPackage is not specified, will use clusterName if specified. If clusterName is specified, will overwrite appPackage for file naming. One or the other is required. | | [clusterName] | string | The name of the deployed cluster to affect, also used for file naming for file being uploaded. scaling policy for. If this is not specified, it will use | | host | string | Hostname of controller. | | [instances] | string | number of instances to set for cluster scaling (both min and max). If not specified, will default to 1. | | keystorePassword | string | Keystore Password for joining new member to the collective. | | password | string | Admin password for controller. | | port | string | Port to get to controller. | | serverName | string | Name of new member. | | username | string | Admin username for controller. member. |
FileService.uploadScalingPolicy(appPackage, [clusterName], host, instances, password, port, username)
Upload Scaling Policy to controller configDropins/overrides folder.
Kind: static method of FileService
| Param | Type | Description | | --- | --- | --- | | appPackage | string | The name of the package being deployed. Should already be on the server in the specified appDir. If an appPackage is not specified, will use clusterName if specified. One or the other is required. | | [clusterName] | string | The name of the deployed cluster to affect, also used for file naming for file being uploaded. | | host | string | Hostname of controller. to the collective. | | instances | string | number of instances to set for cluster scaling. | | password | string | Admin password for controller. | | port | string | Port to get to controller. not provided, the other parameters must be passed into the function call | | username | string | Admin username for controller. member. |
ServerCommand
Kind: global class
new ServerCommand()
Provides commands to directly control server/application instances via a collective controller.
ServerCommand.start(options)
Implements the server start commands.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.hostName | string | The host on which the server is running. | | options.wlpnUserDir | string | The user directory in which the server is set up. | | options.serverName | string | The server name identifying a server. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.stop(options)
Implements the server stop commands.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.hostName | string | The host on which the server is running. | | options.wlpnUserDir | string | The user directory in which the server is set up. | | options.serverName | string | The server name identifying a server. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.status(options)
Implements the server status commands.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.hostName | string | The host on which the server is running. | | options.wlpnUserDir | string | The user directory in which the server is set up. | | options.serverName | string | The server name identifying a server. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.list(options)
Implements the server list commands.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.getData(options)
Retrieve a key-value pair from the Collective Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.path | string | The registry path to get the data stored in a particular path. The data could be an environmental variable formatted as 'key=value'. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.deleteNode(options)
Delete a node in Collective Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.path | string | The registry path to get the data stored in a particular path. The data could be an environmental variable formatted as 'key=value'. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.setData(options)
Sets the data (a key-value pair) in the Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.path | string | The registry path to set the data. | | options.data | string | The data to be stored in the path specified above. The data could be an environmental variable formatted as 'key=value'. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.createNode(options)
Creates a node in the Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.path | string | The registry path to set the data. | | options.data | string | The data to be stored in the path specified above. The data could be an environmental variable formatted as 'key=value'. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.listClusterData(options)
Retrieve a key-value pair from the Collective Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.path | string | The registry path to get the data stored in a particular path. The data could be an environmental variable formatted as 'key=value'. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.getClusterData(options)
Retrieve a key-value pair from the Collective Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.clusterName | string | The name of the cluster to get from. | | options.key | string | The registry path to get the data stored in a particular path. The data could be an environmental variable formatted as 'key=value'. FIXME not 'could be', is | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. | | options.autoAcceptCertificates | string | An option to accept the certificate of the controller. |
ServerCommand.setClusterData(options)
Sets the data (a key-value pair) in the Repository.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.clusterName | string | The name of the cluster to store data. | | options.key | string | The name of the variable to set the data. | | options.data | string | The data to be stored in the variable |
ServerCommand.setIhsInfo()
Sets a IHS IP/name to a port.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options.ihsIp | string | The IP of the IHS server. | | options.ihsPort | string | The port of the IHS server. | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. |
ServerCommand.listIhsInfo()
Gets the IHS IP/name to port mappings
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's password. Return looks like { '1.2.3.4': '8080', ... } |
ServerCommand.getHosts()
Gets a list of hosts registered to the controller.
Kind: static method of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options.host | string | The host on which controller is running. | | options.port | string | The https port assigned to the controller. | | options.user | string | The controller's admin user name. | | options.password | string | The controller's admin password. Returned data looks like: { allServersRunning: 1, allServersStopped: 0, allServersUnknown: 0, someServersRunning: 0, noServers: 0, type: 'hosts', ids: [ 'hostname1', 'hostname2' ] } |
ServerCommand.deleteClusterData
Deletes the data (a key-value pair) in the Repository.
Kind: static typedef of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.clusterName | string | The name of the cluster to remove data from. | | options.key | string | The name of the variable to delete. | | callback | | |
ServerCommand.clearClusterData
Deletes all of data (the key-value pairs) for a cluster in the Repository.
Kind: static typedef of ServerCommand
| Param | Type | Description | | --- | --- | --- | | options | object | The options object. | | options.clusterName | string | The name of the cluster to clear data from. | | callback | | |