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. 49
Chapter 4 vSphere SDK for Perl Subroutine Reference
Parameters
Returns
ReturnsthevSphereobjectinstance.
Example
Toloadasessionusingasessionfile:load_session(session_file => $filename);
ToloadasessionusingasessionID:load_session(service_url => $url, session_id =>
$sessionid);
login
EstablishesasessionwiththeWebservicerunningonthevCenterServerorESX/ESXisystemusingtheuser
nameandpasswordcredentialsprovidedusingthecommand‐line,environmentvariables,orconfiguration
file.
Parameters
Returns
ReturnsthevSphereobjectinstance.
logout
DisconnectstheclientfromtheserverandclosestheconnectiontotheWebservice.Usethissubroutineifyou
connectedusingVim::login().Otherwise,useUtil::disconnect().
Parameters
Noparameters.
Returns
Returnsnothing.
save_session
Savesasessioncookie,whichisatextfile.See“UsingaSessionFile”onpage 13.
Parameter Description
service_url URLoftheservertowhichtheclientconnects(optionalifusingsession_file).
session_file Fullpathandfilenameforasessionfilereturnedbysave_session().Youmustspecifyeither
session_fileorsession_id.Youmustpassinthefilenameasahash.
session_id SessionIDreturnedbyget_session_id().Youmustspecify
eithersession_fileor
session_id.
NOTEInmostcases,youuseUtil::connect()insteadtoestablishaconnection.
Parameter Description
service_url URLoftheservertowhichtheclientconnects.
user_name UseraccountontheESX/ESXiorvCenterServersystem.
password Passwordfortheus eraccount.