+
+
+
+

gcloud

+

Google Cloud Client Library for Java - an idiomatic, intuitive, and natural way for Java developers to integrate with Google Cloud Platform services, like Cloud Datastore and Cloud Storage.

+
+
+

Quickstart with Maven: Add gcloud to your pom.xml

+
<dependency>
+  <groupId>com.google.gcloud</groupId>
+  <artifactId>gcloud-java</artifactId>
+  <version>0.0.6</version>
+</dependency>
+
+
+
+ +
+ +
+ +
+
+

What is it?

+ +

gcloud is a client library for accessing Google + Cloud Platform services that significantly reduces the boilerplate + code you have to write. The library provides high-level API + abstractions so they're easier to understand. It embraces + idioms of Java, works well with the standard library, and + integrates better with your codebase. + All this means you spend more time creating code that matters + to you.

+ +

gcloud is configured to access Google Cloud Platform + services and authorize (OAuth 2.0) automatically on your behalf. + Add the gcloud dependency to your project and get a private key to be + up and ready to go. Better yet, if you are running on a Google + Compute Engine instance, the private key is automatically detected. + +

Example: Retrieve Datastore Entries

+ +
+
import com.google.gcloud.datastore.Datastore;
+import com.google.gcloud.datastore.DatastoreFactory;
+import com.google.gcloud.datastore.DatastoreOptions;
+import com.google.gcloud.datastore.Entity;
+import com.google.gcloud.datastore.Key;
+import com.google.gcloud.datastore.KeyFactory;
+
+DatastoreOptions options = DatastoreOptions.builder().projectId(PROJECT_ID).build();
+Datastore datastore = DatastoreFactory.instance().get(options);
+KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
+Key key = keyFactory.newKey(keyName);
+Entity entity = datastore.get(key);
+
+
+ +
+
+

FAQ

+

What is the relationship between the gcloud-java library and the gcloud command-line tool?

+

Both the gcloud command-line tool and gcloud-java library are a part of the Google Cloud SDK: a collection of tools and libraries that enable you to easily create and manage resources on the Google Cloud Platform. The gcloud command-line tool can be used to manage both your development workflow and your Google Cloud Platform resources while the gcloud-java library is the Google Cloud Client Library for Java.

+ +

What is the relationship between gcloud and the Google APIs Java Client?

+

The Google APIs Java Client is a client library for using the broad set of Google APIs. gcloud is built specifically for the Google Cloud Platform and is the recommended way to integrate Google Cloud APIs into your Java applications. If your application requires both Google Cloud Platform and other Google APIs, the 2 libraries may be used by your application.

+
+
+