API Guide

Table Of Contents
deployment.set("numberOfDeployments", '1')
# Inject the template into the deployment
deployment.replaceInner('serviceTemplate',
template.doc.at_xpath('ServiceTemplate'))
deployment.save_xml('deploy_payload.xml')
response = ASM::API::sign {
RestClient.post url, deployment.to_xml, :content_type => :xml
}
doc = Nokogiri::parse(response)
deploymentId = doc.xpath('//Deployment/id').text
print "<id>%s</id>\n" % deploymentId
Tear down a Service
In order to completely tear down a Service we set the teardown element to true for all components in
the Deployment plus the Deployment itself, and then we PUT this Deployment back to ASM.
require 'ASMConfig'
deploymentId = "ff8080814aba74ce014ac455e9b80951"
url = ASM::API::URI("/Deployment/%s"%deploymentId)
response = ASM::API::sign {
RestClient.get url
}
payload = ASM::Payload.from_xml(response)
payload.set('Deployment/teardown', 'true')
payload.set_all('components/teardown', 'true')
payload.save_xml('teardown.xml')
response = ASM::API::sign {
RestClient.put url, payload.to_xml, :content_type => :xml
}
doc = Nokogiri::parse(response)
deploymentId = doc.xpath('//Deployment/id').text
jobStatus = doc.xpath('//Deployment/jobStatus').text
print "<jobStatus>%s</jobStatus>\n" % jobStatus
Firmware
Firmware versions reported by individual resource components are compared against a firmware
repository to determine if component firmware is up-to-date with the latest required versions.
Check Firmware compliance of all Resources
Here we check the firmware compliance state of all resources. Note this is done by the POST method
and supplying a ManagedDevice as the request body. The response is the same ManagedDevice with the
addition of a compliance field.
require 'ASMConfig'
# Get all managed devices
url = ASM::API::URI('/ManagedDevice')
response = ASM::API::sign {
RestClient.get url
24