jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Phillips <notificati...@github.com>
Subject Re: [jclouds-labs-openstack] JCLOUDS-494: Change EndpointParam parser to negotiate version for Glance API (#82)
Date Tue, 18 Mar 2014 21:04:59 GMT
> +         public String status;
> +         public String id;
> +         public List<Link> links;
> +      }
> +      public List<Version> versions;
> +   }
> +
> +   private final Supplier<Map<String, Supplier<URI>>> zoneToEndpointSupplier;
> +   private final String apiVersion;
> +   private final LoadingCache<URI, URI> endpointCache;
> +
> +   @Inject
> +   public ZoneToEndpointNegotiateVersion(@Zone Supplier<Map<String, Supplier<URI>>>
zoneToEndpointSupplier,
> +         @ApiVersion String apiVersionString, final HttpClient client, final Json json)
{
> +      this.zoneToEndpointSupplier = checkNotNull(zoneToEndpointSupplier, "zoneToEndpointSupplier");
> +      if(!apiVersionString.startsWith("v"))

> OK, after testing it seems that the version number in fact does not start w/ a 'v' typically.
(Tests quickly failed on 
> that, their just using '1.0'

Ah, interesting. Any idea why the jclouds code was using a hard-coded `v1.0`? Is that supported
in some kind of compatibility mode? Do we even need the `v` at all, then?

If we do need to keep this, we should at least add a test for it. And I think you can call
the parameter `apiVersion` and simply do something like:
```
if (!apiVersion.startsWith("v")) {
  this.apiVersion = "v" + apiVersion;
} else {
  this.apiVersion = apiVersion;
}
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/82/files#r10725682
Mime
View raw message