diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java index f42e86b1e1..0b57843d22 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java @@ -55,6 +55,7 @@ public class Endpoint implements Comparable { protected String region; protected URI publicURL; protected URI internalURL; + protected URI adminURL; protected String tenantId; /** @@ -89,6 +90,14 @@ public class Endpoint implements Comparable { return this; } + /** + * @see Endpoint#getInternalURL() + */ + public Builder adminURL(URI adminURL) { + this.adminURL = checkNotNull(adminURL, "adminURL"); + return this; + } + /** * @see Endpoint#getTenantId() */ @@ -98,7 +107,7 @@ public class Endpoint implements Comparable { } public Endpoint build() { - return new Endpoint(versionId, region, publicURL, internalURL, tenantId); + return new Endpoint(versionId, region, publicURL, internalURL, adminURL, tenantId); } public Builder fromEndpoint(Endpoint from) { @@ -113,17 +122,20 @@ public class Endpoint implements Comparable { protected final String region; protected final URI publicURL; protected final URI internalURL; + protected final URI adminURL; + // renamed half-way through @Deprecated protected String tenantName; protected final String tenantId; protected Endpoint(String versionId, String region, @Nullable URI publicURL, @Nullable URI internalURL, - @Nullable String tenantId) { + @Nullable URI adminURL, @Nullable String tenantId) { this.versionId = checkNotNull(versionId, "versionId"); this.region = checkNotNull(region, "region"); this.publicURL = publicURL; this.internalURL = internalURL; + this.adminURL = adminURL; this.tenantId = tenantId; } @@ -160,6 +172,14 @@ public class Endpoint implements Comparable { return internalURL; } + /** + * @return the admin url of the endpoint + */ + @Nullable + public URI getAdminURL() { + return adminURL; + } + /** * @return the tenant versionId of the endpoint or null */ @@ -176,7 +196,7 @@ public class Endpoint implements Comparable { if (object instanceof Endpoint) { final Endpoint other = Endpoint.class.cast(object); return equal(getVersionId(), other.getVersionId()) && equal(region, other.region) && equal(publicURL, other.publicURL) - && equal(internalURL, other.internalURL) && equal(getTenantId(), other.getTenantId()); + && equal(internalURL, other.internalURL) && equal(adminURL, other.adminURL) && equal(getTenantId(), other.getTenantId()); } else { return false; } @@ -184,13 +204,13 @@ public class Endpoint implements Comparable { @Override public int hashCode() { - return Objects.hashCode(getVersionId(), region, publicURL, internalURL, getTenantId()); + return Objects.hashCode(getVersionId(), region, publicURL, internalURL, adminURL, getTenantId()); } @Override public String toString() { return toStringHelper("").add("versionId", getVersionId()).add("region", region).add("publicURL", publicURL).add("internalURL", - internalURL).add("tenantId", getTenantId()).toString(); + internalURL).add("adminURL", adminURL).add("tenantId", getTenantId()).toString(); } @Override diff --git a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/parse/ParseAccessTest.java b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/parse/ParseAccessTest.java index bf7492dcf6..146a376533 100644 --- a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/parse/ParseAccessTest.java +++ b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/parse/ParseAccessTest.java @@ -67,11 +67,13 @@ public class ParseAccessTest extends BaseItemParserTest { Service.builder().name("Object Storage").type("object-store").endpoints( Endpoint.builder().tenantId("40806637803162").publicURL( URI.create("https://objects.jclouds.org/v1.0/40806637803162")) + .adminURL(URI.create("https://objects.jclouds.org/v1.0/")) .region("region-a.geo-1").versionId("1.0").build()).build(), Service.builder().name("Identity").type("identity").endpoints( - Endpoint.builder().publicURL(URI.create("https://csnode.jclouds.org/v2.0/")).region( - "region-a.geo-1").versionId("2.0").build()).build(), + Endpoint.builder().publicURL(URI.create("https://csnode.jclouds.org/v2.0/")) + .adminURL(URI.create("https://csnode.jclouds.org:35357/v2.0/")) + .region("region-a.geo-1").versionId("2.0").build()).build(), Service.builder().name("Image Management").type("image").endpoints( Endpoint.builder().tenantId("40806637803162").publicURL(