> +
> +   @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));

Egads! I think I understand the underlying motivation, but adding magic 
api-version-rewriting-logic for all calls (rather than being some option that 
users have to switch on, or provide themselves by adding a custom module to 
their context) seems a bit scary.

Would it make more sense to allow users to specify an "alternative endpoint" to 
try for their context? Or is it infeasible to delegate this kind of logic to 
the user?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/169/files#r20176798

Reply via email to