diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java deleted file mode 100644 index 295f9ff9f4..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/AuthenticationAsyncApi.java +++ /dev/null @@ -1,93 +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; - -import java.io.Closeable; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.MediaType; - -import org.jclouds.javax.annotation.Nullable; -import org.jclouds.openstack.keystone.v2_0.binders.BindAuthToJsonPayload; -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.domain.PasswordCredentials; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.SelectJson; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Service via their REST API. - *

- * - * @see AuthenticationApi - * @see - * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer - * supported. please use {@link AuthenticationApi} - */ -@Deprecated -public interface AuthenticationAsyncApi extends Closeable { - - /** - * @see AuthenticationApi#authenticateWithTenantNameAndCredentials(String,PasswordCredentials) - */ - @POST - @SelectJson("access") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens") - @MapBinder(BindAuthToJsonPayload.class) - ListenableFuture authenticateWithTenantNameAndCredentials(@Nullable @PayloadParam("tenantName") String tenantName, - PasswordCredentials passwordCredentials); - - /** - * @see AuthenticationApi#authenticateWithTenantIdAndCredentials(String,PasswordCredentials) - */ - @POST - @SelectJson("access") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens") - @MapBinder(BindAuthToJsonPayload.class) - ListenableFuture authenticateWithTenantIdAndCredentials(@Nullable @PayloadParam("tenantId") String tenantId, - PasswordCredentials passwordCredentials); - - /** - * @see AuthenticationApi#authenticateWithTenantNameAndCredentials(String,ApiAccessKeyCredentials) - */ - @POST - @SelectJson("access") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens") - @MapBinder(BindAuthToJsonPayload.class) - ListenableFuture authenticateWithTenantNameAndCredentials(@Nullable @PayloadParam("tenantName") String tenantName, - ApiAccessKeyCredentials apiAccessKeyCredentials); - - /** - * @see AuthenticationApi#authenticateWithTenantIdAndCredentials(String,ApiAccessKeyCredentials) - */ - @POST - @SelectJson("access") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens") - @MapBinder(BindAuthToJsonPayload.class) - ListenableFuture authenticateWithTenantIdAndCredentials(@Nullable @PayloadParam("tenantId") String tenantId, - ApiAccessKeyCredentials apiAccessKeyCredentials); -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java index ff21237b15..a46df20908 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneApiMetadata.java @@ -40,15 +40,6 @@ import com.google.inject.Module; */ public class KeystoneApiMetadata extends BaseHttpApiMetadata { - /** - * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as - * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7. - */ - @Deprecated - public static final TypeToken> CONTEXT_TOKEN = new TypeToken>() { - private static final long serialVersionUID = 1L; - }; - @Override public Builder toBuilder() { return new ConcreteBuilder().fromApiMetadata(this); diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java deleted file mode 100644 index 426cce6e7d..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/KeystoneAsyncApi.java +++ /dev/null @@ -1,117 +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; - -import java.io.Closeable; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata; -import org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.UserAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi; -import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi; -import org.jclouds.rest.annotations.Delegate; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.SelectJson; - -import com.google.common.base.Optional; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides access to OpenStack keystone resources via their REST API. - *

- * - * @see - * @see KeystoneApi - * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(KeystoneApi.class)} as - * {@link KeystoneAsyncApi} interface will be removed in jclouds 1.7. - */ -@Deprecated -public interface KeystoneAsyncApi extends Closeable { - - /** - * @see KeystoneApi#getApiMetadata() - */ - @GET - @SelectJson("version") - @Consumes(MediaType.APPLICATION_JSON) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getApiMetadata(); - - /** - * @see KeystoneApi#getServiceApi() - */ - @Delegate - ServiceAsyncApi getServiceApi(); - - /** - * Provides asynchronous access to Extension features. - */ - @Delegate - ExtensionAsyncApi getExtensionApi(); - - /** - * @see KeystoneApi#getTokenApi() - */ - @Delegate - Optional getTokenApi(); - - /** - * @see KeystoneApi#getUserApi() - */ - @Delegate - Optional getUserApi(); - - /** - * @see KeystoneApi#getTenantApi() - */ - @Delegate - Optional getTenantApi(); - - /** - * @see KeystoneApi#getUserAdminApi() - */ - @Delegate - Optional getUserAdminApi(); - - /** - * @see KeystoneApi#getTenantAdminApi() - */ - @Delegate - Optional getTenantAdminApi(); - - /** - * @see KeystoneApi#getRoleAdminApi() - */ - @Delegate - Optional getRoleAdminApi(); - - /** - * @see KeystoneApi#getServiceAdminApi() - */ - @Delegate - Optional getServiceAdminApi(); -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java index eaff908b16..90e54889c1 100644 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java +++ b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java @@ -77,7 +77,7 @@ public class KeystoneAuthenticationModule extends AbstractModule { *

  • add this module to your {@link org.jclouds.apis.ApiMetadata#getDefaultModules()}
  • *
  • create a service-specific annotation, such as {@code @CloudDNS}, and make sure that has the meta-annotation * {@link javax.inject.Qualifier}
  • - *
  • add the above annotation to any {@link AsyncApi} classes by placing it on the type. ex. + *
  • add the above annotation to any {@code Api} classes by placing it on the type. ex. * {@code @Endpoint(CloudDNS.class)}
  • *
  • add the following to your {@link org.jclouds.rest.config.RestClientModule}
  • * diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java deleted file mode 100644 index 4824edf996..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneRestClientModule.java +++ /dev/null @@ -1,167 +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; - -import static org.jclouds.reflect.Reflection2.typeToken; -import static org.jclouds.util.Suppliers2.getLastValueInMap; - -import java.net.URI; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import javax.inject.Singleton; - -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.KeystoneAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminApi; -import org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminApi; -import org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminApi; -import org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.extensions.UserAdminApi; -import org.jclouds.openstack.keystone.v2_0.extensions.UserAdminAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.ServiceApi; -import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.TenantApi; -import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.TokenApi; -import org.jclouds.openstack.keystone.v2_0.features.TokenAsyncApi; -import org.jclouds.openstack.keystone.v2_0.features.UserApi; -import org.jclouds.openstack.keystone.v2_0.features.UserAsyncApi; -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.features.ExtensionApi; -import org.jclouds.openstack.v2_0.features.ExtensionAsyncApi; -import org.jclouds.openstack.v2_0.functions.PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet; -import org.jclouds.openstack.v2_0.services.Identity; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.annotations.ApiVersion; -import org.jclouds.rest.config.RestClientModule; -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.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import com.google.common.reflect.TypeToken; -import com.google.inject.AbstractModule; -import com.google.inject.Provides; -import com.google.inject.assistedinject.FactoryModuleBuilder; - -/** - * Configures the Keystone connection. - */ -@ConfiguresRestClient -public class KeystoneRestClientModule extends - RestClientModule { - - public static final Map, Class> DELEGATE_MAP = ImmutableMap., Class> builder() - .put(ServiceApi.class, ServiceAsyncApi.class) - .put(ExtensionApi.class, ExtensionAsyncApi.class) - .put(TokenApi.class, TokenAsyncApi.class) - .put(UserApi.class, UserAsyncApi.class) - .put(TenantApi.class, TenantAsyncApi.class) - .put(UserAdminApi.class, UserAdminAsyncApi.class) - .put(TenantAdminApi.class, TenantAdminAsyncApi.class) - .put(RoleAdminApi.class, RoleAdminAsyncApi.class) - .put(ServiceAdminApi.class, ServiceAdminAsyncApi.class) - .build(); - - @SuppressWarnings("unchecked") - public KeystoneRestClientModule() { - super(TypeToken.class.cast(typeToken(KeystoneApi.class)), TypeToken.class.cast(typeToken(KeystoneAsyncApi.class)), DELEGATE_MAP); - } - - protected KeystoneRestClientModule(TypeToken syncApiType, TypeToken
    asyncApiType, Map, Class> sync2Async) { - super(syncApiType, asyncApiType, sync2Async); - } - - 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 Supplier provideStorageUrl(final RegionIdToAdminURISupplier.Factory factory, - @ApiVersion final String version, @Provider final Supplier providerURI) { - Supplier identityServiceForVersion = getLastValueInMap(factory.createForApiTypeAndVersion( - ServiceType.IDENTITY, version)); - Supplier whenIdentityServiceIsntListedFallbackToProviderURI = Suppliers2.onThrowable( - identityServiceForVersion, NoSuchElementException.class, providerURI); - Supplier whenIdentityServiceHasNoAdminURLFallbackToProviderURI = Suppliers2.or( - whenIdentityServiceIsntListedFallbackToProviderURI, providerURI); - return whenIdentityServiceHasNoAdminURLFallbackToProviderURI; - } - } - - @Override - protected void configure() { - bind(ImplicitOptionalConverter.class).to(PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensionsSet.class); - super.configure(); - } - - @Provides - @Singleton - public Multimap aliases() { - return ImmutableMultimap.builder() - .build(); - } - - @Provides - @Singleton - public LoadingCache> provideExtensionsByRegion(final javax.inject.Provider keystoneApi) { - return CacheBuilder.newBuilder().expireAfterWrite(23, TimeUnit.HOURS) - .build(CacheLoader.from(Suppliers.memoize(new Supplier>() { - @Override - public Set get() { - return keystoneApi.get().getExtensionApi().list(); - } - }))); - } - - @Override - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(KeystoneErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(KeystoneErrorHandler.class); - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(KeystoneErrorHandler.class); - } -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.java deleted file mode 100644 index 6c0dfba71d..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/config/MappedAuthenticationApiModule.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.config; - -import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; - -import org.jclouds.openstack.keystone.v2_0.AuthenticationApi; -import org.jclouds.openstack.keystone.v2_0.AuthenticationAsyncApi; - -import com.google.inject.AbstractModule; - -/** - * - * @deprecated will be removed in jclouds 1.7, as async interfaces are no longer - * supported. please use {@link AuthenticationApiModule} - */ -@Deprecated -public class MappedAuthenticationApiModule extends AbstractModule { - - @Override - protected void configure() { - // AuthenticationApi is used directly for filters and retry handlers, so let's bind it explicitly - bindSyncToAsyncHttpApi(binder(), AuthenticationApi.class, AuthenticationAsyncApi.class); - } - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java deleted file mode 100644 index fe4ef533fd..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/RoleAdminAsyncApi.java +++ /dev/null @@ -1,110 +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.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -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; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; -import com.google.common.collect.FluentIterable; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to roles Administration actions. - *

    - * - * @see org.jclouds.openstack.keystone.v2_0.extensions.RoleAdminApi - */ -@Beta -@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM) -@RequestFilters(AuthenticateRequest.class) -public interface RoleAdminAsyncApi { - - /** - * Returns a summary list of roles. - * - * @return The list of roles - */ - @Named("role:list") - @GET - @Path("OS-KSADM/roles") - @SelectJson("roles") - @Consumes(MediaType.APPLICATION_JSON) - @Fallback(EmptyFluentIterableOnNotFoundOr404.class) - ListenableFuture> list(); - - /** - * Creates a new role - * - * @return the new role - */ - @Named("role:create") - @POST - @Path("OS-KSADM/roles") - @SelectJson("role") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Fallback(NullOnNotFoundOr404.class) - @WrapWith("role") - ListenableFuture create(@PayloadParam("name") String name); - - /** - * Gets the role - * - * @return the role - */ - @Named("role:get") - @GET - @SelectJson("role") - @Consumes(MediaType.APPLICATION_JSON) - @Path("OS-KSADM/roles/{roleId}") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("roleId") String roleId); - - /** - * Deletes an role. - * - * @return true if successful - */ - @Named("role:delete") - @DELETE - @Path("OS-KSADM/roles/{id}") - @Consumes - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture delete(@PathParam("id") String id); - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java deleted file mode 100644 index 1dc0f3dcec..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/ServiceAdminAsyncApi.java +++ /dev/null @@ -1,126 +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.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -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; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; -import org.jclouds.openstack.v2_0.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; -import org.jclouds.rest.annotations.WrapWith; - -import com.google.common.annotations.Beta; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to services Administration actions. - *

    - * - * @see org.jclouds.openstack.keystone.v2_0.extensions.ServiceAdminApi - */ -@Beta -@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM) -@RequestFilters(AuthenticateRequest.class) -public interface ServiceAdminAsyncApi { - - /** - * @see ServiceApi#list() - */ - @Named("service:list") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("OS-KSADM/services") - @ResponseParser(ParseServices.class) - @Transform(ToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - ListenableFuture> list(); - - /** @see ServiceApi#list(PaginationOptions) */ - @Named("service:list") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("OS-KSADM/services") - @ResponseParser(ParseServices.class) - @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) - ListenableFuture> list(PaginationOptions options); - - /** - * Creates a new service - * - * @return the new service - */ - @Named("service:create") - @POST - @Path("OS-KSADM/services") - @SelectJson("OS-KSADM:service") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @WrapWith("OS-KSADM:service") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture create(@PayloadParam("name") String name, @PayloadParam("type") String type, - @PayloadParam("description") String description); - - /** - * Gets the service - * - * @return the service - */ - @Named("service:get") - @GET - @SelectJson("OS-KSADM:service") - @Consumes(MediaType.APPLICATION_JSON) - @Path("OS-KSADM/services/{serviceId}") - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("serviceId") String serviceId); - - /** - * Deletes a service. - * - * @return true if successful - */ - @Named("service:delete") - @DELETE - @Path("OS-KSADM/services/{id}") - @Consumes - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture delete(@PathParam("id") String id); - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java deleted file mode 100644 index 8a4ca7f571..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminAsyncApi.java +++ /dev/null @@ -1,137 +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.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -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; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SelectJson; - -import com.google.common.annotations.Beta; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to tenants Administration actions. - *

    - * - * @see org.jclouds.openstack.keystone.v2_0.extensions.TenantAdminApi - */ -@Beta -@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM) -@RequestFilters(AuthenticateRequest.class) -public interface TenantAdminAsyncApi { - - /** - * Creates a new tenant - * - * @return the new tenant - */ - @Named("tenant:create") - @POST - @Path("/tenants") - @SelectJson("tenant") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture create(@PayloadParam("name") String name); - - /** - * Creates a new tenant - * - * @return the new tenant - */ - @Named("tenant:create") - @POST - @Path("/tenants") - @SelectJson("tenant") - @Consumes(MediaType.APPLICATION_JSON) - @MapBinder(CreateTenantOptions.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture create(@PayloadParam("name") String name, CreateTenantOptions options); - - /** - * Deletes a tenant. - * - * @return true if successful - */ - @Named("tenant:delete") - @DELETE - @Path("/tenants/{id}") - @Consumes - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture delete(@PathParam("id") String id); - - /** - * Updates a tenant - * - * @return the updated tenant - */ - @Named("tenant:updatetenant") - @PUT - @Path("/tenants/{id}") - @SelectJson("tenant") - @Consumes(MediaType.APPLICATION_JSON) - @MapBinder(UpdateTenantOptions.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture update(@PathParam("id") String id, UpdateTenantOptions options); - - /** - * Adds role to a user on a tenant - * - * @return true if successful - */ - @Named("tenant:addroleontenant") - @PUT - @Path("/tenants/{id}/users/{userId}/roles/OS-KSADM/{roleId}") - @Consumes - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture addRoleOnTenant(@PathParam("id") String tenantId, @PathParam("userId") String userdId, - @PathParam("roleId") String roleId); - - /** - * Deletes role to a user on tenant - * - * @return - */ - @Named("tenant:deleteroleontenant") - @DELETE - @Path("/tenants/{id}/users/{userId}/roles/OS-KSADM/{roleId}") - @Consumes - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture deleteRoleOnTenant(@PathParam("id") String tenantId, @PathParam("userId") String userdId, - @PathParam("roleId") String roleId); - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java deleted file mode 100644 index b343c28996..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/UserAdminAsyncApi.java +++ /dev/null @@ -1,113 +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.extensions; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -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; -import org.jclouds.openstack.v2_0.services.Extension; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.SelectJson; - -import com.google.common.annotations.Beta; -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Users Administration actions. - *

    - * - * @see org.jclouds.openstack.keystone.v2_0.extensions.UserAdminApi - */ -@Beta -@Extension(of = ServiceType.IDENTITY, namespace = ExtensionNamespaces.OS_KSADM) -@RequestFilters(AuthenticateRequest.class) -public interface UserAdminAsyncApi { - - /** - * Creates a new user - * - * @return the new user - */ - @Named("user:create") - @POST - @Path("/users") - @SelectJson("user") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture create(@PayloadParam("name") String name, - @PayloadParam("password") String password); - - /** - * Creates a new user - * - * @return the new user - */ - @Named("user:create") - @POST - @Path("/users") - @SelectJson("user") - @Consumes(MediaType.APPLICATION_JSON) - @MapBinder(CreateUserOptions.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture create(@PayloadParam("name") String name, - @PayloadParam("password") String password, CreateUserOptions options); - - /** - * Deletes an user. - * - * @return true if successful - */ - @Named("user:delete") - @DELETE - @Path("/users/{id}") - @Consumes - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture delete(@PathParam("id") String id); - - /** - * Updates an user - * - * @return the updated user - */ - @Named("user:updateuser") - @PUT - @Path("/users/{id}") - @SelectJson("user") - @Consumes(MediaType.APPLICATION_JSON) - @MapBinder(UpdateUserOptions.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture update(@PathParam("id") String id, UpdateUserOptions options); - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java deleted file mode 100644 index 5b70c59080..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/ServiceAsyncApi.java +++ /dev/null @@ -1,58 +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.features; - -import java.util.Set; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -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; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Service via their REST API. - *

    - * - * @see ServiceApi - * @see - */ -public interface ServiceAsyncApi { - - /** - * @see ServiceApi#listTenants() - */ - @Named("service:listtenants") - @GET - @SelectJson("tenants") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tenants") - @RequestFilters(AuthenticateRequest.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listTenants(); -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java deleted file mode 100644 index 7ce0b75863..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TenantAsyncApi.java +++ /dev/null @@ -1,101 +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.features; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; -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.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Identity; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Tenant via their REST API. - *

    - * - * @see TenantApi - * @see - */ -@org.jclouds.rest.annotations.Endpoint(Identity.class) -public interface TenantAsyncApi { - - /** - * @see TenantApi#list() - */ - @Named("tenant:list") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tenants") - @RequestFilters(AuthenticateRequest.class) - @ResponseParser(ParseTenants.class) - @Transform(ToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - ListenableFuture> list(); - - /** @see TenantApi#list(PaginationOptions) */ - @Named("tenant:list") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tenants") - @RequestFilters(AuthenticateRequest.class) - @ResponseParser(ParseTenants.class) - @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) - ListenableFuture> list(PaginationOptions options); - - /** @see TenantApi#get(String) */ - @Named("tenant:get") - @GET - @SelectJson("tenant") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tenants/{tenantId}") - @RequestFilters(AuthenticateRequest.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("tenantId") String tenantId); - - /** @see TenantApi#getByName(String) */ - @Named("tenant:get") - @GET - @SelectJson("tenant") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tenants") - @RequestFilters(AuthenticateRequest.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getByName(@QueryParam("name") String tenantName); - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java deleted file mode 100644 index ed8d80764e..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/TokenAsyncApi.java +++ /dev/null @@ -1,94 +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.features; - -import java.util.Set; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.FalseOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -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; -import org.jclouds.rest.annotations.SelectJson; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Token via their REST API. - *

    - * - * @see TokenApi - * @see - */ -@org.jclouds.rest.annotations.Endpoint(Identity.class) -public interface TokenAsyncApi { - - - /** @see TokenApi#get(String) */ - @Named("token:get") - @GET - @SelectJson("token") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens/{token}") - @RequestFilters(AuthenticateRequest.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("token") String token); - - /** @see TokenApi#getUserOfToken(String) */ - @Named("token:getuser") - @GET - @SelectJson("user") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens/{token}") - @RequestFilters(AuthenticateRequest.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getUserOfToken(@PathParam("token") String token); - - /** @see TokenApi#isValid(String) */ - @Named("token:valid") - @HEAD - @Path("/tokens/{token}") - @RequestFilters(AuthenticateRequest.class) - @Fallback(FalseOnNotFoundOr404.class) - ListenableFuture isValid(@PathParam("token") String token); - - /** @see TokenApi#listEndpointsForToken(String) */ - @Named("token:listendpoints") - @GET - @SelectJson("endpoints") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tokens/{token}/endpoints") - @RequestFilters(AuthenticateRequest.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listEndpointsForToken(@PathParam("token") String token); - -} diff --git a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java b/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java deleted file mode 100644 index c17728dcfd..0000000000 --- a/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/features/UserAsyncApi.java +++ /dev/null @@ -1,125 +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.features; - -import java.util.Set; - -import javax.inject.Named; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; - -import org.jclouds.Fallbacks.EmptyPagedIterableOnNotFoundOr404; -import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404; -import org.jclouds.Fallbacks.NullOnNotFoundOr404; -import org.jclouds.collect.PagedIterable; -import org.jclouds.openstack.keystone.v2_0.KeystoneFallbacks.EmptyPaginatedCollectionOnNotFoundOr404; -import org.jclouds.openstack.v2_0.domain.PaginatedCollection; -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.options.PaginationOptions; -import org.jclouds.openstack.v2_0.services.Identity; -import org.jclouds.rest.annotations.Fallback; -import org.jclouds.rest.annotations.RequestFilters; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.SelectJson; -import org.jclouds.rest.annotations.Transform; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to User via their REST API. - *

    - * - * @see UserApi - * @see - */ -@org.jclouds.rest.annotations.Endpoint(Identity.class) -public interface UserAsyncApi { - - /** - * @see UserApi#list() - */ - @Named("user:list") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/users") - @RequestFilters(AuthenticateRequest.class) - @ResponseParser(ParseUsers.class) - @Transform(ToPagedIterable.class) - @Fallback(EmptyPagedIterableOnNotFoundOr404.class) - ListenableFuture> list(); - - /** @see UserApi#list(PaginationOptions) */ - @Named("user:list") - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Path("/users") - @RequestFilters(AuthenticateRequest.class) - @ResponseParser(ParseUsers.class) - @Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class) - ListenableFuture> list(PaginationOptions options); - - /** @see UserApi#get(String) */ - @Named("user:get") - @GET - @SelectJson("user") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/users/{userId}") - @RequestFilters(AuthenticateRequest.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture get(@PathParam("userId") String userId); - - /** @see UserApi#getByName(String) */ - @Named("user:get") - @GET - @SelectJson("user") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/users") - @RequestFilters(AuthenticateRequest.class) - @Fallback(NullOnNotFoundOr404.class) - ListenableFuture getByName(@QueryParam("name") String userName); - - /** @see UserApi#listRolesOfUser(String) */ - @Named("user:listroles") - @GET - @SelectJson("roles") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/users/{userId}/roles") - @RequestFilters(AuthenticateRequest.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listRolesOfUser(@PathParam("userId") String userId); - - /** @see UserApi#listRolesOfUserOnTenant(String, String) */ - @Named("user:listroles") - @GET - @SelectJson("roles") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/tenants/{tenantId}/users/{userId}/roles") - @RequestFilters(AuthenticateRequest.class) - @Fallback(EmptySetOnNotFoundOr404.class) - ListenableFuture> listRolesOfUserOnTenant(@PathParam("userId") String userId, - @PathParam("tenantId") String tenantId); -} diff --git a/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java index 9d675fad0c..9a98f7f166 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/config/OpenStackAuthenticationModule.java @@ -17,7 +17,7 @@ package org.jclouds.openstack.config; import static com.google.common.base.Suppliers.memoizeWithExpiration; -import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; +import static org.jclouds.rest.config.BinderUtils.bindHttpApi; import java.util.Date; import java.util.concurrent.ExecutionException; @@ -36,7 +36,6 @@ import org.jclouds.openstack.domain.AuthenticationResponse; import org.jclouds.openstack.functions.URIFromAuthenticationResponseForService; import org.jclouds.openstack.handlers.RetryOnRenew; import org.jclouds.openstack.internal.Authentication; -import org.jclouds.openstack.internal.OpenStackAuthAsyncClient; import org.jclouds.openstack.internal.OpenStackAuthClient; import com.google.common.base.Supplier; @@ -55,7 +54,7 @@ public class OpenStackAuthenticationModule extends AbstractModule { @Override protected void configure() { // OpenStackAuthClient is used directly for filters and retry handlers, so let's bind it explicitly - bindSyncToAsyncHttpApi(binder(), OpenStackAuthClient.class, OpenStackAuthAsyncClient.class); + bindHttpApi(binder(), OpenStackAuthClient.class); install(new FactoryModuleBuilder().build(URIFromAuthenticationResponseForService.Factory.class)); bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class); } diff --git a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java deleted file mode 100644 index 622b636ace..0000000000 --- a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClient.java +++ /dev/null @@ -1,57 +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.internal; - -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; - -import org.jclouds.Constants; -import org.jclouds.openstack.domain.AuthenticationResponse; -import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders; -import org.jclouds.openstack.reference.AuthHeaders; -import org.jclouds.rest.annotations.ResponseParser; -import org.jclouds.rest.annotations.VirtualHost; - -import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.name.Named; - -/** - * Provides access to Rackspace resources via their REST API. - *

    - * - * @see - */ -@Path("/v{" + Constants.PROPERTY_API_VERSION + "}") -@VirtualHost -public interface OpenStackAuthAsyncClient { - - @Named("authenticate") - @GET - @Consumes - @ResponseParser(ParseAuthenticationResponseFromHeaders.class) - ListenableFuture authenticate(@HeaderParam(AuthHeaders.AUTH_USER) String user, - @HeaderParam(AuthHeaders.AUTH_KEY) String key); - - @Named("authenticate") - @GET - @Consumes - @ResponseParser(ParseAuthenticationResponseFromHeaders.class) - ListenableFuture authenticateStorage(@HeaderParam(AuthHeaders.STORAGE_USER) String user, - @HeaderParam(AuthHeaders.STORAGE_PASS) String key); -} diff --git a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java b/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java index 9802c38acb..34355ce1f7 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/internal/OpenStackAuthClient.java @@ -15,6 +15,8 @@ * limitations under the License. */ package org.jclouds.openstack.internal; +import java.io.Closeable; + import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; @@ -25,6 +27,7 @@ import org.jclouds.openstack.domain.AuthenticationResponse; import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders; import org.jclouds.openstack.reference.AuthHeaders; import org.jclouds.rest.annotations.ResponseParser; +import org.jclouds.rest.annotations.VirtualHost; import com.google.inject.name.Named; @@ -32,7 +35,8 @@ import com.google.inject.name.Named; * Provides access to OpenStack auth. */ @Path("/v{" + Constants.PROPERTY_API_VERSION + "}") -public interface OpenStackAuthClient { +@VirtualHost +public interface OpenStackAuthClient extends Closeable { @Named("authenticate") @GET diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java deleted file mode 100644 index b801e3b844..0000000000 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationAsyncClient.java +++ /dev/null @@ -1,54 +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.v1_1; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.core.MediaType; - -import org.jclouds.openstack.keystone.v1_1.binders.BindCredentialsToJsonPayload; -import org.jclouds.openstack.keystone.v1_1.domain.Auth; -import org.jclouds.rest.annotations.MapBinder; -import org.jclouds.rest.annotations.PayloadParam; -import org.jclouds.rest.annotations.SelectJson; - -import com.google.common.util.concurrent.ListenableFuture; - -/** - * Provides asynchronous access to Service via their REST API. - *

    - * - * @see AuthenticationClient - * @see - */ -@Path("/v1.1") -public interface AuthenticationAsyncClient { - - /** - * @see AuthenticationClient#authenticate - */ - @POST - @SelectJson("auth") - @Consumes(MediaType.APPLICATION_JSON) - @Path("/auth") - @MapBinder(BindCredentialsToJsonPayload.class) - ListenableFuture authenticate(@PayloadParam("username") String username, @PayloadParam("key") String key); - -} diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java index b05a26e091..6e470afdf0 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v1_1/AuthenticationClient.java @@ -16,6 +16,8 @@ */ package org.jclouds.openstack.keystone.v1_1; +import java.io.Closeable; + import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -24,26 +26,25 @@ import javax.ws.rs.core.MediaType; import org.jclouds.openstack.keystone.v1_1.binders.BindCredentialsToJsonPayload; import org.jclouds.openstack.keystone.v1_1.domain.Auth; import org.jclouds.rest.annotations.MapBinder; +import org.jclouds.rest.annotations.PayloadParam; import org.jclouds.rest.annotations.SelectJson; -import com.google.inject.name.Named; - /** * Provides access to the Keystone v1.1 Service API. */ @Consumes(MediaType.APPLICATION_JSON) @Path("/v1.1") -public interface AuthenticationClient { +public interface AuthenticationClient extends Closeable { /** * Authenticate to generate a token. * * @return access with token */ - @Named("authenticate") @POST @SelectJson("auth") + @Consumes(MediaType.APPLICATION_JSON) @Path("/auth") @MapBinder(BindCredentialsToJsonPayload.class) - Auth authenticate(String username, String key); + Auth authenticate(@PayloadParam("username") String username, @PayloadParam("key") String key); } 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 7d9c048fd4..f8d32e1cbb 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 @@ -16,7 +16,7 @@ */ package org.jclouds.openstack.keystone.v1_1.config; -import static org.jclouds.rest.config.BinderUtils.bindSyncToAsyncHttpApi; +import static org.jclouds.rest.config.BinderUtils.bindHttpApi; import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; import java.util.concurrent.ExecutionException; @@ -33,7 +33,6 @@ import org.jclouds.location.Provider; import org.jclouds.location.suppliers.ImplicitRegionIdSupplier; import org.jclouds.location.suppliers.RegionIdToURISupplier; import org.jclouds.openstack.internal.Authentication; -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; @@ -54,7 +53,7 @@ public class AuthenticationServiceModule extends AbstractModule { @Override protected void configure() { // ServiceClient is used directly for filters and retry handlers, so let's bind it explicitly - bindSyncToAsyncHttpApi(binder(), AuthenticationClient.class, AuthenticationAsyncClient.class); + bindHttpApi(binder(), AuthenticationClient.class); install(new FactoryModuleBuilder().implement(RegionIdToURISupplier.class, RegionIdToURIFromAuthForServiceSupplier.class).build(RegionIdToURISupplier.Factory.class)); install(new FactoryModuleBuilder().implement(ImplicitRegionIdSupplier.class, V1DefaultRegionIdSupplier.class) diff --git a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java similarity index 85% rename from common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java rename to common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java index 1b7e884888..9e14ba7235 100644 --- a/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthAsyncClientTest.java +++ b/common/openstack/src/test/java/org/jclouds/openstack/internal/OpenStackAuthClientTest.java @@ -33,15 +33,12 @@ import org.testng.annotations.Test; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; -/** - * Tests behavior of {@code OpenStackAuthAsyncClient} - */ -// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire -@Test(groups = "unit", testName = "OpenStackAuthAsyncClientTest") -public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest { + +@Test(groups = "unit", testName = "OpenStackAuthClientTest") +public class OpenStackAuthClientTest extends BaseAsyncClientTest { public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(OpenStackAuthAsyncClient.class, "authenticate", String.class, String.class); + Invokable method = method(OpenStackAuthClient.class, "authenticate", String.class, String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("foo", "bar")); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1"); @@ -55,7 +52,7 @@ public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest method = method(OpenStackAuthAsyncClient.class, "authenticateStorage", String.class, String.class); + Invokable method = method(OpenStackAuthClient.class, "authenticateStorage", String.class, String.class); GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList. of("foo", "bar")); assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");