6.0
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. 63
Chapter B Credential Store Perl Library
vSphere Credential Store Subroutine Reference
TheViCredStorepackageincludesthefollowingsubroutines:
“init”onpage 63
“get_password”onpage 63
“add_password”onpage 64
“remove_password”onpage 64
“clear_passwords”onpage 64
“get_hosts”onpage 64
“get_usernames”onpage 64
“close”onpage 65
init
Initializesthecredentialstore.Callthissubroutineonce,beforeanyoftheothercredentialstoresubroutines.
Thecredentialstoreisnotcreateduntilyourprogramcallsadd_password.
Thissubroutineacceptsthelocationofthecredentialstorefile.Ifyoudonotprovideacredentialstorefilename
VICredStore::init()looksinthe
defaultlocation.
Linux:$HOME/.vmware/credstore/vicredentials.xml
Windows:%APPDATA%\VMware\credstore\vicredentials.xml
Ifnocredentialstoreexistsatthedefaultlocation,theinitializationprocess:
Checksthatthecredstoredirectoryexists,andcreatesoneifitdoesnot.
Createsthevicredentials.xmlfileandparentdirectory.
Ifyouprovideanon‐defaultcredentialstorefilenametoVICredStore::init(),thecredentialstoreatthat
locationisused.Ifthereisnocredentialstoreatthatlocationandthedirectoryyouspecifyexists,the
initializationprocesscreatesthefile.Ifthedirectory
youspecifydoesnotexist,theinitializationprocessfails.
Parameters
Returns
Returns1ifinitializationissuccessful;otherwise,returns0.
get_password
Retrievesthepasswordforaspecifiedserverandusername.
Parameters
Returns
Returnsthepassword,orundefifnopasswordisfound.
Parameter Description
filename Nameofcredentialstorefile.
Parameter Description
server Serverforwhichyouwanttoretrievethepasswordforthespecifieduser.CanbeanESX/ESXi
orvCenterServersystem.
username Userforwhomyouwanttoretrievethepassword.