> +
> + @Override
> + public URI apply(@Nullable Object from) {
> + checkArgument(from != null && from instanceof String, "you must
> specify a region, as a String argument");
> + Map<String, Supplier<URI>> regionToEndpoint =
> regionToEndpointSupplier.get();
> + checkState(!regionToEndpoint.isEmpty(), "no region name to endpoint
> mappings configured!");
> + checkArgument(regionToEndpoint.containsKey(from),
> + "requested location %s, which is not in the configured
> locations: %s", from, regionToEndpoint);
> + String uri = regionToEndpoint.get(from).get().toString();
> +
> + /**
> + * A quick fix to ensure Neutron works with endpoint definitions that
> are not version-agnostic.
> + */
> + if (uri.endsWith("/v2.0")) {
> + try {
> + return new URI(uri.substring(0, uri.length() - 5));
The endpoint has to be automatically provided to the user. The problem is some
small inconsistencies in how providers and services manage versioning. I think
(my guess) in the end something similar to
https://github.com/jclouds/jclouds-labs-openstack/blob/master/openstack-glance/src/main/java/org/jclouds/openstack/glance/functions/RegionToEndpointNegotiateVersion.java
will have to be moved up to better negotiate versioning for services.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/169/files#r20212037