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.
1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 |
# File 'lib/nexpose.rb', line 1240 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
1234 1235 1236 |
# File 'lib/nexpose.rb', line 1234 def connection @connection end |
#devices ⇒ Object (readonly)
//Array of (Device)*
1238 1239 1240 |
# File 'lib/nexpose.rb', line 1238 def devices @devices end |
#error ⇒ Object (readonly)
true if an error condition exists; false otherwise
1226 1227 1228 |
# File 'lib/nexpose.rb', line 1226 def error @error end |
#error_msg ⇒ Object (readonly)
Error message string
1228 1229 1230 |
# File 'lib/nexpose.rb', line 1228 def error_msg @error_msg end |
#request_xml ⇒ Object (readonly)
The last XML request sent by this object
1230 1231 1232 |
# File 'lib/nexpose.rb', line 1230 def request_xml @request_xml end |
#response_xml ⇒ Object (readonly)
The last XML response received by this object
1232 1233 1234 |
# File 'lib/nexpose.rb', line 1232 def response_xml @response_xml end |
#site_id ⇒ Object (readonly)
The Site ID. 0 if all sites are specified.
1236 1237 1238 |
# File 'lib/nexpose.rb', line 1236 def site_id @site_id end |