diff --git a/apis/openstack-keystone/pom.xml b/apis/openstack-keystone/pom.xml index 243167b505..2399ae689f 100644 --- a/apis/openstack-keystone/pom.xml +++ b/apis/openstack-keystone/pom.xml @@ -35,7 +35,7 @@ - http://localhost:5000 + http://localhost:5000/v${jclouds.api-version}/ 2.0 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 index 44531eb70d..02dd7c590e 100644 --- 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 @@ -43,7 +43,6 @@ import com.google.common.util.concurrent.ListenableFuture; * /> * @author Adrian Cole */ -@Path("/v2.0") public interface AuthenticationAsyncApi { /** @@ -76,8 +75,6 @@ public interface AuthenticationAsyncApi { @Consumes(MediaType.APPLICATION_JSON) @Path("/tokens") @MapBinder(BindAuthToJsonPayload.class) - // TODO: is tenantName permanent? or should we switch to tenantId at some point. seems most tools - // still use tenantName ListenableFuture authenticateWithTenantNameAndCredentials(@Nullable @PayloadParam("tenantName") String tenantName, 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 fe0f189556..68b2c7a90a 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 @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneParserModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule; import org.jclouds.openstack.v2_0.ServiceType; @@ -69,10 +68,8 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata { public static Properties defaultProperties() { Properties properties = BaseRestApiMetadata.defaultProperties(); - // TODO: this doesn't actually do anything yet. - properties.setProperty(KeystoneProperties.VERSION, "2.0"); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); - properties.put(SERVICE_TYPE, ServiceType.IDENTITY); + properties.setProperty(SERVICE_TYPE, ServiceType.IDENTITY); return properties; } @@ -82,11 +79,12 @@ public class KeystoneApiMetadata extends BaseRestApiMetadata { super(api, asyncApi); id("openstack-keystone") .name("OpenStack Keystone Essex+ API") - .identityName("tenantId:user") - .credentialName("password") + .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") + .credentialName("${password}") + .endpointName("KeyStone base url ending in /v${jclouds.api-version}/") .documentation(URI.create("http://api.openstack.org/")) .version("2.0") - .defaultEndpoint("http://localhost:5000") + .defaultEndpoint("http://localhost:5000/v${jclouds.api-version}/") .defaultProperties(KeystoneApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.>builder() .add(KeystoneAuthenticationModule.class) 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 index 08be81c521..50560fc9ae 100644 --- 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 @@ -20,10 +20,8 @@ package org.jclouds.openstack.keystone.v2_0; import javax.ws.rs.Consumes; import javax.ws.rs.GET; -import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; -import org.jclouds.Constants; import org.jclouds.openstack.keystone.v2_0.domain.ApiMetadata; import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi; import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi; @@ -53,7 +51,6 @@ public interface KeystoneAsyncApi { @GET @SelectJson("version") @Consumes(MediaType.APPLICATION_JSON) - @Path("/v{" + Constants.PROPERTY_API_VERSION + "}/") @ExceptionParser(ReturnNullOnNotFoundOr404.class) ListenableFuture getApiMetadata(); 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 index f8fe080932..fc5146f8f5 100644 --- 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 @@ -60,11 +60,6 @@ public interface KeystoneProperties { */ public static final String REQUIRES_TENANT = "jclouds.keystone.requires-tenant"; - /** - * version of the keystone service - */ - public static final String VERSION = "jclouds.keystone.version"; - /** * type of the keystone service. ex. {@code compute} * 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 index 245a4efdc3..f3615eb573 100644 --- 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 @@ -22,24 +22,25 @@ import static org.jclouds.util.Suppliers2.getLastValueInMap; import java.net.URI; import java.util.Map; +import java.util.NoSuchElementException; -import javax.inject.Named; 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.openstack.keystone.v2_0.KeystoneAsyncApi; +import org.jclouds.location.Provider; import org.jclouds.openstack.keystone.v2_0.KeystoneApi; -import org.jclouds.openstack.keystone.v2_0.features.ServiceAsyncApi; +import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi; import org.jclouds.openstack.keystone.v2_0.features.ServiceApi; -import org.jclouds.openstack.keystone.v2_0.features.TenantAsyncApi; +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.TokenAsyncApi; +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.UserAsyncApi; +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.functions.PresentWhenAdminURLExistsForIdentityService; import org.jclouds.openstack.keystone.v2_0.handlers.KeystoneErrorHandler; import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURIFromAccessForTypeAndVersion; @@ -47,8 +48,10 @@ import org.jclouds.openstack.keystone.v2_0.suppliers.RegionIdToAdminURISupplier; import org.jclouds.openstack.v2_0.ServiceType; 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.collect.ImmutableMap; @@ -90,13 +93,22 @@ public class KeystoneRestClientModule provideStorageUrl(RegionIdToAdminURISupplier.Factory factory, - @Named(KeystoneProperties.VERSION) String version) { - return getLastValueInMap(factory.createForApiTypeAndVersion(ServiceType.IDENTITY, version)); + 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; } } 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 index f1db058d6d..b32482ff45 100644 --- 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 @@ -25,7 +25,6 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; -import org.jclouds.Constants; import org.jclouds.openstack.keystone.v2_0.domain.Tenant; import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest; import org.jclouds.rest.annotations.ExceptionParser; @@ -46,7 +45,6 @@ import com.google.common.util.concurrent.ListenableFuture; * /> * @author Adam Lowe */ -@Path("/v{" + Constants.PROPERTY_API_VERSION + "}") @SkipEncoding( { '/', '=' }) public interface ServiceAsyncApi { 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 index d39e101da2..2a9f61b27e 100644 --- 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 @@ -2,6 +2,7 @@ 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; @@ -16,15 +17,16 @@ import com.google.inject.assistedinject.Assisted; public interface RegionIdToAdminURISupplier extends Supplier>> { static interface Factory { /** - * + * * @param apiType - * type of the api, according to the provider. ex. {@code compute} {@code - * object-store} + * 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); + @Nullable @Assisted("apiVersion") String apiVersion) throws NoSuchElementException; } } diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java index 7ed1d4b4db..d4eb9cb166 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/features/TokenApiLiveTest.java @@ -51,7 +51,7 @@ public class TokenApiLiveTest extends BaseKeystoneApiLiveTest { @BeforeMethod public void grabToken() { AuthenticateRequest ar = keystoneContext.getUtils().getInjector().getInstance(AuthenticateRequest.class); - HttpRequest test = ar.filter(HttpRequest.builder().method("GET").endpoint(endpoint).build()); + HttpRequest test = ar.filter(HttpRequest.builder().method("GET").endpoint(context.getProviderMetadata().getEndpoint()).build()); token = Iterables.getOnlyElement(test.getHeaders().get("X-Auth-Token")); } diff --git a/apis/openstack-nova/pom.xml b/apis/openstack-nova/pom.xml index 44935e33af..07c0332e10 100644 --- a/apis/openstack-nova/pom.xml +++ b/apis/openstack-nova/pom.xml @@ -35,7 +35,7 @@ - http://localhost:5000 + http://localhost:5000/v2.0/ 1.1 diff --git a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java index 917826ed96..780eb81706 100644 --- a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java +++ b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApiMetadata.java @@ -20,7 +20,6 @@ package org.jclouds.openstack.nova.v2_0; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.VERSION; import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS; import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS; import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.TIMEOUT_SECURITYGROUP_PRESENT; @@ -79,9 +78,6 @@ public class NovaApiMetadata extends BaseRestApiMetadata { properties.setProperty(SERVICE_TYPE, ServiceType.COMPUTE); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); - // TODO: this doesn't actually do anything yet. - properties.setProperty(VERSION, "2.0"); - properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "false"); properties.setProperty(AUTO_GENERATE_KEYPAIRS, "false"); properties.setProperty(TIMEOUT_SECURITYGROUP_PRESENT, "500"); @@ -94,11 +90,12 @@ public class NovaApiMetadata extends BaseRestApiMetadata { super(NovaApi.class, NovaAsyncApi.class); id("openstack-nova") .name("OpenStack Nova Diablo+ API") - .identityName("tenantName:user or user") - .credentialName("password") + .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") + .credentialName("${password}") + .endpointName("KeyStone base url ending in /v2.0/") .documentation(URI.create("http://api.openstack.org/")) .version("1.1") - .defaultEndpoint("http://localhost:5000") + .defaultEndpoint("http://localhost:5000/v2.0/") .defaultProperties(NovaApiMetadata.defaultProperties()) .view(TypeToken.of(ComputeServiceContext.class)) .defaultModules(ImmutableSet.>builder() diff --git a/apis/rackspace-cloudidentity/pom.xml b/apis/rackspace-cloudidentity/pom.xml index f0ac011331..a0b478d390 100644 --- a/apis/rackspace-cloudidentity/pom.xml +++ b/apis/rackspace-cloudidentity/pom.xml @@ -35,11 +35,11 @@ - https://identity.api.rackspacecloud.com + https://identity.api.rackspacecloud.com/v${jclouds.api-version}/ 2.0 - 413274:${test.rackspace-us.identity} + ${test.rackspace-us.identity} ${test.rackspace-us.credential} RAX-KSKEY:apiKeyCredentials diff --git a/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java b/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java index 1883e601a3..3f8b457ea0 100644 --- a/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java +++ b/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityApiMetadata.java @@ -25,9 +25,9 @@ import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; +import org.jclouds.openstack.keystone.v2_0.KeystoneApi; import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata; import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi; -import org.jclouds.openstack.keystone.v2_0.KeystoneApi; import org.jclouds.openstack.keystone.v2_0.config.KeystoneParserModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneRestClientModule.KeystoneAdminURLModule; @@ -73,7 +73,6 @@ public class CloudIdentityApiMetadata extends KeystoneApiMetadata { public static Properties defaultProperties() { Properties properties = KeystoneApiMetadata.defaultProperties(); properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS); - return properties; } @@ -82,9 +81,10 @@ public class CloudIdentityApiMetadata extends KeystoneApiMetadata { super(KeystoneApi.class, KeystoneAsyncApi.class); id("rackspace-cloudidentity") .name("Rackspace Cloud Identity Service") - .defaultEndpoint("https://identity.api.rackspacecloud.com") - .identityName("username") - .credentialName("API Key") + .identityName("${userName}") + .credentialName("${apiKey}") + .defaultEndpoint("https://identity.api.rackspacecloud.com/v${jclouds.api-version}/") + .endpointName("identity service url ending in /v${jclouds.api-version}/") .defaultProperties(CloudIdentityApiMetadata.defaultProperties()) .context(CONTEXT_TOKEN) .documentation(URI.create("http://docs.rackspace.com/auth/api/v2.0/auth-api-devguide/")) diff --git a/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncApi.java b/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncApi.java index 3f3f9f24b9..9d787955f9 100644 --- a/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncApi.java +++ b/apis/rackspace-cloudidentity/src/main/java/org/jclouds/rackspace/cloudidentity/v2_0/CloudIdentityAuthenticationAsyncApi.java @@ -43,7 +43,6 @@ import com.google.common.util.concurrent.ListenableFuture; * /> * @author Adrian Cole */ -@Path("/v2.0") public interface CloudIdentityAuthenticationAsyncApi extends AuthenticationAsyncApi { /** diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java index 9648e2c901..ba6f4c6ffc 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/SwiftKeystoneApiMetadata.java @@ -27,7 +27,6 @@ import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.openstack.services.ServiceType; import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule; import org.jclouds.openstack.swift.config.SwiftKeystoneRestClientModule; @@ -72,22 +71,24 @@ public class SwiftKeystoneApiMetadata extends SwiftApiMetadata { public static Properties defaultProperties() { Properties properties = SwiftApiMetadata.defaultProperties(); properties.setProperty(SERVICE_TYPE, ServiceType.OBJECT_STORE); - // TODO: this doesn't actually do anything yet. - properties.setProperty(KeystoneProperties.VERSION, "2.0"); - properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); + properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); properties.remove(PROPERTY_REGIONS); return properties; } public static class Builder extends SwiftApiMetadata.Builder { protected Builder() { - super(SwiftKeystoneClient.class, SwiftKeystoneAsyncClient.class); + this(SwiftKeystoneClient.class, SwiftKeystoneAsyncClient.class); + } + + protected Builder(Class syncClient, Class asyncClient) { + super(syncClient, asyncClient); id("swift-keystone") .name("OpenStack Swift with Keystone authentication") - .identityName("tenantName:user or user") - .credentialName("password") - .defaultEndpoint("http://localhost:5000") - .endpointName("keystone url") + .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") + .credentialName("${password}") + .endpointName("KeyStone base url ending in /v2.0/") + .defaultEndpoint("http://localhost:5000/v2.0/") .context(CONTEXT_TOKEN) .defaultProperties(SwiftKeystoneApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.>of(KeystoneStorageEndpointModule.class, KeystoneAuthenticationModule.RegionModule.class, diff --git a/labs/openstack-glance/pom.xml b/labs/openstack-glance/pom.xml index aa172d80bb..a12df99345 100644 --- a/labs/openstack-glance/pom.xml +++ b/labs/openstack-glance/pom.xml @@ -35,7 +35,7 @@ - http://localhost:5000 + http://localhost:5000/v2.0/ 1.0 diff --git a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/GlanceApiMetadata.java b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/GlanceApiMetadata.java index 6ee563bac6..6669d59c8f 100644 --- a/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/GlanceApiMetadata.java +++ b/labs/openstack-glance/src/main/java/org/jclouds/openstack/glance/v1_0/GlanceApiMetadata.java @@ -29,7 +29,6 @@ import org.jclouds.openstack.glance.v1_0.config.GlanceRestClientModule; import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.openstack.v2_0.ServiceType; import org.jclouds.rest.RestContext; import org.jclouds.rest.internal.BaseRestApiMetadata; @@ -69,9 +68,6 @@ public class GlanceApiMetadata extends BaseRestApiMetadata { Properties properties = BaseRestApiMetadata.defaultProperties(); properties.setProperty(SERVICE_TYPE, ServiceType.IMAGE); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); - - // TODO: this doesn't actually do anything yet. - properties.setProperty(KeystoneProperties.VERSION, "2.0"); return properties; } @@ -81,11 +77,12 @@ public class GlanceApiMetadata extends BaseRestApiMetadata { super(GlanceApi.class, GlanceAsyncApi.class); id("openstack-glance") .name("OpenStack Glance API") - .identityName("tenantName:user or user") - .credentialName("password") + .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") + .credentialName("${password}") + .endpointName("KeyStone base url ending in /v2.0/") .documentation(URI.create("http://glance.openstack.org/glanceapi.html")) .version("1.0") - .defaultEndpoint("http://localhost:5000") + .defaultEndpoint("http://localhost:5000/v2.0/") .defaultProperties(GlanceApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.>builder() .add(KeystoneAuthenticationModule.class) diff --git a/labs/openstack-quantum/pom.xml b/labs/openstack-quantum/pom.xml index 951c56517e..ccaa60084d 100644 --- a/labs/openstack-quantum/pom.xml +++ b/labs/openstack-quantum/pom.xml @@ -35,7 +35,7 @@ - http://localhost:5000 + http://localhost:5000/v2.0/ 1.0 diff --git a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java index 33b245215e..9d38d93e9c 100644 --- a/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java +++ b/labs/openstack-quantum/src/main/java/org/jclouds/openstack/quantum/v1_0/QuantumApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.openstack.quantum.v1_0.config.QuantumRestClientModule; import org.jclouds.openstack.v2_0.ServiceType; import org.jclouds.rest.RestContext; @@ -68,9 +67,6 @@ public class QuantumApiMetadata extends BaseRestApiMetadata { Properties properties = BaseRestApiMetadata.defaultProperties(); properties.setProperty(SERVICE_TYPE, ServiceType.NETWORK); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); - - // TODO: this doesn't actually do anything yet. - properties.setProperty(KeystoneProperties.VERSION, "2.0"); return properties; } @@ -80,11 +76,12 @@ public class QuantumApiMetadata extends BaseRestApiMetadata { super(QuantumApi.class, QuantumAsyncApi.class); id("openstack-quantum") .name("OpenStack Quantum API") - .identityName("tenantName:user or user") - .credentialName("password") + .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") + .credentialName("${password}") + .endpointName("KeyStone base url ending in /v2.0/") .documentation(URI.create("http://docs.openstack.org/api/openstack-network/1.0/content/")) .version("1.0") - .defaultEndpoint("http://localhost:5000") + .defaultEndpoint("http://localhost:5000/v2.0/") .defaultProperties(QuantumApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.>builder() .add(KeystoneAuthenticationModule.class) diff --git a/labs/openstack-swift/pom.xml b/labs/openstack-swift/pom.xml index 665e77ee60..4bab5dfd87 100644 --- a/labs/openstack-swift/pom.xml +++ b/labs/openstack-swift/pom.xml @@ -35,7 +35,7 @@ - http://localhost:5000 + http://localhost:5000/v2.0/ 1.0 FIXME_IDENTITY diff --git a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/SwiftApiMetadata.java b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/SwiftApiMetadata.java index 0f4b52a05f..440937b09e 100644 --- a/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/SwiftApiMetadata.java +++ b/labs/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/SwiftApiMetadata.java @@ -28,7 +28,6 @@ import org.jclouds.apis.ApiMetadata; import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.openstack.swift.v1.config.SwiftRestClientModule; import org.jclouds.openstack.v2_0.ServiceType; import org.jclouds.rest.RestContext; @@ -69,9 +68,6 @@ public class SwiftApiMetadata extends BaseRestApiMetadata { Properties properties = BaseRestApiMetadata.defaultProperties(); properties.setProperty(SERVICE_TYPE, ServiceType.OBJECT_STORE); properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.PASSWORD_CREDENTIALS); - - // TODO: this doesn't actually do anything yet. - properties.setProperty(KeystoneProperties.VERSION, "2.0"); return properties; } @@ -81,11 +77,12 @@ public class SwiftApiMetadata extends BaseRestApiMetadata { super(SwiftApi.class, SwiftAsyncApi.class); id("openstack-swift") .name("OpenStack Swift Diablo+ API") - .identityName("tenantId:user") - .credentialName("password") + .identityName("${tenantName}:${userName} or ${userName}, if your keystone supports a default tenant") + .credentialName("${password}") .documentation(URI.create("http://docs.openstack.org/api/openstack-object-storage/1.0/content/ch_object-storage-dev-overview.html")) .version("1.0") - .defaultEndpoint("http://localhost:5000") + .endpointName("KeyStone base url ending in /v2.0/") + .defaultEndpoint("http://localhost:5000/v2.0/") .defaultProperties(SwiftApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.>builder() .add(KeystoneAuthenticationModule.class) diff --git a/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java b/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java index 0c95eebdb1..ae083d6b94 100644 --- a/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java +++ b/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java @@ -22,13 +22,12 @@ import java.util.Properties; import org.jclouds.apis.BaseContextLiveTest; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; +import org.jclouds.openstack.swift.v1.SwiftApi; import org.jclouds.openstack.swift.v1.SwiftApiMetadata; import org.jclouds.openstack.swift.v1.SwiftAsyncApi; -import org.jclouds.openstack.swift.v1.SwiftApi; import org.jclouds.rest.RestContext; import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; -import org.testng.annotations.Test; import com.google.common.reflect.TypeToken; @@ -37,7 +36,6 @@ import com.google.common.reflect.TypeToken; * * @author Adrian Cole */ -@Test(groups = "live") public class BaseSwiftApiLiveTest extends BaseContextLiveTest> { public BaseSwiftApiLiveTest() { diff --git a/providers/hpcloud-compute/pom.xml b/providers/hpcloud-compute/pom.xml index aaa4bfd114..6f1ee52bee 100644 --- a/providers/hpcloud-compute/pom.xml +++ b/providers/hpcloud-compute/pom.xml @@ -34,7 +34,7 @@ bundle - https://region-a.geo-1.identity.hpcloudsvc.com:35357 + https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/ 1.1 FIXME_IDENTITY diff --git a/providers/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java b/providers/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java index 3132d561f2..796269d83f 100644 --- a/providers/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java +++ b/providers/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java @@ -20,8 +20,6 @@ package org.jclouds.hpcloud.compute; import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE; import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED; -import static org.jclouds.openstack.keystone.v2_0.config.CredentialTypes.API_ACCESS_KEY_CREDENTIALS; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.REQUIRES_TENANT; import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS; import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS; @@ -68,11 +66,10 @@ public class HPCloudComputeProviderMetadata extends BaseProviderMetadata { } public static Properties defaultProperties() { - Properties properties = new Properties(); + Properties properties = NovaApiMetadata.defaultProperties(); // deallocating ip addresses can take a while properties.setProperty(TIMEOUT_NODE_TERMINATED, 60 * 1000 + ""); - properties.setProperty(CREDENTIAL_TYPE, API_ACCESS_KEY_CREDENTIALS); properties.setProperty(REQUIRES_TENANT, "true"); properties.setProperty(AUTO_ALLOCATE_FLOATING_IPS, "true"); properties.setProperty(AUTO_GENERATE_KEYPAIRS, "true"); @@ -86,8 +83,8 @@ public class HPCloudComputeProviderMetadata extends BaseProviderMetadata { id("hpcloud-compute") .name("HP Cloud Compute Services") .apiMetadata(new NovaApiMetadata().toBuilder() - .identityName("yourTenantName:yourAccessKey") - .credentialName("secretKey") + .endpointName("identity service url ending in /v2.0/") + .defaultEndpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/") .defaultModules(ImmutableSet.>builder() .add(KeystoneAuthenticationModule.class) .add(ZoneModule.class) @@ -98,7 +95,7 @@ public class HPCloudComputeProviderMetadata extends BaseProviderMetadata { .console(URI.create("https://manage.hpcloud.com/compute")) .linkedServices("hpcloud-compute", "hpcloud-objectstorage") .iso3166Codes("US-NV") - .endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357") + .endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/") .defaultProperties(HPCloudComputeProviderMetadata.defaultProperties()); } diff --git a/providers/hpcloud-objectstorage/pom.xml b/providers/hpcloud-objectstorage/pom.xml index 4b6534de2f..67e11e156e 100644 --- a/providers/hpcloud-objectstorage/pom.xml +++ b/providers/hpcloud-objectstorage/pom.xml @@ -34,7 +34,7 @@ bundle - https://region-a.geo-1.identity.hpcloudsvc.com:35357 + https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/ 1.0 FIXME_IDENTITY diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java index 465b7803b6..522bd4c164 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageApiMetadata.java @@ -18,21 +18,14 @@ */ package org.jclouds.hpcloud.objectstorage; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE; - import java.net.URI; import java.util.Properties; import org.jclouds.apis.ApiMetadata; import org.jclouds.hpcloud.objectstorage.blobstore.config.HPCloudObjectStorageBlobStoreContextModule; import org.jclouds.hpcloud.objectstorage.config.HPCloudObjectStorageRestClientModule; -import org.jclouds.openstack.keystone.v2_0.config.CredentialTypes; import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule; -import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; -import org.jclouds.openstack.services.ServiceType; -import org.jclouds.openstack.swift.SwiftApiMetadata; +import org.jclouds.openstack.swift.SwiftKeystoneApiMetadata; import org.jclouds.openstack.swift.config.SwiftRestClientModule.KeystoneStorageEndpointModule; import org.jclouds.rest.RestContext; @@ -44,7 +37,7 @@ import com.google.inject.Module; * * @author Jeremy Daggett */ -public class HPCloudObjectStorageApiMetadata extends SwiftApiMetadata { +public class HPCloudObjectStorageApiMetadata extends SwiftKeystoneApiMetadata { /** The serialVersionUID */ private static final long serialVersionUID = 820062881469203616L; @@ -71,22 +64,17 @@ public class HPCloudObjectStorageApiMetadata extends SwiftApiMetadata { } public static Properties defaultProperties() { - Properties properties = SwiftApiMetadata.defaultProperties(); - properties.setProperty(SERVICE_TYPE, ServiceType.OBJECT_STORE); - // TODO: this doesn't actually do anything yet. - properties.setProperty(KeystoneProperties.VERSION, "2.0"); - properties.setProperty(CREDENTIAL_TYPE, CredentialTypes.API_ACCESS_KEY_CREDENTIALS); - properties.remove(PROPERTY_REGIONS); + Properties properties = SwiftKeystoneApiMetadata.defaultProperties(); return properties; } - public static class Builder extends SwiftApiMetadata.Builder { + public static class Builder extends SwiftKeystoneApiMetadata.Builder { protected Builder(){ super(HPCloudObjectStorageClient.class, HPCloudObjectStorageAsyncClient.class); id("hpcloud-objectstorage") + .endpointName("identity service url ending in /v2.0/") + .defaultEndpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/") .name("HP Cloud Services Object Storage API") - .identityName("yourTenantName:yourAccessKey") - .credentialName("secretKey") .documentation(URI.create("https://build.hpcloud.com/object-storage/api")) .defaultProperties(HPCloudObjectStorageApiMetadata.defaultProperties()) .context(CONTEXT_TOKEN) diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java index cda5c4df9e..8a8262ce34 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/HPCloudObjectStorageProviderMetadata.java @@ -72,7 +72,7 @@ public class HPCloudObjectStorageProviderMetadata extends BaseProviderMetadata { .console(URI.create("https://manage.hpcloud.com/objects/us-west")) .linkedServices("hpcloud-compute", "hpcloud-objectstorage") .iso3166Codes("US-NV") - .endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357") + .endpoint("https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0/") .defaultProperties(HPCloudObjectStorageProviderMetadata.defaultProperties()); } diff --git a/providers/rackspace-cloudservers-us/pom.xml b/providers/rackspace-cloudservers-us/pom.xml index d6fedebe19..2c82f5a3b8 100644 --- a/providers/rackspace-cloudservers-us/pom.xml +++ b/providers/rackspace-cloudservers-us/pom.xml @@ -34,7 +34,7 @@ bundle - https://identity.api.rackspacecloud.com + https://identity.api.rackspacecloud.com/v2.0/ 2 ${test.rackspace-us.identity} diff --git a/providers/rackspace-cloudservers-us/src/main/java/org/jclouds/rackspace/cloudservers/us/CloudServersUSProviderMetadata.java b/providers/rackspace-cloudservers-us/src/main/java/org/jclouds/rackspace/cloudservers/us/CloudServersUSProviderMetadata.java index 4096ff8738..b4b2551816 100644 --- a/providers/rackspace-cloudservers-us/src/main/java/org/jclouds/rackspace/cloudservers/us/CloudServersUSProviderMetadata.java +++ b/providers/rackspace-cloudservers-us/src/main/java/org/jclouds/rackspace/cloudservers/us/CloudServersUSProviderMetadata.java @@ -74,9 +74,11 @@ public class CloudServersUSProviderMetadata extends BaseProviderMetadata { id("rackspace-cloudservers-us") .name("Rackspace Next Generation Cloud Servers") .apiMetadata(new NovaApiMetadata().toBuilder() - .identityName("username") - .credentialName("API Key") + .identityName("${userName}") + .credentialName("${apiKey}") .version("2") + .defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/") + .endpointName("identity service url ending in /v2.0/") .documentation(URI.create("http://docs.rackspace.com/servers/api/v2/cs-devguide/content/ch_preface.html#webhelp-currentid")) .defaultModules(ImmutableSet.>builder() .add(CloudIdentityAuthenticationModule.class) @@ -88,7 +90,7 @@ public class CloudServersUSProviderMetadata extends BaseProviderMetadata { .console(URI.create("https://mycloud.rackspace.com")) .linkedServices("rackspace-cloudservers-us", "cloudfiles-swift-us") .iso3166Codes("US-TX") - .endpoint("https://identity.api.rackspacecloud.com") + .endpoint("https://identity.api.rackspacecloud.com/v2.0/") .defaultProperties(CloudServersUSProviderMetadata.defaultProperties()); } diff --git a/providers/trystack-nova/pom.xml b/providers/trystack-nova/pom.xml index ba50265a81..7de9fd5d95 100644 --- a/providers/trystack-nova/pom.xml +++ b/providers/trystack-nova/pom.xml @@ -34,7 +34,7 @@ bundle - https://nova-api.trystack.org:5443 + https://nova-api.trystack.org:5443/v2.0/ 1.1 FIXME_IDENTITY diff --git a/providers/trystack-nova/src/main/java/org/jclouds/trystack/nova/TryStackNovaProviderMetadata.java b/providers/trystack-nova/src/main/java/org/jclouds/trystack/nova/TryStackNovaProviderMetadata.java index fe646e63ac..fa58662f01 100644 --- a/providers/trystack-nova/src/main/java/org/jclouds/trystack/nova/TryStackNovaProviderMetadata.java +++ b/providers/trystack-nova/src/main/java/org/jclouds/trystack/nova/TryStackNovaProviderMetadata.java @@ -19,7 +19,6 @@ package org.jclouds.trystack.nova; import static org.jclouds.Constants.PROPERTY_TRUST_ALL_CERTS; -import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE; import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS; import java.net.URI; @@ -64,7 +63,6 @@ public class TryStackNovaProviderMetadata extends BaseProviderMetadata { public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(PROPERTY_TRUST_ALL_CERTS, "true"); - properties.setProperty(CREDENTIAL_TYPE, "passwordCredentials"); properties.setProperty(AUTO_GENERATE_KEYPAIRS, "true"); return properties; } @@ -81,7 +79,7 @@ public class TryStackNovaProviderMetadata extends BaseProviderMetadata { .homepage(URI.create("https://trystack.org")) .console(URI.create("https://trystack.org/dash")) .iso3166Codes("US-CA") - .endpoint("https://nova-api.trystack.org:5443") + .endpoint("https://nova-api.trystack.org:5443/v2.0/") .defaultProperties(TryStackNovaProviderMetadata.defaultProperties()); }