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.
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 |
# File 'lib/nexpose.rb', line 1369 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
1363 1364 1365 |
# File 'lib/nexpose.rb', line 1363 def connection @connection end |
#devices ⇒ Object (readonly)
//Array of (Device)*
1367 1368 1369 |
# File 'lib/nexpose.rb', line 1367 def devices @devices end |
#error ⇒ Object (readonly)
true if an error condition exists; false otherwise
1355 1356 1357 |
# File 'lib/nexpose.rb', line 1355 def error @error end |
#error_msg ⇒ Object (readonly)
Error message string
1357 1358 1359 |
# File 'lib/nexpose.rb', line 1357 def error_msg @error_msg end |
#request_xml ⇒ Object (readonly)
The last XML request sent by this object
1359 1360 1361 |
# File 'lib/nexpose.rb', line 1359 def request_xml @request_xml end |
#response_xml ⇒ Object (readonly)
The last XML response received by this object
1361 1362 1363 |
# File 'lib/nexpose.rb', line 1361 def response_xml @response_xml end |
#site_id ⇒ Object (readonly)
The Site ID. 0 if all sites are specified.
1365 1366 1367 |
# File 'lib/nexpose.rb', line 1365 def site_id @site_id end |