6.5
Table Of Contents
- vSphere SDK for Perl Programming Guide
- Contents
- Getting Started with vSphere SDK for Perl
- Writing vSphere SDK for Perl Scripts
- Refining vSphere SDK for Perl Scripts
- Creating and Using Filters
- Filtering Views Selectively Using Properties
- Retrieving the ServiceInstance Object on a vSphere Host
- Saving and Using Sessions
- Using Multiple Sessions
- Learning About Object Structure Using Data::Dumper
- Specifying Untyped Arguments in Scheduled Tasks and Callbacks
- Using Advanced Subroutines
- vSphere SDK for Perl Subroutine Reference
- Web Services for Management Perl Library
- Credential Store Perl Library
VMware, Inc. 59
Chapter A Web Services for Management Perl Library
Arguments
Ahash.Keysaretheprefixes,valuesaretherelativeURLsasvalues.
Example
$client->register_class_ns((OMC => 'http://schema.omc-project.org/wbem/wscim/1/cim-schema/2',
VMware => 'http://schemas.vmware.com/wbem/wscim/1/cim-schema/2'));
RegisterstheResourceURIsneededtoenumerateclassesintheOMCandVMwareschemas.
Identify
Performsthewsmid:Identifyoperation,whichcausestheWS‐Managementservertoidentifyitself.Helps
youdeterminewhethertheserverisrunning.
Arguments
Noarguments.
Returns
Printsafaultstringifafaultoccurs,orreturnsthereplysentbytheserver.Thereplyisahashreference
containingtheparsedreplyin
key‐valuepairs.
EnumerateInstances
Enumeratestheinstancesofagivenclass.
Returns
Returnsalistofhashescontainingtheparsedreplyfromtheserver,orprintsafaultstringfromtheserverif
anerroroccurs.
Example
$client->EnumerateInstances(
class_name => 'CIM_Processor',
namespace => 'root/cimv2' #optional
)
EnumerateInstanceNames
Enumeratesonlythekeyvaluesoftheinstancesofagivenclass.SimilartoEnumerateInstances.
Returns
LikeEnumerateInstances,eitherreturnsalistofhashescontainingtheparsedreplyfromtheserver(keys
only),orprintsafaultstringifanerroroccurs.
EnumerateAssociatedInstances
Returnstheinstancesrelatedtothesourceobjectthroughanassociation.Resultsarefilteredbasedonthe
argumentyoupassin.
Arguments
Acceptsthefollowingarguments:
Argument Description
class_name Nameoftheclassforwhichyouwanttogettheassociatedinstances.
selectors Setkeysasareferencetoahash.Usedtoidentifytheinstanceoftheclass
mentionedintheclass_nameargument.
associationclassname (optional) Nameoftheassociationclassfortheinstance.