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. 41
4
ThevSphereSDKforPerlareavailableinthreepackages:
TheOptspackageincludessubroutinesforhandlingbuilt‐inoptionsandcreatingcustomoptions.See
“SubroutinesintheOptsPackage”onpage 42.
TheUtilpackageincludessubroutinesforfacilitatingroutinetaskssuchassettingupandclosing
connectionstotheserver.See“SubroutinesintheUtilPackage”onpage 43.
TheVimpackageincludessubroutinesforaccessingserver‐sidemanagedobjects,instantiatinglocalview
objects,updatingproperties,andrunninglocalmethodstorunoperationsonremoteservers.
vSphere SDK for Perl Subroutine
Reference
4
Table 4-1. Subroutines in the Opts Package
Subroutine Description
add_options Enablescustomoptionstobeparsedandvalidatedforexecutioninthecontextofthescripttowhichthe
optionshavebeenadded.
get_option Retrievesthevalueofaspecifiedbuilt‐inorcustomoption.
option_is_set Checkswhetheranoptionhasbeenexplicitlysetbyascriptorfromthecommandline
orwhetherthe
optionhasadefaultorcomputedvalue(thatis,thereturnvalueofafunc).
parse Readsoptionsfromthecommandline,anenvironmentvariable,oraconfigurationfileandtransforms
themintoappropriatedatastructuresforvalidation.
validate Ensuresthatinputvaluesarecomplete,consistent,andvalid.
usage Displays
ahelptextmessage.
Table 4-2. Subroutines in the Vim Package
Subroutine Description
clear_session Terminatesthecurrentsessionloadedbytheload_session()subroutine.
find_entity_view Searchestheinventorytreeforamanagedobjectthatmatchesthespecifiedentitytype.
find_entity_views Searchestheinventorytreeformanagedobjectsthatmatchthespecifiedentitytype.
get_service_instance RetrievesaServiceInstanceobject,whichcanbeusedtoquerytheserver
timeortoretrievethe
ServiceContentobject.
get_service_content Retrievespropertiesoftheserviceinstance,enablingaccesstotheservice’smanagedobjects.
get_session_id RetrievesasessionID.
get_view Retrievesthepropertiesofasinglemanagedobject.
get_views Retrievesthepropertiesofasetofmanagedobjects.
load_session Usesasavedsessionfileforconnectingtoa
server.
login EstablishesasessionwiththeWebservicerunningonthevSpherehost.