You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ga...@apache.org on 2014/06/18 01:38:04 UTC
git commit: JCLOUDS-458: GCS skeleton with authentication
Repository: jclouds-labs-google
Updated Branches:
refs/heads/master caf21af16 -> e1b706d91
JCLOUDS-458: GCS skeleton with authentication
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/e1b706d9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/tree/e1b706d9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/diff/e1b706d9
Branch: refs/heads/master
Commit: e1b706d91ad80702a53302d7808d50d66d532a16
Parents: caf21af
Author: hsbhathiya <hs...@gmail.com>
Authored: Tue Jun 17 16:31:38 2014 +0530
Committer: Andrew Gaul <ga...@apache.org>
Committed: Tue Jun 17 16:37:35 2014 -0700
----------------------------------------------------------------------
google-cloud-storage/README.md | 46 +++++++
google-cloud-storage/pom.xml | 125 +++++++++++++++++++
.../GoogleCloudStorageApi.java | 27 ++++
.../GoogleCloudStorageApiMetadata.java | 92 ++++++++++++++
.../config/GoogleCloudStorageHttpApiModule.java | 30 +++++
.../config/GoogleCloudStorageParserModule.java | 48 +++++++
.../config/OAuthModuleWithoutTypeAdapters.java | 49 ++++++++
.../reference/GoogleCloudStorageConstants.java | 49 ++++++++
.../services/org.jclouds.apis.ApiMetadata | 18 +++
.../GoogleCloudStorageApiMetadataTest.java | 31 +++++
...StorageAuthenticatedRestContextLiveTest.java | 35 ++++++
pom.xml | 1 +
12 files changed, 551 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/README.md
----------------------------------------------------------------------
diff --git a/google-cloud-storage/README.md b/google-cloud-storage/README.md
new file mode 100644
index 0000000..0d68f46
--- /dev/null
+++ b/google-cloud-storage/README.md
@@ -0,0 +1,46 @@
+jclouds Google Cloud Storage Provider
+===========================================================
+Make sure both Google Cloud Storage and Google Cloud Storage JSON API are enabled for the project
+(check from Developers Console -> Api&auth -> APIs)
+
+* Q. What is the identity for GCE?
+
+A. the identity is the developer email which can be obtained from the admin GUI. Its usually something in the form: <my account id>@developer.gserviceaccount.com
+
+* Q. What is the credential for GCE
+
+A. the credential is a private key, in pem format. It can be extracted from the p12 keystore that is obtained when creating a "Service Account" (in the GUI: Developers Console(For the project) -> APIs and Auth -> Create New Client ID -> "Service Account"
+
+* Q. How to convert a p12 keystore into a pem format jclouds Google Cloud Storage can handle:
+
+A.
+
+1. Convert the p12 file into pem format (it will ask for the keystore password, which is usually "notasecret"):
+ openssl pkcs12 -in <my_keystore>.p12 -out <my_keystore>.pem -nodes
+
+2. Extract only the pk and remove passphrase
+ openssl rsa -in <my_keystore>.pem -out <my_key>.pem
+
+The last file (<my_key>.pem) should contain the pk that needs to be passed to `ContextBuilder.credential()` for the provider `google-cloud-storage`.
+
+
+Running the live tests:
+---------------------------------------------------------------
+
+1. Place the following in your ~/.m2/settings.xml in a profile enabled when live:
+
+```
+<properties>
+ <test.google-cloud-storage.identity>Email address associated with service account</test.google-cloud-storage.identity>
+ <!-- this text is literally from your <my_key>.pem -->
+ <test.google-cloud-storage.credential>-----BEGIN RSA PRIVATE KEY-----
+MIICXgIBAAKBgQRRbRqVDtJLN1MO/xJoKqZuphDeBh5jIKueW3aNIiWs1XFcct+h
+...
+aH7xmpHSTbbXmQkuuv+z8EKijigprd/FoJpTX1f5/R+4wQ==
+-----END RSA PRIVATE KEY-----</test.google-cloud-storage.credential>
+</properties>
+```
+
+Example identity :- 123451234-abcd01234efgh@developer.gserviceaccount.com (NUMERIC_PREFIX-ALPHANEUMERIC_SUFFIX@developer.gserviceaccount.com)
+
+2. mvn integration-test -pl google-cloud-storage -Plive
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/pom.xml
----------------------------------------------------------------------
diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml
new file mode 100644
index 0000000..2bf002d
--- /dev/null
+++ b/google-cloud-storage/pom.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>jclouds-labs-google</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ </parent>
+ <!-- TODO: when out of labs, switch to org.jclouds.provider -->
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>google-cloud-storage</artifactId>
+ <name>jclouds Google Cloud Storage provider</name>
+ <description>jclouds components to access Google Cloud Storage</description>
+
+ <properties>
+ <test.google-cloud-storage.identity> Email_Address_Associated_With_Service_Account</test.google-cloud-storage.identity>
+ <test.google-cloud-storage.credential>Private_Key_Associated__With_Service Account</test.google-cloud-storage.credential>
+ <test.google-cloud-storage.api-version>v1</test.google-cloud-storage.api-version>
+ <test.google-cloud-storage.build-version />
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>oauth</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.labs</groupId>
+ <artifactId>oauth</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-blobstore</artifactId>
+ <version>${jclouds.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-blobstore</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-slf4j</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
+ <jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
+ <test.google-cloud-storage.identity>${test.google-cloud-storage.identity}</test.google-cloud-storage.identity>
+ <test.google-cloud-storage.credential>${test.google-cloud-storage.credential}</test.google-cloud-storage.credential>
+ <test.google-cloud-storage.api-version>${test.google-cloud-storage.api-version}</test.google-cloud-storage.api-version>
+ <test.google-cloud-storage.build-version>${test.google-cloud-storage.build-version}</test.google-cloud-storage.build-version>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java
new file mode 100644
index 0000000..5d2691c
--- /dev/null
+++ b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApi.java
@@ -0,0 +1,27 @@
+/*
+ * 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.googlecloudstorage;
+
+import java.io.Closeable;
+
+/**
+ * Provide access to GoogleCloudStorage
+ *
+ * @see <a href="https://developers.google.com/storage/docs/json_api/v1/">api doc /a>
+ */
+public interface GoogleCloudStorageApi extends Closeable {
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java
new file mode 100644
index 0000000..dd6999d
--- /dev/null
+++ b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadata.java
@@ -0,0 +1,92 @@
+/*
+ * 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.googlecloudstorage;
+
+import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
+import static org.jclouds.googlecloudstorage.reference.GoogleCloudStorageConstants.GCS_PROVIDER_NAME;
+import static org.jclouds.googlecloudstorage.reference.GoogleCloudStorageConstants.OPERATION_COMPLETE_INTERVAL;
+import static org.jclouds.googlecloudstorage.reference.GoogleCloudStorageConstants.OPERATION_COMPLETE_TIMEOUT;
+import static org.jclouds.oauth.v2.config.OAuthProperties.AUDIENCE;
+import static org.jclouds.oauth.v2.config.OAuthProperties.SIGNATURE_OR_MAC_ALGORITHM;
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+import java.net.URI;
+import java.util.Properties;
+import org.jclouds.blobstore.BlobStoreContext;
+import org.jclouds.googlecloudstorage.config.GoogleCloudStorageHttpApiModule;
+import org.jclouds.googlecloudstorage.config.GoogleCloudStorageParserModule;
+import org.jclouds.googlecloudstorage.config.OAuthModuleWithoutTypeAdapters;
+import org.jclouds.oauth.v2.config.OAuthAuthenticationModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+public class GoogleCloudStorageApiMetadata extends BaseHttpApiMetadata<GoogleCloudStorageApi> {
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public GoogleCloudStorageApiMetadata() {
+ this(new Builder());
+ }
+
+ protected GoogleCloudStorageApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
+ properties.put("oauth.endpoint", "https://accounts.google.com/o/oauth2/token");
+ properties.put(AUDIENCE, "https://accounts.google.com/o/oauth2/token");
+ properties.put(SIGNATURE_OR_MAC_ALGORITHM, "RS256");
+ properties.put(PROPERTY_SESSION_INTERVAL, 3600);
+ properties.put(OPERATION_COMPLETE_INTERVAL, 2000);
+ properties.put(OPERATION_COMPLETE_TIMEOUT, 600000);
+ return properties;
+ }
+
+ public static class Builder extends BaseHttpApiMetadata.Builder<GoogleCloudStorageApi, Builder> {
+ protected Builder() {
+ id(GCS_PROVIDER_NAME)
+ .name("Google Cloud Storage Api ")
+ .identityName("Email associated with the Google API client_id")
+ .credentialName("Private key literal associated with the Google API client_id")
+ .documentation(URI.create("https://developers.google.com/storage/docs/json_api"))
+ .version("v1")
+ .defaultEndpoint("https://www.googleapis.com/storage/v1")
+ .defaultProperties(GoogleCloudStorageApiMetadata.defaultProperties())
+ .view(typeToken(BlobStoreContext.class))
+ .defaultModules(
+ ImmutableSet.<Class<? extends Module>> builder().add(GoogleCloudStorageParserModule.class)
+ .add(OAuthAuthenticationModule.class).add(OAuthModuleWithoutTypeAdapters.class)
+ .add(GoogleCloudStorageHttpApiModule.class).build());
+ }
+
+ @Override
+ public GoogleCloudStorageApiMetadata build() {
+ return new GoogleCloudStorageApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java
new file mode 100644
index 0000000..8372355
--- /dev/null
+++ b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageHttpApiModule.java
@@ -0,0 +1,30 @@
+/*
+ * 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.googlecloudstorage.config;
+
+import org.jclouds.googlecloudstorage.GoogleCloudStorageApi;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.config.HttpApiModule;
+
+/**
+ * Configures the GoogleCloud connection.
+ */
+@ConfiguresHttpApi
+public class GoogleCloudStorageHttpApiModule extends HttpApiModule<GoogleCloudStorageApi> {
+ public GoogleCloudStorageHttpApiModule() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java
new file mode 100644
index 0000000..ee9543c
--- /dev/null
+++ b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/GoogleCloudStorageParserModule.java
@@ -0,0 +1,48 @@
+/*
+ * 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.googlecloudstorage.config;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.inject.Singleton;
+
+import org.jclouds.json.config.GsonModule.DateAdapter;
+import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
+import org.jclouds.oauth.v2.domain.ClaimSet;
+import org.jclouds.oauth.v2.domain.Header;
+import org.jclouds.oauth.v2.json.ClaimSetTypeAdapter;
+import org.jclouds.oauth.v2.json.HeaderTypeAdapter;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+
+public class GoogleCloudStorageParserModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(DateAdapter.class).to(Iso8601DateAdapter.class);
+ }
+
+ @Provides
+ @Singleton
+ public Map<Type, Object> provideCustomAdapterBindings() {
+ return new ImmutableMap.Builder<Type, Object>().put(Header.class, new HeaderTypeAdapter())
+ .put(ClaimSet.class, new ClaimSetTypeAdapter()).build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/OAuthModuleWithoutTypeAdapters.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/OAuthModuleWithoutTypeAdapters.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/OAuthModuleWithoutTypeAdapters.java
new file mode 100644
index 0000000..ae1b417
--- /dev/null
+++ b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/config/OAuthModuleWithoutTypeAdapters.java
@@ -0,0 +1,49 @@
+/*
+ * 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.googlecloudstorage.config;
+
+import org.jclouds.oauth.v2.config.OAuthModule;
+import org.jclouds.oauth.v2.domain.OAuthCredentials;
+import org.jclouds.oauth.v2.domain.Token;
+import org.jclouds.oauth.v2.domain.TokenRequest;
+import org.jclouds.oauth.v2.functions.BuildTokenRequest;
+import org.jclouds.oauth.v2.functions.FetchToken;
+import org.jclouds.oauth.v2.functions.OAuthCredentialsSupplier;
+import org.jclouds.oauth.v2.functions.SignOrProduceMacForToken;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+
+import com.google.common.base.Function;
+import com.google.common.base.Supplier;
+import com.google.inject.TypeLiteral;
+
+/**
+ * Overrides OAuthModule leaving TypeAdapters bindings out.
+ */
+public class OAuthModuleWithoutTypeAdapters extends OAuthModule {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral<Function<byte[], byte[]>>() {
+ }).to(SignOrProduceMacForToken.class);
+ bind(new TypeLiteral<Supplier<OAuthCredentials>>() {
+ }).to(OAuthCredentialsSupplier.class);
+ bind(new TypeLiteral<Function<GeneratedHttpRequest, TokenRequest>>() {
+ }).to(BuildTokenRequest.class);
+ bind(new TypeLiteral<Function<TokenRequest, Token>>() {
+ }).to(FetchToken.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java
new file mode 100644
index 0000000..faac784
--- /dev/null
+++ b/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/reference/GoogleCloudStorageConstants.java
@@ -0,0 +1,49 @@
+/*
+ * 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.googlecloudstorage.reference;
+
+import com.google.common.annotations.Beta;
+
+public final class GoogleCloudStorageConstants {
+
+ private GoogleCloudStorageConstants() {
+ }
+
+ public static final String GCS_PROVIDER_NAME = "google-cloud-storage";
+
+ public static final String STORAGE_READONLY_SCOPE = "https://www.googleapis.com/auth/devstorage.read_only";
+
+ public static final String STORAGE_WRITEONLY_SCOPE = "https://www.googleapis.com/auth/devstorage.write_only";
+
+ public static final String STORAGE_READWRITE_SCOPE = "https://www.googleapis.com/auth/devstorage.read_write";
+
+ public static final String STORAGE_FULLCONTROL_SCOPE = "https://www.googleapis.com/auth/devstorage.full_control";
+
+ /**
+ * The total time, in msecs, to wait for an operation to complete.
+ */
+
+ @Beta
+ public static final String OPERATION_COMPLETE_TIMEOUT = "jclouds.google-cloud-storage.operation-complete-timeout";
+
+ /**
+ * The interval, in msecs, between calls to check whether an operation has completed.
+ */
+
+ @Beta
+ public static final String OPERATION_COMPLETE_INTERVAL = "jclouds.google-cloud-storage.operation-complete-interval";
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/google-cloud-storage/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
new file mode 100644
index 0000000..7528137
--- /dev/null
+++ b/google-cloud-storage/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+org.jclouds.googlecloudstorage.GoogleCloudStorageApiMetadata
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadataTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadataTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadataTest.java
new file mode 100644
index 0000000..579bbd1
--- /dev/null
+++ b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageApiMetadataTest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.googlecloudstorage;
+
+import org.jclouds.View;
+import org.jclouds.apis.internal.BaseApiMetadataTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.reflect.TypeToken;
+
+@Test(groups = "unit", testName = "GoogleStorageApiMetadataTest")
+public class GoogleCloudStorageApiMetadataTest extends BaseApiMetadataTest {
+ public GoogleCloudStorageApiMetadataTest() {
+ super(new GoogleCloudStorageApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of());
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageAuthenticatedRestContextLiveTest.java
----------------------------------------------------------------------
diff --git a/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageAuthenticatedRestContextLiveTest.java b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageAuthenticatedRestContextLiveTest.java
new file mode 100644
index 0000000..ecb814f
--- /dev/null
+++ b/google-cloud-storage/src/test/java/org/jclouds/googlecloudstorage/GoogleCloudStorageAuthenticatedRestContextLiveTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.googlecloudstorage;
+
+import org.jclouds.googlecloudstorage.reference.GoogleCloudStorageConstants;
+import org.jclouds.oauth.v2.internal.BaseOAuthAuthenticatedApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live")
+public class GoogleCloudStorageAuthenticatedRestContextLiveTest extends
+ BaseOAuthAuthenticatedApiLiveTest<GoogleCloudStorageApi> {
+
+ public GoogleCloudStorageAuthenticatedRestContextLiveTest() {
+ provider = "google-cloud-storage";
+ }
+
+ @Override
+ public String getScopes() {
+ return GoogleCloudStorageConstants.STORAGE_FULLCONTROL_SCOPE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/blob/e1b706d9/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 677f078..77e62a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,7 @@
<modules>
<module>oauth</module>
<module>google-compute-engine</module>
+ <module>google-cloud-storage</module>
</modules>
<build>