VMware::API::vCloud - The VMware vCloud API
my $api = new VMware::API::vCloud ( $hostname, $username, $password, $orgname ); my $raw_login_data = $vcd->login;
This module provides a bare interface to VMware's vCloud REST API.
VMware::vCloud is designed for high level usage with vCloud Director. This module, however, provides a more low-level access to the REST interface.
Responses received from vCloud are in XML. They are translated via XML::Simple with ForceArray set for consistency in nesting. This is the object returned.
Aside from the translation of XML into a perl data structure, no further alteration is performed on the data.
HTTP errors are automatically parsed and die() is called. If you need to perform a dangerous action, do so in an eval block and evaluate $@.
These methods are not API calls. They represent the methods that create this module as a "wrapper" for the vCloud API.
This method creates the vCloud object.
Arguments
hostname
username
password
organization
$vcd->config( debug => 1 );
These are direct access to the REST web methods.
Performs a DELETE action on the given URL, and returns the parsed XML response.
Performs a GET action on the given URL, and returns the parsed XML response.
Performs a GET action on the given URL, and returns the unparsed HTTP::Request object.
Performs a POST action on the given URL, and returns the parsed XML response.
The optional value for $type is set as the Content Type for the transaction.
The optional value for $content is used as the content of the post.
* Relative URL: /api/versions
This call queries the server for the current version of the API supported. It is implicitly called when library is instanced.
* Relative URL: dynamic, but usually: /login/
This call takes the username and password provided in the config() and creates an authentication token from the server. If successful, it returns the login data returned by the server.
In the 5.1 version of the API, this is a list of several access URLs.
* Relative URL: dynamic admin URL, usually /api/admin/
Parses the admin API URL to build and return a hash reference of key URLs for the API.
* Relative URL: dynamic admin URL followed by "/extension"
As a parameter, this method thakes the raw numeric id of the catalog or the full URL detailed for the catalog from the login catalog.
It returns the requested catalog.
Create an organization?
As a parameter, this method takes the raw numeric id of the organization or the full URL detailed for the organization from the login catalog.
It returns the requested organization.
Returns the full list of available organizations.
Create an org network
The conf hash reference can contain:
* name, * desc, * gateway, * netmask, * dns1, * dns2, * dnssuffix, * is_enabled, * start_ip, * end_ip)
Create an org VDC
* name, * desc, * np_href, * sp_enabled, * sp_units, * sp_limit, * sp_default, * sp_href, * allocation_model, * cpu_unit * cpu_alloc * cpu_limit * mem_unit * mem_alloc * mem_limit * nic_quota * net_quota * ResourceGuaranteedMemory * ResourceGuaranteedCpu * VCpuInMhz * is_thin_provision * pvdc_name * pvdc_href * use_fast_provisioning
As a parameter, this method thakes the raw numeric id of the template or the full URL.
It returns the requested template.
As a parameter, this method thakes the raw numeric id of the virtual data center or the full URL detailed a catalog.
It returns the requested VDC.
Returns the full list of available VDCs.
As a parameter, this method thakes the raw numeric id of the vApp or the full URL.
It returns the requested vApp.
Template name validation.
Most names in the GUI (for vApps, VMs, Templates, and Catalogs) are limited to 128 characters, and are restricted to being composed of alpha numerics and standard keyboard punctuations. Notably, spaces and tabs are NOT allowed to be entered in the GUI. However, you can upload a template in the API with a space in the name. It will only be visable or usable some of the time in the GUI. Apparently there is a bug in name validation via the API.
If someone from VMware is reading this, and has control of the API, I would dearly love a few changes, that might help things:
Version: v2.19 (2013/03/13)
Phillip Pollard, <bennie@cpan.org>
stu41j - http://communities.vmware.com/people/stu42j
LWP XML::Simple
Released under Perl Artistic License
VMware vCloud Director Publications http://www.vmware.com/support/pubs/vcd_pubs.html http://pubs.vmware.com/vcd-51/index.jsp VMware vCloud API Programming Guide v5.1 http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-86CA32C2-3753-49B2-A471-1CE460109ADB.html vCloud API and Admin API v5.1 schema definition files http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/about.html VMware vCloud API Communities http://communities.vmware.com/community/vmtn/developer/forums/vcloudapi VMware vCloud API Specification v1.5 http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/
1 POD Error
The following errors were encountered while parsing the POD:
Deleting unknown formatting code U<>
To install VMware::vCloud, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VMware::vCloud
CPAN shell
perl -MCPAN -e shell install VMware::vCloud
For more information on module installation, please visit the detailed CPAN module installation guide.