Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull master branch updates to resource manager branch #426

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e063bc5
Auth cleanup
Nov 7, 2015
9394d28
Remove DefaultAuthCredentials from serialization tests, since there a…
Nov 7, 2015
6074605
Modify project id lookup order and revert style changes
Nov 9, 2015
2ffac2d
Move generation from BlobInfo to BlobId
mziccard Nov 12, 2015
6c961b6
Create version 0.0.12
Nov 12, 2015
29d9c23
Merge pull request #369 from ajkannan/update-version-0.0.12
aozarov Nov 12, 2015
2fd8066
Updating version in README files.
Nov 12, 2015
af10dbf
Update version to 0.0.13-SNAPSHOT
Nov 13, 2015
6890fa1
Merge pull request #370 from ajkannan/update-version-0.0.13-SNAPSHOT
aozarov Nov 13, 2015
f0ce897
Remove Blob(Source/Get)Option.setGeneration method, add Storage.optio…
mziccard Nov 13, 2015
3311969
Set blob generation before sending requests in DefaultStorageRpc
mziccard Nov 13, 2015
dc71a56
Simplify package-info examples
Nov 13, 2015
22f52ae
Document that we should wait until artifacts are pushed to finish rel…
Nov 13, 2015
f3c8274
Fix code to get app engine ID
Nov 13, 2015
b67dad7
Merge pull request #378 from ajkannan/reflection-fix
aozarov Nov 13, 2015
522ed56
Merge pull request #377 from ajkannan/releasing-docs
aozarov Nov 13, 2015
1bcdf4b
Make package info wording clearer
Nov 13, 2015
cf777fc
Fix setting ContentRange to inclusive positions
mziccard Nov 13, 2015
b7099e0
Merge pull request #376 from ajkannan/update-pkg-info-examples
mziccard Nov 13, 2015
d039537
Merge pull request #375 from mziccard/fix-content-range
aozarov Nov 13, 2015
77dab2c
Remove extra central repository deploy
Nov 14, 2015
3f6d791
Add additional deploy check comment
Nov 14, 2015
29d8ec3
Merge pull request #379 from ajkannan/push-to-maven-once
aozarov Nov 14, 2015
315a0eb
Merge pull request #366 from mziccard/add-generation-blob-id
aozarov Nov 14, 2015
76cb620
Better document delete methods
mziccard Nov 17, 2015
e22e8a3
Make batch delete return false if not found
mziccard Nov 17, 2015
c3b6616
Use GOOGLE_APPLICATION_CREDENTIALS and GCLOUD_PROJECT vars in RemoteG…
mziccard Nov 9, 2015
82ebc71
Add support for signUrl when default credentials are used
mziccard Nov 17, 2015
4ecd840
Merge pull request #339 from mziccard/integration-test-env-vars
aozarov Nov 17, 2015
93da8a9
fix readmes for storage
aozarov Nov 18, 2015
101048e
Merge pull request #389 from aozarov/temp
mziccard Nov 18, 2015
87e4bac
Fix BlobWriteChannel and BlobReadChannel javadoc
mziccard Nov 18, 2015
6537314
BlobReadChannel fails if blob is updated while being read
mziccard Nov 18, 2015
1e7fe54
Move all checks for HTTP_NOT_FOUND to DefaultStorageRpc
mziccard Nov 18, 2015
a4c4273
Merge pull request #380 from mziccard/fix-delete-batch
aozarov Nov 18, 2015
a560777
Use version auth library verison 0.3.1 to avoid NPE
Nov 18, 2015
f995b12
Merge to get AuthCredentials updates
Nov 18, 2015
02694ca
Update javadoc for FullEntity
aozarov Nov 19, 2015
bfe8924
Add message check to IT tests, better javadoc for storage.reader
mziccard Nov 19, 2015
39829a0
Merge pull request #390 from mziccard/rewriter-check-blob-update
aozarov Nov 19, 2015
bbf3cb6
Merge pull request #393 from aozarov/temp
ludoch Nov 20, 2015
a07fbda
Add step-by-step datastore guide
Nov 19, 2015
424f144
fix snippets to match full code
Nov 20, 2015
b48d163
Merge pull request #399 from ajkannan/fix-docs
aozarov Nov 20, 2015
791fba1
Add links to gcloud-common docs in READMEs
Nov 20, 2015
78f8f28
Limit batch deletes to 100, issue serveral batch if limit's exceeded
mziccard Nov 20, 2015
dba9efb
Merge pull request #401 from mziccard/limit-batch-deletes
aozarov Nov 20, 2015
84c91bc
fix link to auth readme
Nov 21, 2015
347d5be
use anchors in links
Nov 21, 2015
08c0f28
Add step-by-step guide for storage README
Nov 21, 2015
a6da17e
Merge pull request #404 from ajkannan/link-docs
aozarov Nov 21, 2015
3af2bba
fix storage readme sample
Nov 23, 2015
8ebfdf8
add link to bucket naming rules
Nov 23, 2015
a27282e
Merge pull request #405 from ajkannan/add-storage-examples
aozarov Nov 23, 2015
539ac61
Add back AppEngineCredentials
Nov 23, 2015
fc2ab10
Avoid throwing exception when checking isLocalHost in Datastore
Nov 24, 2015
8808c54
Add link about datastore indexing in docs
Nov 24, 2015
d8a6159
Merge pull request #411 from ajkannan/fix-socket-api-bug
aozarov Nov 24, 2015
a23d8f9
Merge pull request #412 from ajkannan/datastore-index-link
aozarov Nov 24, 2015
0a05851
Translate SocketTimeoutException to retryable service exception
mziccard Nov 24, 2015
a0f2d20
Set special reason for timeout exceptions
mziccard Nov 24, 2015
1a6dcde
Fix toBuilder so that info.equals(info.toBuilder().build()) is true
mziccard Nov 24, 2015
2ef47e8
Use NetHttpTransport when running on Compute
Nov 24, 2015
f87a394
Fix dependency on two different versions of the GoogleCredential class
Nov 25, 2015
2c90245
Merge pull request #337 from ajkannan/auth-cleanup
aozarov Nov 25, 2015
bbc968e
Merge pull request #414 from mziccard/retry-on-timeout
aozarov Nov 25, 2015
a25e504
Merge pull request #416 from mziccard/fix-storage-to-builder
aozarov Nov 25, 2015
1830275
Enable travis to branches other than master
mziccard Nov 30, 2015
80c7a96
Merge pull request #424 from mziccard/test-all-branches
aozarov Nov 30, 2015
5e46fba
Merge branch 'master' of https://github.com/GoogleCloudPlatform/gclou…
Nov 30, 2015
0160867
sync pom version to parent project
Nov 30, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ before_install:
install: mvn install -DskipTests=true -Dgpg.skip=true
script:
- utilities/verify.sh
branches:
only:
- master
after_success:
- utilities/after_success.sh
env:
Expand Down
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ If you are using Maven, add this to your pom.xml file
<dependency>
<groupId>com.google.gcloud</groupId>
<artifactId>gcloud-java</artifactId>
<version>0.0.11</version>
<version>0.0.12</version>
</dependency>
```
If you are using Gradle, add this to your dependencies
```Groovy
compile 'com.google.gcloud:gcloud-java:jar:0.0.11'
compile 'com.google.gcloud:gcloud-java:jar:0.0.12'
```
If you are using SBT, add this to your dependencies
```Scala
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.0.11"
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.0.12"
```

Example Applications
Expand Down Expand Up @@ -69,13 +69,15 @@ Most `gcloud-java` libraries require a project ID. There are multiple ways to s
1. Project ID supplied when building the service options
2. Project ID specified by the environment variable `GCLOUD_PROJECT`
3. App Engine project ID
4. Compute Engine project ID
5. Google Cloud SDK project ID
4. Google Cloud SDK project ID
5. Compute Engine project ID

Authentication
--------------

There are multiple ways to authenticate to use Google Cloud services.
First, ensure that the necessary Google Cloud APIs are enabled for your project. To do this, follow the instructions on the [authentication document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/authentication/readme.md#authentication) shared by all the gcloud language libraries.

Next, choose a method for authenticating API requests from within your project:

1. When using `gcloud-java` libraries from within Compute/App Engine, no additional authentication steps are necessary.
2. When using `gcloud-java` libraries elsewhere, there are two options:
Expand Down Expand Up @@ -164,8 +166,7 @@ import com.google.gcloud.storage.StorageOptions;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;

StorageOptions options = StorageOptions.builder().projectId("project").build();
Storage storage = options.service();
Storage storage = StorageOptions.defaultInstance().service();
BlobId blobId = BlobId.of("bucket", "blob_name");
Blob blob = Blob.load(storage, blobId);
if (blob == null) {
Expand All @@ -181,6 +182,11 @@ if (blob == null) {
}
```

