Class: Nexpose::SiteDeviceListing
- Inherits:
-
Object
- Object
- Nexpose::SiteDeviceListing
- Defined in:
- lib/nexpose.rb
Overview
Description
Object that represents a listing of devices for a site or the entire NSC. Note that only devices which are accessible to the account used to create the connection object will be returned. This object is created and populated automatically with the instantiation of a new Site object.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
The NSC Connection associated with this object.
-
#devices ⇒ Object
readonly
//Array of (Device)*.
-
#error ⇒ Object
readonly
true if an error condition exists; false otherwise.
-
#error_msg ⇒ Object
readonly
Error message string.
-
#request_xml ⇒ Object
readonly
The last XML request sent by this object.
-
#response_xml ⇒ Object
readonly
The last XML response received by this object.
-
#site_id ⇒ Object
readonly
The Site ID.
Instance Method Summary collapse
-
#initialize(connection, site_id = 0) ⇒ SiteDeviceListing
constructor
A new instance of SiteDeviceListing.
Constructor Details
#initialize(connection, site_id = 0) ⇒ SiteDeviceListing
Returns a new instance of SiteDeviceListing.
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
# File 'lib/nexpose.rb', line 892 def initialize(connection, site_id = 0) @site_id = site_id @error = false @connection = connection @devices = Array.new() r = nil if (@site_id) r = @connection.execute('<SiteDeviceListingRequest session-id="' + connection.session_id + '" site-id="' + @site_id + '"/>') else r = @connection.execute('<SiteDeviceListingRequest session-id="' + connection.session_id + '"/>') end if(r.success) response.elements.each('SiteDeviceListingResponse/SiteDevices/device') do |d| @devices.push(Device.new(d.attributes['id'],@site_id,d.attributes["address"],d.attributes["riskfactor"],d.attributes['riskscore'])) end end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
The NSC Connection associated with this object
886 887 888 |
# File 'lib/nexpose.rb', line 886 def connection @connection end |
#devices ⇒ Object (readonly)
//Array of (Device)*
890 891 892 |
# File 'lib/nexpose.rb', line 890 def devices @devices end |
#error ⇒ Object (readonly)
true if an error condition exists; false otherwise
878 879 880 |
# File 'lib/nexpose.rb', line 878 def error @error end |
#error_msg ⇒ Object (readonly)
Error message string
880 881 882 |
# File 'lib/nexpose.rb', line 880 def error_msg @error_msg end |
#request_xml ⇒ Object (readonly)
The last XML request sent by this object
882 883 884 |
# File 'lib/nexpose.rb', line 882 def request_xml @request_xml end |
#response_xml ⇒ Object (readonly)
The last XML response received by this object
884 885 886 |
# File 'lib/nexpose.rb', line 884 def response_xml @response_xml end |
#site_id ⇒ Object (readonly)
The Site ID. 0 if all sites are specified.
888 889 890 |
# File 'lib/nexpose.rb', line 888 def site_id @site_id end |