« Previous 1 2 3 4 Next »
Many Clouds, One API
Exploring the API with Your Browser
Once the server is running, point your browser at http://HOSTNAME:PORT/api . This returns an HTML version of the top-level entry point, listing all the collections the driver knows about. From here, the rest of the API can be explored: You can click on Images to list all the images the current back end knows about. At this point, you will have to enter the credentials for the back-end cloud, in the case of the mock driver, these are mockuser and mockpassword . The Deltacloud documentation lists where to find the credentials for each driver.
The top-level entry point also links to documentation of the API, which is generated from the internal API specification of each server and driver. An important piece of information in the documentation is what parameters each operation requires from a resource. For example, http://HOSTNAME:PORT/api/docs/instances/create describes the instance creation operation, including which feature is responsible for adding which parameter.
From the list of images, you can navigate to a specific image – for example, img1 at http://HOSTNAME:PORT/api/images/img1 – and click on Launch . After filling the resulting form and clicking Create , you are taken to the details of the newly created instance.
The HTML version of the API is really only meant for exploration and experimenting. More serious use will involve the XML or JSON versions of the API; to view the XML for a resource on your browser, you simply append ?format=xml to any URL; for example, going to http://HOSTNAME:PORT/api/instances/inst3?format=xml will give you the XML version of the details about instance inst3.
Switching Drivers with Every Request
Because it is not really practical to run a different server for every cloud, including separate servers for different regions of the same cloud, the Deltacloud server makes it possible to switch drivers on the go – either by including the HTTP headers X-Deltacloud-Driver and X-Deltacloud-Provider in each request, or by setting corresponding matrix parameters in the requested URL. The provider talks to different endpoints of the same cloud (e.g., to different regions of Amazon’s EC2) or to specify the endpoint of a RHEV-M installation.
In this test setup, you can talk to Amazon’s EC2 us-east-1 region by going to the URL http://HOSTNAME:PORT/api;driver=ec2;provider=us-west-1 . From the resulting page, you can now follow the exact same steps as above, but this time you will launch a real instance, costing real money, in EC2, rather than a fake one with the mock driver.
In moving from the mock driver to the EC2 driver, it is worth noting the list of available collection changes: The EC2 driver offers additional collections, like Addresses for public IP addresses, Firewalls to manage security groups, and Keys to handle SSH keys. Also, the instance creation form has additional fields for EC2. These are included because the EC2 driver supports certain features, like launching multiple instances or applying security groups for instance creation that the mock driver does not. How the XML for the top-level entry point advertises different features between the two drivers, and how that information is used to provide additional fields in the instance creation form, is worth understanding.
« Previous 1 2 3 4 Next »