jclouds/jclouds-labs-openstack — pull request #82 by jasdeep-hundal (2014-03-12 06:19:57+00:00)
Title: WIP: JCLOUDS-494: Change EndpointParam parser to negotiate version for Glance API

Fixes: https://issues.apache.org/jira/browse/JCLOUDS-494

This change adds a new endpoint parser that takes a base endpoint that serves a JSON formatted list of API versions and matching endpoints and returns the endpoint that matches the requested version. This solution made sense as this change certainly does not belong in the ImageAPI spec as those requests in fact depend on the right endpoint from this, and changes elsewhere would affect projects that aren't Openstack related.

This PR for now is PoC proposal that has been tested on a local Glance installation, still needs lots of work to be ready. It was also built w/ skipTests enabled, so tests are probably broken in some way in this branch. I think I particularly need answers to these questions:
- I'd like to inject apiVersion here, but trying to copy from LocationIdToURIFromAccessForTypeAndVersion in jclouds-core appeared to cause some sort of conflict and did not work.
- I'd also like to use an HttpCommandExecutor (esp. as dev installs of Glance don't use real certificates and I'd like Jclouds to handle ignoring cert verification for me.) I was able to successfully inject one, but the BaseHttpExecutor invoke method returns errors on an HTTP status code of 300 (which is what the GET on the Glance base URL returns).
- What's the right/jclouds way to handle the JSON response from Glance that contains the version list?

One more note: The forceSecure attribute was a hack because Glance was returning http endpoints in the version list when the actual endpoints were behind SSL. Not sure how necessary it will be in a final version.