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 20:29:27 GMT
> +      this.zoneToEndpointSupplier = checkNotNull(zoneToEndpointSupplier, "zoneToEndpointSupplier");
> +      if(!apiVersionString.startsWith("v"))
> +         apiVersionString = "v" + apiVersionString;
> +      this.apiVersion = apiVersionString;
> +      this.endpointCache = CacheBuilder.newBuilder()
> +         .build(
> +            new CacheLoader<URI, URI>() {
> +               public URI load(URI baseEndpointUri) {
> +                  URI versionEndpointUri = null;
> +                  try {
> +                     HttpRequest negotiationRequest = HttpRequest.builder()
> +                        .method("GET").endpoint(baseEndpointUri)
> +                        .addHeader(VERSION_NEGOTIATION_HEADER, "true").build();
> +                     InputStream response = client.invoke(negotiationRequest).getPayload().openStream();
> +                     VersionsJsonResponse versions = json.fromJson(Strings2.toStringAndClose(response),
VersionsJsonResponse.class);
> +                     for( VersionsJsonResponse.Version version : versions.versions )
{

Formatting: "for (V...s)"

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