Summary
This article shows how to extract a list of procedures from your installed plugin library. The approach applies to extracting data from other XML-generating API commands.
Solution
Use the Perl XPATH methods find() and get_nodelist on API get commands to generate list that can be processed with a for-loop.
Examples
use strict;
use ElectricCommander;
$| = 1;
my $ec = ElectricCommander->new();
for my $plugin ($ec->getPlugins()->find('//pluginName')->get_nodelist) {
print "Plugin: ", $plugin->string_value(), "\n";
for my $procedure ($ec->getProcedures($plugin->string_value())->find('//procedureName')->get_nodelist) {
print " - ", $procedure->string_value(), "\n";
}
print "\n";
}
The above ec-perl code will generate output similar to the following:
- CleanUp
- Clone
- Create
- CreateResourceFromVM
- Destroy
- List
- Resume
- Revert
- ShutDown
- Snapshot
- Start
- Suspend
- Undefine
Plugin: EC-LabManager-1.5.0.43267
- BulkCleanup
- Capture
- Cleanup
- Clone
- Command
- ConfigurationChangeOwner
- CreateConfigurationFromVMTemplate
- CreateConfigurationFromVMTemplate4.0
- CreateLMConnection
- CreateResourcesFromConfiguration
- DeleteLMConnection
- Deploy
- Provision
- Provision4.0
- Revert
- Snapshot
0 Comments