This is a repository that contains java code snippets on Cloud Platform Documentation.
The repo is organized as follows:
Technology Samples:
- Bigquery
- Datastore
- Endpoints
- Key Management Service
- Logging
- Monitoring
- Natural Language
- PubSub
- Cloud Spanner
- Speech
- Cloud Storage
- Translate
- Vision
The documentation for Application Default Credentials.
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
The client library looks for credentials using the following rules:
GOOGLE_APPLICATION_CREDENTIALS
environment variable, pointing to a service account key JSON file path.- Cloud SDK credentials
gcloud auth application-default login
- App Engine standard environment credentials.
- Compute Engine credentials.
You can override this behavior using setCredentials in BigQueryOptions.newBuilder()
by adding setCredentials(Credentials credentials)
from ServiceOptions.builder and Credentials.