diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java index 54d21bcb5..d06056bbf 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java @@ -20,32 +20,40 @@ import com.google.api.core.ApiFutures; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.longrunning.OperationFuture; import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.firestore.v1.stub.FirestoreAdminStub; import com.google.cloud.firestore.v1.stub.FirestoreAdminStubSettings; import com.google.common.util.concurrent.MoreExecutors; +import com.google.firestore.admin.v1.CollectionGroupName; import com.google.firestore.admin.v1.CreateIndexRequest; import com.google.firestore.admin.v1.DatabaseName; import com.google.firestore.admin.v1.DeleteIndexRequest; +import com.google.firestore.admin.v1.ExportDocumentsMetadata; import com.google.firestore.admin.v1.ExportDocumentsRequest; +import com.google.firestore.admin.v1.ExportDocumentsResponse; import com.google.firestore.admin.v1.Field; import com.google.firestore.admin.v1.FieldName; +import com.google.firestore.admin.v1.FieldOperationMetadata; import com.google.firestore.admin.v1.GetFieldRequest; import com.google.firestore.admin.v1.GetIndexRequest; +import com.google.firestore.admin.v1.ImportDocumentsMetadata; import com.google.firestore.admin.v1.ImportDocumentsRequest; import com.google.firestore.admin.v1.Index; import com.google.firestore.admin.v1.IndexName; +import com.google.firestore.admin.v1.IndexOperationMetadata; import com.google.firestore.admin.v1.ListFieldsRequest; import com.google.firestore.admin.v1.ListFieldsResponse; import com.google.firestore.admin.v1.ListIndexesRequest; import com.google.firestore.admin.v1.ListIndexesResponse; -import com.google.firestore.admin.v1.ParentName; import com.google.firestore.admin.v1.UpdateFieldRequest; import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import java.io.IOException; import java.util.List; @@ -63,9 +71,8 @@ *
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
- * Index index = Index.newBuilder().build();
- * Operation response = firestoreAdminClient.createIndex(parent, index);
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
+ * firestoreAdminClient.deleteIndex(name);
* }
*
*
@@ -125,6 +132,7 @@
public class FirestoreAdminClient implements BackgroundResource {
private final FirestoreAdminSettings settings;
private final FirestoreAdminStub stub;
+ private final OperationsClient operationsClient;
/** Constructs an instance of FirestoreAdminClient with default settings. */
public static final FirestoreAdminClient create() throws IOException {
@@ -157,12 +165,14 @@ public static final FirestoreAdminClient create(FirestoreAdminStub stub) {
protected FirestoreAdminClient(FirestoreAdminSettings settings) throws IOException {
this.settings = settings;
this.stub = ((FirestoreAdminStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected FirestoreAdminClient(FirestoreAdminStub stub) {
this.settings = null;
this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
public final FirestoreAdminSettings getSettings() {
@@ -174,6 +184,249 @@ public FirestoreAdminStub getStub() {
return stub;
}
+ /**
+ * Returns the OperationsClient that can be used to query the status of a long-running operation
+ * returned by another API method call.
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationsClient getOperationsClient() {
+ return operationsClient;
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a composite index.
+ *
+ * Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
+ * firestoreAdminClient.deleteIndex(name);
+ * }
+ *
+ *
+ * @param name Required. A name of the form
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteIndex(IndexName name) {
+ DeleteIndexRequest request =
+ DeleteIndexRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ deleteIndex(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a composite index.
+ *
+ * Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
+ * firestoreAdminClient.deleteIndex(name.toString());
+ * }
+ *
+ *
+ * @param name Required. A name of the form
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteIndex(String name) {
+ DeleteIndexRequest request = DeleteIndexRequest.newBuilder().setName(name).build();
+ deleteIndex(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a composite index.
+ *
+ * Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
+ * DeleteIndexRequest request = DeleteIndexRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * firestoreAdminClient.deleteIndex(request);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteIndex(DeleteIndexRequest request) {
+ deleteIndexCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Deletes a composite index.
+ *
+ * Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
+ * DeleteIndexRequest request = DeleteIndexRequest.newBuilder()
+ * .setName(name.toString())
+ * .build();
+ * ApiFuture<Void> future = firestoreAdminClient.deleteIndexCallable().futureCall(request);
+ * // Do something
+ * future.get();
+ * }
+ *
+ */
+ public final UnaryCallableThis call returns a [google.longrunning.Operation][google.longrunning.Operation] which may + * be used to track the status of the field update. The metadata for the operation will be the + * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + * + *
To configure the default field settings for the database, use the special `Field` with + * resource name: + * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + * + *
Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * Field field = Field.newBuilder().build();
+ * Field response = firestoreAdminClient.updateFieldAsync(field).get();
+ * }
+ *
+ *
+ * @param field Required. The field to be updated.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureThis call returns a [google.longrunning.Operation][google.longrunning.Operation] which may + * be used to track the status of the field update. The metadata for the operation will be the + * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + * + *
To configure the default field settings for the database, use the special `Field` with + * resource name: + * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + * + *
Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * Field field = Field.newBuilder().build();
+ * UpdateFieldRequest request = UpdateFieldRequest.newBuilder()
+ * .setField(field)
+ * .build();
+ * Field response = firestoreAdminClient.updateFieldAsync(request).get();
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureThis call returns a [google.longrunning.Operation][google.longrunning.Operation] which may + * be used to track the status of the field update. The metadata for the operation will be the + * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + * + *
To configure the default field settings for the database, use the special `Field` with + * resource name: + * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + * + *
Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * Field field = Field.newBuilder().build();
+ * UpdateFieldRequest request = UpdateFieldRequest.newBuilder()
+ * .setField(field)
+ * .build();
+ * OperationFuture<Field, FieldOperationMetadata> future = firestoreAdminClient.updateFieldOperationCallable().futureCall(request);
+ * // Do something
+ * Field response = future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallableThis call returns a [google.longrunning.Operation][google.longrunning.Operation] which may + * be used to track the status of the field update. The metadata for the operation will be the + * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + * + *
To configure the default field settings for the database, use the special `Field` with + * resource name: + * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + * + *
Sample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * Field field = Field.newBuilder().build();
+ * UpdateFieldRequest request = UpdateFieldRequest.newBuilder()
+ * .setField(field)
+ * .build();
+ * ApiFuture<Operation> future = firestoreAdminClient.updateFieldCallable().futureCall(request);
+ * // Do something
+ * Operation response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* Index index = Index.newBuilder().build();
- * Operation response = firestoreAdminClient.createIndex(parent, index);
+ * Index response = firestoreAdminClient.createIndexAsync(parent, index).get();
* }
*
*
@@ -196,13 +449,16 @@ public FirestoreAdminStub getStub() {
* @param index Required. The composite index to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation createIndex(ParentName parent, Index index) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* Index index = Index.newBuilder().build();
- * Operation response = firestoreAdminClient.createIndex(parent.toString(), index);
+ * Index response = firestoreAdminClient.createIndexAsync(parent.toString(), index).get();
* }
*
*
@@ -227,10 +483,13 @@ public final Operation createIndex(ParentName parent, Index index) {
* @param index Required. The composite index to create.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation createIndex(String parent, Index index) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* Index index = Index.newBuilder().build();
* CreateIndexRequest request = CreateIndexRequest.newBuilder()
* .setParent(parent.toString())
* .setIndex(index)
* .build();
- * Operation response = firestoreAdminClient.createIndex(request);
+ * Index response = firestoreAdminClient.createIndexAsync(request).get();
* }
*
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation createIndex(CreateIndexRequest request) {
- return createIndexCallable().call(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFutureSample code: + * + *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
+ * Index index = Index.newBuilder().build();
+ * CreateIndexRequest request = CreateIndexRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .setIndex(index)
+ * .build();
+ * OperationFuture<Index, IndexOperationMetadata> future = firestoreAdminClient.createIndexOperationCallable().futureCall(request);
+ * // Do something
+ * Index response = future.get();
+ * }
+ *
+ */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* Index index = Index.newBuilder().build();
* CreateIndexRequest request = CreateIndexRequest.newBuilder()
* .setParent(parent.toString())
@@ -296,7 +587,7 @@ public final UnaryCallable createIndexCallable()
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* for (Index element : firestoreAdminClient.listIndexes(parent).iterateAll()) {
* // doThingsWith(element);
* }
@@ -307,7 +598,7 @@ public final UnaryCallable createIndexCallable()
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListIndexesPagedResponse listIndexes(ParentName parent) {
+ public final ListIndexesPagedResponse listIndexes(CollectionGroupName parent) {
ListIndexesRequest request =
ListIndexesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
@@ -323,7 +614,7 @@ public final ListIndexesPagedResponse listIndexes(ParentName parent) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* for (Index element : firestoreAdminClient.listIndexes(parent.toString()).iterateAll()) {
* // doThingsWith(element);
* }
@@ -347,7 +638,7 @@ public final ListIndexesPagedResponse listIndexes(String parent) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* ListIndexesRequest request = ListIndexesRequest.newBuilder()
* .setParent(parent.toString())
* .build();
@@ -372,7 +663,7 @@ public final ListIndexesPagedResponse listIndexes(ListIndexesRequest request) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* ListIndexesRequest request = ListIndexesRequest.newBuilder()
* .setParent(parent.toString())
* .build();
@@ -397,7 +688,7 @@ public final ListIndexesPagedResponse listIndexes(ListIndexesRequest request) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
* ListIndexesRequest request = ListIndexesRequest.newBuilder()
* .setParent(parent.toString())
* .build();
@@ -428,7 +719,7 @@ public final UnaryCallable listIndexesC
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
* Index response = firestoreAdminClient.getIndex(name);
* }
*
@@ -451,7 +742,7 @@ public final Index getIndex(IndexName name) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
* Index response = firestoreAdminClient.getIndex(name.toString());
* }
*
@@ -473,7 +764,7 @@ public final Index getIndex(String name) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
* GetIndexRequest request = GetIndexRequest.newBuilder()
* .setName(name.toString())
* .build();
@@ -496,7 +787,7 @@ public final Index getIndex(GetIndexRequest request) {
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
+ * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
* GetIndexRequest request = GetIndexRequest.newBuilder()
* .setName(name.toString())
* .build();
@@ -512,194 +803,246 @@ public final UnaryCallable getIndexCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes a composite index.
+ * Gets the metadata and configuration for a Field.
*
* Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
- * firestoreAdminClient.deleteIndex(name);
+ * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]");
+ * Field response = firestoreAdminClient.getField(name);
* }
*
*
* @param name Required. A name of the form
- * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final void deleteIndex(IndexName name) {
- DeleteIndexRequest request =
- DeleteIndexRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- deleteIndex(request);
+ public final Field getField(FieldName name) {
+ GetFieldRequest request =
+ GetFieldRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getField(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes a composite index.
+ * Gets the metadata and configuration for a Field.
*
* Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
- * firestoreAdminClient.deleteIndex(name.toString());
+ * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]");
+ * Field response = firestoreAdminClient.getField(name.toString());
* }
*
*
* @param name Required. A name of the form
- * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final void deleteIndex(String name) {
- DeleteIndexRequest request = DeleteIndexRequest.newBuilder().setName(name).build();
- deleteIndex(request);
+ public final Field getField(String name) {
+ GetFieldRequest request = GetFieldRequest.newBuilder().setName(name).build();
+ return getField(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes a composite index.
+ * Gets the metadata and configuration for a Field.
*
* Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
- * DeleteIndexRequest request = DeleteIndexRequest.newBuilder()
+ * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]");
+ * GetFieldRequest request = GetFieldRequest.newBuilder()
* .setName(name.toString())
* .build();
- * firestoreAdminClient.deleteIndex(request);
+ * Field response = firestoreAdminClient.getField(request);
* }
*
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final void deleteIndex(DeleteIndexRequest request) {
- deleteIndexCallable().call(request);
+ public final Field getField(GetFieldRequest request) {
+ return getFieldCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Deletes a composite index.
+ * Gets the metadata and configuration for a Field.
*
* Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]");
- * DeleteIndexRequest request = DeleteIndexRequest.newBuilder()
+ * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]");
+ * GetFieldRequest request = GetFieldRequest.newBuilder()
* .setName(name.toString())
* .build();
- * ApiFuture<Void> future = firestoreAdminClient.deleteIndexCallable().futureCall(request);
+ * ApiFuture<Field> future = firestoreAdminClient.getFieldCallable().futureCall(request);
* // Do something
- * future.get();
+ * Field response = future.get();
* }
*
*/
- public final UnaryCallable deleteIndexCallable() {
- return stub.deleteIndexCallable();
+ public final UnaryCallable getFieldCallable() {
+ return stub.getFieldCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Imports documents into Google Cloud Firestore. Existing documents with the same name are
- * overwritten. The import occurs in the background and its progress can be monitored and managed
- * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
- * possible that a subset of the data has already been imported to Cloud Firestore.
+ * Lists the field configuration and metadata for this database.
+ *
+ * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
+ * only supports listing fields that have been explicitly overridden. To issue this query, call
+ * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
+ * filter set to `indexConfig.usesAncestorConfig:false`.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
- * Operation response = firestoreAdminClient.importDocuments(name);
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
+ * for (Field element : firestoreAdminClient.listFields(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*
- * @param name Required. Database to import into. Should be of the form:
- * `projects/{project_id}/databases/{database_id}`.
+ * @param parent Required. A parent name of the form
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation importDocuments(DatabaseName name) {
- ImportDocumentsRequest request =
- ImportDocumentsRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return importDocuments(request);
+ public final ListFieldsPagedResponse listFields(CollectionGroupName parent) {
+ ListFieldsRequest request =
+ ListFieldsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listFields(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Imports documents into Google Cloud Firestore. Existing documents with the same name are
- * overwritten. The import occurs in the background and its progress can be monitored and managed
- * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
- * possible that a subset of the data has already been imported to Cloud Firestore.
+ * Lists the field configuration and metadata for this database.
+ *
+ * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
+ * only supports listing fields that have been explicitly overridden. To issue this query, call
+ * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
+ * filter set to `indexConfig.usesAncestorConfig:false`.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
- * Operation response = firestoreAdminClient.importDocuments(name.toString());
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
+ * for (Field element : firestoreAdminClient.listFields(parent.toString()).iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*
- * @param name Required. Database to import into. Should be of the form:
- * `projects/{project_id}/databases/{database_id}`.
+ * @param parent Required. A parent name of the form
+ * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation importDocuments(String name) {
- ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder().setName(name).build();
- return importDocuments(request);
+ public final ListFieldsPagedResponse listFields(String parent) {
+ ListFieldsRequest request = ListFieldsRequest.newBuilder().setParent(parent).build();
+ return listFields(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Imports documents into Google Cloud Firestore. Existing documents with the same name are
- * overwritten. The import occurs in the background and its progress can be monitored and managed
- * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
- * possible that a subset of the data has already been imported to Cloud Firestore.
+ * Lists the field configuration and metadata for this database.
+ *
+ * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
+ * only supports listing fields that have been explicitly overridden. To issue this query, call
+ * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
+ * filter set to `indexConfig.usesAncestorConfig:false`.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
- * ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder()
- * .setName(name.toString())
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
+ * ListFieldsRequest request = ListFieldsRequest.newBuilder()
+ * .setParent(parent.toString())
* .build();
- * Operation response = firestoreAdminClient.importDocuments(request);
+ * for (Field element : firestoreAdminClient.listFields(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation importDocuments(ImportDocumentsRequest request) {
- return importDocumentsCallable().call(request);
+ public final ListFieldsPagedResponse listFields(ListFieldsRequest request) {
+ return listFieldsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Imports documents into Google Cloud Firestore. Existing documents with the same name are
- * overwritten. The import occurs in the background and its progress can be monitored and managed
- * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
- * possible that a subset of the data has already been imported to Cloud Firestore.
+ * Lists the field configuration and metadata for this database.
+ *
+ * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
+ * only supports listing fields that have been explicitly overridden. To issue this query, call
+ * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
+ * filter set to `indexConfig.usesAncestorConfig:false`.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
- * ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder()
- * .setName(name.toString())
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
+ * ListFieldsRequest request = ListFieldsRequest.newBuilder()
+ * .setParent(parent.toString())
* .build();
- * ApiFuture<Operation> future = firestoreAdminClient.importDocumentsCallable().futureCall(request);
+ * ApiFuture<ListFieldsPagedResponse> future = firestoreAdminClient.listFieldsPagedCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * for (Field element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
* }
*
*/
- public final UnaryCallable importDocumentsCallable() {
- return stub.importDocumentsCallable();
+ public final UnaryCallable listFieldsPagedCallable() {
+ return stub.listFieldsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the field configuration and metadata for this database.
+ *
+ * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
+ * only supports listing fields that have been explicitly overridden. To issue this query, call
+ * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
+ * filter set to `indexConfig.usesAncestorConfig:false`.
+ *
+ *
Sample code:
+ *
+ *
+ * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
+ * CollectionGroupName parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
+ * ListFieldsRequest request = ListFieldsRequest.newBuilder()
+ * .setParent(parent.toString())
+ * .build();
+ * while (true) {
+ * ListFieldsResponse response = firestoreAdminClient.listFieldsCallable().call(request);
+ * for (Field element : response.getFieldsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable listFieldsCallable() {
+ return stub.listFieldsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -716,7 +1059,7 @@ public final UnaryCallable importDocumentsCal
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
- * Operation response = firestoreAdminClient.exportDocuments(name);
+ * ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(name).get();
* }
*
*
@@ -724,10 +1067,13 @@ public final UnaryCallable importDocumentsCal
* `projects/{project_id}/databases/{database_id}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation exportDocuments(DatabaseName name) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ exportDocumentsAsync(DatabaseName name) {
ExportDocumentsRequest request =
ExportDocumentsRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return exportDocuments(request);
+ return exportDocumentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -744,7 +1090,7 @@ public final Operation exportDocuments(DatabaseName name) {
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
- * Operation response = firestoreAdminClient.exportDocuments(name.toString());
+ * ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(name.toString()).get();
* }
*
*
@@ -752,9 +1098,12 @@ public final Operation exportDocuments(DatabaseName name) {
* `projects/{project_id}/databases/{database_id}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation exportDocuments(String name) {
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ exportDocumentsAsync(String name) {
ExportDocumentsRequest request = ExportDocumentsRequest.newBuilder().setName(name).build();
- return exportDocuments(request);
+ return exportDocumentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -774,15 +1123,18 @@ public final Operation exportDocuments(String name) {
* ExportDocumentsRequest request = ExportDocumentsRequest.newBuilder()
* .setName(name.toString())
* .build();
- * Operation response = firestoreAdminClient.exportDocuments(request);
+ * ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(request).get();
* }
*
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation exportDocuments(ExportDocumentsRequest request) {
- return exportDocumentsCallable().call(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture
+ exportDocumentsAsync(ExportDocumentsRequest request) {
+ return exportDocumentsOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
@@ -802,360 +1154,181 @@ public final Operation exportDocuments(ExportDocumentsRequest request) {
* ExportDocumentsRequest request = ExportDocumentsRequest.newBuilder()
* .setName(name.toString())
* .build();
- * ApiFuture<Operation> future = firestoreAdminClient.exportDocumentsCallable().futureCall(request);
+ * OperationFuture<ExportDocumentsResponse, ExportDocumentsMetadata> future = firestoreAdminClient.exportDocumentsOperationCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * ExportDocumentsResponse response = future.get();
* }
*
*/
- public final UnaryCallable exportDocumentsCallable() {
- return stub.exportDocumentsCallable();
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationCallable() {
+ return stub.exportDocumentsOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Gets the metadata and configuration for a Field.
- *
- * Sample code:
- *
- *
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]");
- * Field response = firestoreAdminClient.getField(name);
- * }
- *
- *
- * @param name Required. A name of the form
- * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Field getField(FieldName name) {
- GetFieldRequest request =
- GetFieldRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- return getField(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the metadata and configuration for a Field.
- *
- * Sample code:
- *
- *
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]");
- * Field response = firestoreAdminClient.getField(name.toString());
- * }
- *
- *
- * @param name Required. A name of the form
- * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Field getField(String name) {
- GetFieldRequest request = GetFieldRequest.newBuilder().setName(name).build();
- return getField(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the metadata and configuration for a Field.
- *
- * Sample code:
- *
- *
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]");
- * GetFieldRequest request = GetFieldRequest.newBuilder()
- * .setName(name.toString())
- * .build();
- * Field response = firestoreAdminClient.getField(request);
- * }
- *
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Field getField(GetFieldRequest request) {
- return getFieldCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the metadata and configuration for a Field.
+ * Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage
+ * system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the
+ * export. The export occurs in the background and its progress can be monitored and managed via
+ * the Operation resource that is created. The output of an export may only be used once the
+ * associated operation is done. If an export operation is cancelled before completion it may
+ * leave partial data behind in Google Cloud Storage.
*
* Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]");
- * GetFieldRequest request = GetFieldRequest.newBuilder()
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
+ * ExportDocumentsRequest request = ExportDocumentsRequest.newBuilder()
* .setName(name.toString())
* .build();
- * ApiFuture<Field> future = firestoreAdminClient.getFieldCallable().futureCall(request);
+ * ApiFuture<Operation> future = firestoreAdminClient.exportDocumentsCallable().futureCall(request);
* // Do something
- * Field response = future.get();
+ * Operation response = future.get();
* }
*
*/
- public final UnaryCallable getFieldCallable() {
- return stub.getFieldCallable();
+ public final UnaryCallable exportDocumentsCallable() {
+ return stub.exportDocumentsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the field configuration and metadata for this database.
- *
- * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
- * only supports listing fields that have been explicitly overridden. To issue this query, call
- * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
- * filter set to `indexConfig.usesAncestorConfig:false`.
+ * Imports documents into Google Cloud Firestore. Existing documents with the same name are
+ * overwritten. The import occurs in the background and its progress can be monitored and managed
+ * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
+ * possible that a subset of the data has already been imported to Cloud Firestore.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
- * for (Field element : firestoreAdminClient.listFields(parent).iterateAll()) {
- * // doThingsWith(element);
- * }
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
+ * firestoreAdminClient.importDocumentsAsync(name).get();
* }
*
*
- * @param parent Required. A parent name of the form
- * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
+ * @param name Required. Database to import into. Should be of the form:
+ * `projects/{project_id}/databases/{database_id}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListFieldsPagedResponse listFields(ParentName parent) {
- ListFieldsRequest request =
- ListFieldsRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
- return listFields(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture importDocumentsAsync(
+ DatabaseName name) {
+ ImportDocumentsRequest request =
+ ImportDocumentsRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return importDocumentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the field configuration and metadata for this database.
- *
- * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
- * only supports listing fields that have been explicitly overridden. To issue this query, call
- * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
- * filter set to `indexConfig.usesAncestorConfig:false`.
+ * Imports documents into Google Cloud Firestore. Existing documents with the same name are
+ * overwritten. The import occurs in the background and its progress can be monitored and managed
+ * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
+ * possible that a subset of the data has already been imported to Cloud Firestore.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
- * for (Field element : firestoreAdminClient.listFields(parent.toString()).iterateAll()) {
- * // doThingsWith(element);
- * }
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
+ * firestoreAdminClient.importDocumentsAsync(name.toString()).get();
* }
*
*
- * @param parent Required. A parent name of the form
- * `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
+ * @param name Required. Database to import into. Should be of the form:
+ * `projects/{project_id}/databases/{database_id}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListFieldsPagedResponse listFields(String parent) {
- ListFieldsRequest request = ListFieldsRequest.newBuilder().setParent(parent).build();
- return listFields(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture importDocumentsAsync(String name) {
+ ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder().setName(name).build();
+ return importDocumentsAsync(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the field configuration and metadata for this database.
- *
- * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
- * only supports listing fields that have been explicitly overridden. To issue this query, call
- * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
- * filter set to `indexConfig.usesAncestorConfig:false`.
+ * Imports documents into Google Cloud Firestore. Existing documents with the same name are
+ * overwritten. The import occurs in the background and its progress can be monitored and managed
+ * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
+ * possible that a subset of the data has already been imported to Cloud Firestore.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
- * ListFieldsRequest request = ListFieldsRequest.newBuilder()
- * .setParent(parent.toString())
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
+ * ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * for (Field element : firestoreAdminClient.listFields(request).iterateAll()) {
- * // doThingsWith(element);
- * }
+ * firestoreAdminClient.importDocumentsAsync(request).get();
* }
*
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListFieldsPagedResponse listFields(ListFieldsRequest request) {
- return listFieldsPagedCallable().call(request);
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public final OperationFuture importDocumentsAsync(
+ ImportDocumentsRequest request) {
+ return importDocumentsOperationCallable().futureCall(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Lists the field configuration and metadata for this database.
- *
- * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
- * only supports listing fields that have been explicitly overridden. To issue this query, call
- * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
- * filter set to `indexConfig.usesAncestorConfig:false`.
+ * Imports documents into Google Cloud Firestore. Existing documents with the same name are
+ * overwritten. The import occurs in the background and its progress can be monitored and managed
+ * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
+ * possible that a subset of the data has already been imported to Cloud Firestore.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
- * ListFieldsRequest request = ListFieldsRequest.newBuilder()
- * .setParent(parent.toString())
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
+ * ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * ApiFuture<ListFieldsPagedResponse> future = firestoreAdminClient.listFieldsPagedCallable().futureCall(request);
+ * OperationFuture<Empty, ImportDocumentsMetadata> future = firestoreAdminClient.importDocumentsOperationCallable().futureCall(request);
* // Do something
- * for (Field element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- *
- */
- public final UnaryCallable listFieldsPagedCallable() {
- return stub.listFieldsPagedCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the field configuration and metadata for this database.
- *
- * Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
- * only supports listing fields that have been explicitly overridden. To issue this query, call
- * [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the
- * filter set to `indexConfig.usesAncestorConfig:false`.
- *
- *
Sample code:
- *
- *
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
- * ListFieldsRequest request = ListFieldsRequest.newBuilder()
- * .setParent(parent.toString())
- * .build();
- * while (true) {
- * ListFieldsResponse response = firestoreAdminClient.listFieldsCallable().call(request);
- * for (Field element : response.getFieldsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- *
- */
- public final UnaryCallable listFieldsCallable() {
- return stub.listFieldsCallable();
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates a field configuration. Currently, field updates apply only to single field index
- * configuration. However, calls to
- * [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should
- * provide a field mask to avoid changing any configuration that the caller isn't aware of. The
- * field mask should be specified as: `{ paths: "index_config" }`.
- *
- * This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may
- * be used to track the status of the field update. The metadata for the operation will be the
- * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
- *
- *
To configure the default field settings for the database, use the special `Field` with
- * resource name:
- * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
- *
- *
Sample code:
- *
- *
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * Field field = Field.newBuilder().build();
- * Operation response = firestoreAdminClient.updateField(field);
- * }
- *
- *
- * @param field Required. The field to be updated.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Operation updateField(Field field) {
- UpdateFieldRequest request = UpdateFieldRequest.newBuilder().setField(field).build();
- return updateField(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Updates a field configuration. Currently, field updates apply only to single field index
- * configuration. However, calls to
- * [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should
- * provide a field mask to avoid changing any configuration that the caller isn't aware of. The
- * field mask should be specified as: `{ paths: "index_config" }`.
- *
- * This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may
- * be used to track the status of the field update. The metadata for the operation will be the
- * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
- *
- *
To configure the default field settings for the database, use the special `Field` with
- * resource name:
- * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
- *
- *
Sample code:
- *
- *
- * try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * Field field = Field.newBuilder().build();
- * UpdateFieldRequest request = UpdateFieldRequest.newBuilder()
- * .setField(field)
- * .build();
- * Operation response = firestoreAdminClient.updateField(request);
+ * future.get();
* }
*
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Operation updateField(UpdateFieldRequest request) {
- return updateFieldCallable().call(request);
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public final OperationCallable
+ importDocumentsOperationCallable() {
+ return stub.importDocumentsOperationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
- * Updates a field configuration. Currently, field updates apply only to single field index
- * configuration. However, calls to
- * [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should
- * provide a field mask to avoid changing any configuration that the caller isn't aware of. The
- * field mask should be specified as: `{ paths: "index_config" }`.
- *
- * This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may
- * be used to track the status of the field update. The metadata for the operation will be the
- * type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
- *
- *
To configure the default field settings for the database, use the special `Field` with
- * resource name:
- * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
+ * Imports documents into Google Cloud Firestore. Existing documents with the same name are
+ * overwritten. The import occurs in the background and its progress can be monitored and managed
+ * via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is
+ * possible that a subset of the data has already been imported to Cloud Firestore.
*
*
Sample code:
*
*
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
- * Field field = Field.newBuilder().build();
- * UpdateFieldRequest request = UpdateFieldRequest.newBuilder()
- * .setField(field)
+ * DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
+ * ImportDocumentsRequest request = ImportDocumentsRequest.newBuilder()
+ * .setName(name.toString())
* .build();
- * ApiFuture<Operation> future = firestoreAdminClient.updateFieldCallable().futureCall(request);
+ * ApiFuture<Operation> future = firestoreAdminClient.importDocumentsCallable().futureCall(request);
* // Do something
- * Operation response = future.get();
+ * future.get();
* }
*
*/
- public final UnaryCallable updateFieldCallable() {
- return stub.updateFieldCallable();
+ public final UnaryCallable importDocumentsCallable() {
+ return stub.importDocumentsCallable();
}
@Override
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminSettings.java
index f06f5e6ed..0f295bac1 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminSettings.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminSettings.java
@@ -26,18 +26,24 @@
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
+import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.firestore.v1.stub.FirestoreAdminStubSettings;
import com.google.firestore.admin.v1.CreateIndexRequest;
import com.google.firestore.admin.v1.DeleteIndexRequest;
+import com.google.firestore.admin.v1.ExportDocumentsMetadata;
import com.google.firestore.admin.v1.ExportDocumentsRequest;
+import com.google.firestore.admin.v1.ExportDocumentsResponse;
import com.google.firestore.admin.v1.Field;
+import com.google.firestore.admin.v1.FieldOperationMetadata;
import com.google.firestore.admin.v1.GetFieldRequest;
import com.google.firestore.admin.v1.GetIndexRequest;
+import com.google.firestore.admin.v1.ImportDocumentsMetadata;
import com.google.firestore.admin.v1.ImportDocumentsRequest;
import com.google.firestore.admin.v1.Index;
+import com.google.firestore.admin.v1.IndexOperationMetadata;
import com.google.firestore.admin.v1.ListFieldsRequest;
import com.google.firestore.admin.v1.ListFieldsResponse;
import com.google.firestore.admin.v1.ListIndexesRequest;
@@ -64,16 +70,16 @@
* The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
- *
For example, to set the total timeout of createIndex to 30 seconds:
+ *
For example, to set the total timeout of deleteIndex to 30 seconds:
*
*
*
* FirestoreAdminSettings.Builder firestoreAdminSettingsBuilder =
* FirestoreAdminSettings.newBuilder();
* firestoreAdminSettingsBuilder
- * .createIndexSettings()
+ * .deleteIndexSettings()
* .setRetrySettings(
- * firestoreAdminSettingsBuilder.createIndexSettings().getRetrySettings().toBuilder()
+ * firestoreAdminSettingsBuilder.deleteIndexSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* FirestoreAdminSettings firestoreAdminSettings = firestoreAdminSettingsBuilder.build();
@@ -83,11 +89,37 @@
@Generated("by gapic-generator")
@BetaApi
public class FirestoreAdminSettings extends ClientSettings {
+ /** Returns the object with the settings used for calls to deleteIndex. */
+ public UnaryCallSettings deleteIndexSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).deleteIndexSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateField. */
+ public UnaryCallSettings updateFieldSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).updateFieldSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateField. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings
+ updateFieldOperationSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).updateFieldOperationSettings();
+ }
+
/** Returns the object with the settings used for calls to createIndex. */
public UnaryCallSettings createIndexSettings() {
return ((FirestoreAdminStubSettings) getStubSettings()).createIndexSettings();
}
+ /** Returns the object with the settings used for calls to createIndex. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings
+ createIndexOperationSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).createIndexOperationSettings();
+ }
+
/** Returns the object with the settings used for calls to listIndexes. */
public PagedCallSettings
listIndexesSettings() {
@@ -99,14 +131,15 @@ public UnaryCallSettings getIndexSettings() {
return ((FirestoreAdminStubSettings) getStubSettings()).getIndexSettings();
}
- /** Returns the object with the settings used for calls to deleteIndex. */
- public UnaryCallSettings deleteIndexSettings() {
- return ((FirestoreAdminStubSettings) getStubSettings()).deleteIndexSettings();
+ /** Returns the object with the settings used for calls to getField. */
+ public UnaryCallSettings getFieldSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).getFieldSettings();
}
- /** Returns the object with the settings used for calls to importDocuments. */
- public UnaryCallSettings importDocumentsSettings() {
- return ((FirestoreAdminStubSettings) getStubSettings()).importDocumentsSettings();
+ /** Returns the object with the settings used for calls to listFields. */
+ public PagedCallSettings
+ listFieldsSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).listFieldsSettings();
}
/** Returns the object with the settings used for calls to exportDocuments. */
@@ -114,20 +147,26 @@ public UnaryCallSettings exportDocumentsSetti
return ((FirestoreAdminStubSettings) getStubSettings()).exportDocumentsSettings();
}
- /** Returns the object with the settings used for calls to getField. */
- public UnaryCallSettings getFieldSettings() {
- return ((FirestoreAdminStubSettings) getStubSettings()).getFieldSettings();
+ /** Returns the object with the settings used for calls to exportDocuments. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).exportDocumentsOperationSettings();
}
- /** Returns the object with the settings used for calls to listFields. */
- public PagedCallSettings
- listFieldsSettings() {
- return ((FirestoreAdminStubSettings) getStubSettings()).listFieldsSettings();
+ /** Returns the object with the settings used for calls to importDocuments. */
+ public UnaryCallSettings importDocumentsSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).importDocumentsSettings();
}
- /** Returns the object with the settings used for calls to updateField. */
- public UnaryCallSettings updateFieldSettings() {
- return ((FirestoreAdminStubSettings) getStubSettings()).updateFieldSettings();
+ /** Returns the object with the settings used for calls to importDocuments. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings
+ importDocumentsOperationSettings() {
+ return ((FirestoreAdminStubSettings) getStubSettings()).importDocumentsOperationSettings();
}
public static final FirestoreAdminSettings create(FirestoreAdminStubSettings stub)
@@ -227,11 +266,37 @@ public Builder applyToAllUnaryMethods(
return this;
}
+ /** Returns the builder for the settings used for calls to deleteIndex. */
+ public UnaryCallSettings.Builder deleteIndexSettings() {
+ return getStubSettingsBuilder().deleteIndexSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateField. */
+ public UnaryCallSettings.Builder updateFieldSettings() {
+ return getStubSettingsBuilder().updateFieldSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateField. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ updateFieldOperationSettings() {
+ return getStubSettingsBuilder().updateFieldOperationSettings();
+ }
+
/** Returns the builder for the settings used for calls to createIndex. */
public UnaryCallSettings.Builder createIndexSettings() {
return getStubSettingsBuilder().createIndexSettings();
}
+ /** Returns the builder for the settings used for calls to createIndex. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ createIndexOperationSettings() {
+ return getStubSettingsBuilder().createIndexOperationSettings();
+ }
+
/** Returns the builder for the settings used for calls to listIndexes. */
public PagedCallSettings.Builder<
ListIndexesRequest, ListIndexesResponse, ListIndexesPagedResponse>
@@ -244,14 +309,15 @@ public UnaryCallSettings.Builder getIndexSettings() {
return getStubSettingsBuilder().getIndexSettings();
}
- /** Returns the builder for the settings used for calls to deleteIndex. */
- public UnaryCallSettings.Builder deleteIndexSettings() {
- return getStubSettingsBuilder().deleteIndexSettings();
+ /** Returns the builder for the settings used for calls to getField. */
+ public UnaryCallSettings.Builder getFieldSettings() {
+ return getStubSettingsBuilder().getFieldSettings();
}
- /** Returns the builder for the settings used for calls to importDocuments. */
- public UnaryCallSettings.Builder importDocumentsSettings() {
- return getStubSettingsBuilder().importDocumentsSettings();
+ /** Returns the builder for the settings used for calls to listFields. */
+ public PagedCallSettings.Builder
+ listFieldsSettings() {
+ return getStubSettingsBuilder().listFieldsSettings();
}
/** Returns the builder for the settings used for calls to exportDocuments. */
@@ -259,20 +325,26 @@ public UnaryCallSettings.Builder exportDocume
return getStubSettingsBuilder().exportDocumentsSettings();
}
- /** Returns the builder for the settings used for calls to getField. */
- public UnaryCallSettings.Builder getFieldSettings() {
- return getStubSettingsBuilder().getFieldSettings();
+ /** Returns the builder for the settings used for calls to exportDocuments. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationSettings() {
+ return getStubSettingsBuilder().exportDocumentsOperationSettings();
}
- /** Returns the builder for the settings used for calls to listFields. */
- public PagedCallSettings.Builder
- listFieldsSettings() {
- return getStubSettingsBuilder().listFieldsSettings();
+ /** Returns the builder for the settings used for calls to importDocuments. */
+ public UnaryCallSettings.Builder importDocumentsSettings() {
+ return getStubSettingsBuilder().importDocumentsSettings();
}
- /** Returns the builder for the settings used for calls to updateField. */
- public UnaryCallSettings.Builder updateFieldSettings() {
- return getStubSettingsBuilder().updateFieldSettings();
+ /** Returns the builder for the settings used for calls to importDocuments. */
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ importDocumentsOperationSettings() {
+ return getStubSettingsBuilder().importDocumentsOperationSettings();
}
@Override
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java
index cb3a43c77..833eb4914 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java
@@ -30,14 +30,16 @@
import com.google.cloud.firestore.v1.stub.FirestoreStub;
import com.google.cloud.firestore.v1.stub.FirestoreStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
-import com.google.firestore.v1.AnyPathName;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
+import com.google.firestore.v1.BatchWriteRequest;
+import com.google.firestore.v1.BatchWriteResponse;
import com.google.firestore.v1.BeginTransactionRequest;
import com.google.firestore.v1.BeginTransactionResponse;
import com.google.firestore.v1.CommitRequest;
import com.google.firestore.v1.CommitResponse;
import com.google.firestore.v1.CreateDocumentRequest;
+import com.google.firestore.v1.Cursor;
import com.google.firestore.v1.DeleteDocumentRequest;
import com.google.firestore.v1.Document;
import com.google.firestore.v1.DocumentMask;
@@ -48,6 +50,8 @@
import com.google.firestore.v1.ListDocumentsResponse;
import com.google.firestore.v1.ListenRequest;
import com.google.firestore.v1.ListenResponse;
+import com.google.firestore.v1.PartitionQueryRequest;
+import com.google.firestore.v1.PartitionQueryResponse;
import com.google.firestore.v1.RollbackRequest;
import com.google.firestore.v1.RunQueryRequest;
import com.google.firestore.v1.RunQueryResponse;
@@ -194,9 +198,9 @@ public FirestoreStub getStub() {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * AnyPathName name = AnyPathName.of("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String name = "";
* GetDocumentRequest request = GetDocumentRequest.newBuilder()
- * .setName(name.toString())
+ * .setName(name)
* .build();
* Document response = firestoreClient.getDocument(request);
* }
@@ -217,9 +221,9 @@ public final Document getDocument(GetDocumentRequest request) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * AnyPathName name = AnyPathName.of("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String name = "";
* GetDocumentRequest request = GetDocumentRequest.newBuilder()
- * .setName(name.toString())
+ * .setName(name)
* .build();
* ApiFuture<Document> future = firestoreClient.getDocumentCallable().futureCall(request);
* // Do something
@@ -239,10 +243,10 @@ public final UnaryCallable getDocumentCallable() {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* String collectionId = "";
* ListDocumentsRequest request = ListDocumentsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .setCollectionId(collectionId)
* .build();
* for (Document element : firestoreClient.listDocuments(request).iterateAll()) {
@@ -266,10 +270,10 @@ public final ListDocumentsPagedResponse listDocuments(ListDocumentsRequest reque
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* String collectionId = "";
* ListDocumentsRequest request = ListDocumentsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .setCollectionId(collectionId)
* .build();
* ApiFuture<ListDocumentsPagedResponse> future = firestoreClient.listDocumentsPagedCallable().futureCall(request);
@@ -293,10 +297,10 @@ public final ListDocumentsPagedResponse listDocuments(ListDocumentsRequest reque
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* String collectionId = "";
* ListDocumentsRequest request = ListDocumentsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .setCollectionId(collectionId)
* .build();
* while (true) {
@@ -326,14 +330,12 @@ public final UnaryCallable listDocu
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* String collectionId = "";
- * String documentId = "";
* Document document = Document.newBuilder().build();
* CreateDocumentRequest request = CreateDocumentRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .setCollectionId(collectionId)
- * .setDocumentId(documentId)
* .setDocument(document)
* .build();
* Document response = firestoreClient.createDocument(request);
@@ -355,14 +357,12 @@ public final Document createDocument(CreateDocumentRequest request) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* String collectionId = "";
- * String documentId = "";
* Document document = Document.newBuilder().build();
* CreateDocumentRequest request = CreateDocumentRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .setCollectionId(collectionId)
- * .setDocumentId(documentId)
* .setDocument(document)
* .build();
* ApiFuture<Document> future = firestoreClient.createDocumentCallable().futureCall(request);
@@ -413,10 +413,8 @@ public final Document updateDocument(Document document, DocumentMask updateMask)
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* Document document = Document.newBuilder().build();
- * DocumentMask updateMask = DocumentMask.newBuilder().build();
* UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder()
* .setDocument(document)
- * .setUpdateMask(updateMask)
* .build();
* Document response = firestoreClient.updateDocument(request);
* }
@@ -438,10 +436,8 @@ public final Document updateDocument(UpdateDocumentRequest request) {
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* Document document = Document.newBuilder().build();
- * DocumentMask updateMask = DocumentMask.newBuilder().build();
* UpdateDocumentRequest request = UpdateDocumentRequest.newBuilder()
* .setDocument(document)
- * .setUpdateMask(updateMask)
* .build();
* ApiFuture<Document> future = firestoreClient.updateDocumentCallable().futureCall(request);
* // Do something
@@ -461,7 +457,7 @@ public final UnaryCallable updateDocumentCallab
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * AnyPathName name = AnyPathName.of("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String name = "";
* firestoreClient.deleteDocument(name);
* }
*
@@ -470,29 +466,6 @@ public final UnaryCallable updateDocumentCallab
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final void deleteDocument(AnyPathName name) {
- DeleteDocumentRequest request =
- DeleteDocumentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
- deleteDocument(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Deletes a document.
- *
- * Sample code:
- *
- *
- * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * AnyPathName name = AnyPathName.of("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
- * firestoreClient.deleteDocument(name.toString());
- * }
- *
- *
- * @param name Required. The resource name of the Document to delete. In the format:
- * `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
public final void deleteDocument(String name) {
DeleteDocumentRequest request = DeleteDocumentRequest.newBuilder().setName(name).build();
deleteDocument(request);
@@ -506,9 +479,9 @@ public final void deleteDocument(String name) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * AnyPathName name = AnyPathName.of("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String name = "";
* DeleteDocumentRequest request = DeleteDocumentRequest.newBuilder()
- * .setName(name.toString())
+ * .setName(name)
* .build();
* firestoreClient.deleteDocument(request);
* }
@@ -529,9 +502,9 @@ public final void deleteDocument(DeleteDocumentRequest request) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * AnyPathName name = AnyPathName.of("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String name = "";
* DeleteDocumentRequest request = DeleteDocumentRequest.newBuilder()
- * .setName(name.toString())
+ * .setName(name)
* .build();
* ApiFuture<Void> future = firestoreClient.deleteDocumentCallable().futureCall(request);
* // Do something
@@ -554,11 +527,9 @@ public final UnaryCallable deleteDocumentCallable(
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
- * List<String> documents = new ArrayList<>();
+ * String database = "";
* BatchGetDocumentsRequest request = BatchGetDocumentsRequest.newBuilder()
- * .setDatabase(formattedDatabase)
- * .addAllDocuments(documents)
+ * .setDatabase(database)
* .build();
*
* ServerStream<BatchGetDocumentsResponse> stream = firestoreClient.batchGetDocumentsCallable().call(request);
@@ -581,8 +552,8 @@ public final UnaryCallable deleteDocumentCallable(
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
- * BeginTransactionResponse response = firestoreClient.beginTransaction(formattedDatabase);
+ * String database = "";
+ * BeginTransactionResponse response = firestoreClient.beginTransaction(database);
* }
*
*
@@ -604,9 +575,9 @@ public final BeginTransactionResponse beginTransaction(String database) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* BeginTransactionRequest request = BeginTransactionRequest.newBuilder()
- * .setDatabase(formattedDatabase)
+ * .setDatabase(database)
* .build();
* BeginTransactionResponse response = firestoreClient.beginTransaction(request);
* }
@@ -627,9 +598,9 @@ public final BeginTransactionResponse beginTransaction(BeginTransactionRequest r
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* BeginTransactionRequest request = BeginTransactionRequest.newBuilder()
- * .setDatabase(formattedDatabase)
+ * .setDatabase(database)
* .build();
* ApiFuture<BeginTransactionResponse> future = firestoreClient.beginTransactionCallable().futureCall(request);
* // Do something
@@ -650,9 +621,9 @@ public final BeginTransactionResponse beginTransaction(BeginTransactionRequest r
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* List<Write> writes = new ArrayList<>();
- * CommitResponse response = firestoreClient.commit(formattedDatabase, writes);
+ * CommitResponse response = firestoreClient.commit(database, writes);
* }
*
*
@@ -676,11 +647,9 @@ public final CommitResponse commit(String database, List writes) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
- * List<Write> writes = new ArrayList<>();
+ * String database = "";
* CommitRequest request = CommitRequest.newBuilder()
- * .setDatabase(formattedDatabase)
- * .addAllWrites(writes)
+ * .setDatabase(database)
* .build();
* CommitResponse response = firestoreClient.commit(request);
* }
@@ -701,11 +670,9 @@ public final CommitResponse commit(CommitRequest request) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
- * List<Write> writes = new ArrayList<>();
+ * String database = "";
* CommitRequest request = CommitRequest.newBuilder()
- * .setDatabase(formattedDatabase)
- * .addAllWrites(writes)
+ * .setDatabase(database)
* .build();
* ApiFuture<CommitResponse> future = firestoreClient.commitCallable().futureCall(request);
* // Do something
@@ -725,9 +692,9 @@ public final UnaryCallable commitCallable() {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* ByteString transaction = ByteString.copyFromUtf8("");
- * firestoreClient.rollback(formattedDatabase, transaction);
+ * firestoreClient.rollback(database, transaction);
* }
*
*
@@ -750,10 +717,10 @@ public final void rollback(String database, ByteString transaction) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* ByteString transaction = ByteString.copyFromUtf8("");
* RollbackRequest request = RollbackRequest.newBuilder()
- * .setDatabase(formattedDatabase)
+ * .setDatabase(database)
* .setTransaction(transaction)
* .build();
* firestoreClient.rollback(request);
@@ -775,10 +742,10 @@ public final void rollback(RollbackRequest request) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* ByteString transaction = ByteString.copyFromUtf8("");
* RollbackRequest request = RollbackRequest.newBuilder()
- * .setDatabase(formattedDatabase)
+ * .setDatabase(database)
* .setTransaction(transaction)
* .build();
* ApiFuture<Void> future = firestoreClient.rollbackCallable().futureCall(request);
@@ -799,9 +766,9 @@ public final UnaryCallable rollbackCallable() {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* RunQueryRequest request = RunQueryRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .build();
*
* ServerStream<RunQueryResponse> stream = firestoreClient.runQueryCallable().call(request);
@@ -826,9 +793,9 @@ public final ServerStreamingCallable runQuery
* BidiStream<WriteRequest, WriteResponse> bidiStream =
* firestoreClient.writeCallable().call();
*
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* WriteRequest request = WriteRequest.newBuilder()
- * .setDatabase(formattedDatabase)
+ * .setDatabase(database)
* .build();
* bidiStream.send(request);
* for (WriteResponse response : bidiStream) {
@@ -852,9 +819,9 @@ public final BidiStreamingCallable writeCallable()
* BidiStream<ListenRequest, ListenResponse> bidiStream =
* firestoreClient.listenCallable().call();
*
- * String formattedDatabase = DatabaseRootName.format("[PROJECT]", "[DATABASE]");
+ * String database = "";
* ListenRequest request = ListenRequest.newBuilder()
- * .setDatabase(formattedDatabase)
+ * .setDatabase(database)
* .build();
* bidiStream.send(request);
* for (ListenResponse response : bidiStream) {
@@ -875,8 +842,8 @@ public final BidiStreamingCallable listenCallable
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
- * for (String element : firestoreClient.listCollectionIds(formattedParent).iterateAll()) {
+ * String parent = "";
+ * for (String element : firestoreClient.listCollectionIds(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
@@ -901,9 +868,9 @@ public final ListCollectionIdsPagedResponse listCollectionIds(String parent) {
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* ListCollectionIdsRequest request = ListCollectionIdsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .build();
* for (String element : firestoreClient.listCollectionIds(request).iterateAll()) {
* // doThingsWith(element);
@@ -926,9 +893,9 @@ public final ListCollectionIdsPagedResponse listCollectionIds(ListCollectionIdsR
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* ListCollectionIdsRequest request = ListCollectionIdsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .build();
* ApiFuture<ListCollectionIdsPagedResponse> future = firestoreClient.listCollectionIdsPagedCallable().futureCall(request);
* // Do something
@@ -951,9 +918,9 @@ public final ListCollectionIdsPagedResponse listCollectionIds(ListCollectionIdsR
*
*
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
- * String formattedParent = AnyPathName.format("[PROJECT]", "[DATABASE]", "[DOCUMENT]", "[ANY_PATH]");
+ * String parent = "";
* ListCollectionIdsRequest request = ListCollectionIdsRequest.newBuilder()
- * .setParent(formattedParent)
+ * .setParent(parent)
* .build();
* while (true) {
* ListCollectionIdsResponse response = firestoreClient.listCollectionIdsCallable().call(request);
@@ -975,6 +942,155 @@ public final ListCollectionIdsPagedResponse listCollectionIds(ListCollectionIdsR
return stub.listCollectionIdsCallable();
}
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Partitions a query by returning partition cursors that can be used to run the query in
+ * parallel. The returned partition cursors are split points that can be used by RunQuery as
+ * starting/end points for the query results.
+ *
+ * Sample code:
+ *
+ *
+ * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
+ * String parent = "";
+ * PartitionQueryRequest request = PartitionQueryRequest.newBuilder()
+ * .setParent(parent)
+ * .build();
+ * for (Cursor element : firestoreClient.partitionQuery(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final PartitionQueryPagedResponse partitionQuery(PartitionQueryRequest request) {
+ return partitionQueryPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Partitions a query by returning partition cursors that can be used to run the query in
+ * parallel. The returned partition cursors are split points that can be used by RunQuery as
+ * starting/end points for the query results.
+ *
+ * Sample code:
+ *
+ *
+ * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
+ * String parent = "";
+ * PartitionQueryRequest request = PartitionQueryRequest.newBuilder()
+ * .setParent(parent)
+ * .build();
+ * ApiFuture<PartitionQueryPagedResponse> future = firestoreClient.partitionQueryPagedCallable().futureCall(request);
+ * // Do something
+ * for (Cursor element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ partitionQueryPagedCallable() {
+ return stub.partitionQueryPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Partitions a query by returning partition cursors that can be used to run the query in
+ * parallel. The returned partition cursors are split points that can be used by RunQuery as
+ * starting/end points for the query results.
+ *
+ * Sample code:
+ *
+ *
+ * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
+ * String parent = "";
+ * PartitionQueryRequest request = PartitionQueryRequest.newBuilder()
+ * .setParent(parent)
+ * .build();
+ * while (true) {
+ * PartitionQueryResponse response = firestoreClient.partitionQueryCallable().call(request);
+ * for (Cursor element : response.getPartitionsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ *
+ */
+ public final UnaryCallable
+ partitionQueryCallable() {
+ return stub.partitionQueryCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Applies a batch of write operations.
+ *
+ * The BatchWrite method does not apply the write operations atomically and can apply them out
+ * of order. Method does not allow more than one write per document. Each write succeeds or fails
+ * independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
+ * success status of each write.
+ *
+ *
If you require an atomically applied set of writes, use
+ * [Commit][google.firestore.v1.Firestore.Commit] instead.
+ *
+ *
Sample code:
+ *
+ *
+ * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
+ * String database = "";
+ * BatchWriteRequest request = BatchWriteRequest.newBuilder()
+ * .setDatabase(database)
+ * .build();
+ * BatchWriteResponse response = firestoreClient.batchWrite(request);
+ * }
+ *
+ *
+ * @param request The request object containing all of the parameters for the API call.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final BatchWriteResponse batchWrite(BatchWriteRequest request) {
+ return batchWriteCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Applies a batch of write operations.
+ *
+ * The BatchWrite method does not apply the write operations atomically and can apply them out
+ * of order. Method does not allow more than one write per document. Each write succeeds or fails
+ * independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
+ * success status of each write.
+ *
+ *
If you require an atomically applied set of writes, use
+ * [Commit][google.firestore.v1.Firestore.Commit] instead.
+ *
+ *
Sample code:
+ *
+ *
+ * try (FirestoreClient firestoreClient = FirestoreClient.create()) {
+ * String database = "";
+ * BatchWriteRequest request = BatchWriteRequest.newBuilder()
+ * .setDatabase(database)
+ * .build();
+ * ApiFuture<BatchWriteResponse> future = firestoreClient.batchWriteCallable().futureCall(request);
+ * // Do something
+ * BatchWriteResponse response = future.get();
+ * }
+ *
+ */
+ public final UnaryCallable batchWriteCallable() {
+ return stub.batchWriteCallable();
+ }
+
@Override
public final void close() {
stub.close();
@@ -1167,4 +1283,85 @@ protected ListCollectionIdsFixedSizeCollection createCollection(
return new ListCollectionIdsFixedSizeCollection(pages, collectionSize);
}
}
+
+ public static class PartitionQueryPagedResponse
+ extends AbstractPagedListResponse<
+ PartitionQueryRequest,
+ PartitionQueryResponse,
+ Cursor,
+ PartitionQueryPage,
+ PartitionQueryFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ PartitionQueryPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ new ApiFunction() {
+ @Override
+ public PartitionQueryPagedResponse apply(PartitionQueryPage input) {
+ return new PartitionQueryPagedResponse(input);
+ }
+ },
+ MoreExecutors.directExecutor());
+ }
+
+ private PartitionQueryPagedResponse(PartitionQueryPage page) {
+ super(page, PartitionQueryFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class PartitionQueryPage
+ extends AbstractPage<
+ PartitionQueryRequest, PartitionQueryResponse, Cursor, PartitionQueryPage> {
+
+ private PartitionQueryPage(
+ PageContext context,
+ PartitionQueryResponse response) {
+ super(context, response);
+ }
+
+ private static PartitionQueryPage createEmptyPage() {
+ return new PartitionQueryPage(null, null);
+ }
+
+ @Override
+ protected PartitionQueryPage createPage(
+ PageContext context,
+ PartitionQueryResponse response) {
+ return new PartitionQueryPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class PartitionQueryFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ PartitionQueryRequest,
+ PartitionQueryResponse,
+ Cursor,
+ PartitionQueryPage,
+ PartitionQueryFixedSizeCollection> {
+
+ private PartitionQueryFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static PartitionQueryFixedSizeCollection createEmptyCollection() {
+ return new PartitionQueryFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected PartitionQueryFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new PartitionQueryFixedSizeCollection(pages, collectionSize);
+ }
+ }
}
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java
index fc4d44bb2..c01d0cce6 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java
@@ -17,6 +17,7 @@
import static com.google.cloud.firestore.v1.FirestoreClient.ListCollectionIdsPagedResponse;
import static com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
+import static com.google.cloud.firestore.v1.FirestoreClient.PartitionQueryPagedResponse;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
@@ -34,6 +35,8 @@
import com.google.cloud.firestore.v1.stub.FirestoreStubSettings;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
+import com.google.firestore.v1.BatchWriteRequest;
+import com.google.firestore.v1.BatchWriteResponse;
import com.google.firestore.v1.BeginTransactionRequest;
import com.google.firestore.v1.BeginTransactionResponse;
import com.google.firestore.v1.CommitRequest;
@@ -48,6 +51,8 @@
import com.google.firestore.v1.ListDocumentsResponse;
import com.google.firestore.v1.ListenRequest;
import com.google.firestore.v1.ListenResponse;
+import com.google.firestore.v1.PartitionQueryRequest;
+import com.google.firestore.v1.PartitionQueryResponse;
import com.google.firestore.v1.RollbackRequest;
import com.google.firestore.v1.RunQueryRequest;
import com.google.firestore.v1.RunQueryResponse;
@@ -162,6 +167,18 @@ public StreamingCallSettings listenSettings() {
return ((FirestoreStubSettings) getStubSettings()).listCollectionIdsSettings();
}
+ /** Returns the object with the settings used for calls to partitionQuery. */
+ public PagedCallSettings<
+ PartitionQueryRequest, PartitionQueryResponse, PartitionQueryPagedResponse>
+ partitionQuerySettings() {
+ return ((FirestoreStubSettings) getStubSettings()).partitionQuerySettings();
+ }
+
+ /** Returns the object with the settings used for calls to batchWrite. */
+ public UnaryCallSettings batchWriteSettings() {
+ return ((FirestoreStubSettings) getStubSettings()).batchWriteSettings();
+ }
+
public static final FirestoreSettings create(FirestoreStubSettings stub) throws IOException {
return new FirestoreSettings.Builder(stub.toBuilder()).build();
}
@@ -330,6 +347,18 @@ public StreamingCallSettings.Builder listenSettin
return getStubSettingsBuilder().listCollectionIdsSettings();
}
+ /** Returns the builder for the settings used for calls to partitionQuery. */
+ public PagedCallSettings.Builder<
+ PartitionQueryRequest, PartitionQueryResponse, PartitionQueryPagedResponse>
+ partitionQuerySettings() {
+ return getStubSettingsBuilder().partitionQuerySettings();
+ }
+
+ /** Returns the builder for the settings used for calls to batchWrite. */
+ public UnaryCallSettings.Builder batchWriteSettings() {
+ return getStubSettingsBuilder().batchWriteSettings();
+ }
+
@Override
public FirestoreSettings build() throws IOException {
return new FirestoreSettings(this);
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStub.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStub.java
index d847aaad5..579adc2c3 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStub.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStub.java
@@ -20,21 +20,28 @@
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.firestore.admin.v1.CreateIndexRequest;
import com.google.firestore.admin.v1.DeleteIndexRequest;
+import com.google.firestore.admin.v1.ExportDocumentsMetadata;
import com.google.firestore.admin.v1.ExportDocumentsRequest;
+import com.google.firestore.admin.v1.ExportDocumentsResponse;
import com.google.firestore.admin.v1.Field;
+import com.google.firestore.admin.v1.FieldOperationMetadata;
import com.google.firestore.admin.v1.GetFieldRequest;
import com.google.firestore.admin.v1.GetIndexRequest;
+import com.google.firestore.admin.v1.ImportDocumentsMetadata;
import com.google.firestore.admin.v1.ImportDocumentsRequest;
import com.google.firestore.admin.v1.Index;
+import com.google.firestore.admin.v1.IndexOperationMetadata;
import com.google.firestore.admin.v1.ListFieldsRequest;
import com.google.firestore.admin.v1.ListFieldsResponse;
import com.google.firestore.admin.v1.ListIndexesRequest;
import com.google.firestore.admin.v1.ListIndexesResponse;
import com.google.firestore.admin.v1.UpdateFieldRequest;
import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
import javax.annotation.Generated;
@@ -48,6 +55,31 @@
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public abstract class FirestoreAdminStub implements BackgroundResource {
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationsStub getOperationsStub() {
+ throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ }
+
+ public UnaryCallable deleteIndexCallable() {
+ throw new UnsupportedOperationException("Not implemented: deleteIndexCallable()");
+ }
+
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallable
+ updateFieldOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateFieldOperationCallable()");
+ }
+
+ public UnaryCallable updateFieldCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateFieldCallable()");
+ }
+
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallable
+ createIndexOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: createIndexOperationCallable()");
+ }
+
public UnaryCallable createIndexCallable() {
throw new UnsupportedOperationException("Not implemented: createIndexCallable()");
}
@@ -64,18 +96,6 @@ public UnaryCallable getIndexCallable() {
throw new UnsupportedOperationException("Not implemented: getIndexCallable()");
}
- public UnaryCallable deleteIndexCallable() {
- throw new UnsupportedOperationException("Not implemented: deleteIndexCallable()");
- }
-
- public UnaryCallable importDocumentsCallable() {
- throw new UnsupportedOperationException("Not implemented: importDocumentsCallable()");
- }
-
- public UnaryCallable exportDocumentsCallable() {
- throw new UnsupportedOperationException("Not implemented: exportDocumentsCallable()");
- }
-
public UnaryCallable getFieldCallable() {
throw new UnsupportedOperationException("Not implemented: getFieldCallable()");
}
@@ -88,8 +108,24 @@ public UnaryCallable listFieldsCallable()
throw new UnsupportedOperationException("Not implemented: listFieldsCallable()");
}
- public UnaryCallable updateFieldCallable() {
- throw new UnsupportedOperationException("Not implemented: updateFieldCallable()");
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallable
+ exportDocumentsOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: exportDocumentsOperationCallable()");
+ }
+
+ public UnaryCallable exportDocumentsCallable() {
+ throw new UnsupportedOperationException("Not implemented: exportDocumentsCallable()");
+ }
+
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallable
+ importDocumentsOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: importDocumentsOperationCallable()");
+ }
+
+ public UnaryCallable importDocumentsCallable() {
+ throw new UnsupportedOperationException("Not implemented: importDocumentsCallable()");
}
@Override
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java
index def68553b..e681e64fb 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreAdminStubSettings.java
@@ -27,10 +27,14 @@
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.longrunning.OperationSnapshot;
+import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.PagedListDescriptor;
@@ -46,12 +50,17 @@
import com.google.common.collect.Lists;
import com.google.firestore.admin.v1.CreateIndexRequest;
import com.google.firestore.admin.v1.DeleteIndexRequest;
+import com.google.firestore.admin.v1.ExportDocumentsMetadata;
import com.google.firestore.admin.v1.ExportDocumentsRequest;
+import com.google.firestore.admin.v1.ExportDocumentsResponse;
import com.google.firestore.admin.v1.Field;
+import com.google.firestore.admin.v1.FieldOperationMetadata;
import com.google.firestore.admin.v1.GetFieldRequest;
import com.google.firestore.admin.v1.GetIndexRequest;
+import com.google.firestore.admin.v1.ImportDocumentsMetadata;
import com.google.firestore.admin.v1.ImportDocumentsRequest;
import com.google.firestore.admin.v1.Index;
+import com.google.firestore.admin.v1.IndexOperationMetadata;
import com.google.firestore.admin.v1.ListFieldsRequest;
import com.google.firestore.admin.v1.ListFieldsResponse;
import com.google.firestore.admin.v1.ListIndexesRequest;
@@ -79,16 +88,16 @@
* The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
- *
For example, to set the total timeout of createIndex to 30 seconds:
+ *
For example, to set the total timeout of deleteIndex to 30 seconds:
*
*
*
* FirestoreAdminStubSettings.Builder firestoreAdminSettingsBuilder =
* FirestoreAdminStubSettings.newBuilder();
* firestoreAdminSettingsBuilder
- * .createIndexSettings()
+ * .deleteIndexSettings()
* .setRetrySettings(
- * firestoreAdminSettingsBuilder.createIndexSettings().getRetrySettings().toBuilder()
+ * firestoreAdminSettingsBuilder.deleteIndexSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* FirestoreAdminStubSettings firestoreAdminSettings = firestoreAdminSettingsBuilder.build();
@@ -105,23 +114,56 @@ public class FirestoreAdminStubSettings extends StubSettings deleteIndexSettings;
+ private final UnaryCallSettings updateFieldSettings;
+ private final OperationCallSettings
+ updateFieldOperationSettings;
private final UnaryCallSettings createIndexSettings;
+ private final OperationCallSettings
+ createIndexOperationSettings;
private final PagedCallSettings
listIndexesSettings;
private final UnaryCallSettings getIndexSettings;
- private final UnaryCallSettings deleteIndexSettings;
- private final UnaryCallSettings importDocumentsSettings;
- private final UnaryCallSettings exportDocumentsSettings;
private final UnaryCallSettings getFieldSettings;
private final PagedCallSettings
listFieldsSettings;
- private final UnaryCallSettings updateFieldSettings;
+ private final UnaryCallSettings exportDocumentsSettings;
+ private final OperationCallSettings<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationSettings;
+ private final UnaryCallSettings importDocumentsSettings;
+ private final OperationCallSettings
+ importDocumentsOperationSettings;
+
+ /** Returns the object with the settings used for calls to deleteIndex. */
+ public UnaryCallSettings deleteIndexSettings() {
+ return deleteIndexSettings;
+ }
+
+ /** Returns the object with the settings used for calls to updateField. */
+ public UnaryCallSettings updateFieldSettings() {
+ return updateFieldSettings;
+ }
+
+ /** Returns the object with the settings used for calls to updateField. */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings
+ updateFieldOperationSettings() {
+ return updateFieldOperationSettings;
+ }
/** Returns the object with the settings used for calls to createIndex. */
public UnaryCallSettings createIndexSettings() {
return createIndexSettings;
}
+ /** Returns the object with the settings used for calls to createIndex. */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings
+ createIndexOperationSettings() {
+ return createIndexOperationSettings;
+ }
+
/** Returns the object with the settings used for calls to listIndexes. */
public PagedCallSettings
listIndexesSettings() {
@@ -133,14 +175,15 @@ public UnaryCallSettings getIndexSettings() {
return getIndexSettings;
}
- /** Returns the object with the settings used for calls to deleteIndex. */
- public UnaryCallSettings deleteIndexSettings() {
- return deleteIndexSettings;
+ /** Returns the object with the settings used for calls to getField. */
+ public UnaryCallSettings getFieldSettings() {
+ return getFieldSettings;
}
- /** Returns the object with the settings used for calls to importDocuments. */
- public UnaryCallSettings importDocumentsSettings() {
- return importDocumentsSettings;
+ /** Returns the object with the settings used for calls to listFields. */
+ public PagedCallSettings
+ listFieldsSettings() {
+ return listFieldsSettings;
}
/** Returns the object with the settings used for calls to exportDocuments. */
@@ -148,20 +191,24 @@ public UnaryCallSettings exportDocumentsSetti
return exportDocumentsSettings;
}
- /** Returns the object with the settings used for calls to getField. */
- public UnaryCallSettings getFieldSettings() {
- return getFieldSettings;
+ /** Returns the object with the settings used for calls to exportDocuments. */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationSettings() {
+ return exportDocumentsOperationSettings;
}
- /** Returns the object with the settings used for calls to listFields. */
- public PagedCallSettings
- listFieldsSettings() {
- return listFieldsSettings;
+ /** Returns the object with the settings used for calls to importDocuments. */
+ public UnaryCallSettings importDocumentsSettings() {
+ return importDocumentsSettings;
}
- /** Returns the object with the settings used for calls to updateField. */
- public UnaryCallSettings updateFieldSettings() {
- return updateFieldSettings;
+ /** Returns the object with the settings used for calls to importDocuments. */
+ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings
+ importDocumentsOperationSettings() {
+ return importDocumentsOperationSettings;
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
@@ -233,15 +280,19 @@ public Builder toBuilder() {
protected FirestoreAdminStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
+ deleteIndexSettings = settingsBuilder.deleteIndexSettings().build();
+ updateFieldSettings = settingsBuilder.updateFieldSettings().build();
+ updateFieldOperationSettings = settingsBuilder.updateFieldOperationSettings().build();
createIndexSettings = settingsBuilder.createIndexSettings().build();
+ createIndexOperationSettings = settingsBuilder.createIndexOperationSettings().build();
listIndexesSettings = settingsBuilder.listIndexesSettings().build();
getIndexSettings = settingsBuilder.getIndexSettings().build();
- deleteIndexSettings = settingsBuilder.deleteIndexSettings().build();
- importDocumentsSettings = settingsBuilder.importDocumentsSettings().build();
- exportDocumentsSettings = settingsBuilder.exportDocumentsSettings().build();
getFieldSettings = settingsBuilder.getFieldSettings().build();
listFieldsSettings = settingsBuilder.listFieldsSettings().build();
- updateFieldSettings = settingsBuilder.updateFieldSettings().build();
+ exportDocumentsSettings = settingsBuilder.exportDocumentsSettings().build();
+ exportDocumentsOperationSettings = settingsBuilder.exportDocumentsOperationSettings().build();
+ importDocumentsSettings = settingsBuilder.importDocumentsSettings().build();
+ importDocumentsOperationSettings = settingsBuilder.importDocumentsOperationSettings().build();
}
private static final PagedListDescriptor
@@ -354,21 +405,31 @@ public ApiFuture getFuturePagedResponse(
public static class Builder extends StubSettings.Builder {
private final ImmutableList> unaryMethodSettingsBuilders;
+ private final UnaryCallSettings.Builder deleteIndexSettings;
+ private final UnaryCallSettings.Builder updateFieldSettings;
+ private final OperationCallSettings.Builder
+ updateFieldOperationSettings;
private final UnaryCallSettings.Builder createIndexSettings;
+ private final OperationCallSettings.Builder
+ createIndexOperationSettings;
private final PagedCallSettings.Builder<
ListIndexesRequest, ListIndexesResponse, ListIndexesPagedResponse>
listIndexesSettings;
private final UnaryCallSettings.Builder getIndexSettings;
- private final UnaryCallSettings.Builder deleteIndexSettings;
- private final UnaryCallSettings.Builder
- importDocumentsSettings;
- private final UnaryCallSettings.Builder
- exportDocumentsSettings;
private final UnaryCallSettings.Builder getFieldSettings;
private final PagedCallSettings.Builder<
ListFieldsRequest, ListFieldsResponse, ListFieldsPagedResponse>
listFieldsSettings;
- private final UnaryCallSettings.Builder updateFieldSettings;
+ private final UnaryCallSettings.Builder
+ exportDocumentsSettings;
+ private final OperationCallSettings.Builder<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationSettings;
+ private final UnaryCallSettings.Builder
+ importDocumentsSettings;
+ private final OperationCallSettings.Builder<
+ ImportDocumentsRequest, Empty, ImportDocumentsMetadata>
+ importDocumentsOperationSettings;
private static final ImmutableMap>
RETRYABLE_CODE_DEFINITIONS;
@@ -384,6 +445,11 @@ public static class Builder extends StubSettings.BuildernewArrayList()));
+ definitions.put(
+ "idempotent2",
+ ImmutableSet.copyOf(
+ Lists.newArrayList(
+ StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
@@ -413,35 +479,43 @@ protected Builder() {
protected Builder(ClientContext clientContext) {
super(clientContext);
+ deleteIndexSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
+ updateFieldSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+
+ updateFieldOperationSettings = OperationCallSettings.newBuilder();
+
createIndexSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ createIndexOperationSettings = OperationCallSettings.newBuilder();
+
listIndexesSettings = PagedCallSettings.newBuilder(LIST_INDEXES_PAGE_STR_FACT);
getIndexSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
- deleteIndexSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ getFieldSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
- importDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ listFieldsSettings = PagedCallSettings.newBuilder(LIST_FIELDS_PAGE_STR_FACT);
exportDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
- getFieldSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ exportDocumentsOperationSettings = OperationCallSettings.newBuilder();
- listFieldsSettings = PagedCallSettings.newBuilder(LIST_FIELDS_PAGE_STR_FACT);
+ importDocumentsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
- updateFieldSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ importDocumentsOperationSettings = OperationCallSettings.newBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
+ deleteIndexSettings,
+ updateFieldSettings,
createIndexSettings,
listIndexesSettings,
getIndexSettings,
- deleteIndexSettings,
- importDocumentsSettings,
- exportDocumentsSettings,
getFieldSettings,
listFieldsSettings,
- updateFieldSettings);
+ exportDocumentsSettings,
+ importDocumentsSettings);
initDefaults(this);
}
@@ -457,6 +531,16 @@ private static Builder createDefault() {
private static Builder initDefaults(Builder builder) {
+ builder
+ .deleteIndexSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
+ builder
+ .updateFieldSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+
builder
.createIndexSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
@@ -464,22 +548,22 @@ private static Builder initDefaults(Builder builder) {
builder
.listIndexesSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
builder
.getIndexSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
builder
- .deleteIndexSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+ .getFieldSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
builder
- .importDocumentsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+ .listFieldsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
builder
@@ -488,19 +572,99 @@ private static Builder initDefaults(Builder builder) {
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
builder
- .getFieldSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
+ .importDocumentsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
-
builder
- .listFieldsSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
-
+ .updateFieldOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings.newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(Field.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(FieldOperationMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(5000L))
+ .setInitialRpcTimeout(Duration.ZERO) // ignored
+ .setRpcTimeoutMultiplier(1.0) // ignored
+ .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
builder
- .updateFieldSettings()
- .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
- .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
+ .createIndexOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings.newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(Index.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(IndexOperationMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(5000L))
+ .setInitialRpcTimeout(Duration.ZERO) // ignored
+ .setRpcTimeoutMultiplier(1.0) // ignored
+ .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+ builder
+ .exportDocumentsOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(ExportDocumentsResponse.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(ExportDocumentsMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(5000L))
+ .setInitialRpcTimeout(Duration.ZERO) // ignored
+ .setRpcTimeoutMultiplier(1.0) // ignored
+ .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+ builder
+ .importDocumentsOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings
+ .newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(Empty.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(ImportDocumentsMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(500L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(5000L))
+ .setInitialRpcTimeout(Duration.ZERO) // ignored
+ .setRpcTimeoutMultiplier(1.0) // ignored
+ .setMaxRpcTimeout(Duration.ZERO) // ignored
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
return builder;
}
@@ -508,27 +672,31 @@ private static Builder initDefaults(Builder builder) {
protected Builder(FirestoreAdminStubSettings settings) {
super(settings);
+ deleteIndexSettings = settings.deleteIndexSettings.toBuilder();
+ updateFieldSettings = settings.updateFieldSettings.toBuilder();
+ updateFieldOperationSettings = settings.updateFieldOperationSettings.toBuilder();
createIndexSettings = settings.createIndexSettings.toBuilder();
+ createIndexOperationSettings = settings.createIndexOperationSettings.toBuilder();
listIndexesSettings = settings.listIndexesSettings.toBuilder();
getIndexSettings = settings.getIndexSettings.toBuilder();
- deleteIndexSettings = settings.deleteIndexSettings.toBuilder();
- importDocumentsSettings = settings.importDocumentsSettings.toBuilder();
- exportDocumentsSettings = settings.exportDocumentsSettings.toBuilder();
getFieldSettings = settings.getFieldSettings.toBuilder();
listFieldsSettings = settings.listFieldsSettings.toBuilder();
- updateFieldSettings = settings.updateFieldSettings.toBuilder();
+ exportDocumentsSettings = settings.exportDocumentsSettings.toBuilder();
+ exportDocumentsOperationSettings = settings.exportDocumentsOperationSettings.toBuilder();
+ importDocumentsSettings = settings.importDocumentsSettings.toBuilder();
+ importDocumentsOperationSettings = settings.importDocumentsOperationSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.>of(
+ deleteIndexSettings,
+ updateFieldSettings,
createIndexSettings,
listIndexesSettings,
getIndexSettings,
- deleteIndexSettings,
- importDocumentsSettings,
- exportDocumentsSettings,
getFieldSettings,
listFieldsSettings,
- updateFieldSettings);
+ exportDocumentsSettings,
+ importDocumentsSettings);
}
// NEXT_MAJOR_VER: remove 'throws Exception'
@@ -547,11 +715,37 @@ public Builder applyToAllUnaryMethods(
return unaryMethodSettingsBuilders;
}
+ /** Returns the builder for the settings used for calls to deleteIndex. */
+ public UnaryCallSettings.Builder deleteIndexSettings() {
+ return deleteIndexSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to updateField. */
+ public UnaryCallSettings.Builder updateFieldSettings() {
+ return updateFieldSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to updateField. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ updateFieldOperationSettings() {
+ return updateFieldOperationSettings;
+ }
+
/** Returns the builder for the settings used for calls to createIndex. */
public UnaryCallSettings.Builder createIndexSettings() {
return createIndexSettings;
}
+ /** Returns the builder for the settings used for calls to createIndex. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ createIndexOperationSettings() {
+ return createIndexOperationSettings;
+ }
+
/** Returns the builder for the settings used for calls to listIndexes. */
public PagedCallSettings.Builder<
ListIndexesRequest, ListIndexesResponse, ListIndexesPagedResponse>
@@ -564,14 +758,15 @@ public UnaryCallSettings.Builder getIndexSettings() {
return getIndexSettings;
}
- /** Returns the builder for the settings used for calls to deleteIndex. */
- public UnaryCallSettings.Builder deleteIndexSettings() {
- return deleteIndexSettings;
+ /** Returns the builder for the settings used for calls to getField. */
+ public UnaryCallSettings.Builder getFieldSettings() {
+ return getFieldSettings;
}
- /** Returns the builder for the settings used for calls to importDocuments. */
- public UnaryCallSettings.Builder importDocumentsSettings() {
- return importDocumentsSettings;
+ /** Returns the builder for the settings used for calls to listFields. */
+ public PagedCallSettings.Builder
+ listFieldsSettings() {
+ return listFieldsSettings;
}
/** Returns the builder for the settings used for calls to exportDocuments. */
@@ -579,20 +774,26 @@ public UnaryCallSettings.Builder exportDocume
return exportDocumentsSettings;
}
- /** Returns the builder for the settings used for calls to getField. */
- public UnaryCallSettings.Builder getFieldSettings() {
- return getFieldSettings;
+ /** Returns the builder for the settings used for calls to exportDocuments. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder<
+ ExportDocumentsRequest, ExportDocumentsResponse, ExportDocumentsMetadata>
+ exportDocumentsOperationSettings() {
+ return exportDocumentsOperationSettings;
}
- /** Returns the builder for the settings used for calls to listFields. */
- public PagedCallSettings.Builder
- listFieldsSettings() {
- return listFieldsSettings;
+ /** Returns the builder for the settings used for calls to importDocuments. */
+ public UnaryCallSettings.Builder importDocumentsSettings() {
+ return importDocumentsSettings;
}
- /** Returns the builder for the settings used for calls to updateField. */
- public UnaryCallSettings.Builder updateFieldSettings() {
- return updateFieldSettings;
+ /** Returns the builder for the settings used for calls to importDocuments. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ importDocumentsOperationSettings() {
+ return importDocumentsOperationSettings;
}
@Override
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java
index 50456e9ef..6711c2a14 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java
@@ -17,6 +17,7 @@
import static com.google.cloud.firestore.v1.FirestoreClient.ListCollectionIdsPagedResponse;
import static com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
+import static com.google.cloud.firestore.v1.FirestoreClient.PartitionQueryPagedResponse;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
@@ -25,6 +26,8 @@
import com.google.api.gax.rpc.UnaryCallable;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
+import com.google.firestore.v1.BatchWriteRequest;
+import com.google.firestore.v1.BatchWriteResponse;
import com.google.firestore.v1.BeginTransactionRequest;
import com.google.firestore.v1.BeginTransactionResponse;
import com.google.firestore.v1.CommitRequest;
@@ -39,6 +42,8 @@
import com.google.firestore.v1.ListDocumentsResponse;
import com.google.firestore.v1.ListenRequest;
import com.google.firestore.v1.ListenResponse;
+import com.google.firestore.v1.PartitionQueryRequest;
+import com.google.firestore.v1.PartitionQueryResponse;
import com.google.firestore.v1.RollbackRequest;
import com.google.firestore.v1.RunQueryRequest;
import com.google.firestore.v1.RunQueryResponse;
@@ -123,6 +128,19 @@ public BidiStreamingCallable listenCallable() {
throw new UnsupportedOperationException("Not implemented: listCollectionIdsCallable()");
}
+ public UnaryCallable
+ partitionQueryPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: partitionQueryPagedCallable()");
+ }
+
+ public UnaryCallable partitionQueryCallable() {
+ throw new UnsupportedOperationException("Not implemented: partitionQueryCallable()");
+ }
+
+ public UnaryCallable batchWriteCallable() {
+ throw new UnsupportedOperationException("Not implemented: batchWriteCallable()");
+ }
+
@Override
public abstract void close();
}
diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java
index 6272c4e94..eab7bf699 100644
--- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java
+++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStubSettings.java
@@ -17,6 +17,7 @@
import static com.google.cloud.firestore.v1.FirestoreClient.ListCollectionIdsPagedResponse;
import static com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
+import static com.google.cloud.firestore.v1.FirestoreClient.PartitionQueryPagedResponse;
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
@@ -48,11 +49,14 @@
import com.google.common.collect.Lists;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
+import com.google.firestore.v1.BatchWriteRequest;
+import com.google.firestore.v1.BatchWriteResponse;
import com.google.firestore.v1.BeginTransactionRequest;
import com.google.firestore.v1.BeginTransactionResponse;
import com.google.firestore.v1.CommitRequest;
import com.google.firestore.v1.CommitResponse;
import com.google.firestore.v1.CreateDocumentRequest;
+import com.google.firestore.v1.Cursor;
import com.google.firestore.v1.DeleteDocumentRequest;
import com.google.firestore.v1.Document;
import com.google.firestore.v1.GetDocumentRequest;
@@ -62,6 +66,8 @@
import com.google.firestore.v1.ListDocumentsResponse;
import com.google.firestore.v1.ListenRequest;
import com.google.firestore.v1.ListenResponse;
+import com.google.firestore.v1.PartitionQueryRequest;
+import com.google.firestore.v1.PartitionQueryResponse;
import com.google.firestore.v1.RollbackRequest;
import com.google.firestore.v1.RunQueryRequest;
import com.google.firestore.v1.RunQueryResponse;
@@ -133,6 +139,10 @@ public class FirestoreStubSettings extends StubSettings {
private final PagedCallSettings<
ListCollectionIdsRequest, ListCollectionIdsResponse, ListCollectionIdsPagedResponse>
listCollectionIdsSettings;
+ private final PagedCallSettings<
+ PartitionQueryRequest, PartitionQueryResponse, PartitionQueryPagedResponse>
+ partitionQuerySettings;
+ private final UnaryCallSettings batchWriteSettings;
/** Returns the object with the settings used for calls to getDocument. */
public UnaryCallSettings getDocumentSettings() {
@@ -204,6 +214,18 @@ public StreamingCallSettings listenSettings() {
return listCollectionIdsSettings;
}
+ /** Returns the object with the settings used for calls to partitionQuery. */
+ public PagedCallSettings<
+ PartitionQueryRequest, PartitionQueryResponse, PartitionQueryPagedResponse>
+ partitionQuerySettings() {
+ return partitionQuerySettings;
+ }
+
+ /** Returns the object with the settings used for calls to batchWrite. */
+ public UnaryCallSettings batchWriteSettings() {
+ return batchWriteSettings;
+ }
+
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public FirestoreStub createStub() throws IOException {
if (getTransportChannelProvider()
@@ -285,6 +307,8 @@ protected FirestoreStubSettings(Builder settingsBuilder) throws IOException {
writeSettings = settingsBuilder.writeSettings().build();
listenSettings = settingsBuilder.listenSettings().build();
listCollectionIdsSettings = settingsBuilder.listCollectionIdsSettings().build();
+ partitionQuerySettings = settingsBuilder.partitionQuerySettings().build();
+ batchWriteSettings = settingsBuilder.batchWriteSettings().build();
}
private static final PagedListDescriptor
@@ -362,6 +386,43 @@ public Iterable extractResources(ListCollectionIdsResponse payload) {
}
};
+ private static final PagedListDescriptor
+ PARTITION_QUERY_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public PartitionQueryRequest injectToken(PartitionQueryRequest payload, String token) {
+ return PartitionQueryRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public PartitionQueryRequest injectPageSize(
+ PartitionQueryRequest payload, int pageSize) {
+ return PartitionQueryRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(PartitionQueryRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(PartitionQueryResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(PartitionQueryResponse payload) {
+ return payload.getPartitionsList() != null
+ ? payload.getPartitionsList()
+ : ImmutableList.