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:32:23 GMT
> +                     VersionsJsonResponse versions = json.fromJson(Strings2.toStringAndClose(response),
VersionsJsonResponse.class);
> +                     for( VersionsJsonResponse.Version version : versions.versions )
{
> +                        if(apiVersion.equals(version.id)) {
> +                           String newURIString = version.links.get(0).href;
> +                           if(newURIString.startsWith("http:") && baseEndpointUri.toString().startsWith("https:"))
> +                              newURIString = "https" + newURIString.substring(4);
> +                           versionEndpointUri = new URI(newURIString);
> +                           break;
> +                        }
> +                     }
> +                  } catch (Exception ex) {
> +                     throw Throwables.propagate(ex);
> +                  }
> +                  if (versionEndpointUri == null)
> +                     throw new HttpException("Glance endpoint does not support API version:
" + apiVersion);
> +                  return versionEndpointUri;

Why can't we just return the first one we find in the loop?

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