API Guide
url = ASM::API::URI("/Timezone")
RestClient.put url, payload.to_xml, :content_type => :xml
}
Credential
Credential objects can be created and referenced in ASM. These named credentials are used to gain access to the various Resources
during the Discovery process. Credentials are also typed according to their target resource such as, Server, Storage, VCenter, IOM,
Chassis, and SCVMM.
Get all dened Credentials
Default credentials are dened for several hardware types. These can be listed for the purpose of obtaining their reference id’s
needed for the Discovery process and to utilize as XML skeleton.
require 'ASMConfig'
url = ASM::API::URI('/Credential')
begin
response = ASM::API::sign {
RestClient.get url, :content_type => :xml
}
payload = ASM::Payload.from_xml(response)
payload.save_xml('credentials.xml')
rescue RestClient::Exception => e
print "Got exception with status: %d\n" % e.response.code
print "%s\n" % e.response
end
Dene new Credential
Dene a new Server Credential using a skeleton le previously saved to a le.
require 'ASMConfig'
url = ASM::API::URI('/Credential')
cred = ASM::Payload::load_xml('credential_skeleton.xml')
# Set Credential parameters
cred.set('label', 'ServerX')
cred.set('username', 'admin')
cred.set('password', 'abc123')
cred.set('protocol', '')
cred.set('snmpCommunityString', '')
response = ASM::API::sign {
RestClient.post url, cred.to_xml, :content_type => :xml
}
payload = ASM::Payload.from_xml(response)
credId = payload.get('id')
# Save it for future use as a payload
payload.save_xml("credential_%s.xml" % credId)
DiscoveryRequest
A DiscoveryRequest is a set of credential references and a set of IP ranges. A sweep of the given IP ranges will attempt to determine
if Resources of the given types, specied by the credential types referenced in the request, exist at those IP addresses.
17