Class: Nexpose::DiscoveredAsset

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/discovery.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ DiscoveredAsset

Returns a new instance of DiscoveredAsset.



265
266
267
# File 'lib/nexpose/discovery.rb', line 265

def initialize(&block)
  instance_eval &block if block_given?
end

Instance Attribute Details

#clusterObject

Returns the value of attribute cluster.



260
261
262
# File 'lib/nexpose/discovery.rb', line 260

def cluster
  @cluster
end

#datacenterObject

Returns the value of attribute datacenter.



259
260
261
# File 'lib/nexpose/discovery.rb', line 259

def datacenter
  @datacenter
end

#hostObject

Returns the value of attribute host.



258
259
260
# File 'lib/nexpose/discovery.rb', line 258

def host
  @host
end

#ipObject

Returns the value of attribute ip.



257
258
259
# File 'lib/nexpose/discovery.rb', line 257

def ip
  @ip
end

#nameObject

Returns the value of attribute name.



256
257
258
# File 'lib/nexpose/discovery.rb', line 256

def name
  @name
end

#osObject

Returns the value of attribute os.



262
263
264
# File 'lib/nexpose/discovery.rb', line 262

def os
  @os
end

#poolObject

Returns the value of attribute pool.



261
262
263
# File 'lib/nexpose/discovery.rb', line 261

def pool
  @pool
end

#statusObject

Returns the value of attribute status.



263
264
265
# File 'lib/nexpose/discovery.rb', line 263

def status
  @status
end

Class Method Details

.parse(json) ⇒ Object



273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/nexpose/discovery.rb', line 273

def self.parse(json)
  new do |asset|
    asset.ip = json['IPAddress']
    asset.os = json['OSName']
    asset.name = json['assetDiscoveryName']
    asset.cluster = json['cluster']
    asset.datacenter = json['datacenter']
    asset.host = json['host']
    asset.status = json['powerStatus']
    asset.pool = json['resourcePool']
  end
end

Instance Method Details

#on?Boolean

Returns:

  • (Boolean)


269
270
271
# File 'lib/nexpose/discovery.rb', line 269

def on?
  @status == 'On'
end