From f079a2d0b9daaf8ba64cb005d04cbae64b64c7c3 Mon Sep 17 00:00:00 2001 From: Les Vogel Date: Fri, 21 Apr 2017 19:49:03 -0700 Subject: [PATCH] Add a bit more to the readme 1. Put an index up (Note that we have to GAE Standard samples at the top level) 2. Add some info about credentials. --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 40352cb272d..61281c1f694 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,41 @@ This is a repository that contains java code snippets on [Cloud Platform Documentation](https://cloud.google.com/docs/). +The repo is organized as follows: + +* [App Engine Standard](appengine) + * [TaskQueue](taskqueue) + * [Unit Tests](unittests) +* [App Engine Flexible](flexible) +* [Compute Engine](compute) + +Technology Samples: + +* [Bigquery](bigquery) +* [Datastore](datastore) +* [Endpoints](endpoints) +* [Key Management Service](kms) +* [Logging](logging) +* [Monitoring](monitoring) +* [Natural Language](language) +* [PubSub](pubsub) +* [Cloud Spanner](spanner) +* [Speech](speech) +* [Cloud Storage](storage) +* [Translate](translate) +* [Vision](vision) + +## Credentials Example + +The documentation for [Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials). + +`BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();` + +The client library looks for credentials using the following rules: + +1. `GOOGLE_APPLICATION_CREDENTIALS` environment variable, pointing to a service account key JSON file path. +2. Cloud SDK credentials `gcloud auth application-default login` +3. App Engine standard environment credentials. +4. Compute Engine credentials. + +You can override this behavior using setCredentials in `BigQueryOptions.newBuilder()` by adding `setCredentials(Credentials credentials)` from [ServiceOptions.builder](http://googlecloudplatform.github.io/google-cloud-java/0.12.0/apidocs/com/google/cloud/ServiceOptions.Builder.html#setCredentials-com.google.auth.Credentials-) and [Credentials](http://google.github.io/google-auth-library-java/releases/0.6.0/apidocs/com/google/auth/Credentials.html?is-external=true).