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.



307
308
309
# File 'lib/nexpose/discovery.rb', line 307

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

Instance Attribute Details

#clusterObject

Returns the value of attribute cluster.



302
303
304
# File 'lib/nexpose/discovery.rb', line 302

def cluster
  @cluster
end

#datacenterObject

Returns the value of attribute datacenter.



301
302
303
# File 'lib/nexpose/discovery.rb', line 301

def datacenter
  @datacenter
end

#hostObject

Returns the value of attribute host.



300
301
302
# File 'lib/nexpose/discovery.rb', line 300

def host
  @host
end

#ipObject

Returns the value of attribute ip.



299
300
301
# File 'lib/nexpose/discovery.rb', line 299

def ip
  @ip
end

#nameObject

Returns the value of attribute name.



298
299
300
# File 'lib/nexpose/discovery.rb', line 298

def name
  @name
end

#osObject

Returns the value of attribute os.



304
305
306
# File 'lib/nexpose/discovery.rb', line 304

def os
  @os
end

#poolObject

Returns the value of attribute pool.



303
304
305
# File 'lib/nexpose/discovery.rb', line 303

def pool
  @pool
end

#statusObject

Returns the value of attribute status.



305
306
307
# File 'lib/nexpose/discovery.rb', line 305

def status
  @status
end

Class Method Details

.parse(json) ⇒ Object



315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/nexpose/discovery.rb', line 315

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)


311
312
313
# File 'lib/nexpose/discovery.rb', line 311

def on?
  @status == 'On'
end