6.0

Table Of Contents
VMware, Inc. 47
Chapter 4 vSphere SDK for Perl Subroutine Reference
Returns
Referencetoanarrayofviewobjectscontainingstaticcopiesofpropertyvaluesforthematchinginventory
objects.Ifnomatchingentitiesarefound,thearrayisempty.
Example
Thefollowingexample,originallypublishedinVMwareCommunitiesinpost#1272780,retrievesthename
propertyfromeachinventoryobject.Notethat$entity_views
extractedfromtheserversidemanagedobject
isanarrayreference,notascalar.
...
my %opts = (
entity => {
type => "=s",
variable => "VI_ENTITY",
help => "ManagedEntity type: HostSystem, etc",
required => 1, },
);
Opts::add_options(%opts);
Opts::parse();
Opts::validate();
Util::connect();
# Obtain all inventory objects of the specified type
my $entity_type = Opts::get_option('entity');
my $entity_views = Vim::find_entity_views();
view_type => $entity_type,
properties => [ 'name' ]);
...
get_service_instance
RetrievesaServiceInstanceobject,whichcanbeusedtoquerytheservertimeortoretrievethe
ServiceContentobject.
Parameters
Noparameters.
Returns
ReturnsaServiceInstanceobject.
get_service_content
Retrievespropertiesoftheserviceinstanceenablingaccesstothemanagedobjectsoftheservice.Alternatively,
youcanuseget_views(),get_view(),andothersubroutinestoaccesstheobjectsmoredirectly.Ifyoustart
withtheservicecontenttoworkwiththeWebservice,youcannavigatetotheobjectof
interest.
Parameters
Noparameters.
Returns
ReferencetoServiceContentobject,whichcontainsmanagedobjectreferencestoallinventorycontent,
includingtherootfolder.
filter(optional) Hashofoneormorenamevaluepairs.Thenamerepresentsthepropertyvaluetotestandthevalue
representsapatternthatthepropertymustmatch.Ifmorethanonepairisspecified,allthepatterns
mustmatch.
properties Propertiestoretrieve.Defaultisallproperties.Useafilteror
propertiestoav oidperformance
problems.See“FilteringViewsSelectivelyUsingProperties”onpage 34.
Parameter Description