Using the vCloud SDK for PHP: Part 1
At Cloudhelix we make use of the vCloud SDK for various automation and reporting tasks. The good news is that customers can use it with their own vCD login in the same way.
Why would you want to do that? There are various reasons:
You may wish to write your own PHP applications for deploying vApps on demand.
You may wish to keep on top of your resource usage in line with your company’s reporting policies.
You may wish to add custom metadata entries to your vApps or virtual machines?—?we regularly poll the vCloud private hosting environment to record these, so if you would like your internal PO number for a virtual machine to show up on your bill (for example) we could arrange to look for the metadata value and add this automatically.
Future blog posts will go into particular configuration requirements in more depth?—?first, let’s quickly get things up and running to test with, using XAMPP on a CentOS 6.5 virtual machine.
NB: the versions below are correct at the time of writing, however feel free to check for updates and amend accordingly, if some time has passed.
As always, while we are proceeding with simple settings for the sake of this demo, please review and choose settings in line with your organisation’s policies.
First, download and install XAMPP:
As shown, there is a simple setup wizard:
- Run /opt/lampp/lampp security to set passwords.
- If you want to test any webpages from outside the local LAN, edit the LocationMatch section of /opt/lampp/etc/extra/httpd-xampp.conf (or comment it out).
- Start the service
The following are required by the vCloud SDK:
These can be added as follows:
Ensure that your path is correct: export PATH=$PATH:/opt/lampp/bin/?—?the PATH entry in ~/.bash_profile can be also be amended for future use.
Now, onto the reason we have done all this?—?download the vCloud SDK. The main page is here?—?the Download button should take you to a My VMware login page.
Once you have uploaded the file to your server:
You should now be ready to go! In this example, I am using the script inventory.php that is provided as a sample with the SDK download?—?because I am using a demo customer login, I have edited it and commented out the call to the provider resources function, which would require a system administrator login.
As shown in the warning, certificate validation should be used in a production environment as a best practice?—?this has not been included for the purposes of this demo.
However, as a basic test it has been successful?—?we have retrieved a list of the four vApps in this demo customer Org?—?a couple used for demonstrating the performance gains with flash-accelerated storage, the Cloudhelix half of the failover demo previously detailed here, and finally the server we have built for the purposes of this SDK demo.
Posts in this series
Part 1: Initial Setup
Part 2: Deploying a vApp
Part 3: Adding Metadata
Our specialists have the answer