Class: Nexpose::DiscoveredAsset
- Inherits:
-
Object
- Object
- Nexpose::DiscoveredAsset
- Defined in:
- lib/nexpose/discovery.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#datacenter ⇒ Object
Returns the value of attribute datacenter.
-
#host ⇒ Object
Returns the value of attribute host.
-
#ip ⇒ Object
Returns the value of attribute ip.
-
#name ⇒ Object
Returns the value of attribute name.
-
#os ⇒ Object
Returns the value of attribute os.
-
#pool ⇒ Object
Returns the value of attribute pool.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ DiscoveredAsset
constructor
A new instance of DiscoveredAsset.
- #on? ⇒ Boolean
Constructor Details
#initialize(&block) ⇒ DiscoveredAsset
Returns a new instance of DiscoveredAsset.
170 171 172 |
# File 'lib/nexpose/discovery.rb', line 170 def initialize(&block) instance_eval &block if block_given? end |
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster.
165 166 167 |
# File 'lib/nexpose/discovery.rb', line 165 def cluster @cluster end |
#datacenter ⇒ Object
Returns the value of attribute datacenter.
164 165 166 |
# File 'lib/nexpose/discovery.rb', line 164 def datacenter @datacenter end |
#host ⇒ Object
Returns the value of attribute host.
163 164 165 |
# File 'lib/nexpose/discovery.rb', line 163 def host @host end |
#ip ⇒ Object
Returns the value of attribute ip.
162 163 164 |
# File 'lib/nexpose/discovery.rb', line 162 def ip @ip end |
#name ⇒ Object
Returns the value of attribute name.
161 162 163 |
# File 'lib/nexpose/discovery.rb', line 161 def name @name end |
#os ⇒ Object
Returns the value of attribute os.
167 168 169 |
# File 'lib/nexpose/discovery.rb', line 167 def os @os end |
#pool ⇒ Object
Returns the value of attribute pool.
166 167 168 |
# File 'lib/nexpose/discovery.rb', line 166 def pool @pool end |
#status ⇒ Object
Returns the value of attribute status.
168 169 170 |
# File 'lib/nexpose/discovery.rb', line 168 def status @status end |
Class Method Details
.parse(json) ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/nexpose/discovery.rb', line 178 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
174 175 176 |
# File 'lib/nexpose/discovery.rb', line 174 def on? @status == 'On' end |