The vSphere SDK for Perl are available in three packages.
- The
Opts
package includes subroutines for handling built-in options and creating custom options. See Subroutines in the Opts Package.
- The
Util
package includes subroutines for facilitating routine tasks such as setting up and closing connections to the server. See Subroutines in the Util Package.
- The
Vim
package includes subroutines for accessing server-side managed objects, instantiating local view objects, updating properties, and running local methods to run operations on remote servers.
Table 1.
Subroutines in the Opts Package
Subroutine |
Description |
add_options |
Enables custom options to be parsed and validated for execution in the context of the script to which the options have been added. |
get_option |
Retrieves the value of a specified built-in or custom option. |
option_is_set |
Checks whether an option has been explicitly set by a script or from the command line or whether the option has a default or computed value (that is, the return value of a func). |
parse |
Reads options from the command line, an environment variable, or a configuration file and transforms them into appropriate data structures for validation. |
validate |
Ensures that input values are complete, consistent, and valid. |
usage |
Displays a help text message. |
Table 2.
Subroutines in the Vim Package
Subroutine |
Description |
clear_session |
Terminates the current session loaded by the load_session() subroutine. |
find_entity_view |
Searches the inventory tree for a managed object that matches the specified entity type. |
find_entity_views |
Searches the inventory tree for managed objects that match the specified entity type. |
get_service_instance |
Retrieves a ServiceInstance object, which can be used to query the server time or to retrieve the ServiceContent object. |
get_service_content |
Retrieves properties of the service instance, enabling access to the service’s managed objects. |
get_session_id |
Retrieves a session ID. |
get_view |
Retrieves the properties of a single managed object. |
get_views |
Retrieves the properties of a set of managed objects. |
load_session |
Uses a saved session file for connecting to a server. |
login |
Establishes a session with the Web service running on the vSphere host. |
logout |
Disconnects the client from the server and closes the connection to the Web service. |
save_session |
Saves a session cookie, which is a text file. |
update_view_data |
Refreshes the property values of a view object. |
Table 3.
Subroutines in the Util Package
Subroutine |
Description |
connect |
Establishes a session by using the token provided in a previously-saved session file, or by using the user name and password provided on the command line, in environment variables, or in a configuration file. |
disconnect |
If used in conjunction with connect (and a session file), does nothing. If used in conjunction with a user name and password, logs out and closes the session. |
get_inventory_path |
Returns the inventory path for the specified managed entity. |
trace |
General-purpose logging function used in conjunction with the --verbose command-line option. |