ReportCiStatusOutputJS - Scoped

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 2 minutes to read
  • The ReportCiStatusOutputJS methods are getters that return specific object properties for the DiscoveryAPI reportCiIpAddressStatus method and then convert the information into a JSON string.

    This class runs is in the sn_discovery namespace.

    Scoped ReportCiStatusOutputJS - getCiOperationStatus()

    Used to return the state of the scanned CI.

    This is a calculated field based on the last_state field in discovery_device_history table and the state field in the discovery_status table.

    Table 1. Parameters
    Name Type Description
    None
    Table 2. Returns
    Type Description
    string The three possible states returned by this method are:
    • Processing: Discovery is still processing the request.
    • Successful: A CI was created or updated.
    • NotSuccessful: A CI was not created or updated, and the Discovery status was Completed or Cancelled.
    var ipResultObj = sn_discovery.DiscoveryAPI.reportCiIpAddressStatus(ipAddress, discoveryStatus);
    gs.info("ipResultObj(CiOperationStatus): " + ipResultObj.getCiOperationStatus());
    

    Scoped ReportCiStatusOutputJS - getCmdbCI()

    Used to return the value in the cmdb_ci field from the discovery_device_history table for the CI being scanned.

    Table 3. Parameters
    Name Type Description
    None
    Table 4. Returns
    Type Description
    string Sys_id of the CI created or updated. This value can be null in the case of intermediate results before a CI is created.
    var ipResultObj = sn_discovery.DiscoveryAPI.reportCiIpAddressStatus(ipAddress, discoveryStatus);
    gs.info("ipResultObj(cmdb): " + ipResultObj.getCmdbCI());
    

    Scoped ReportCiStatusOutputJS - getDiscoveryState()

    Used to return the value from the State field in the Discovery Status [discovery_status] table.

    The values returned by this method are used to calculate the value returned by the getCiOperationStatus() method

    Table 5. Parameters
    Name Type Description
    None
    Table 6. Returns
    Type Description
    string The possible states returned by this method are:
    • Starting
    • Active
    • Complete
    • Cancelled
    var ipResultObj = sn_discovery.DiscoveryAPI.reportCiIpAddressStatus(ipAddress, discoveryStatus);
    gs.info("ipResultObj(discoveryState): " + ipResultObj.getDiscoveryState());
    

    Scoped ReportCiStatusOutputJS - getIpAddress()

    Used to return the value from the source field in the discovery_device_history table for the CI being scanned.

    Table 7. Parameters
    Name Type Description
    None
    Table 8. Returns
    Type Description
    string The IP address of the CI being scanned.
    var ipResultObj = sn_discovery.DiscoveryAPI.reportCiIpAddressStatus(ipAddress, discoveryStatus);
    gs.info("ipResultObj(IpAddress): " + ipResultObj.getIpAddress());

    Scoped ReportCiStatusOutputJS - getIssues()

    Used to return the value from the issues field in the discovery_device_history table for the CI being scanned.

    Table 9. Parameters
    Name Type Description
    None
    Table 10. Returns
    Type Description
    integer Number of issues in this Discovery for this CI.
    var ipResultObj = sn_discovery.DiscoveryAPI.reportCiIpAddressStatus(ipAddress, discoveryStatus);
    gs.info("ipResultObj(issues): " + ipResultObj.getIssues());

    Scoped ReportCiStatusOutputJS - toJson()

    Used to serialized the ReportCiStatusOutputJS object.

    This method throws the IllegalArgumentException exception, Cannot serialize object, e when the method is unable to serialize the object. The e is the exception object, which provides the exception message and trace.

    Table 13. Parameters
    Name Type Description
    None
    Table 14. Returns
    Type Description
    string Serialized instance of the ReportCiStatusOutputJS object into a JSON string.
    var ipResultObj = sn_discovery.DiscoveryAPI.reportCiIpAddressStatus(ipAddress, discoveryStatus);
    gs.info("ipResultObj(json): " + ipResultObj.toJson());