Skip to content

Commit 6411d64

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 2419 b: refs/heads/update-datastore c: fe57e98 h: refs/heads/master i: 2417: 5f4851a 2415: 559c159
1 parent aeb25de commit 6411d64

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: f4c3a327ca0030fed4326a004e717bb62e0e969e
8+
refs/heads/update-datastore: fe57e9865b20a4dee394c8042cd9306a20291149
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,30 @@ There are multiple ways to authenticate to use Google Cloud services.
4646
2. When using `gcloud-java` libraries elsewhere, there are two options:
4747
* [Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts). After downloading that key, you must do one of the following:
4848
* Define the environment variable GOOGLE_APPLICATION_CREDENTIALS to be the location of the key. For example, `export GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json`
49-
* Supply the downloaded JSON credentials file when building the options supplied to datastore/storage constructor. For example, `StorageOptions.builder().authCredentials(AuthCredentials.createForJson(new FileInputStream("/path/to/my/key.json")).build().service()` returns a `Storage` object that has the necessary permissions.
49+
* Supply the JSON credentials file when building the service options. For example, this Storage object has the necessary permissions to interact with your Google Cloud Storage data:
50+
```java
51+
Storage storage = StorageOptions.builder()
52+
.authCredentials(AuthCredentials.createForJson(new FileInputStream("/path/to/my/key.json"))
53+
.build()
54+
.service();
55+
```
5056
* If running locally for development/testing, you can use use [Google Cloud SDK](https://cloud.google.com/sdk/?hl=en). To use the SDK authentication, [download the SDK](https://cloud.google.com/sdk/?hl=en) if you haven't already. Then login using the SDK (`gcloud auth login` in command line), and set your current project using `gcloud config set project PROJECT_ID`.
5157

5258
`gcloud-java` looks for credentials in the following order, stopping once it finds credentials:
5359

54-
1. Credentials supplied to the `DatastoreOptions`/`ServiceOptions` builder
60+
1. Credentials supplied when building the service options
5561
2. App Engine credentials
5662
3. Key file pointed to by the GOOGLE_APPLICATION_CREDENTIALS environment variable
57-
4. Google SDK credentials
63+
4. Google Cloud SDK credentials
5864
5. Compute Engine credentials
5965

66+
Note that this sequence is different than the order in which `gcloud-java` determines the project ID. The project ID is determined in the following order:
67+
68+
1. Project ID supplied when building the service options
69+
2. Project ID specified by the environment variable `GCLOUD_PROJECT`
70+
3. App Engine project ID
71+
4. Google Cloud SDK project ID
72+
6073
Google Cloud Datastore
6174
----------------------
6275

0 commit comments

Comments
 (0)