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.



287
288
289
# File 'lib/nexpose/discovery.rb', line 287

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

Instance Attribute Details

#clusterObject

Returns the value of attribute cluster.



282
283
284
# File 'lib/nexpose/discovery.rb', line 282

def cluster
  @cluster
end

#datacenterObject

Returns the value of attribute datacenter.



281
282
283
# File 'lib/nexpose/discovery.rb', line 281

def datacenter
  @datacenter
end

#hostObject

Returns the value of attribute host.



280
281
282
# File 'lib/nexpose/discovery.rb', line 280

def host
  @host
end

#ipObject

Returns the value of attribute ip.



279
280
281
# File 'lib/nexpose/discovery.rb', line 279

def ip
  @ip
end

#nameObject

Returns the value of attribute name.



278
279
280
# File 'lib/nexpose/discovery.rb', line 278

def name
  @name
end

#osObject

Returns the value of attribute os.



284
285
286
# File 'lib/nexpose/discovery.rb', line 284

def os
  @os
end

#poolObject

Returns the value of attribute pool.



283
284
285
# File 'lib/nexpose/discovery.rb', line 283

def pool
  @pool
end

#statusObject

Returns the value of attribute status.



285
286
287
# File 'lib/nexpose/discovery.rb', line 285

def status
  @status
end

Class Method Details

.parse(json) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/nexpose/discovery.rb', line 295

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)


291
292
293
# File 'lib/nexpose/discovery.rb', line 291

def on?
  @status == 'On'
end