Skip to content

Commit a98fa25

Browse files
committed
---
yaml --- r: 2883 b: refs/heads/dns-alpha c: 8684506 h: refs/heads/master i: 2881: 8d55950 2879: 8633a52
1 parent 8d1255c commit a98fa25

167 files changed

Lines changed: 6044 additions & 11036 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2
1212
refs/tags/v0.0.12: 2fd8066e891fb3dfea69b65f6bf6461db79342b9
1313
refs/heads/compute-alpha: b1274b5bdf4eea955f3588b56378a5ae4ba59cef
14-
refs/heads/dns-alpha: d163bfb1ae1cd03f828d11c42f77a81c1f2c84d7
14+
refs/heads/dns-alpha: 86845061f481d0125ba18ce044cd242e396f40af

branches/dns-alpha/CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ When changes are made to authentication and project ID-related code, authenticat
3232

3333
Known issue: If you have installed the Google Cloud SDK, be sure to log in (using `gcloud auth login`) before running tests. Though the Datastore tests use a local Datastore emulator that doesn't require authentication, they will not run if you have the Google Cloud SDK installed but aren't authenticated.
3434

35-
**Please, do not use your production projects for executing integration tests.** While we do our best to make our tests independent of your project's state and content, they do perform create, modify and deletes, and you do not want to have your production data accidentally modified.
36-
3735
Adding Features
3836
---------------
3937
In order to add a feature to gcloud-java:

branches/dns-alpha/README.md