Troubleshooting
---------------

To get help, follow the `gcloud-java` links in the `gcloud-*` [shared Troubleshooting document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting).

Java Versions
-------------

Expand All @@ -207,7 +213,7 @@ Contributing

Contributions to this library are always welcome and highly encouraged.

See [CONTRIBUTING] for more information on how to get started.
See `gcloud-java`'s [CONTRIBUTING] documentation and the `gcloud-*` [shared documentation](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information.

Expand All @@ -218,7 +224,7 @@ Apache 2.0 - See [LICENSE] for more information.


[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md
[code-of-conduct]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CODE_OF_CONDUCT.md
[code-of-conduct]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[LICENSE]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/LICENSE
[TESTING]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/TESTING.md
[cloud-platform]: https://cloud.google.com/
Expand Down
8 changes: 5 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ This script takes an optional argument denoting the new version. By default, if
2. Create a PR to update the pom.xml version.
The PR should look something like [#225](https://github.com/GoogleCloudPlatform/gcloud-java/pull/225). After this PR is merged into GoogleCloudPlatform/gcloud-java, Travis CI will push a new website to GoogleCloudPlatform/gh-pages, push a new artifact to the Maven Central Repository, and update versions in the README files.

3. Create a release on Github manually.
3. Before moving on, verify that the artifacts have successfully been pushed to the Maven Central Repository. Open Travis CI, click the ["Build History" tab](https://travis-ci.org/GoogleCloudPlatform/gcloud-java/builds), and open the second build's logs for Step 2's PR. Be sure that you are not opening the "Pull Request" build logs. When the build finishes, scroll to the end of the log and verify that the artifacts were successfully staged and deployed. You can also search for `gcloud-java` on the [Sonatype website](https://oss.sonatype.org/#nexus-search;quick~gcloud-java) and check the latest version number. If the deployment didn't succeed because of a flaky test, rerun the build.

4. Create a release on Github manually.
Go to the [releases page](https://github.com/GoogleCloudPlatform/gcloud-java/releases) and click "Draft a new release." Use `vX.Y.Z` as the "Tag Version" and `X.Y.Z` as the "Release Title", where `X.Y.Z` is the release version as listed in the `pom.xml` files.

4. Run `utilities/update_pom_version.sh` again (to include "-SNAPSHOT" in the project version).
5. Run `utilities/update_pom_version.sh` again (to include "-SNAPSHOT" in the project version).
As mentioned before, there is an optional version argument. By default, the script will update the version from "X.Y.Z" to "X.Y.Z+1-SNAPSHOT". Suppose a different version is desired, for example X+1.0.0-SNAPSHOT. Then the appropriate command to run would be `utilities/update_pom_version.sh X+1.0.0-SNAPSHOT`.

5. Create and merge in another PR to reflect the updated project version. For an example of what this PR should look like, see [#227](https://github.com/GoogleCloudPlatform/gcloud-java/pull/227).
6. Create and merge in another PR to reflect the updated project version. For an example of what this PR should look like, see [#227](https://github.com/GoogleCloudPlatform/gcloud-java/pull/227).

### To push a snapshot version

Expand Down
16 changes: 12 additions & 4 deletions gcloud-java-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ If you are using Maven, add this to your pom.xml file
<dependency>
<groupId>com.google.gcloud</groupId>
<artifactId>gcloud-java-core</artifactId>
<version>0.0.11</version>
<version>0.0.12</version>
</dependency>
```
If you are using Gradle, add this to your dependencies
```Groovy
compile 'com.google.gcloud:gcloud-java-core:jar:0.0.11'
compile 'com.google.gcloud:gcloud-java-core:jar:0.0.12'
```
If you are using SBT, add this to your dependencies
```Scala
libraryDependencies += "com.google.gcloud" % "gcloud-java-core" % "0.0.11"
libraryDependencies += "com.google.gcloud" % "gcloud-java-core" % "0.0.12"
```

Troubleshooting
---------------

To get help, follow the `gcloud-java` links in the `gcloud-*` [shared Troubleshooting document](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/troubleshooting/readme.md#troubleshooting).

Java Versions
-------------

Expand All @@ -39,7 +44,9 @@ Contributing

Contributions to this library are always welcome and highly encouraged.

See [CONTRIBUTING] for more information on how to get started.
See `gcloud-java`'s [CONTRIBUTING] documentation and the `gcloud-*` [shared documentation](https://github.com/GoogleCloudPlatform/gcloud-common/blob/master/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information.

Versioning
----------
Expand All @@ -57,5 +64,6 @@ Apache 2.0 - See [LICENSE] for more information.


[CONTRIBUTING]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CONTRIBUTING.md
[code-of-conduct]:https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[LICENSE]: https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/LICENSE
[cloud-platform]: https://cloud.google.com/
12 changes: 9 additions & 3 deletions gcloud-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.google.gcloud</groupId>
<artifactId>gcloud-java-pom</artifactId>
<version>0.0.12-SNAPSHOT</version>
<version>0.0.13-SNAPSHOT</version>
</parent>
<properties>
<site.installationModule>gcloud-java-core</site.installationModule>
Expand All @@ -20,12 +20,18 @@
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-credentials</artifactId>
<version>0.1.0</version>
<version>0.3.1</version>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>0.1.0</version>
<version>0.3.1</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava-jdk5</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@
import static com.google.common.base.Preconditions.checkNotNull;

import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.compute.ComputeCredential;
import com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.jackson.JacksonFactory;
import com.google.auth.http.HttpCredentialsAdapter;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.auth.oauth2.ServiceAccountCredentials;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.security.GeneralSecurityException;
import java.security.PrivateKey;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -163,56 +160,7 @@ public RestorableState<AuthCredentials> capture() {
}
}

private static class ComputeEngineAuthCredentials extends AuthCredentials {

private ComputeCredential computeCredential;

private static final ComputeEngineAuthCredentialsState STATE =
new ComputeEngineAuthCredentialsState();

private static class ComputeEngineAuthCredentialsState
implements RestorableState<AuthCredentials>, Serializable {

private static final long serialVersionUID = -6168594072854417404L;

@Override
public AuthCredentials restore() {
try {
return new ComputeEngineAuthCredentials();
} catch (IOException | GeneralSecurityException e) {
throw new IllegalStateException(
"Could not restore " + ComputeEngineAuthCredentials.class.getSimpleName(), e);
}
}

@Override
public int hashCode() {
return getClass().getName().hashCode();
}

@Override
public boolean equals(Object obj) {
return obj instanceof ComputeEngineAuthCredentialsState;
}
}

ComputeEngineAuthCredentials() throws IOException, GeneralSecurityException {
computeCredential = getComputeCredential();
}

@Override
protected HttpRequestInitializer httpRequestInitializer(HttpTransport transport,
Set<String> scopes) {
return computeCredential;
}

@Override
public RestorableState<AuthCredentials> capture() {
return STATE;
}
}

private static class ApplicationDefaultAuthCredentials extends AuthCredentials {
public static class ApplicationDefaultAuthCredentials extends AuthCredentials {

private GoogleCredentials googleCredentials;

Expand Down Expand Up @@ -255,6 +203,15 @@ protected HttpRequestInitializer httpRequestInitializer(HttpTransport transport,
return new HttpCredentialsAdapter(googleCredentials.createScoped(scopes));
}

public ServiceAccountAuthCredentials toServiceAccountCredentials() {
if (googleCredentials instanceof ServiceAccountCredentials) {
ServiceAccountCredentials credentials = (ServiceAccountCredentials) googleCredentials;
return new ServiceAccountAuthCredentials(credentials.getClientEmail(),
credentials.getPrivateKey());
}
return null;
}

@Override
public RestorableState<AuthCredentials> capture() {
return STATE;
Expand All @@ -268,11 +225,6 @@ public static AuthCredentials createForAppEngine() {
return AppEngineAuthCredentials.INSTANCE;
}

public static AuthCredentials createForComputeEngine()
throws IOException, GeneralSecurityException {
return new ComputeEngineAuthCredentials();
}

/**
* Returns the Application Default Credentials.
*
Expand Down Expand Up @@ -327,13 +279,4 @@ public static ServiceAccountAuthCredentials createForJson(InputStream jsonCreden
public static AuthCredentials noCredentials() {
return ServiceAccountAuthCredentials.NO_CREDENTIALS;
}

static ComputeCredential getComputeCredential() throws IOException, GeneralSecurityException {
NetHttpTransport transport = GoogleNetHttpTransport.newTrustedTransport();
// Try to connect using Google Compute Engine service account credentials.
ComputeCredential credential = new ComputeCredential(transport, new JacksonFactory());
// Force token refresh to detect if we are running on Google Compute Engine.
credential.refreshToken();
return credential;
}
}
Loading