diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/ServiceAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java
similarity index 93%
rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/ServiceAsyncClient.java
rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java
index d47967c2c8..be75da1b5a 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/ServiceAsyncClient.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java
@@ -35,17 +35,17 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides asynchronous access to Service via their REST API.
*
*
- * @see ServiceClient
+ * @see AuthenticationClient
* @see
* @author Adrian Cole
*/
@Path("/v1.1")
-public interface ServiceAsyncClient {
+public interface AuthenticationAsyncClient {
/**
- * @see ServiceClient#authenticate
+ * @see AuthenticationClient#authenticate
*/
@POST
@SelectJson("auth")
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/ServiceClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
similarity index 95%
rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/ServiceClient.java
rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
index 5bbb520611..0e51289ad8 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/ServiceClient.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java
@@ -27,13 +27,13 @@ import org.jclouds.openstack.keystone.v1_1.domain.Auth;
* Provides synchronous access to the KeyStone Service API.
*
*
- * @see ServiceAsyncClient
+ * @see AuthenticationAsyncClient
* @see
* @author Adrian Cole
*/
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
-public interface ServiceClient {
+public interface AuthenticationClient {
/**
* Authenticate to generate a token.
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
index ba16265d27..4f70bc4c0f 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/config/AuthenticationServiceModule.java
@@ -35,8 +35,8 @@ import org.jclouds.http.annotation.ClientError;
import org.jclouds.location.Provider;
import org.jclouds.location.suppliers.RegionIdToURISupplier;
import org.jclouds.openstack.Authentication;
-import org.jclouds.openstack.keystone.v1_1.ServiceAsyncClient;
-import org.jclouds.openstack.keystone.v1_1.ServiceClient;
+import org.jclouds.openstack.keystone.v1_1.AuthenticationAsyncClient;
+import org.jclouds.openstack.keystone.v1_1.AuthenticationClient;
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
import org.jclouds.openstack.keystone.v1_1.handlers.RetryOnRenew;
import org.jclouds.openstack.keystone.v1_1.suppliers.RegionIdToURIFromAuthForServiceSupplier;
@@ -63,7 +63,7 @@ public class AuthenticationServiceModule extends AbstractModule {
}).to(GetAuth.class);
// ServiceClient is used directly for filters and retry handlers, so let's bind it
// explicitly
- bindClientAndAsyncClient(binder(), ServiceClient.class, ServiceAsyncClient.class);
+ bindClientAndAsyncClient(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class);
install(new FactoryModuleBuilder().implement(RegionIdToURISupplier.class,
RegionIdToURIFromAuthForServiceSupplier.class).build(RegionIdToURISupplier.Factory.class));
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class);
@@ -88,7 +88,7 @@ public class AuthenticationServiceModule extends AbstractModule {
public static class GetAuth extends RetryOnTimeOutExceptionFunction {
@Inject
- public GetAuth(final ServiceClient client) {
+ public GetAuth(final AuthenticationClient client) {
super(new Function() {
@Override
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncClient.java
similarity index 90%
rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java
rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncClient.java
index 31c1ffcd70..2f160ed365 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncClient.java
@@ -37,16 +37,16 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides asynchronous access to Service via their REST API.
*
*
- * @see ServiceClient
+ * @see AuthenticationClient
* @see
* @author Adrian Cole
*/
@Path("/v2.0")
-public interface ServiceAsyncClient {
+public interface AuthenticationAsyncClient {
/**
- * @see ServiceClient#authenticateTenantWithCredentials(String,PasswordCredentials)
+ * @see AuthenticationClient#authenticateTenantWithCredentials(String,PasswordCredentials)
*/
@POST
@SelectJson("access")
@@ -57,7 +57,7 @@ public interface ServiceAsyncClient {
PasswordCredentials passwordCredentials);
/**
- * @see ServiceClient#authenticateTenantWithCredentials(String,ApiAccessKeyCredentials)
+ * @see AuthenticationClient#authenticateTenantWithCredentials(String,ApiAccessKeyCredentials)
*/
@POST
@SelectJson("access")
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationClient.java
similarity index 96%
rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java
rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationClient.java
index 0e53e6067a..695b55f527 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationClient.java
@@ -29,13 +29,13 @@ import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
* Provides synchronous access to the KeyStone Service API.
*
*
- * @see ServiceAsyncClient
+ * @see AuthenticationAsyncClient
* @see
* @author Adrian Cole
*/
@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
-public interface ServiceClient {
+public interface AuthenticationClient {
/**
* Authenticate to generate a token.
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
index 4730cf4efd..21b1733918 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java
@@ -40,12 +40,14 @@ import org.jclouds.location.suppliers.ZoneIdsSupplier;
import org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet;
import org.jclouds.location.suppliers.derived.ZoneIdsFromZoneIdToURIKeySet;
import org.jclouds.openstack.Authentication;
-import org.jclouds.openstack.keystone.v2_0.ServiceAsyncClient;
-import org.jclouds.openstack.keystone.v2_0.ServiceClient;
+import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncClient;
+import org.jclouds.openstack.keystone.v2_0.AuthenticationClient;
import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.functions.AuthenticateApiAccessKeyCredentials;
import org.jclouds.openstack.keystone.v2_0.functions.AuthenticatePasswordCredentials;
import org.jclouds.openstack.keystone.v2_0.handlers.RetryOnRenew;
+import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersionSupplier;
+import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier;
import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToURIFromAccessForTypeAndVersionSupplier;
import org.jclouds.openstack.keystone.v2_0.suppliers.ZoneIdToURIFromAccessForTypeAndVersionSupplier;
import org.jclouds.rest.annotations.ApiVersion;
@@ -85,6 +87,8 @@ public class KeystoneAuthenticationModule extends AbstractModule {
protected void configure() {
install(new FactoryModuleBuilder().implement(RegionIdToURISupplier.class,
RegionIdToURIFromAccessForTypeAndVersionSupplier.class).build(RegionIdToURISupplier.Factory.class));
+ install(new FactoryModuleBuilder().implement(RegionIdToAdminURISupplier.class,
+ RegionIdToAdminURIFromAccessForTypeAndVersionSupplier.class).build(RegionIdToAdminURISupplier.Factory.class));
// dynamically build the region list as opposed to from properties
bind(RegionIdsSupplier.class).to(RegionIdsFromRegionIdToURIKeySet.class);
}
@@ -98,6 +102,16 @@ public class KeystoneAuthenticationModule extends AbstractModule {
RegionIdToURISupplier.Factory factory) {
return factory.createForApiTypeAndVersion(serviceType, apiVersion);
}
+
+ // supply the region to id to AdminURL map from keystone, based on the servicetype and api version in
+ // config
+ @Provides
+ @Singleton
+ protected RegionIdToAdminURISupplier provideRegionIdToAdminURISupplierForApiVersion(
+ @Named(KeystoneProperties.SERVICE_TYPE) String serviceType, @ApiVersion String apiVersion,
+ RegionIdToAdminURISupplier.Factory factory) {
+ return factory.createForApiTypeAndVersion(serviceType, apiVersion);
+ }
}
@@ -132,7 +146,7 @@ public class KeystoneAuthenticationModule extends AbstractModule {
bind(CredentialType.class).toProvider(CredentialTypeFromPropertyOrDefault.class);
// ServiceClient is used directly for filters and retry handlers, so let's bind it
// explicitly
- bindClientAndAsyncClient(binder(), ServiceClient.class, ServiceAsyncClient.class);
+ bindClientAndAsyncClient(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class);
install(locationModule);
}
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java
new file mode 100644
index 0000000000..61057d76da
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiMetadata.java
@@ -0,0 +1,170 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.keystone.v2_0.domain;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Set;
+
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.domain.Link;
+import org.jclouds.openstack.domain.Resource;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Class ApiMetadata
+ */
+public class ApiMetadata extends Resource {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public static class Builder extends Resource.Builder {
+ private String status;
+ private Date updated;
+ private Set mediaTypes = Sets.newLinkedHashSet();
+
+ public Builder status(String status) {
+ this.status = status;
+ return this;
+ }
+
+ public Builder updated(Date updated) {
+ this.updated = updated;
+ return this;
+ }
+
+ public Builder mediaTypes(Set mediaTypes) {
+ this.mediaTypes = mediaTypes;
+ return this;
+ }
+
+ public ApiMetadata build() {
+ return new ApiMetadata(id, name, links, updated, status, mediaTypes);
+ }
+
+ public Builder fromApiMetadata(ApiMetadata in) {
+ return fromResource(in)
+ .status(in.getStatus())
+ .updated(in.getUpdated())
+ .mediaTypes(in.getMediaTypes());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder id(String id) {
+ return Builder.class.cast(super.id(id));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder name(String name) {
+ return Builder.class.cast(super.name(name));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder links(Set links) {
+ return Builder.class.cast(super.links(links));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Builder fromResource(Resource in) {
+ return Builder.class.cast(super.fromResource(in));
+ }
+ }
+
+ private final String status;
+ private final Date updated;
+ @SerializedName("media-types")
+ private final Set mediaTypes;
+
+ protected ApiMetadata(String id, String name, Set links, Date updated, String status, Set mediaTypes) {
+ super(id, name, links);
+ this.status = status;
+ this.updated = updated;
+ this.mediaTypes = ImmutableSet.copyOf(checkNotNull(mediaTypes, "mediaTypes"));
+ }
+
+ /**
+ */
+ @Nullable
+ public String getStatus() {
+ return this.status;
+ }
+
+ /**
+ */
+ @Nullable
+ public Date getUpdated() {
+ return this.updated;
+ }
+
+ /**
+ */
+ @Nullable
+ public Set getMediaTypes() {
+ return Collections.unmodifiableSet(this.mediaTypes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(status, updated, mediaTypes);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ ApiMetadata that = ApiMetadata.class.cast(obj);
+ return Objects.equal(this.status, that.status)
+ && Objects.equal(this.updated, that.updated)
+ && Objects.equal(this.mediaTypes, that.mediaTypes)
+ ;
+ }
+
+ protected ToStringHelper string() {
+ return super.string()
+ .add("status", status)
+ .add("updated", updated)
+ .add("mediaTypes", mediaTypes);
+ }
+
+}
\ No newline at end of file
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/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java
new file mode 100644
index 0000000000..cb3cf6d071
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/MediaType.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.keystone.v2_0.domain;
+
+import org.jclouds.javax.annotation.Nullable;
+
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
+
+/**
+ * Class MediaType
+ */
+public class MediaType {
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public Builder toBuilder() {
+ return builder().fromMediaType(this);
+ }
+
+ public static class Builder {
+
+ private String base;
+ private String type;
+
+ public Builder base(String base) {
+ this.base = base;
+ return this;
+ }
+
+ public Builder type(String type) {
+ this.type = type;
+ return this;
+ }
+
+ public MediaType build() {
+ return new MediaType(this);
+ }
+
+ public Builder fromMediaType(MediaType in) {
+ return this.base(in.getBase()).type(in.getType());
+ }
+ }
+
+ private final String base;
+ private final String type;
+
+ protected MediaType(Builder builder) {
+ this.base = builder.base;
+ this.type = builder.type;
+ }
+
+ /**
+ */
+ @Nullable
+ public String getBase() {
+ return this.base;
+ }
+
+ /**
+ */
+ @Nullable
+ public String getType() {
+ return this.type;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(base, type);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ MediaType that = MediaType.class.cast(obj);
+ return Objects.equal(this.base, that.base)
+ && Objects.equal(this.type, that.type)
+ ;
+ }
+
+ protected ToStringHelper string() {
+ return Objects.toStringHelper("")
+ .add("base", base)
+ .add("type", type);
+ }
+
+ @Override
+ public String toString() {
+ return string().toString();
+ }
+
+}
\ No newline at end of file
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java
index 77a3bc27cf..6f8d579f74 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Service.java
@@ -52,7 +52,7 @@ public class Service implements Comparable {
protected Set endpoints = ImmutableSet.of();
/**
- * @see Service#getId()
+ * @see Service#getType()
*/
public Builder type(String type) {
this.type = checkNotNull(type, "type");
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java
index 840892e338..35f884629c 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Tenant.java
@@ -23,12 +23,16 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
+import javax.ws.rs.DefaultValue;
+
+import org.jclouds.javax.annotation.Nullable;
+
import com.google.common.base.Objects;
/**
* A container used to group or isolate resources and/or identity objects. Depending on the service
* operator, a tenant may map to a customer, account, organization, or project.
- *
+ *
* @author Adrian Cole
* @see
@@ -46,6 +50,7 @@ public class Tenant implements Comparable {
public static class Builder {
protected String id;
protected String name;
+ protected String description;
/**
* @see Tenant#getId()
@@ -63,8 +68,16 @@ public class Tenant implements Comparable {
return this;
}
+ /**
+ * @see Tenant#getDescription()
+ */
+ public Builder description(String description) {
+ this.description = description;
+ return this;
+ }
+
public Tenant build() {
- return new Tenant(id, name);
+ return new Tenant(id, name, description);
}
public Builder fromTenant(Tenant from) {
@@ -74,15 +87,17 @@ public class Tenant implements Comparable {
protected final String id;
protected final String name;
+ protected final String description;
- public Tenant(String id, String name) {
+ protected Tenant(String id, String name, String description) {
this.id = checkNotNull(id, "id");
this.name = checkNotNull(name, "name");
+ this.description = description;
}
/**
* When providing an ID, it is assumed that the tenant exists in the current OpenStack deployment
- *
+ *
* @return the id of the tenant in the current OpenStack deployment
*/
public String getId() {
@@ -96,6 +111,14 @@ public class Tenant implements Comparable {
return name;
}
+ /**
+ * @return the description of the tenant
+ */
+ @Nullable
+ public String getDescription() {
+ return description;
+ }
+
@Override
public boolean equals(Object object) {
if (this == object) {
@@ -103,7 +126,8 @@ public class Tenant implements Comparable {
}
if (object instanceof Tenant) {
final Tenant other = Tenant.class.cast(object);
- return equal(id, other.id) && equal(name, other.name);
+ return equal(id, other.id) && equal(name, other.name)
+ && equal(description, other.description);
} else {
return false;
}
@@ -111,12 +135,12 @@ public class Tenant implements Comparable {
@Override
public int hashCode() {
- return Objects.hashCode(id, name);
+ return Objects.hashCode(id, name, description);
}
@Override
public String toString() {
- return toStringHelper("").add("id", id).add("name", name).toString();
+ return toStringHelper("").add("id", id).add("name", name).add("description", description).toString();
}
@Override
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java
index 0ce93ccec3..e8d5ff7dcb 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/User.java
@@ -98,11 +98,17 @@ public class User implements Comparable {
protected final String name;
protected final Set roles;
- public User(String id, String name, Set roles) {
+ protected User(String id, String name, Set roles) {
this.id = checkNotNull(id, "id");
this.name = checkNotNull(name, "name");
this.roles = ImmutableSet.copyOf(checkNotNull(roles, "roles"));
}
+
+ protected User() {
+ id = null;
+ name = null;
+ roles = ImmutableSet.of();
+ }
/**
* When providing an ID, it is assumed that the user exists in the current OpenStack deployment
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java
new file mode 100644
index 0000000000..b4454b6497
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.keystone.v2_0.functions;
+
+import java.net.URI;
+
+import javax.inject.Singleton;
+
+import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
+
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+
+/**
+ * @author Adam Lowe
+ */
+@Singleton
+public class AdminURL implements EndpointToSupplierAdminURI {
+ @Override
+ public Supplier apply(Endpoint input) {
+ return Suppliers.ofInstance(input.getAdminURL());
+ }
+
+ public String toString() {
+ return "supplyAdminURL()";
+ }
+}
\ No newline at end of file
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java
index b62cb33d69..29be1b1ded 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java
@@ -22,7 +22,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.domain.Credentials;
-import org.jclouds.openstack.keystone.v2_0.ServiceClient;
+import org.jclouds.openstack.keystone.v2_0.AuthenticationClient;
import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials;
import org.jclouds.rest.AuthorizationException;
@@ -31,10 +31,10 @@ import com.google.common.base.Function;
@Singleton
public class AuthenticateApiAccessKeyCredentials implements Function {
- private final ServiceClient client;
+ private final AuthenticationClient client;
@Inject
- public AuthenticateApiAccessKeyCredentials(ServiceClient client) {
+ public AuthenticateApiAccessKeyCredentials(AuthenticationClient client) {
this.client = client;
}
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java
index 0191266ead..0c59e02ede 100644
--- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java
@@ -20,7 +20,7 @@ package org.jclouds.openstack.keystone.v2_0.functions;
import javax.inject.Inject;
import org.jclouds.domain.Credentials;
-import org.jclouds.openstack.keystone.v2_0.ServiceClient;
+import org.jclouds.openstack.keystone.v2_0.AuthenticationClient;
import org.jclouds.openstack.keystone.v2_0.domain.Access;
import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
import org.jclouds.rest.AuthorizationException;
@@ -28,10 +28,10 @@ import org.jclouds.rest.AuthorizationException;
import com.google.common.base.Function;
public class AuthenticatePasswordCredentials implements Function {
- private final ServiceClient client;
+ private final AuthenticationClient client;
@Inject
- public AuthenticatePasswordCredentials(ServiceClient client) {
+ public AuthenticatePasswordCredentials(AuthenticationClient client) {
this.client = client;
}
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java
new file mode 100644
index 0000000000..2061a2dc11
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.keystone.v2_0.functions;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * @author Adam Lowe
+ */
+@ImplementedBy(AdminURL.class)
+public interface EndpointToSupplierAdminURI extends EndpointToSupplierURI {
+}
\ No newline at end of file
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java
new file mode 100644
index 0000000000..a98bf9d87f
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java
@@ -0,0 +1,16 @@
+package org.jclouds.openstack.keystone.v2_0.functions;
+
+import javax.inject.Inject;
+
+import org.jclouds.location.functions.RegionToEndpoint;
+import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier;
+
+/**
+ * @author Adam Lowe
+ */
+public class RegionToAdminEndpointURI extends RegionToEndpoint {
+ @Inject
+ public RegionToAdminEndpointURI(RegionIdToAdminURISupplier regionToEndpointSupplier) {
+ super(regionToEndpointSupplier);
+ }
+}
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionSupplier.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionSupplier.java
new file mode 100644
index 0000000000..74d15f5be0
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersionSupplier.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.keystone.v2_0.suppliers;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import org.jclouds.openstack.keystone.v2_0.domain.Access;
+import org.jclouds.openstack.keystone.v2_0.functions.EndpointToRegion;
+import org.jclouds.openstack.keystone.v2_0.functions.EndpointToSupplierAdminURI;
+
+import com.google.common.base.Supplier;
+import com.google.inject.assistedinject.Assisted;
+
+@Singleton
+public class RegionIdToAdminURIFromAccessForTypeAndVersionSupplier extends
+ LocationIdToURIFromAccessForTypeAndVersionSupplier implements RegionIdToAdminURISupplier {
+ @Inject
+ public RegionIdToAdminURIFromAccessForTypeAndVersionSupplier(Supplier access,
+ EndpointToSupplierAdminURI endpointToSupplierURI, EndpointToRegion endpointToRegion,
+ @Assisted("apiType") String apiType, @Assisted("apiVersion") String apiVersion) {
+ super(access, endpointToSupplierURI, endpointToRegion, apiType, apiVersion);
+ }
+
+ @Override
+ public String toString() {
+ return "regionIdToAdminURIFromAccessForTypeAndVersion(" + apiType + ", " + apiVersion + ")";
+ }
+}
\ No newline at end of file
diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java
new file mode 100644
index 0000000000..9f2b1c15b7
--- /dev/null
+++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java
@@ -0,0 +1,28 @@
+package org.jclouds.openstack.keystone.v2_0.suppliers;
+
+import java.net.URI;
+import java.util.Map;
+
+import com.google.common.base.Supplier;
+import com.google.inject.ImplementedBy;
+import com.google.inject.assistedinject.Assisted;
+
+/**
+ * @author Adam Lowe
+ */
+@ImplementedBy(RegionIdToAdminURIFromAccessForTypeAndVersionSupplier.class)
+public interface RegionIdToAdminURISupplier extends Supplier