Class IQServiceUtilities


  • public class IQServiceUtilities
    extends Object
    Utilities for interacting with the IQService, particularly for executing Powershell
    • Method Detail

      • checkRpcFailure

        protected static sailpoint.object.RpcResponse checkRpcFailure​(sailpoint.object.RpcResponse response)
                                                               throws sailpoint.tools.GeneralException
        Checks the RpcResponse for error messages.

        If there are any, it throws an exception with the messages. If the RpcResponse contains any messages, they will be logged as warnings.

        The default logger will be used. If you wish to provide your own logger, use the two-argument checkRpcFailure(RpcResponse, Log).

        Parameters:
        response - the response to check
        Returns:
        the same response
        Throws:
        sailpoint.tools.GeneralException - if there were any errors
      • checkRpcFailure

        public static sailpoint.object.RpcResponse checkRpcFailure​(sailpoint.object.RpcResponse response,
                                                                   org.apache.commons.logging.Log yourLogger)
                                                            throws sailpoint.tools.GeneralException
        Checks the RpcResponse for error messages.

        If there are any, it throws an exception with the messages. If the RpcResponse contains any messages, they will be logged as warnings.

        Parameters:
        response - the response to check
        yourLogger - The logger ot which the errors should be logged
        Returns:
        the same response
        Throws:
        sailpoint.tools.GeneralException - if there were any errors
      • createFakeAccountRequest

        public static sailpoint.object.ProvisioningPlan.AccountRequest createFakeAccountRequest​(Map<String,​Object> parameters)
        Constructs a fake account request to use for a call to IIQ
        Parameters:
        parameters - Any parameters to send to the IIQ call
        Returns:
        The account request
      • createRPCRequestContent

        public static Map<String,​ObjectcreateRPCRequestContent​(sailpoint.object.Rule rule,
                                                                       sailpoint.object.Application connectionInfo,
                                                                       Map<String,​Object> inputs)
        Creates a map to be passed to an RPCRequest.
        Parameters:
        rule - The rule to execute
        connectionInfo - The Application containing connection into
        inputs - The rule inputs
        Returns:
        The populated Map
      • createRPCRequestContent

        public static Map<String,​ObjectcreateRPCRequestContent​(sailpoint.object.Rule rule,
                                                                       Map<String,​Object> connectionInfo,
                                                                       sailpoint.object.ProvisioningPlan.AccountRequest inputs)
        Creates a map to be passed to an RPCRequest.
        Parameters:
        rule - The rule to execute
        connectionInfo - The Map containing connection into
        inputs - The rule inputs
        Returns:
        The populated Map
      • createRPCRequestContent

        public static Map<String,​ObjectcreateRPCRequestContent​(sailpoint.object.Rule rule,
                                                                       Map<String,​Object> connectionInfo,
                                                                       Map<String,​Object> inputs)
        Creates a map to be passed to an RPCRequest.
        Parameters:
        rule - The rule to execute
        connectionInfo - The Map containing connection into
        inputs - The rule inputs
        Returns:
        The populated Map
      • createRPCRequestContent

        public static Map<String,​ObjectcreateRPCRequestContent​(String commands,
                                                                       sailpoint.object.Application connectionInfo,
                                                                       Map<String,​Object> inputs)
                                                                throws sailpoint.tools.GeneralException
        Creates a map to be passed to an RPCRequest.
        Parameters:
        commands - The Powershell commands to execute; will be translated via wrapPowershellCommands(String, String)
        connectionInfo - The Application containing connection into
        inputs - The rule inputs
        Returns:
        The populated Map
        Throws:
        sailpoint.tools.GeneralException - if constructing request input fails, usually because of failure to read the template
      • createRPCService

        public static sailpoint.connector.RPCService createRPCService​(Map<String,​Object> connectionInfo)
        Constructs an RPCService from the connection info provided
        Parameters:
        connectionInfo - The connection info from an Application or other config
        Returns:
        The resulting RPCService
      • findIQServiceConfig

        public static Map<String,​ObjectfindIQServiceConfig​(Map<String,​Object> connectionInfo)
        Finds the IQService config.

        This is isolated here so that we can ignore warnings on as small a bit of code as possible

        Parameters:
        connectionInfo - The connection info from the application or other config
        Returns:
        The IQService config, either the original, or extracted
      • getStandardTemplate

        public static String getStandardTemplate()
                                          throws IOException,
                                                 sailpoint.tools.GeneralException
        Get standard template from the classpath
        Returns:
        The standard template
        Throws:
        IOException - If any errors occur opening the template stream
        sailpoint.tools.GeneralException - If any errors occur parsing the template stream
      • supportsTLS

        public static boolean supportsTLS()
        Returns true if the RPCService in this instance of IIQ supports TLS.

        The TLS four and five-argument constructors to IQService are available in the following IIQ versions and higher:

        • 8.0 GA
        • 7.3p3
        • 7.2p4
        • 7.1p7

        This result is cached.

        Returns:
        True if it supports TLS, false otherwise
      • wrapPowershellCommands

        public static sailpoint.object.Rule wrapPowershellCommands​(String commands,
                                                                   String ruleTextTemplate)
                                                            throws sailpoint.tools.GeneralException
        Wraps Powershell commands into a Rule, substituting it into a template wrapper.

        This Rule should not be saved, but should be serialized directly with the input to the RPCService.

        Parameters:
        commands - The commands to execute in Powershell
        ruleTextTemplate - The rule text template, or null to use the included default
        Returns:
        The resulting Rule object
        Throws:
        sailpoint.tools.GeneralException - if constructing the new Rule fails