Skip to content

Commit 40e83a1

Browse files
committed
Merge branch 'master' into pubsub-ordering-keys
2 parents 18aca86 + d931fac commit 40e83a1

5 files changed

Lines changed: 135 additions & 48 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ Java idiomatic client for [Google Cloud Platform][cloud-platform] services.
1313
This library supports the following Google Cloud Platform services with clients at a [GA](#versioning) quality level:
1414
- [BigQuery](google-cloud-clients/google-cloud-bigquery) (GA)
1515
- [Cloud Datastore](google-cloud-clients/google-cloud-datastore) (GA)
16+
- [Cloud Firestore](google-cloud-clients/google-cloud-firestore) (GA)
17+
- [Cloud KMS](google-cloud-clients/google-cloud-kms) (GA)
1618
- [Cloud Natural Language](google-cloud-clients/google-cloud-language) (GA)
1719
- [Cloud Pub/Sub](google-cloud-clients/google-cloud-pubsub) (GA)
1820
- [Cloud Spanner](google-cloud-clients/google-cloud-spanner) (GA)
21+
- [Cloud Speech](google-cloud-clients/google-cloud-speech) (GA)
1922
- [Cloud Storage](google-cloud-clients/google-cloud-storage) (GA)
2023
- [Cloud Translation](google-cloud-clients/google-cloud-translate) (GA)
2124
- [Cloud Vision](google-cloud-clients/google-cloud-vision) (GA)
@@ -29,10 +32,7 @@ This library supports the following Google Cloud Platform services with clients
2932
- [Cloud AutoML](google-cloud-clients/google-cloud-automl) (Beta)
3033
- [Cloud Container Analysis](google-cloud-clients/google-cloud-containeranalysis) (Beta)
3134
- [Cloud Data Loss Prevention](google-cloud-clients/google-cloud-dlp) (Beta)
32-
- [Cloud Firestore](google-cloud-clients/google-cloud-firestore) (Beta)
3335
- [Cloud IoT Core](google-cloud-clients/google-cloud-iot) (Beta)
34-
- [Cloud KMS](google-cloud-clients/google-cloud-kms) (Beta)
35-
- [Cloud Speech](google-cloud-clients/google-cloud-speech) (Beta)
3636
- [Cloud Text-to-Speech](google-cloud-clients/google-cloud-texttospeech) (Beta)
3737
- [Cloud Video Intelligence](google-cloud-clients/google-cloud-video-intelligence) (Beta)
3838
- [Kubernetes Engine](google-cloud-clients/google-cloud-container) (Beta)

google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java

Lines changed: 114 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import com.google.firestore.admin.v1.ListFieldsResponse;
4444
import com.google.firestore.admin.v1.ListIndexesRequest;
4545
import com.google.firestore.admin.v1.ListIndexesResponse;
46+
import com.google.firestore.admin.v1.ParentName;
4647
import com.google.firestore.admin.v1.UpdateFieldRequest;
4748
import com.google.longrunning.Operation;
4849
import com.google.protobuf.Empty;
@@ -62,9 +63,9 @@
6263
* <pre>
6364
* <code>
6465
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
65-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
66+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
6667
* Index index = Index.newBuilder().build();
67-
* Operation response = firestoreAdminClient.createIndex(formattedParent, index);
68+
* Operation response = firestoreAdminClient.createIndex(parent, index);
6869
* }
6970
* </code>
7071
* </pre>
@@ -184,9 +185,41 @@ public FirestoreAdminStub getStub() {
184185
*
185186
* <pre><code>
186187
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
187-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
188+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
188189
* Index index = Index.newBuilder().build();
189-
* Operation response = firestoreAdminClient.createIndex(formattedParent, index);
190+
* Operation response = firestoreAdminClient.createIndex(parent, index);
191+
* }
192+
* </code></pre>
193+
*
194+
* @param parent A parent name of the form
195+
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
196+
* @param index The composite index to create.
197+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
198+
*/
199+
public final Operation createIndex(ParentName parent, Index index) {
200+
201+
CreateIndexRequest request =
202+
CreateIndexRequest.newBuilder()
203+
.setParent(parent == null ? null : parent.toString())
204+
.setIndex(index)
205+
.build();
206+
return createIndex(request);
207+
}
208+
209+
// AUTO-GENERATED DOCUMENTATION AND METHOD
210+
/**
211+
* Creates a composite index. This returns a
212+
* [google.longrunning.Operation][google.longrunning.Operation] which may be used to track the
213+
* status of the creation. The metadata for the operation will be the type
214+
* [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
215+
*
216+
* <p>Sample code:
217+
*
218+
* <pre><code>
219+
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
220+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
221+
* Index index = Index.newBuilder().build();
222+
* Operation response = firestoreAdminClient.createIndex(parent.toString(), index);
190223
* }
191224
* </code></pre>
192225
*
@@ -213,10 +246,10 @@ public final Operation createIndex(String parent, Index index) {
213246
*
214247
* <pre><code>
215248
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
216-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
249+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
217250
* Index index = Index.newBuilder().build();
218251
* CreateIndexRequest request = CreateIndexRequest.newBuilder()
219-
* .setParent(formattedParent)
252+
* .setParent(parent.toString())
220253
* .setIndex(index)
221254
* .build();
222255
* Operation response = firestoreAdminClient.createIndex(request);
@@ -241,10 +274,10 @@ public final Operation createIndex(CreateIndexRequest request) {
241274
*
242275
* <pre><code>
243276
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
244-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
277+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
245278
* Index index = Index.newBuilder().build();
246279
* CreateIndexRequest request = CreateIndexRequest.newBuilder()
247-
* .setParent(formattedParent)
280+
* .setParent(parent.toString())
248281
* .setIndex(index)
249282
* .build();
250283
* ApiFuture&lt;Operation&gt; future = firestoreAdminClient.createIndexCallable().futureCall(request);
@@ -265,8 +298,35 @@ public final UnaryCallable<CreateIndexRequest, Operation> createIndexCallable()
265298
*
266299
* <pre><code>
267300
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
268-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
269-
* for (Index element : firestoreAdminClient.listIndexes(formattedParent).iterateAll()) {
301+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
302+
* for (Index element : firestoreAdminClient.listIndexes(parent).iterateAll()) {
303+
* // doThingsWith(element);
304+
* }
305+
* }
306+
* </code></pre>
307+
*
308+
* @param parent A parent name of the form
309+
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
310+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
311+
*/
312+
public final ListIndexesPagedResponse listIndexes(ParentName parent) {
313+
ListIndexesRequest request =
314+
ListIndexesRequest.newBuilder()
315+
.setParent(parent == null ? null : parent.toString())
316+
.build();
317+
return listIndexes(request);
318+
}
319+
320+
// AUTO-GENERATED DOCUMENTATION AND METHOD
321+
/**
322+
* Lists composite indexes.
323+
*
324+
* <p>Sample code:
325+
*
326+
* <pre><code>
327+
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
328+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
329+
* for (Index element : firestoreAdminClient.listIndexes(parent.toString()).iterateAll()) {
270330
* // doThingsWith(element);
271331
* }
272332
* }
@@ -289,9 +349,9 @@ public final ListIndexesPagedResponse listIndexes(String parent) {
289349
*
290350
* <pre><code>
291351
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
292-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
352+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
293353
* ListIndexesRequest request = ListIndexesRequest.newBuilder()
294-
* .setParent(formattedParent)
354+
* .setParent(parent.toString())
295355
* .build();
296356
* for (Index element : firestoreAdminClient.listIndexes(request).iterateAll()) {
297357
* // doThingsWith(element);
@@ -314,9 +374,9 @@ public final ListIndexesPagedResponse listIndexes(ListIndexesRequest request) {
314374
*
315375
* <pre><code>
316376
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
317-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
377+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
318378
* ListIndexesRequest request = ListIndexesRequest.newBuilder()
319-
* .setParent(formattedParent)
379+
* .setParent(parent.toString())
320380
* .build();
321381
* ApiFuture&lt;ListIndexesPagedResponse&gt; future = firestoreAdminClient.listIndexesPagedCallable().futureCall(request);
322382
* // Do something
@@ -339,9 +399,9 @@ public final ListIndexesPagedResponse listIndexes(ListIndexesRequest request) {
339399
*
340400
* <pre><code>
341401
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
342-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
402+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
343403
* ListIndexesRequest request = ListIndexesRequest.newBuilder()
344-
* .setParent(formattedParent)
404+
* .setParent(parent.toString())
345405
* .build();
346406
* while (true) {
347407
* ListIndexesResponse response = firestoreAdminClient.listIndexesCallable().call(request);
@@ -867,8 +927,38 @@ public final UnaryCallable<GetFieldRequest, Field> getFieldCallable() {
867927
*
868928
* <pre><code>
869929
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
870-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
871-
* for (Field element : firestoreAdminClient.listFields(formattedParent).iterateAll()) {
930+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
931+
* for (Field element : firestoreAdminClient.listFields(parent).iterateAll()) {
932+
* // doThingsWith(element);
933+
* }
934+
* }
935+
* </code></pre>
936+
*
937+
* @param parent A parent name of the form
938+
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
939+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
940+
*/
941+
public final ListFieldsPagedResponse listFields(ParentName parent) {
942+
ListFieldsRequest request =
943+
ListFieldsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
944+
return listFields(request);
945+
}
946+
947+
// AUTO-GENERATED DOCUMENTATION AND METHOD
948+
/**
949+
* Lists the field configuration and metadata for this database.
950+
*
951+
* <p>Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
952+
* only supports listing fields that have been explicitly overridden. To issue this query, call
953+
* [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
954+
* filter set to `indexConfig.usesAncestorConfig:false`.
955+
*
956+
* <p>Sample code:
957+
*
958+
* <pre><code>
959+
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
960+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
961+
* for (Field element : firestoreAdminClient.listFields(parent.toString()).iterateAll()) {
872962
* // doThingsWith(element);
873963
* }
874964
* }
@@ -896,9 +986,9 @@ public final ListFieldsPagedResponse listFields(String parent) {
896986
*
897987
* <pre><code>
898988
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
899-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
989+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
900990
* ListFieldsRequest request = ListFieldsRequest.newBuilder()
901-
* .setParent(formattedParent)
991+
* .setParent(parent.toString())
902992
* .build();
903993
* for (Field element : firestoreAdminClient.listFields(request).iterateAll()) {
904994
* // doThingsWith(element);
@@ -926,9 +1016,9 @@ public final ListFieldsPagedResponse listFields(ListFieldsRequest request) {
9261016
*
9271017
* <pre><code>
9281018
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
929-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
1019+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
9301020
* ListFieldsRequest request = ListFieldsRequest.newBuilder()
931-
* .setParent(formattedParent)
1021+
* .setParent(parent.toString())
9321022
* .build();
9331023
* ApiFuture&lt;ListFieldsPagedResponse&gt; future = firestoreAdminClient.listFieldsPagedCallable().futureCall(request);
9341024
* // Do something
@@ -955,9 +1045,9 @@ public final UnaryCallable<ListFieldsRequest, ListFieldsPagedResponse> listField
9551045
*
9561046
* <pre><code>
9571047
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
958-
* String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
1048+
* ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
9591049
* ListFieldsRequest request = ListFieldsRequest.newBuilder()
960-
* .setParent(formattedParent)
1050+
* .setParent(parent.toString())
9611051
* .build();
9621052
* while (true) {
9631053
* ListFieldsResponse response = firestoreAdminClient.listFieldsCallable().call(request);

google-cloud-clients/google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1/FirestoreAdminClientTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ public void createIndexTest() {
103103
Operation expectedResponse = Operation.newBuilder().setName(name).setDone(done).build();
104104
mockFirestoreAdmin.addResponse(expectedResponse);
105105

106-
String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
106+
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
107107
Index index = Index.newBuilder().build();
108108

109-
Operation actualResponse = client.createIndex(formattedParent, index);
109+
Operation actualResponse = client.createIndex(parent, index);
110110
Assert.assertEquals(expectedResponse, actualResponse);
111111

112112
List<AbstractMessage> actualRequests = mockFirestoreAdmin.getRequests();
113113
Assert.assertEquals(1, actualRequests.size());
114114
CreateIndexRequest actualRequest = (CreateIndexRequest) actualRequests.get(0);
115115

116-
Assert.assertEquals(formattedParent, actualRequest.getParent());
116+
Assert.assertEquals(parent, ParentName.parse(actualRequest.getParent()));
117117
Assert.assertEquals(index, actualRequest.getIndex());
118118
Assert.assertTrue(
119119
channelProvider.isHeaderSent(
@@ -128,10 +128,10 @@ public void createIndexExceptionTest() throws Exception {
128128
mockFirestoreAdmin.addException(exception);
129129

130130
try {
131-
String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
131+
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
132132
Index index = Index.newBuilder().build();
133133

134-
client.createIndex(formattedParent, index);
134+
client.createIndex(parent, index);
135135
Assert.fail("No exception raised");
136136
} catch (InvalidArgumentException e) {
137137
// Expected exception
@@ -151,9 +151,9 @@ public void listIndexesTest() {
151151
.build();
152152
mockFirestoreAdmin.addResponse(expectedResponse);
153153

154-
String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
154+
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
155155

156-
ListIndexesPagedResponse pagedListResponse = client.listIndexes(formattedParent);
156+
ListIndexesPagedResponse pagedListResponse = client.listIndexes(parent);
157157

158158
List<Index> resources = Lists.newArrayList(pagedListResponse.iterateAll());
159159
Assert.assertEquals(1, resources.size());
@@ -163,7 +163,7 @@ public void listIndexesTest() {
163163
Assert.assertEquals(1, actualRequests.size());
164164
ListIndexesRequest actualRequest = (ListIndexesRequest) actualRequests.get(0);
165165

166-
Assert.assertEquals(formattedParent, actualRequest.getParent());
166+
Assert.assertEquals(parent, ParentName.parse(actualRequest.getParent()));
167167
Assert.assertTrue(
168168
channelProvider.isHeaderSent(
169169
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -177,9 +177,9 @@ public void listIndexesExceptionTest() throws Exception {
177177
mockFirestoreAdmin.addException(exception);
178178

179179
try {
180-
String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
180+
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
181181

182-
client.listIndexes(formattedParent);
182+
client.listIndexes(parent);
183183
Assert.fail("No exception raised");
184184
} catch (InvalidArgumentException e) {
185185
// Expected exception
@@ -394,9 +394,9 @@ public void listFieldsTest() {
394394
.build();
395395
mockFirestoreAdmin.addResponse(expectedResponse);
396396

397-
String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
397+
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
398398

399-
ListFieldsPagedResponse pagedListResponse = client.listFields(formattedParent);
399+
ListFieldsPagedResponse pagedListResponse = client.listFields(parent);
400400

401401
List<Field> resources = Lists.newArrayList(pagedListResponse.iterateAll());
402402
Assert.assertEquals(1, resources.size());
@@ -406,7 +406,7 @@ public void listFieldsTest() {
406406
Assert.assertEquals(1, actualRequests.size());
407407
ListFieldsRequest actualRequest = (ListFieldsRequest) actualRequests.get(0);
408408

409-
Assert.assertEquals(formattedParent, actualRequest.getParent());
409+
Assert.assertEquals(parent, ParentName.parse(actualRequest.getParent()));
410410
Assert.assertTrue(
411411
channelProvider.isHeaderSent(
412412
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -420,9 +420,9 @@ public void listFieldsExceptionTest() throws Exception {
420420
mockFirestoreAdmin.addException(exception);
421421

422422
try {
423-
String formattedParent = ParentName.format("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
423+
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
424424

425-
client.listFields(formattedParent);
425+
client.listFields(parent);
426426
Assert.fail("No exception raised");
427427
} catch (InvalidArgumentException e) {
428428
// Expected exception

google-cloud-clients/google-cloud-firestore/synth.metadata

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"updateTime": "2019-04-17T07:46:10.093356Z",
2+
"updateTime": "2019-04-19T07:44:53.419733Z",
33
"sources": [
44
{
55
"generator": {
@@ -12,8 +12,8 @@
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "6f7c8618e0a3ef1f3ce504586e9de58aed7ccc79",
16-
"internalRef": "243860937"
15+
"sha": "3369c803f56d52662ea3792076deb8545183bdb0",
16+
"internalRef": "244282812"
1717
}
1818
}
1919
],

google-cloud-clients/google-cloud-speech/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ Java idiomatic client for [Google Cloud Speech][cloud-speech].
1010
- [Product Documentation][speech-product-docs]
1111
- [Client Library Documentation][speech-client-lib-docs]
1212

13-
> Note: This client is a work-in-progress, and may occasionally
14-
> make backwards-incompatible changes.
15-
1613
Quickstart
1714
----------
1815

0 commit comments

Comments
 (0)