Tim Burks 489bc80eb4 Primitive command-line interface to Datastore demo. 8 years ago
..
Sources 489bc80eb4 Primitive command-line interface to Datastore demo. 8 years ago
Makefile 6012c30579 Update use of auth-library-swift to explicitly pass scopes to token providers. 8 years ago
Package.swift 489bc80eb4 Primitive command-line interface to Datastore demo. 8 years ago
README.md 787eba927e Update README for Datastore example. 8 years ago
RUNME f3926c5c6a Change access level for generated classes and methods from "public" to "internal". 8 years ago
roots.pem 459480eed6 Simple (very!) datastore example. 8 years ago

README.md

Calling the Google Cloud Datastore API

This directory contains a very simple sample that calls the Google Cloud Datastore API. Calls are made directly to the Datastore RPC interface. In practice, these would be wrapped in idiomatic code.

Use RUNME to generate the necessary Protocol Buffer and gRPC support code. It uses protoc and the Swift Protocol Buffer and gRPC plugins, so please be sure these are in your path. The plugins can be built by running make in the top-level Plugins directory.

Calls require a Google project ID and an OAuth token.

To create a project ID, visit the Google Cloud Console. Then edit Sources/main.swift to replace "YOUR PROJECT ID" with your project ID.

OAuth tokens are obtained using Google's Auth Library for Swift. On OS X, this package uses a locally-installed browser and a temporary web server to take a user through an OAuth signin flow. On Linux, it gets an OAuth token from the Instance Metadata Service that is available in Google Cloud instances, such as Google Compute Engine or Google Cloud Shell.