/java-docs-samples

Primary LanguageJavaApache License 2.0Apache-2.0

Google Cloud Platform Java Samples

Kokoro Build Status Coverage Status

Open in Cloud Shell

This repository holds sample code written in Java that demonstrates the Google Cloud Platform.

Some samples have accompanying guides on <cloud.google.com>. See respective README files for details.

Set Up

  1. Set up your Java Development Environment

  2. Clone this repository:

     git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git
    
  3. Obtain authentication credentials.

    Create local credentials by running the following command and following the oauth2 flow (read more about the command here):

     gcloud auth application-default login
    

    Or manually set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to a service account key JSON file path.

    Learn more at Setting Up Authentication for Server to Server Production Applications.

    Note: Application Default Credentials is able to implicitly find the credentials as long as the application is running on Compute Engine, Kubernetes Engine, App Engine, or Cloud Functions.

Contributing

Licensing