Class: EpoClient

EpoClient(dxlClient, epoUniqueIdopt)

This client provides a high level wrapper for invoking ePO remote commands via the Data Exchange Layer (DXL) fabric.

The purpose of this library is to allow users to invoke ePO remote commands without having to focus on lower-level details such as ePO-specific DXL topics and message formats.

ePO Unique Identifier

DXL supports communicating with multiple ePO servers on a single DXL fabric. However, each instance of this client can only be associated with one ePO server (the server it will be invoking remote commands on).

The ePO unique identifier specified must match the identifier that was associated with the particular ePO when a corresponding ePO DXL service was started.

If only one ePO server is connected to the DXL fabric this parameter is optional (the client will automatically determine the ePO's unique identifier).

The EpoClient.lookupEpoUniqueIdentifiers method can be used to determine the unique identifiers for ePO servers that are currently exposed to the fabric.

Constructor

new EpoClient(dxlClient, epoUniqueIdopt)

Parameters:
Name Type Attributes Description
dxlClient external:DxlClient

The DXL client to use for communication with the ePO DXL service

epoUniqueId String <optional>

The unique identifier used to specify the ePO server that this client will communicate with.

Source:

Methods

(static) lookupEpoUniqueIdentifiers(dxlClient, callback)

Retrieves an array of strings containing the unique identifiers for the ePO servers that are currently exposed to the DXL fabric.

Parameters:
Name Type Description
dxlClient external:DxlClient

The DXL client with which to perform the request

callback function

Callback function to invoke with the unique identifiers which are found. If an error occurs when performing the lookup, the first parameter supplied to the callback contains an Error object with failure details. On successful lookup, the array of unique identifier strings is provided as the second parameter to the callback.

Source:

addThreatEventCallback(threatEventResponseCallback, topicopt)

Registers an event callback with the client to receive ePO threat events.

Parameters:
Name Type Attributes Default Description
threatEventResponseCallback function

The function that will receive ePO threat events. The first argument passed to the callback function is an object decoded from the JSON payload of the event content. The second argument passed to the callback function is the full DXL Event object.

topic String <optional>
/mcafee/event/epo/threat/response

The topic that ePO threat events are published to.

Source:
Example
epoClient.addThreatEventCallback(function (threatEventObj, originalEvent) {
  console.log('Threat event on topic: ' + originalEvent.destinationTopic)
  console.log(threatEventObj)
})

help(responseCallback)

Returns the list of remote commands that are supported by the ePO server this client is communicating with.

Parameters:
Name Type Description
responseCallback function

Callback function to invoke with the remote commands which are found. If an error occurs when performing the command, the first parameter supplied to the callback contains an Error object with failure details. On successful execution of the command, the remote command output is provided as the second parameter to the callback.

If determination of the ePO unique identifier fails, the first parameter supplied to the callback contains an Error object with failure details. An Error object could be delivered for any of the following conditions:

  • No value is provided for the epoUniqueId parameter during client construction and zero or more than 1 ePO service is found on the DXL fabric.
  • A value is provided for the epoUniqueId parameter during client construction but no ePO service matching the id is found on the DXL fabric.
  • An error occurs when trying to make DXL requests to the broker to query for available ePO services.
Source:
Examples

Example Usage

epoClient.help(function (helpError, helpText) {
  if (helpError) {
    console.log('Error getting help: ' + helpError.message)
  } else {
    console.log(helpText)
  }
})

Example Response Text

ComputerMgmt.createAgentDeploymentUrlCmd deployPath groupId [edit] [ahId]
[fallBackAhId] [urlName] [agentVersionNumber] [agentHotFix] - Create Agent
Deployment URL Command
ComputerMgmt.createCustomInstallPackageCmd deployPath [ahId] [fallBackAhId] -
Create Custom Install Package Command
ComputerMgmt.createDefaultAgentDeploymentUrlCmd tenantId - Create Default
Non-Editable Agent Deployment URL Command
ComputerMgmt.createTagGroup parentTagGroupId newTagGroupName - Create a new
subgroup under an existing tag group.
ComputerMgmt.deleteTag tagIds [forceDelete] - Delete one or more tags.

removeThreatEventCallback(threatEventResponseCallback, topicopt)

Unregisters an event callback from the client so that it will no longer receive ePO threat events.

Parameters:
Name Type Attributes Default Description
threatEventResponseCallback function

The function to unregister.

topic String <optional>
/mcafee/event/epo/threat/response

The topic that ePO threat events are published to.

Source:

runCommand(commandName, optionsopt)

Invokes an ePO remote command on the ePO server this client is communicating with.

Parameters:
Name Type Attributes Description
commandName String

The name of the remote command to invoke.

options Object <optional>

Additional options to supply for the remote command.

Properties
Name Type Attributes Default Description
responseCallback function <optional>

Callback function to invoke with the results of the remote command.

If an error occurs when performing the command, the first parameter supplied to the callback contains an Error object with failure details. On successful execution of the command, the remote command output is provided as the second parameter to the callback. If supported for the remote command, the raw response payload should be formatted in JSON. The type of the response payload can be set via the outputFormat option.

If determination of the ePO unique identifier fails, the first parameter supplied to the callback contains an Error object with failure details. An Error object could be delivered for any of the following conditions:

  • No value is provided for the epoUniqueId parameter during client construction and zero or more than 1 ePO service is found on the DXL fabric.
  • A value is provided for the epoUniqueId parameter during client construction but no ePO service matching the id is found on the DXL fabric.
  • An error occurs when trying to make DXL requests to the broker to query for available ePO services.
params Object <optional>

An object containing the parameters for the command.

outputFormat String <optional>
object

The output format for ePO to use when returning the response. The list of output formats can be found in the OutputFormat constants module.

Source:
Throws:

If the outputFormat is not valid.

Type
TypeError
Examples

Example Usage

epoClient.runCommand('system.find',
  {
    responseCallback: function (searchError, responseObj) {
      if (searchError) {
        console.log('Error finding system: ' + searchError.message)
      } else {
        console.log(JSON.stringify(responseObj, null, 2))
      }
    },
    params: {searchText: 'mySystem'}
  }
)

Example Response Text

[
  {
    "EPOBranchNode.AutoID": 7,
    "EPOComputerProperties.CPUSerialNum": "N/A",
    "EPOComputerProperties.CPUSpeed": 2794,
    "EPOComputerProperties.CPUType": "Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz",
    "EPOComputerProperties.ComputerName": "mySystemForTesting",
    "EPOComputerProperties.DefaultLangID": "0409",
   ...
  }
]