Class: AMT::Service::HardwareAsset

Inherits:
Basic
  • Object
show all
Defined in:
lib/amt/service/hardware_asset.rb,
lib/amt/service/hardware_asset/fru.rb,
lib/amt/service/hardware_asset/bios.rb,
lib/amt/service/hardware_asset/asset.rb,
lib/amt/service/hardware_asset/baseboard.rb,
lib/amt/service/hardware_asset/processor.rb,
lib/amt/service/hardware_asset/media_device.rb,
lib/amt/service/hardware_asset/memory_module.rb,
lib/amt/service/hardware_asset/computer_system.rb,
lib/amt/service/hardware_asset/portable_battery.rb,
lib/amt/service/hardware_asset/amt_information_table.rb,
lib/amt/service/hardware_asset/vpro_verification_table.rb

Overview

AMT Service for retrieving information about the hardware assets of the AMT device.

Defined Under Namespace

Classes: AmtInformationTable, Asset, AssetType, Baseboard, Bios, ComputerSystem, FRU, MediaDevice, MemoryModule, PortableBattery, Processor, VproVerificationTable

Constant Summary collapse

ASSET_TYPE_CLASS =
{
  2 => :Bios,
  3 => :ComputerSystem,
  4 => :Baseboard,
  5 => :Processor,
  6 => :MemoryModule,
  7 => :FRU,
  8 => :MediaDevice,
  9 => :PortableBattery,
  10 => :VproVerificationTable,
  11 => :AmtInformationTable
}

Instance Attribute Summary

Attributes inherited from Basic

#host, #port

Instance Method Summary collapse

Methods inherited from Basic

#initialize, #soap_call

Constructor Details

This class inherits a constructor from AMT::Service::Basic

Instance Method Details

#enumerate_asset_typesObject

Return an array of supported hardware asset type names.

All API supported asset type names are available as values in the ASSET_TYPES hash.

Supported by AMT 1.0 and later.



38
39
40
41
42
# File 'lib/amt/service/hardware_asset.rb', line 38

def enumerate_asset_types
  soap_call("EnumerateAssetTypes", 'Status').process do |node|
    node.xpath('./ns:AssetTypes/ns:AssetType/text()').collect {|at| AssetType.for(at.to_i)}
  end
end

#get_asset_data(asset_type) ⇒ Object

Return an array of all hardware asset data identified by the asset type asset_type.

asset_type

Can either be the numerical asset type, an asset type name or an instance of AssetType.

The class of the returned values is different for every asset_type. See Bios, ComputerSystem, Baseboard, Processor, MemoryModule, FRU, MediaDevice, PortableBattery, VproVerificationTable and AmtInformationTable.

Supported by AMT 1.0 and later.



68
69
70
71
72
73
74
75
76
77
# File 'lib/amt/service/hardware_asset.rb', line 68

def get_asset_data(asset_type)
  soap_call("GetAssetData", 'Status') do |msg|
    msg.add('ns:AssetType', AssetType.for(asset_type).value)
  end.process do |node|
    node.xpath('./ns:AssetData/ns:AssetData').collect do |anode|
      data = anode.xpath('./ns:AssetData/text()').to_s.unpack('m*').first
      self.class.const_get(ASSET_TYPE_CLASS[anode.xpath('./ns:AssetType/text()').to_i]).new(data)
    end
  end
end