API Guide

Table Of Contents
ManagedDevice
ManagedDevice is a generic interface to any Resources on the network which is being managed by ASM.
A successful discovery request results in the creation of instances of ManagedDevice.
Get all Managed Devices
Assuming the Discovery process succeeded, ASM will now know about some or all of the devices
available on the network.
require 'ASMConfig'
url = ASM::API::URI('/ManagedDevice')
response = ASM::API::sign {
RestClient.get url
}
doc = Nokogiri::XML(response)
# Print selected info for each device
print "%30s%15s%20s%20s%15s\n" % %w(ServiceTag State IP Model Type)
print
"-------------------------------------------------------------------------------
---------------------\n"
doc.xpath('//ManagedDevice').sort_by{|d| d.at_xpath('deviceType').content}.each
do |device|
svc_tag = device.at_xpath('serviceTag').content
state = device.at_xpath('state').content
ip_addr = device.at_xpath('ipAddress').content
model = device.at_xpath('model').content
dev_type = device.at_xpath('deviceType').content
print "%30s%15s%20s%20s%15s\n" % [svc_tag,state,ip_addr,model,dev_type]
end
ServiceTemplate
A ServiceTemplate is a reusable structure that defines the network topology and components of a future
service deployment. A trivial example template could be a single server component setup to run Linux.
Deploying this template would result in a single server being chosen from the available discovered
resources and installing Linux on it.
Get all ServiceTemplates
Here we retrieve all ServiceTemplates and output the names of those not in draft mode ( published ). The
draft property determines if a template is in the published state. Only published templates can be
deployed.
require 'ASMConfig'
url = ASM::API::URI('/ServiceTemplate')
21