dxlepoclient.client module¶
-
class
dxlepoclient.client.
EpoClient
(dxl_client, epo_unique_id=None)¶ Bases:
dxlbootstrap.client.Client
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
lookup_epo_unique_identifiers()
method can be used to determine the unique identifiers for ePO servers that are currently exposed to the fabric.Constructor parameters:
Parameters: - dxl_client -- The DXL client to use for communication with the ePO DXL service
- epo_unique_id -- (optional) The unique identifier used to specify the ePO server that this client will communicate with.
Raises: Exception -- If a value is provided for epo_unique_id but no matching service is registered with the DXL fabric.
-
DEFAULT_RESPONSE_TIMEOUT
= 30¶
-
DXL_REQUEST_FORMAT
= '/mcafee/service/epo/remote/{0}'¶
-
DXL_REQUEST_PREFIX
= '/mcafee/service/epo/remote/'¶
-
DXL_SERVICE_TYPE
= '/mcafee/service/epo/remote'¶
-
MIN_RESPONSE_TIMEOUT
= 30¶
-
help
(output_format='verbose')¶ Returns the list of remote commands that are supported by the ePO server this client is communicating with.
Example Usage
# Display the help print(epo_client.help())
Example Response
ComputerMgmt.createAgentDeploymentUrlCmd deployPath groupId urlName agentVersionNumber agentHotFix [edit] [ahId] [fallBackAhId] - 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. ...
Parameters: output_format -- (optional) The output format for ePO to use when returning the response. The list of output formats can be found in the OutputFormat
constants class. If the command is processed by the ePO-hosted DXL Commands service, this parameter can only be set toOutputFormat.VERBOSE
orOutputFormat.JSON
.Raises: Exception -- If an unsupported output format is specified. This exception is raised if the command is to be sent to an ePO-hosted DXL Commands service and an output format of anything other than OutputFormat.VERBOSE
orOutputFormat.JSON
is specified.Returns: The result of the remote command execution
-
static
lookup_epo_unique_identifiers
(dxl_client, response_timeout=30)¶ Returns a
set
containing the unique identifiers for the ePO servers that are currently exposed to the DXL fabricParameters: - dxl_client -- The DXL client with which to perform the request
- response_timeout -- (optional) The maximum amount of time to wait for a response
Returns: A
set
containing the unique identifiers for the ePO servers that are currently exposed to the DXL fabric.
-
run_command
(command_name, params=None, output_format='json')¶ Invokes an ePO remote command on the ePO server this client is communicating with.
Example Usage
# Run the system find command result = epo_client.run_command("system.find", {"searchText": "mySystem"})
Example Response
[ { "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", ... } ]
Parameters: - command_name -- The name of the remote command to invoke
- params -- (optional) A dictionary (
dict
) containing the parameters for the command - output_format -- (optional) The output format for ePO to use when
returning the response. The list of output formats can be found
in the
OutputFormat
constants class. This parameter can only be set to a value other thanOutputFormat.JSON
when the command is processed by a McAfee ePO DXL Python Service service. If the command is processed by the ePO-hosted DXL commands service, this parameter can only be set toOutputFormat.JSON
. For compatibility across ePO service configurations, it is suggested to not set this parameter (using the default value ofOutputFormat.JSON
).
Raises: Exception -- If an unsupported output format is specified. This exception is raised if the command is to be sent to an ePO-hosted DXL Commands service and an output format of anything other than
OutputFormat.JSON
is specified.Returns: The result of the remote command execution
-
class
dxlepoclient.client.
OutputFormat
¶ Bases:
object
Constants that are used to indicate the output format for ePO to use when responding to a remote command invocation.
Type Description JSON JSON format XML XML format VERBOSE Text-based format (verbose) TERSE Text-based format (terse) -
JSON
= 'json'¶
-
TERSE
= 'terse'¶
-
VERBOSE
= 'verbose'¶
-
XML
= 'xml'¶
-
static
validate
(output_format)¶ Validates that the specified format is valid (json, xml, etc.). If the format is not valid an exception is thrown.
Parameters: output_format -- The output format
-