You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2017/12/08 12:56:20 UTC
[5/8] jclouds git commit: Initial work towards Keystone V3
authentication
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneHttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneHttpApiModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneHttpApiModule.java
index fc8aca3..34c2358 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneHttpApiModule.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneHttpApiModule.java
@@ -16,10 +16,7 @@
*/
package org.jclouds.openstack.keystone.v2_0.config;
-import static org.jclouds.util.Suppliers2.getLastValueInMap;
-
import java.net.URI;
-import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -29,30 +26,21 @@ import org.jclouds.http.HttpErrorHandler;
import org.jclouds.http.annotation.ClientError;
import org.jclouds.http.annotation.Redirection;
import org.jclouds.http.annotation.ServerError;
-import org.jclouds.location.Provider;
import org.jclouds.openstack.keystone.v2_0.KeystoneApi;
import org.jclouds.openstack.keystone.v2_0.handlers.KeystoneErrorHandler;
-import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersion;
-import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier;
-import org.jclouds.openstack.v2_0.ServiceType;
import org.jclouds.openstack.v2_0.domain.Extension;
import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationMatchesExtensionSet;
-import org.jclouds.openstack.v2_0.services.Identity;
import org.jclouds.rest.ConfiguresHttpApi;
-import org.jclouds.rest.annotations.ApiVersion;
import org.jclouds.rest.config.HttpApiModule;
import org.jclouds.rest.functions.ImplicitOptionalConverter;
-import org.jclouds.util.Suppliers2;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
-import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.google.inject.Provides;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
import com.google.inject.multibindings.MapBinder;
/**
@@ -64,33 +52,6 @@ public class KeystoneHttpApiModule extends HttpApiModule<KeystoneApi> {
public KeystoneHttpApiModule() {
}
- public static class KeystoneAdminURLModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new FactoryModuleBuilder().implement(RegionIdToAdminURISupplier.class,
- RegionIdToAdminURIFromAccessForTypeAndVersion.class).build(RegionIdToAdminURISupplier.Factory.class));
- }
-
- /**
- * in some cases, there is no {@link ServiceType#IDENTITY} entry in the service catalog. In
- * other cases, there's no adminURL entry present. Fallback to the provider in this case.
- */
- @Provides
- @Singleton
- @Identity
- protected final Supplier<URI> provideStorageUrl(final RegionIdToAdminURISupplier.Factory factory,
- @ApiVersion final String version, @Provider final Supplier<URI> providerURI) {
- Supplier<URI> identityServiceForVersion = getLastValueInMap(factory.createForApiTypeAndVersion(
- ServiceType.IDENTITY, version));
- Supplier<URI> whenIdentityServiceIsntListedFallbackToProviderURI = Suppliers2.onThrowable(
- identityServiceForVersion, NoSuchElementException.class, providerURI);
- Supplier<URI> whenIdentityServiceHasNoAdminURLFallbackToProviderURI = Suppliers2.or(
- whenIdentityServiceIsntListedFallbackToProviderURI, providerURI);
- return whenIdentityServiceHasNoAdminURLFallbackToProviderURI;
- }
- }
-
// Allow providers to cleanly contribute their own aliases
public static MapBinder<URI, URI> namespaceAliasBinder(Binder binder) {
return MapBinder.newMapBinder(binder, URI.class, URI.class, NamespaceAliases.class).permitDuplicates();
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneProperties.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneProperties.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneProperties.java
deleted file mode 100644
index dcb83cf..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneProperties.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.config;
-
-/**
- * Configuration properties and constants used in Keystone connections.
- */
-public final class KeystoneProperties {
-
- /**
- * Type of credentials used to log into the auth service.
- *
- * <h3>valid values</h3>
- * <ul>
- * <li>apiAccessKeyCredentials</li>
- * <li>passwordCredentials</li>
- * </ul>
- *
- * @see CredentialTypes
- * @see <a href=
- * "http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Api_Operations.html"
- * />
- */
- public static final String CREDENTIAL_TYPE = "jclouds.keystone.credential-type";
-
- /**
- * set this property to specify the tenant id of the authenticated user.
- * Cannot be used simultaneously with {@link #TENANT_NAME}
- *
- * @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
- */
- public static final String TENANT_ID = "jclouds.keystone.tenant-id";
-
- /**
- * set this property to specify the tenant name of the authenticated user.
- * Cannot be used simultaneously with {@link #TENANT_ID}
- *
- * @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
- */
- public static final String TENANT_NAME = "jclouds.keystone.tenant-name";
-
- /**
- * set this property to {@code true} to designate that the service requires
- * explicit specification of either {@link #TENANT_NAME} or
- * {@link #TENANT_ID}
- *
- * @see <a href="http://wiki.openstack.org/CLIAuth">openstack docs</a>
- */
- public static final String REQUIRES_TENANT = "jclouds.keystone.requires-tenant";
-
- /**
- * type of the keystone service. ex. {@code compute}
- *
- * @see ServiceType
- */
- public static final String SERVICE_TYPE = "jclouds.keystone.service-type";
-
- private KeystoneProperties() {
- throw new AssertionError("intentionally unimplemented");
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java
index eb63a31..58dac28 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Access.java
@@ -22,6 +22,7 @@ import java.beans.ConstructorProperties;
import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.domain.AuthInfo;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
@@ -36,7 +37,7 @@ import com.google.common.collect.ImmutableSet;
* "http://docs.openstack.org/api/openstack-identity-service/2.0/content/Identity-Service-Concepts-e1362.html"
* />
*/
-public class Access extends ForwardingSet<Service> implements Comparable<Access> {
+public class Access extends ForwardingSet<Service> implements Comparable<Access>, AuthInfo {
public static Builder<?> builder() {
return new ConcreteBuilder();
@@ -166,4 +167,9 @@ public class Access extends ForwardingSet<Service> implements Comparable<Access>
return serviceCatalog;
}
+ @Override
+ public String getAuthToken() {
+ return token.getId();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiAccessKeyCredentials.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiAccessKeyCredentials.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiAccessKeyCredentials.java
deleted file mode 100644
index b189a2f..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/ApiAccessKeyCredentials.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.beans.ConstructorProperties;
-
-import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-/**
- * Api AccessKey Credentials
- *
- * @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Api_Operations.html#d662e583"
-/>
- */
-@CredentialType(CredentialTypes.API_ACCESS_KEY_CREDENTIALS)
-public class ApiAccessKeyCredentials {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromApiAccessKeyCredentials(this);
- }
-
- public static ApiAccessKeyCredentials createWithAccessKeyAndSecretKey(String accessKey, String secretKey) {
- return new ApiAccessKeyCredentials(accessKey, secretKey);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String accessKey;
- protected String secretKey;
-
- /**
- * @see ApiAccessKeyCredentials#getAccessKey()
- */
- public T accessKey(String accessKey) {
- this.accessKey = accessKey;
- return self();
- }
-
- /**
- * @see ApiAccessKeyCredentials#getSecretKey()
- */
- public T secretKey(String secretKey) {
- this.secretKey = secretKey;
- return self();
- }
-
- public ApiAccessKeyCredentials build() {
- return new ApiAccessKeyCredentials(accessKey, secretKey);
- }
-
- public T fromApiAccessKeyCredentials(ApiAccessKeyCredentials in) {
- return this
- .accessKey(in.getAccessKey())
- .secretKey(in.getSecretKey());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String accessKey;
- private final String secretKey;
-
- @ConstructorProperties({
- "accessKey", "secretKey"
- })
- protected ApiAccessKeyCredentials(String accessKey, String secretKey) {
- this.accessKey = checkNotNull(accessKey, "accessKey");
- this.secretKey = checkNotNull(secretKey, "secretKey");
- }
-
- /**
- * @return the accessKey
- */
- public String getAccessKey() {
- return this.accessKey;
- }
-
- /**
- * @return the secretKey
- */
- public String getSecretKey() {
- return this.secretKey;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(accessKey, secretKey);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- ApiAccessKeyCredentials that = ApiAccessKeyCredentials.class.cast(obj);
- return Objects.equal(this.accessKey, that.accessKey)
- && Objects.equal(this.secretKey, that.secretKey);
- }
-
- protected ToStringHelper string() {
- return MoreObjects.toStringHelper(this)
- .add("accessKey", accessKey).add("secretKey", secretKey);
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java
index f5424bd..0080b2e 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/Endpoint.java
@@ -22,8 +22,8 @@ import java.net.URI;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
import com.google.common.base.MoreObjects.ToStringHelper;
+import com.google.common.base.Objects;
/**
* An network-accessible address, usually described by URL, where a service may
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/PasswordCredentials.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/PasswordCredentials.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/PasswordCredentials.java
deleted file mode 100644
index 68b5f99..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/domain/PasswordCredentials.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.beans.ConstructorProperties;
-
-import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import com.google.common.base.MoreObjects.ToStringHelper;
-
-/**
- * Password Credentials
- *
- * @see <a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/POST_authenticate_v2.0_tokens_Service_API_Api_Operations.html#d662e583"
-/>
- */
-@CredentialType("passwordCredentials")
-public class PasswordCredentials {
-
- public static Builder<?> builder() {
- return new ConcreteBuilder();
- }
-
- public Builder<?> toBuilder() {
- return new ConcreteBuilder().fromPasswordCredentials(this);
- }
-
- public static PasswordCredentials createWithUsernameAndPassword(String username, String password) {
- return new PasswordCredentials(username, password);
- }
-
- public abstract static class Builder<T extends Builder<T>> {
- protected abstract T self();
-
- protected String username;
- protected String password;
-
- /**
- * @see PasswordCredentials#getUsername()
- */
- public T username(String username) {
- this.username = username;
- return self();
- }
-
- /**
- * @see PasswordCredentials#getPassword()
- */
- public T password(String password) {
- this.password = password;
- return self();
- }
-
- public PasswordCredentials build() {
- return new PasswordCredentials(username, password);
- }
-
- public T fromPasswordCredentials(PasswordCredentials in) {
- return this
- .username(in.getUsername())
- .password(in.getPassword());
- }
- }
-
- private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
- @Override
- protected ConcreteBuilder self() {
- return this;
- }
- }
-
- private final String username;
- private final String password;
-
- @ConstructorProperties({
- "username", "password"
- })
- protected PasswordCredentials(String username, String password) {
- this.username = checkNotNull(username, "username");
- this.password = checkNotNull(password, "password");
- }
-
- /**
- * @return the username
- */
- public String getUsername() {
- return this.username;
- }
-
- /**
- * @return the password
- */
- public String getPassword() {
- return this.password;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(username, password);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || getClass() != obj.getClass()) return false;
- PasswordCredentials that = PasswordCredentials.class.cast(obj);
- return Objects.equal(this.username, that.username)
- && Objects.equal(this.password, that.password);
- }
-
- protected ToStringHelper string() {
- return MoreObjects.toStringHelper(this)
- .add("username", username)
- .add("password", password == null ? null : "*****");
- }
-
- @Override
- public String toString() {
- return string().toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApi.java
index 2d11b16..f5ced86 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminApi.java
@@ -30,8 +30,8 @@ import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.domain.Role;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.ServiceType;
import org.jclouds.openstack.v2_0.services.Extension;
import org.jclouds.rest.annotations.Fallback;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApi.java
index 8c9b8cf..2bba9fa 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminApi.java
@@ -30,9 +30,9 @@ import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.domain.Service;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseServices;
import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseServices.ToPagedIterable;
import org.jclouds.openstack.v2_0.ServiceType;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java
index 93489b3..f3dec87 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java
@@ -28,8 +28,8 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.options.CreateTenantOptions;
import org.jclouds.openstack.keystone.v2_0.options.UpdateTenantOptions;
import org.jclouds.openstack.v2_0.ServiceType;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApi.java
index 952b4a1..7102fca 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminApi.java
@@ -27,8 +27,8 @@ import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.options.CreateUserOptions;
import org.jclouds.openstack.keystone.v2_0.options.UpdateUserOptions;
import org.jclouds.openstack.v2_0.ServiceType;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java
index dbf982d..0836318 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceApi.java
@@ -25,8 +25,8 @@ import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.SelectJson;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java
index 85828bf..1136a2f 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantApi.java
@@ -27,9 +27,9 @@ import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.domain.Tenant;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseTenants;
import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseTenants.ToPagedIterable;
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java
index f61dc8b..a6d3961 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenApi.java
@@ -30,10 +30,10 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.FalseOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
import org.jclouds.openstack.keystone.v2_0.domain.Token;
import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.v2_0.services.Identity;
import org.jclouds.rest.annotations.Fallback;
import org.jclouds.rest.annotations.RequestFilters;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java
index f7dd75e..11d1ac0 100644
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserApi.java
@@ -31,10 +31,10 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.collect.PagedIterable;
import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.openstack.keystone.auth.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404;
import org.jclouds.openstack.keystone.v2_0.domain.Role;
import org.jclouds.openstack.keystone.v2_0.domain.User;
-import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseUsers;
import org.jclouds.openstack.keystone.v2_0.functions.internal.ParseUsers.ToPagedIterable;
import org.jclouds.openstack.v2_0.domain.PaginatedCollection;
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/filters/AuthenticateRequest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/filters/AuthenticateRequest.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/filters/AuthenticateRequest.java
deleted file mode 100644
index b46899c..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/filters/AuthenticateRequest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.filters;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpException;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpRequestFilter;
-import org.jclouds.openstack.keystone.v2_0.config.Authentication;
-import org.jclouds.openstack.v2_0.reference.AuthHeaders;
-
-import com.google.common.base.Supplier;
-
-/**
- * Signs the Keystone-based request. This will update the Authentication Token before 24 hours is up.
- */
-@Singleton
-public class AuthenticateRequest implements HttpRequestFilter {
-
- private final Supplier<String> authTokenProvider;
-
- @Inject
- public AuthenticateRequest(@Authentication Supplier<String> authTokenProvider) {
- this.authTokenProvider = authTokenProvider;
- }
-
- @Override
- public HttpRequest filter(HttpRequest request) throws HttpException {
- return request.toBuilder().replaceHeader(AuthHeaders.AUTH_TOKEN, authTokenProvider.get()).build();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java
deleted file mode 100644
index 2669965..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AdminURL.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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;
-
-@Singleton
-public class AdminURL implements EndpointToSupplierAdminURI {
- @Override
- public Supplier<URI> apply(Endpoint input) {
- return Suppliers.ofInstance(input.getAdminURL());
- }
-
- public String toString() {
- return "supplyAdminURL()";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java
deleted file mode 100644
index 7a42f33..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticateApiAccessKeyCredentials.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.openstack.keystone.v2_0.AuthenticationApi;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator;
-
-import com.google.common.base.Optional;
-
-@CredentialType(CredentialTypes.API_ACCESS_KEY_CREDENTIALS)
-@Singleton
-public class AuthenticateApiAccessKeyCredentials extends BaseAuthenticator<ApiAccessKeyCredentials> {
- protected final AuthenticationApi api;
-
- @Inject
- public AuthenticateApiAccessKeyCredentials(AuthenticationApi api) {
- this.api = api;
- }
-
- @Override
- protected Access authenticateWithTenantName(Optional<String> tenantName, ApiAccessKeyCredentials apiAccessKeyCredentials) {
- return api.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
- }
-
- @Override
- protected Access authenticateWithTenantId(Optional<String> tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials) {
- return api.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
- }
-
- @Override
- public ApiAccessKeyCredentials createCredentials(String identity, String credential) {
- return ApiAccessKeyCredentials.createWithAccessKeyAndSecretKey(identity, credential);
- }
-
- @Override
- public String toString() {
- return "authenticateApiAccessKeyCredentials()";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java
deleted file mode 100644
index 15d1237..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/AuthenticatePasswordCredentials.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.openstack.keystone.v2_0.AuthenticationApi;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialType;
-import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials;
-import org.jclouds.openstack.keystone.v2_0.functions.internal.BaseAuthenticator;
-
-import com.google.common.base.Optional;
-
-@CredentialType(CredentialTypes.PASSWORD_CREDENTIALS)
-@Singleton
-public class AuthenticatePasswordCredentials extends BaseAuthenticator<PasswordCredentials> {
- protected final AuthenticationApi api;
-
- @Inject
- public AuthenticatePasswordCredentials(AuthenticationApi api) {
- this.api = api;
- }
-
- @Override
- protected Access authenticateWithTenantName(Optional<String> tenantName, PasswordCredentials apiAccessKeyCredentials) {
- return api.authenticateWithTenantNameAndCredentials(tenantName.orNull(), apiAccessKeyCredentials);
- }
-
- @Override
- protected Access authenticateWithTenantId(Optional<String> tenantId, PasswordCredentials apiAccessKeyCredentials) {
- return api.authenticateWithTenantIdAndCredentials(tenantId.orNull(), apiAccessKeyCredentials);
- }
-
- @Override
- public PasswordCredentials createCredentials(String identity, String credential) {
- return PasswordCredentials.createWithUsernameAndPassword(identity, credential);
- }
-
- @Override
- public String toString() {
- return "authenticatePasswordCredentials()";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToRegion.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToRegion.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToRegion.java
deleted file mode 100644
index d3ec6d6..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToRegion.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-
-import com.google.common.base.Function;
-import com.google.inject.ImplementedBy;
-
-@ImplementedBy(ReturnRegionOrProvider.class)
-public interface EndpointToRegion extends Function<Endpoint, String> {
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java
deleted file mode 100644
index 6bf6e11..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierAdminURI.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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;
-
-@ImplementedBy(AdminURL.class)
-public interface EndpointToSupplierAdminURI extends EndpointToSupplierURI {
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierURI.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierURI.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierURI.java
deleted file mode 100644
index 8b424f7..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/EndpointToSupplierURI.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-import com.google.inject.ImplementedBy;
-
-@ImplementedBy(PublicURLOrInternalIfNull.class)
-public interface EndpointToSupplierURI extends Function<Endpoint, Supplier<URI>> {
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURL.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURL.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURL.java
deleted file mode 100644
index fbd23d2..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/InternalURL.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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;
-
-/**
- * Select internal URL endpoints services
- *
- */
-@Singleton
-public class InternalURL implements EndpointToSupplierURI {
- @Override
- public Supplier<URI> apply(Endpoint input) {
- return Suppliers.ofInstance(input.getInternalURL());
- }
-
- @Override
- public String toString() {
- return "supplyInternalURL()";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNull.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNull.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNull.java
deleted file mode 100644
index 01d81bd..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/PublicURLOrInternalIfNull.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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;
-
-@Singleton
-public class PublicURLOrInternalIfNull implements EndpointToSupplierURI {
- // TODO: check accessibility and prioritize private first
- @Override
- public Supplier<URI> apply(Endpoint input) {
- return Suppliers.ofInstance(input.getPublicURL() != null ? input.getPublicURL() : input.getInternalURL());
- }
-
- public String toString() {
- return "supplyPublicURL()";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java
deleted file mode 100644
index c6c1a34..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/RegionToAdminEndpointURI.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
-import java.net.URI;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier;
-
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
-
-public final class RegionToAdminEndpointURI implements Function<Object, URI> {
-
- private final RegionIdToAdminURISupplier regionToAdminEndpoints;
-
- @Inject
- RegionToAdminEndpointURI(RegionIdToAdminURISupplier regionToAdminEndpoints) {
- this.regionToAdminEndpoints = regionToAdminEndpoints;
- }
-
- @Override
- public URI apply(Object from) {
- Map<String, Supplier<URI>> regionToAdminEndpoint = regionToAdminEndpoints.get();
- checkState(!regionToAdminEndpoint.isEmpty(), "no region name to admin endpoint mappings in keystone!");
- checkArgument(regionToAdminEndpoint.containsKey(from),
- "requested location %s, which is not in the keystone admin endpoints: %s", from, regionToAdminEndpoint);
- return regionToAdminEndpoint.get(from).get();
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProvider.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProvider.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProvider.java
deleted file mode 100644
index 2dfc32e..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/ReturnRegionOrProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.location.Provider;
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-
-@Singleton
-public class ReturnRegionOrProvider implements EndpointToRegion {
- private String provider;
-
- @Inject
- ReturnRegionOrProvider(@Provider String provider) {
- this.provider = checkNotNull(provider, "provider");
- }
-
- @Override
- public String apply(Endpoint input) {
- return input.getRegion() != null ? input.getRegion() : provider;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/internal/BaseAuthenticator.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/internal/BaseAuthenticator.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/internal/BaseAuthenticator.java
deleted file mode 100644
index 3e4216a..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/functions/internal/BaseAuthenticator.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.internal;
-
-import static com.google.common.base.Preconditions.checkState;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.TENANT_ID;
-import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.TENANT_NAME;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-
-import org.jclouds.domain.Credentials;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-
-public abstract class BaseAuthenticator<C> implements Function<Credentials, Access> {
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject(optional = true)
- @Named(TENANT_NAME)
- protected String defaultTenantName;
-
- @Inject(optional = true)
- @Named(TENANT_ID)
- protected String defaultTenantId;
-
- @Inject(optional = true)
- @Named(REQUIRES_TENANT)
- protected boolean requiresTenant;
-
- @PostConstruct
- public void checkPropertiesAreCompatible() {
- checkState(defaultTenantName == null || defaultTenantId == null, "you cannot specify both %s and %s",
- TENANT_NAME, TENANT_ID);
- }
-
- @Override
- public Access apply(Credentials input) {
- Optional<String> tenantName = Optional.fromNullable(defaultTenantName);
- Optional<String> tenantId = Optional.fromNullable(defaultTenantId);
-
- String usernameOrAccessKey = input.identity;
-
- if (!tenantName.isPresent() && input.identity.indexOf(':') != -1) {
- tenantName = Optional.of(input.identity.substring(0, input.identity.lastIndexOf(':')));
- usernameOrAccessKey = input.identity.substring(input.identity.lastIndexOf(':') + 1);
- }
-
- String passwordOrSecretKey = input.credential;
-
- C creds = createCredentials(usernameOrAccessKey, passwordOrSecretKey);
-
- Access access;
- if (tenantId.isPresent()) {
- access = authenticateWithTenantId(tenantId, creds);
- } else if (tenantName.isPresent()) {
- access = authenticateWithTenantName(tenantName, creds);
- } else if (!requiresTenant) {
- access = authenticateWithTenantName(tenantName, creds);
- } else {
- throw new IllegalArgumentException(
- String.format(
- "current configuration is set to [%s]. Unless you set [%s] or [%s], you must prefix your identity with 'tenantName:'",
- REQUIRES_TENANT, TENANT_NAME, TENANT_ID));
- }
- return access;
- }
-
- public abstract C createCredentials(String identity, String credential);
-
- protected abstract Access authenticateWithTenantId(Optional<String> tenantId, C apiAccessKeyCredentials);
-
- protected abstract Access authenticateWithTenantName(Optional<String> tenantId, C apiAccessKeyCredentials);
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java
deleted file mode 100644
index 5cedc80..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/handlers/RetryOnRenew.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.handlers;
-
-import java.util.concurrent.TimeUnit;
-
-import javax.annotation.Resource;
-import javax.inject.Named;
-
-import org.jclouds.Constants;
-import org.jclouds.domain.Credentials;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-import org.jclouds.openstack.v2_0.reference.AuthHeaders;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.Multimap;
-import com.google.common.util.concurrent.Uninterruptibles;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-/**
- * This will parse and set an appropriate exception on the command object.
- */
-@Singleton
-public class RetryOnRenew implements HttpRetryHandler {
- @Resource
- protected Logger logger = Logger.NULL;
-
- @VisibleForTesting
- @Inject(optional = true)
- @Named(Constants.PROPERTY_MAX_RETRIES)
- static int NUM_RETRIES = 5;
-
- private final LoadingCache<Credentials, Access> authenticationResponseCache;
-
- private final BackoffLimitedRetryHandler backoffHandler;
-
- @Inject
- protected RetryOnRenew(LoadingCache<Credentials, Access> authenticationResponseCache,
- BackoffLimitedRetryHandler backoffHandler) {
- this.authenticationResponseCache = authenticationResponseCache;
- this.backoffHandler = backoffHandler;
- }
-
- /*
- * The reason retries need to be tracked is that it is possible that a token
- * can be expired at any time. The reason we track by request is that only
- * some requests might return a 401 (such as temporary URLs). However
- * consistent failures of the magnitude this code tracks should indicate a
- * problem.
- */
- private static final Cache<HttpCommand, Integer> retryCountMap = CacheBuilder.newBuilder()
- .expireAfterWrite(5, TimeUnit.MINUTES).build();
-
- @Override
- public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
- boolean retry = false; // default
- switch (response.getStatusCode()) {
- case 401:
- // Do not retry on 401 from authentication request
- Multimap<String, String> headers = command.getCurrentRequest().getHeaders();
- if (headers != null && headers.containsKey(AuthHeaders.AUTH_USER)
- && headers.containsKey(AuthHeaders.AUTH_KEY) && !headers.containsKey(AuthHeaders.AUTH_TOKEN)) {
- retry = false;
- } else {
- // This is not an authentication request returning 401
- // Check if we already had seen this request
- Integer count = retryCountMap.getIfPresent(command);
-
- if (count == null) {
- // First time this non-authentication request failed
- logger.debug("invalidating authentication token - first time for %s", command);
- retryCountMap.put(command, 1);
- authenticationResponseCache.invalidateAll();
- retry = true;
- } else {
- // This request has failed before
- if (count + 1 >= NUM_RETRIES) {
- logger.debug("too many 401s - giving up after: %s for %s", count, command);
- retry = false;
- } else {
- // Retry just in case
- logger.debug("invalidating authentication token - retry %s for %s", count, command);
- retryCountMap.put(command, count + 1);
- // Wait between retries
- authenticationResponseCache.invalidateAll();
- Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
- retry = true;
- }
- }
- }
- break;
- case 408:
- return backoffHandler.shouldRetryRequest(command, response);
- }
- return retry;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/LocationIdToURIFromAccessForTypeAndVersion.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/LocationIdToURIFromAccessForTypeAndVersion.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/LocationIdToURIFromAccessForTypeAndVersion.java
deleted file mode 100644
index 063f4a6..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/LocationIdToURIFromAccessForTypeAndVersion.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 static com.google.common.collect.Iterables.any;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.isEmpty;
-import static com.google.common.collect.Iterables.tryFind;
-import static com.google.common.collect.Multimaps.index;
-
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import javax.annotation.Resource;
-
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.logging.Logger;
-import org.jclouds.openstack.keystone.v2_0.domain.Access;
-import org.jclouds.openstack.keystone.v2_0.domain.Endpoint;
-import org.jclouds.openstack.keystone.v2_0.domain.Service;
-import org.jclouds.openstack.keystone.v2_0.functions.EndpointToSupplierURI;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.base.Supplier;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.inject.Inject;
-import com.google.inject.assistedinject.Assisted;
-
-public class LocationIdToURIFromAccessForTypeAndVersion implements Supplier<Map<String, Supplier<URI>>> {
-
- public interface Factory {
- /**
- *
- * @param apiType
- * type of the api, according to the provider. ex.
- * {@code compute} {@code object-store}
- * @param apiVersion
- * version of the api, or null if not available
- * @return locations mapped to default uri
- * @throws NoSuchElementException
- * if the {@code apiType} is not present in the catalog
- */
- LocationIdToURIFromAccessForTypeAndVersion createForApiTypeAndVersion(@Assisted("apiType") String apiType,
- @Nullable @Assisted("apiVersion") String apiVersion) throws NoSuchElementException;
- }
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- protected final Supplier<Access> access;
- protected final EndpointToSupplierURI endpointToSupplierURI;
- protected final Function<Endpoint, String> endpointToLocationId;
- protected final String apiType;
- protected final String apiVersion;
-
- @Inject
- public LocationIdToURIFromAccessForTypeAndVersion(Supplier<Access> access,
- EndpointToSupplierURI endpointToSupplierURI, Function<Endpoint, String> endpointToLocationId,
- @Assisted("apiType") String apiType, @Nullable @Assisted("apiVersion") String apiVersion) {
- this.access = access;
- this.endpointToSupplierURI = endpointToSupplierURI;
- this.endpointToLocationId = endpointToLocationId;
- this.apiType = apiType;
- this.apiVersion = apiVersion;
- }
-
- @Override
- public Map<String, Supplier<URI>> get() {
- FluentIterable<Service> services = FluentIterable.from(access.get()).filter(apiTypeEquals);
- if (services.isEmpty())
- throw new NoSuchElementException(String.format("apiType %s not found in catalog %s", apiType, services));
-
- Iterable<Endpoint> endpoints = concat(services);
-
- if (isEmpty(endpoints))
- throw new NoSuchElementException(
- String.format("no endpoints for apiType %s in services %s", apiType, services));
-
- boolean checkVersionId = any(endpoints, versionAware);
-
- Multimap<String, Endpoint> locationToEndpoints = index(endpoints, endpointToLocationId);
- Map<String, Endpoint> locationToEndpoint;
- if (checkVersionId && apiVersion != null) {
- locationToEndpoint = refineToVersionSpecificEndpoint(locationToEndpoints);
- if (locationToEndpoint.size() == 0)
- throw new NoSuchElementException(String.format(
- "no endpoints for apiType %s are of version %s, or version agnostic: %s", apiType, apiVersion,
- locationToEndpoints));
- } else {
- locationToEndpoint = firstEndpointInLocation(locationToEndpoints);
- }
-
- logger.debug("endpoints for apiType %s and version %s: %s", apiType, apiVersion, locationToEndpoints);
- return Maps.transformValues(locationToEndpoint, endpointToSupplierURI);
- }
-
- @VisibleForTesting
- Map<String, Endpoint> firstEndpointInLocation(Multimap<String, Endpoint> locationToEndpoints) {
- Builder<String, Endpoint> locationToEndpointBuilder = ImmutableMap.<String, Endpoint> builder();
- for (Map.Entry<String, Collection<Endpoint>> entry : locationToEndpoints.asMap().entrySet()) {
- String locationId = entry.getKey();
- Collection<Endpoint> endpoints = entry.getValue();
- switch (endpoints.size()) {
- case 0:
- logNoEndpointsInLocation(locationId);
- break;
- default:
- locationToEndpointBuilder.put(locationId, Iterables.get(endpoints, 0));
- }
- }
- return locationToEndpointBuilder.build();
- }
-
- @VisibleForTesting
- Map<String, Endpoint> refineToVersionSpecificEndpoint(Multimap<String, Endpoint> locationToEndpoints) {
- Builder<String, Endpoint> locationToEndpointBuilder = ImmutableMap.<String, Endpoint> builder();
- for (Map.Entry<String, Collection<Endpoint>> entry : locationToEndpoints.asMap().entrySet()) {
- String locationId = entry.getKey();
- Collection<Endpoint> endpoints = entry.getValue();
- switch (endpoints.size()) {
- case 0:
- logNoEndpointsInLocation(locationId);
- break;
- default:
- putIfPresent(locationId, strictMatchEndpointVersion(endpoints, locationId), locationToEndpointBuilder);
- }
-
- }
- return locationToEndpointBuilder.build();
- }
-
- /**
- * Prioritizes endpoint.versionId over endpoint.id when matching
- */
- private Optional<Endpoint> strictMatchEndpointVersion(Iterable<Endpoint> endpoints, String locationId) {
- Optional<Endpoint> endpointOfVersion = tryFind(endpoints, apiVersionEqualsVersionId);
- if (!endpointOfVersion.isPresent())
- logger.debug("no endpoints of apiType %s matched expected version %s in location %s: %s", apiType, apiVersion,
- locationId, endpoints);
- return endpointOfVersion;
- }
-
- private void logNoEndpointsInLocation(String locationId) {
- logger.debug("no endpoints found for apiType %s in location %s", apiType, locationId);
- }
-
- private final Predicate<Endpoint> apiVersionEqualsVersionId = new Predicate<Endpoint>() {
-
- @Override
- public boolean apply(Endpoint input) {
- return input.getVersionId().equals(apiVersion);
- }
-
- };
-
- private final Predicate<Endpoint> versionAware = new Predicate<Endpoint>() {
-
- @Override
- public boolean apply(Endpoint input) {
- return input.getVersionId() != null;
- }
-
- };
-
- private final Predicate<Service> apiTypeEquals = new Predicate<Service>() {
-
- @Override
- public boolean apply(Service input) {
- return input.getType().equals(apiType);
- }
-
- };
-
- private static <K, V> void putIfPresent(K key, Optional<V> value, Builder<K, V> builder) {
- if (value.isPresent())
- builder.put(key, value.get());
- }
-
- @Override
- public String toString() {
- return "locationIdToURIFromAccessForTypeAndVersion(" + apiType + ", " + apiVersion + ")";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersion.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersion.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersion.java
deleted file mode 100644
index bd794d2..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURIFromAccessForTypeAndVersion.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.jclouds.javax.annotation.Nullable;
-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;
-
-public class RegionIdToAdminURIFromAccessForTypeAndVersion extends LocationIdToURIFromAccessForTypeAndVersion implements
- RegionIdToAdminURISupplier {
- @Inject
- public RegionIdToAdminURIFromAccessForTypeAndVersion(Supplier<Access> access,
- EndpointToSupplierAdminURI endpointToSupplierURI, EndpointToRegion endpointToRegion,
- @Assisted("apiType") String apiType, @Nullable @Assisted("apiVersion") String apiVersion) {
- super(access, endpointToSupplierURI, endpointToRegion, apiType, apiVersion);
- }
-
- @Override
- public String toString() {
- return "regionIdToAdminURIFromAccessForTypeAndVersion(" + apiType + ", " + apiVersion + ")";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java
deleted file mode 100644
index 759c2b9..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToAdminURISupplier.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 java.net.URI;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-import org.jclouds.javax.annotation.Nullable;
-
-import com.google.common.base.Supplier;
-import com.google.inject.ImplementedBy;
-import com.google.inject.assistedinject.Assisted;
-
-@ImplementedBy(RegionIdToAdminURIFromAccessForTypeAndVersion.class)
-public interface RegionIdToAdminURISupplier extends Supplier<Map<String, Supplier<URI>>> {
- interface Factory {
- /**
- *
- * @param apiType
- * type of the api, according to the provider. ex. {@code compute}
- * {@code object-store}
- * @param apiVersion
- * version of the api, or null
- * @return regions mapped to default uri
- * @throws NoSuchElementException if the {@code apiType} is not present in the catalog
- */
- RegionIdToAdminURISupplier createForApiTypeAndVersion(@Assisted("apiType") String apiType,
- @Nullable @Assisted("apiVersion") String apiVersion) throws NoSuchElementException;
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToURIFromAccessForTypeAndVersion.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToURIFromAccessForTypeAndVersion.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToURIFromAccessForTypeAndVersion.java
deleted file mode 100644
index aff2814..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/RegionIdToURIFromAccessForTypeAndVersion.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.suppliers.RegionIdToURISupplier;
-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.EndpointToSupplierURI;
-
-import com.google.common.base.Supplier;
-import com.google.inject.assistedinject.Assisted;
-
-public class RegionIdToURIFromAccessForTypeAndVersion extends LocationIdToURIFromAccessForTypeAndVersion implements
- RegionIdToURISupplier {
-
- @Inject
- public RegionIdToURIFromAccessForTypeAndVersion(Supplier<Access> access,
- EndpointToSupplierURI endpointToSupplierURI, EndpointToRegion endpointToRegion,
- @Assisted("apiType") String apiType, @Nullable @Assisted("apiVersion") String apiVersion) {
- super(access, endpointToSupplierURI, endpointToRegion, apiType, apiVersion);
- }
-
- @Override
- public String toString() {
- return "regionIdToURIFromAccessForTypeAndVersion(" + apiType + ", " + apiVersion + ")";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/ZoneIdToURIFromAccessForTypeAndVersion.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/ZoneIdToURIFromAccessForTypeAndVersion.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/ZoneIdToURIFromAccessForTypeAndVersion.java
deleted file mode 100644
index 41f936b..0000000
--- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/suppliers/ZoneIdToURIFromAccessForTypeAndVersion.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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 org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.suppliers.ZoneIdToURISupplier;
-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.EndpointToSupplierURI;
-
-import com.google.common.base.Supplier;
-import com.google.inject.assistedinject.Assisted;
-
-public class ZoneIdToURIFromAccessForTypeAndVersion extends LocationIdToURIFromAccessForTypeAndVersion implements
- ZoneIdToURISupplier {
-
- @Inject
- public ZoneIdToURIFromAccessForTypeAndVersion(
- Supplier<Access> access,
- // NOTE that in some services, the region is in fact the zone. temporarily, we need
- // to use the region field, in this case.
- EndpointToSupplierURI endpointToSupplierURI, EndpointToRegion endpointToZone,
- @Assisted("apiType") String apiType, @Nullable @Assisted("apiVersion") String apiVersion) {
- super(access, endpointToSupplierURI, endpointToZone, apiType, apiVersion);
- }
-
- @Override
- public String toString() {
- return "zoneIdToURIFromAccessForTypeAndVersion(" + apiType + ", " + apiVersion + ")";
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds/blob/7def8169/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
new file mode 100644
index 0000000..6c2bca5
--- /dev/null
+++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v3/KeystoneApi.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.v3;
+
+import java.io.Closeable;
+
+import org.jclouds.openstack.keystone.v3.features.TokenApi;
+import org.jclouds.rest.annotations.Delegate;
+
+/**
+ * Provides access to the OpenStack Identity (Keystone) REST API.
+ */
+public interface KeystoneApi extends Closeable {
+
+ /**
+ * Provides access to Token features
+ */
+ @Delegate
+ TokenApi getTokenApi();
+
+}