Skip to content

Commit fc5d091

Browse files
committed
Merge pull request #798 from shinfan/pubsub-alpha
Merge pubsub-alpha from master
2 parents 1a0e970 + a1b6c65 commit fc5d091

File tree

164 files changed

+15695
-1395
lines changed

Some content is hidden

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

164 files changed

+15695
-1395
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ 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+
3537
Adding Features
3638
---------------
3739
In order to add a feature to gcloud-java:

README.md

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
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)
99
[![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)
1011

1112
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
1213
- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs)
@@ -15,6 +16,7 @@ This client supports the following Google Cloud Platform services:
1516

1617
- [Google Cloud BigQuery] (#google-cloud-bigquery-alpha) (Alpha)
1718
- [Google Cloud Datastore] (#google-cloud-datastore)
19+
- [Google Cloud DNS] (#google-cloud-dns-alpha) (Alpha)
1820
- [Google Cloud Resource Manager] (#google-cloud-resource-manager-alpha) (Alpha)
1921
- [Google Cloud Storage] (#google-cloud-storage)
2022

@@ -28,33 +30,35 @@ If you are using Maven, add this to your pom.xml file
2830
<dependency>
2931
<groupId>com.google.gcloud</groupId>
3032
<artifactId>gcloud-java</artifactId>
31-
<version>0.1.3</version>
33+
<version>0.1.5</version>
3234
</dependency>
3335
```
3436
If you are using Gradle, add this to your dependencies
3537
```Groovy
36-
compile 'com.google.gcloud:gcloud-java:0.1.3'
38+
compile 'com.google.gcloud:gcloud-java:0.1.5'
3739
```
3840
If you are using SBT, add this to your dependencies
3941
```Scala
40-
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.3"
42+
libraryDependencies += "com.google.gcloud" % "gcloud-java" % "0.1.5"
4143
```
4244

4345
Example Applications
4446
--------------------
4547

4648
- [`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
47-
- 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).
49+
- 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).
4850
- [`Bookshelf`](https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf) - An App Engine app that manages a virtual bookshelf.
4951
- This app uses `gcloud-java` to interface with Cloud Datastore and Cloud Storage. It also uses Cloud SQL, another Google Cloud Platform service.
50-
- [`DatastoreExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) - A simple command line interface for the Cloud Datastore
51-
- 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).
52+
- [`DatastoreExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/datastore/DatastoreExample.java) - A simple command line interface for Cloud Datastore
53+
- 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).
54+
- [`DnsExample`](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/DnsExample.java) - A simple command line interface for Cloud DNS
55+
- Read more about using this application on the [`DnsExample` docs page](http://googlecloudplatform.github.io/gcloud-java/apidocs/?com/google/gcloud/examples/dns/DnsExample.html).
5256
- [`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
53-
- 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).
57+
- 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).
5458
- [`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.
5559
- 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).
5660
- [`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
57-
- 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).
61+
- 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).
5862

5963
Specifying a Project ID
6064
-----------------------
@@ -217,6 +221,71 @@ if (entity != null) {
217221
}
218222
```
219223
224+
Google Cloud DNS (Alpha)
225+
----------------------
226+
- [API Documentation][dns-api]
227+
- [Official Documentation][cloud-dns-docs]
228+
229+
*Follow the [activation instructions][cloud-dns-activation] to use the Google Cloud DNS API with your project.*
230+
231+
#### Preview
232+
233+
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.
234+
235+
The first snippet shows how to create a zone resource. Complete source code can be found on
236+
[CreateZone.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateZone.java).
237+
238+
```java
239+
import com.google.gcloud.dns.Dns;
240+
import com.google.gcloud.dns.DnsOptions;
241+
import com.google.gcloud.dns.Zone;
242+
import com.google.gcloud.dns.ZoneInfo;
243+
244+
Dns dns = DnsOptions.defaultInstance().service();
245+
String zoneName = "my-unique-zone";
246+
String domainName = "someexampledomain.com.";
247+
String description = "This is a gcloud-java-dns sample zone.";
248+
ZoneInfo zoneInfo = ZoneInfo.of(zoneName, domainName, description);
249+
Zone zone = dns.create(zoneInfo);
250+
```
251+
252+
The second snippet shows how to create records inside a zone. The complete code can be found on [CreateOrUpdateRecordSets.java](./gcloud-java-examples/src/main/java/com/google/gcloud/examples/dns/snippets/CreateOrUpdateRecordSets.java).
253+
254+
```java
255+
import com.google.gcloud.dns.ChangeRequestInfo;
256+
import com.google.gcloud.dns.Dns;
257+
import com.google.gcloud.dns.DnsOptions;
258+
import com.google.gcloud.dns.RecordSet;
259+
import com.google.gcloud.dns.Zone;
260+
261+
import java.util.Iterator;
262+
import java.util.concurrent.TimeUnit;
263+
264+
Dns dns = DnsOptions.defaultInstance().service();
265+
String zoneName = "my-unique-zone";
266+
Zone zone = dns.getZone(zoneName);
267+
String ip = "12.13.14.15";
268+
RecordSet toCreate = RecordSet.builder("www.someexampledomain.com.", RecordSet.Type.A)
269+
.ttl(24, TimeUnit.HOURS)
270+
.addRecord(ip)
271+
.build();
272+
ChangeRequestInfo.Builder changeBuilder = ChangeRequestInfo.builder().add(toCreate);
273+
274+
// Verify that the record does not exist yet.
275+
// If it does exist, we will overwrite it with our prepared record.
276+
Iterator<RecordSet> recordSetIterator = zone.listRecordSets().iterateAll();
277+
while (recordSetIterator.hasNext()) {
278+
RecordSet current = recordSetIterator.next();
279+
if (toCreate.name().equals(current.name()) &&
280+
toCreate.type().equals(current.type())) {
281+
changeBuilder.delete(current);
282+
}
283+
}
284+
285+
ChangeRequestInfo changeRequest = changeBuilder.build();
286+
zone.applyChangeRequest(changeRequest);
287+
```
288+
220289
Google Cloud Resource Manager (Alpha)
221290
----------------------
222291
@@ -358,6 +427,10 @@ Apache 2.0 - See [LICENSE] for more information.
358427
[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate
359428
[datastore-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/datastore/package-summary.html
360429
430+
[dns-api]: http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/dns/package-summary.html
431+
[cloud-dns-docs]: https://cloud.google.com/dns/docs
432+
[cloud-dns-activation]: https://console.cloud.google.com/start/api?id=dns
433+
361434
[cloud-pubsub]: https://cloud.google.com/pubsub/
362435
[cloud-pubsub-docs]: https://cloud.google.com/pubsub/docs
363436

codacy-conf.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

gcloud-java-bigquery/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Java idiomatic client for [Google Cloud BigQuery] (https://cloud.google.com/bigq
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-bigquery.svg)]( https://img.shields.io/maven-central/v/com.google.gcloud/gcloud-java-bigquery.svg)
99
[![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)
1011

1112
- [Homepage] (https://googlecloudplatform.github.io/gcloud-java/)
1213
- [API Documentation] (http://googlecloudplatform.github.io/gcloud-java/apidocs/index.html?com/google/gcloud/bigquery/package-summary.html)
@@ -21,22 +22,22 @@ If you are using Maven, add this to your pom.xml file
2122
<dependency>
2223
<groupId>com.google.gcloud</groupId>
2324
<artifactId>gcloud-java-bigquery</artifactId>
24-
<version>0.1.3</version>
25+
<version>0.1.5</version>
2526
</dependency>
2627
```
2728
If you are using Gradle, add this to your dependencies
2829
```Groovy
29-
compile 'com.google.gcloud:gcloud-java-bigquery:0.1.3'
30+
compile 'com.google.gcloud:gcloud-java-bigquery:0.1.5'
3031
```
3132
If you are using SBT, add this to your dependencies
3233
```Scala
33-
libraryDependencies += "com.google.gcloud" % "gcloud-java-bigquery" % "0.1.3"
34+
libraryDependencies += "com.google.gcloud" % "gcloud-java-bigquery" % "0.1.5"
3435
```
3536

3637
Example Application
3738
-------------------
3839
- [`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.
39-
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).
40+
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).
4041

4142
Authentication
4243
--------------
@@ -184,7 +185,7 @@ Then add the following code to run the query and wait for the result:
184185
QueryRequest queryRequest =
185186
QueryRequest.builder("SELECT * FROM my_dataset_id.my_table_id")
186187
.maxWaitTime(60000L)
187-
.maxResults(1000L)
188+
.pageSize(1000L)
188189
.build();
189190
// Request query to be executed and wait for results
190191
QueryResponse queryResponse = bigquery.query(queryRequest);

gcloud-java-bigquery/pom.xml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<parent>
1111
<groupId>com.google.gcloud</groupId>
1212
<artifactId>gcloud-java-pom</artifactId>
13-
<version>0.1.4-SNAPSHOT</version>
13+
<version>0.1.6-SNAPSHOT</version>
1414
</parent>
1515
<properties>
1616
<site.installationModule>gcloud-java-bigquery</site.installationModule>
@@ -30,15 +30,22 @@
3030
<dependency>
3131
<groupId>com.google.apis</groupId>
3232
<artifactId>google-api-services-bigquery</artifactId>
33-
<version>v2-rev254-1.21.0</version>
33+
<version>v2-rev270-1.21.0</version>
3434
<scope>compile</scope>
3535
<exclusions>
36-
<exclusion>
37-
<groupId>com.google.guava</groupId>
38-
<artifactId>guava-jdk5</artifactId>
39-
</exclusion>
36+
<exclusion>
37+
<groupId>com.google.guava</groupId>
38+
<artifactId>guava-jdk5</artifactId>
39+
</exclusion>
4040
</exclusions>
4141
</dependency>
42+
<dependency>
43+
<groupId>${project.groupId}</groupId>
44+
<artifactId>gcloud-java-core</artifactId>
45+
<version>${project.version}</version>
46+
<type>test-jar</type>
47+
<scope>test</scope>
48+
</dependency>
4249
<dependency>
4350
<groupId>junit</groupId>
4451
<artifactId>junit</artifactId>
@@ -48,7 +55,7 @@
4855
<dependency>
4956
<groupId>org.easymock</groupId>
5057
<artifactId>easymock</artifactId>
51-
<version>3.3</version>
58+
<version>3.4</version>
5259
<scope>test</scope>
5360
</dependency>
5461
</dependencies>

0 commit comments

Comments
 (0)