Lines changed: 58 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
66
[![Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-java.svg?branch=master)](https://travis-ci.org/GoogleCloudPlatform/gcloud-java)
77
[![Coverage Status](https://coveralls.io/repos/GoogleCloudPlatform/gcloud-java/badge.svg?branch=master)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-java?branch=master)
88
[![Maven](https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java.svg)
9-
[![Codacy Badge](https://api.codacy.com/project/badge/grade/9da006ad7c3a4fe1abd142e77c003917)](https://www.codacy.com/app/mziccard/gcloud-java)
10-
[![Dependency Status](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56bd8ee72a29ed002d2b0969)
119

1210
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
1311
- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs)
@@ -29,33 +27,33 @@ If you are using Maven, add this to your pom.xml file
2927
<dependency>
3028
<groupId>com.google.gcloud</groupId>
3129
<artifactId>gcloud-java</artifactId>
32-
<version>0.1.4</version>
30+
<version>0.1.2</version>
3331
</dependency>
3432
```
3533
If you are using Gradle, add this to your dependencies
3634
```Groovy
37-
compile 'com.google.gcloud:gcloud-java:0.1.4'
35+
compile 'com.google.gcloud:gcloud-java:0.1.2'
3836
```
3937
If you are using SBT, add this to your dependencies
4038
```Scala
41-
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.4"
39+
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.2"
4240
```
4341

4442
Example Applications
4543
--------------------
4644

47-
- [`BigQueryExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
48-
- Read more about using this application on the [`BigQueryExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/bigquery/BigQueryExample.html).
45+
- [`BigQueryExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/BigQueryExample.java) - A simple command line interface providing some of Cloud BigQuery's functionality
46+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/BigQueryExample.html).
4947
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf) - An App Engine app that manages a virtual bookshelf.
5048
- This app uses `gcloud-java` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
51-
- [`DatastoreExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
52-
- Read more about using this application on the [`DatastoreExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/datastore/DatastoreExample.html).
53-
- [`ResourceManagerExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
54-
- Read more about using this application on the [`ResourceManagerExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/resourcemanager/ResourceManagerExample.html).
55-
- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managed_vms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
56-
- Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managed_vms/sparkjava#how-does-it-work).
57-
- [`StorageExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
58-
- Read more about using this application on the [`StorageExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/storage/StorageExample.html).
49+
- [`DatastoreExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
50+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/DatastoreExample.html).
51+
- [`ResourceManagerExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/ResourceManagerExample.java) - A simple command line interface providing some of Cloud Resource Manager's functionality
52+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/ResourceManagerExample.html).
53+
- [`SparkDemo`](https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/managedvms/sparkjava) - An example of using gcloud-java-datastore from within the SparkJava and App Engine Managed VM frameworks.
54+
- Read about how it works on the example's [README page](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/managedvms/sparkjava#how-does-it-work).
55+
- [`StorageExample`](https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/gcloud/examples/StorageExample.java) - A simple command line interface providing some of Cloud Storage's functionality
56+
- Read more about using this application on the [`gcloud-java-examples` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/StorageExample.html).
5957

6058
Specifying a Project ID
6159
-----------------------
@@ -125,39 +123,38 @@ Google Cloud BigQuery (Alpha)
125123
126124
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you
127125
must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
128-
Complete source code can be found at
129-
[CreateTableAndLoadData.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/bigquery/snippets/CreateTableAndLoadData.java).
130126
131127
```java
128+
import com.google.gcloud.bigquery.BaseTableInfo;
132129
import com.google.gcloud.bigquery.BigQuery;
133130
import com.google.gcloud.bigquery.BigQueryOptions;
134131
import com.google.gcloud.bigquery.Field;
135-
import com.google.gcloud.bigquery.FormatOptions;
136-
import com.google.gcloud.bigquery.Job;
132+
import com.google.gcloud.bigquery.JobStatus;
133+
import com.google.gcloud.bigquery.LoadJobInfo;
137134
import com.google.gcloud.bigquery.Schema;
138-
import com.google.gcloud.bigquery.StandardTableDefinition;
139-
import com.google.gcloud.bigquery.Table;
140135
import com.google.gcloud.bigquery.TableId;
141136
import com.google.gcloud.bigquery.TableInfo;
142137
143138
BigQuery bigquery = BigQueryOptions.defaultInstance().service();
144139
TableId tableId = TableId.of("dataset", "table");
145-
Table table = bigquery.getTable(tableId);
146-
if (table == null) {
140+
BaseTableInfo info = bigquery.getTable(tableId);
141+
if (info == null) {
147142
System.out.println("Creating table " + tableId);
148143
Field integerField = Field.of("fieldName", Field.Type.integer());
149-
Schema schema = Schema.of(integerField);
150-
table = bigquery.create(TableInfo.of(tableId, StandardTableDefinition.of(schema)));
151-
}
152-
System.out.println("Loading data into table " + tableId);
153-
Job loadJob = table.load(FormatOptions.csv(), "gs://bucket/path");
154-
while (!loadJob.isDone()) {
155-
Thread.sleep(1000L);
156-
}
157-
if (loadJob.status().error() != null) {
158-
System.out.println("Job completed with errors");
144+
bigquery.create(TableInfo.of(tableId, Schema.of(integerField)));
159145
} else {
160-
System.out.println("Job succeeded");
146+
System.out.println("Loading data into table " + tableId);
147+
LoadJobInfo loadJob = LoadJobInfo.of(tableId, "gs://bucket/path");
148+
loadJob = bigquery.create(loadJob);
149+
while (loadJob.status().state() != JobStatus.State.DONE) {
150+
Thread.sleep(1000L);
151+
loadJob = bigquery.getJob(loadJob.jobId());
152+
}
153+
if (loadJob.status().error() != null) {
154+
System.out.println("Job completed with errors");
155+
} else {
156+
System.out.println("Job succeeded");
157+
}
161158
}
162159
```
163160
@@ -171,32 +168,8 @@ Google Cloud Datastore
171168
172169
#### Preview
173170
174-
Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
175-
176-
The first snippet shows how to create a Datastore entity. Complete source code can be found at
177-
[CreateEntity.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/CreateEntity.java).
178-
179-
```java
180-
import com.google.gcloud.datastore.Datastore;
181-
import com.google.gcloud.datastore.DatastoreOptions;
182-
import com.google.gcloud.datastore.DateTime;
183-
import com.google.gcloud.datastore.Entity;
184-
import com.google.gcloud.datastore.Key;
185-
import com.google.gcloud.datastore.KeyFactory;
171+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
186172
187-
Datastore datastore = DatastoreOptions.defaultInstance().service();
188-
KeyFactory keyFactory = datastore.newKeyFactory().kind("keyKind");
189-
Key key = keyFactory.newKey("keyName");
190-
Entity entity = Entity.builder(key)
191-
.set("name", "John Doe")
192-
.set("age", 30)
193-
.set("access_time", DateTime.now())
194-
.build();
195-
datastore.put(entity);
196-
```
197-
The second snippet shows how to update a Datastore entity if it exists. Complete source code can be
198-
found at
199-
[UpdateEntity.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/snippets/UpdateEntity.java).
200173
```java
201174
import com.google.gcloud.datastore.Datastore;
202175
import com.google.gcloud.datastore.DatastoreOptions;
@@ -206,10 +179,17 @@ import com.google.gcloud.datastore.Key;
206179
import com.google.gcloud.datastore.KeyFactory;
207180
208181
Datastore datastore = DatastoreOptions.defaultInstance().service();
209-
KeyFactory keyFactory = datastore.newKeyFactory().kind("keyKind");
210-
Key key = keyFactory.newKey("keyName");
182+
KeyFactory keyFactory = datastore.newKeyFactory().kind(KIND);
183+
Key key = keyFactory.newKey(keyName);
211184
Entity entity = datastore.get(key);
212-
if (entity != null) {
185+
if (entity == null) {
186+
entity = Entity.builder(key)
187+
.set("name", "John Do")
188+
.set("age", 30)
189+
.set("access_time", DateTime.now())
190+
.build();
191+
datastore.put(entity);
192+
} else {
213193
System.out.println("Updating access_time for " + entity.getString("name"));
214194
entity = Entity.builder(entity)
215195
.set("access_time", DateTime.now())
@@ -227,26 +207,22 @@ Google Cloud Resource Manager (Alpha)
227207
#### Preview
228208
229209
Here is a code snippet showing a simple usage example. Note that you must supply Google SDK credentials for this service, not other forms of authentication listed in the [Authentication section](#authentication).
230-
Complete source code can be found at
231-
[UpdateAndListProjects.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/resourcemanager/snippets/UpdateAndListProjects.java).
210+
232211
```java
233-
import com.google.gcloud.resourcemanager.Project;
212+
import com.google.gcloud.resourcemanager.ProjectInfo;
234213
import com.google.gcloud.resourcemanager.ResourceManager;
235214
import com.google.gcloud.resourcemanager.ResourceManagerOptions;
236215
237216
import java.util.Iterator;
238217
239218
ResourceManager resourceManager = ResourceManagerOptions.defaultInstance().service();
240-
Project project = resourceManager.get("some-project-id"); // Use an existing project's ID
241-
if (project != null) {
242-
Project newProject = project.toBuilder()
243-
.addLabel("launch-status", "in-development")
244-
.build()
245-
.replace();
246-
System.out.println("Updated the labels of project " + newProject.projectId()
247-
+ " to be " + newProject.labels());
248-
}
249-
Iterator<Project> projectIterator = resourceManager.list().iterateAll();
219+
ProjectInfo myProject = resourceManager.get("some-project-id"); // Use an existing project's ID
220+
ProjectInfo newProjectInfo = resourceManager.replace(myProject.toBuilder()
221+
.addLabel("launch-status", "in-development").build());
222+
System.out.println("Updated the labels of project " + newProjectInfo.projectId()
223+
+ " to be " + newProjectInfo.labels());
224+
// List all the projects you have permission to view.
225+
Iterator<ProjectInfo> projectIterator = resourceManager.list().iterateAll();
250226
System.out.println("Projects I can view:");
251227
while (projectIterator.hasNext()) {
252228
System.out.println(projectIterator.next().projectId());
@@ -263,28 +239,8 @@ Google Cloud Storage
263239
264240
#### Preview
265241
266-
Here are two code snippets showing simple usage examples from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
267-
268-
The first snippet shows how to create a Storage blob. Complete source code can be found at
269-
[CreateBlob.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/CreateBlob.java).
270-
271-
```java
272-
import static java.nio.charset.StandardCharsets.UTF_8;
273-
274-
import com.google.gcloud.storage.Blob;
275-
import com.google.gcloud.storage.BlobId;
276-
import com.google.gcloud.storage.BlobInfo;
277-
import com.google.gcloud.storage.Storage;
278-
import com.google.gcloud.storage.StorageOptions;
242+
Here is a code snippet showing a simple usage example from within Compute/App Engine. Note that you must [supply credentials](#authentication) and a project ID if running this snippet elsewhere.
279243
280-
Storage storage = StorageOptions.defaultInstance().service();
281-
BlobId blobId = BlobId.of("bucket", "blob_name");
282-
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
283-
Blob blob = storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
284-
```
285-
The second snippet shows how to update a Storage blob if it exists. Complete source code can be
286-
found at
287-
[UpdateBlob.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/storage/snippets/UpdateBlob.java).
288244
```java
289245
import static java.nio.charset.StandardCharsets.UTF_8;
290246
@@ -298,8 +254,12 @@ import java.nio.channels.WritableByteChannel;
298254
299255
Storage storage = StorageOptions.defaultInstance().service();
300256
BlobId blobId = BlobId.of("bucket", "blob_name");
301-
Blob blob = storage.get(blobId);
302-
if (blob != null) {
257+
Blob blob = Blob.get(storage, blobId);
258+
if (blob == null) {
259+
BlobInfo blobInfo = BlobInfo.builder(blobId).contentType("text/plain").build();
260+
storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));
261+
} else {
262+
System.out.println("Updating content for " + blobId.name());
303263
byte[] prevContent = blob.content();
304264
System.out.println(new String(prevContent, UTF_8));
305265
WritableByteChannel channel = blob.writer();

branches/dns-alpha/RELEASING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ As mentioned before, there is an optional version argument. By default, the scr
2626

2727
6. Create and merge in another PR to reflect the updated project version. For an example of what this PR should look like, see [#227](https://github.com/GoogleCloudPlatform/gcloud-java/pull/227).
2828

29-
7. Be sure to update App Engine documentation and [java-docs-samples](https://github.com/GoogleCloudPlatform/java-docs-samples) code as necessary. See directions [here](https://docs.google.com/a/google.com/document/d/1SS3xNn2v0qW7EadGUPBUAPIQAH5VY6WSFmT17ZjjUVE/edit?usp=sharing).
30-
3129
### To push a snapshot version
3230

3331
Pushing a snapshot is completely automated. If "-SNAPSHOT" is included in the version denoted by the base directory's pom.xml, then an updated artifact will be pushed to the snapshot repository when Travis CI successfully completes a non-PR build.

branches/dns-alpha/codacy-conf.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)