@Generated(value="by gapic-generator-java") public class FirestoreAdminClient extends Object implements com.google.api.gax.core.BackgroundResource
This API provides several administrative services for Cloud Firestore.
Project, Database, Namespace, Collection, Collection Group, and Document are used as defined in the Google Cloud Firestore API.
Operation: An Operation represents work being performed in the background.
The index service manages Cloud Firestore indexes.
Index creation is performed asynchronously. An Operation resource is created for each such asynchronous operation. The state of the operation (including any errors encountered) may be queried via the Operation resource.
The Operations collection provides a record of actions performed for the specified Project (including any Operations in progress). Operations are not created directly but through calls on other collections or resources.
An Operation that is done may be deleted so that it is no longer listed as part of the Operation collection. Operations are garbage collected after 30 days. By default, ListOperations will only return in progress and failed operations. To list completed operation, issue a ListOperations request with the filter `done: true`.
Operations are created by service `FirestoreAdmin`, but are accessed via service `google.longrunning.Operations`.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
Index response = firestoreAdminClient.getIndex(name);
}
Note: close() needs to be called on the FirestoreAdminClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of FirestoreAdminSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
FirestoreAdminSettings firestoreAdminSettings =
FirestoreAdminSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create(firestoreAdminSettings);
To customize the endpoint:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
FirestoreAdminSettings firestoreAdminSettings =
FirestoreAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create(firestoreAdminSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
FirestoreAdminSettings firestoreAdminSettings =
FirestoreAdminSettings.newHttpJsonBuilder().build();
FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create(firestoreAdminSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Modifier and Type | Class and Description |
---|---|
static class |
FirestoreAdminClient.ListFieldsFixedSizeCollection |
static class |
FirestoreAdminClient.ListFieldsPage |
static class |
FirestoreAdminClient.ListFieldsPagedResponse |
static class |
FirestoreAdminClient.ListIndexesFixedSizeCollection |
static class |
FirestoreAdminClient.ListIndexesPage |
static class |
FirestoreAdminClient.ListIndexesPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
FirestoreAdminClient(FirestoreAdminSettings settings)
Constructs an instance of FirestoreAdminClient, using the given settings.
|
protected |
FirestoreAdminClient(FirestoreAdminStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static FirestoreAdminClient |
create()
Constructs an instance of FirestoreAdminClient with default settings.
|
static FirestoreAdminClient |
create(FirestoreAdminSettings settings)
Constructs an instance of FirestoreAdminClient, using the given settings.
|
static FirestoreAdminClient |
create(FirestoreAdminStub stub)
Constructs an instance of FirestoreAdminClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Index,IndexOperationMetadata> |
createIndexAsync(CollectionGroupName parent,
Index index)
Creates a composite index.
|
com.google.api.gax.longrunning.OperationFuture<Index,IndexOperationMetadata> |
createIndexAsync(CreateIndexRequest request)
Creates a composite index.
|
com.google.api.gax.longrunning.OperationFuture<Index,IndexOperationMetadata> |
createIndexAsync(String parent,
Index index)
Creates a composite index.
|
com.google.api.gax.rpc.UnaryCallable<CreateIndexRequest,com.google.longrunning.Operation> |
createIndexCallable()
Creates a composite index.
|
com.google.api.gax.rpc.OperationCallable<CreateIndexRequest,Index,IndexOperationMetadata> |
createIndexOperationCallable()
Creates a composite index.
|
void |
deleteIndex(DeleteIndexRequest request)
Deletes a composite index.
|
void |
deleteIndex(IndexName name)
Deletes a composite index.
|
void |
deleteIndex(String name)
Deletes a composite index.
|
com.google.api.gax.rpc.UnaryCallable<DeleteIndexRequest,com.google.protobuf.Empty> |
deleteIndexCallable()
Deletes a composite index.
|
com.google.api.gax.longrunning.OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsAsync(DatabaseName name)
Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage
system, such as Google Cloud Storage.
|
com.google.api.gax.longrunning.OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsAsync(ExportDocumentsRequest request)
Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage
system, such as Google Cloud Storage.
|
com.google.api.gax.longrunning.OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsAsync(String name)
Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage
system, such as Google Cloud Storage.
|
com.google.api.gax.rpc.UnaryCallable<ExportDocumentsRequest,com.google.longrunning.Operation> |
exportDocumentsCallable()
Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage
system, such as Google Cloud Storage.
|
com.google.api.gax.rpc.OperationCallable<ExportDocumentsRequest,ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsOperationCallable()
Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage
system, such as Google Cloud Storage.
|
Database |
getDatabase(DatabaseName name)
Gets information about a database.
|
Database |
getDatabase(GetDatabaseRequest request)
Gets information about a database.
|
Database |
getDatabase(String name)
Gets information about a database.
|
com.google.api.gax.rpc.UnaryCallable<GetDatabaseRequest,Database> |
getDatabaseCallable()
Gets information about a database.
|
Field |
getField(FieldName name)
Gets the metadata and configuration for a Field.
|
Field |
getField(GetFieldRequest request)
Gets the metadata and configuration for a Field.
|
Field |
getField(String name)
Gets the metadata and configuration for a Field.
|
com.google.api.gax.rpc.UnaryCallable<GetFieldRequest,Field> |
getFieldCallable()
Gets the metadata and configuration for a Field.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
Index |
getIndex(GetIndexRequest request)
Gets a composite index.
|
Index |
getIndex(IndexName name)
Gets a composite index.
|
Index |
getIndex(String name)
Gets a composite index.
|
com.google.api.gax.rpc.UnaryCallable<GetIndexRequest,Index> |
getIndexCallable()
Gets a composite index.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
FirestoreAdminSettings |
getSettings() |
FirestoreAdminStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDocumentsMetadata> |
importDocumentsAsync(DatabaseName name)
Imports documents into Google Cloud Firestore.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDocumentsMetadata> |
importDocumentsAsync(ImportDocumentsRequest request)
Imports documents into Google Cloud Firestore.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDocumentsMetadata> |
importDocumentsAsync(String name)
Imports documents into Google Cloud Firestore.
|
com.google.api.gax.rpc.UnaryCallable<ImportDocumentsRequest,com.google.longrunning.Operation> |
importDocumentsCallable()
Imports documents into Google Cloud Firestore.
|
com.google.api.gax.rpc.OperationCallable<ImportDocumentsRequest,com.google.protobuf.Empty,ImportDocumentsMetadata> |
importDocumentsOperationCallable()
Imports documents into Google Cloud Firestore.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
ListDatabasesResponse |
listDatabases(ListDatabasesRequest request)
List all the databases in the project.
|
ListDatabasesResponse |
listDatabases(ProjectName parent)
List all the databases in the project.
|
ListDatabasesResponse |
listDatabases(String parent)
List all the databases in the project.
|
com.google.api.gax.rpc.UnaryCallable<ListDatabasesRequest,ListDatabasesResponse> |
listDatabasesCallable()
List all the databases in the project.
|
FirestoreAdminClient.ListFieldsPagedResponse |
listFields(CollectionGroupName parent)
Lists the field configuration and metadata for this database.
|
FirestoreAdminClient.ListFieldsPagedResponse |
listFields(ListFieldsRequest request)
Lists the field configuration and metadata for this database.
|
FirestoreAdminClient.ListFieldsPagedResponse |
listFields(String parent)
Lists the field configuration and metadata for this database.
|
com.google.api.gax.rpc.UnaryCallable<ListFieldsRequest,ListFieldsResponse> |
listFieldsCallable()
Lists the field configuration and metadata for this database.
|
com.google.api.gax.rpc.UnaryCallable<ListFieldsRequest,FirestoreAdminClient.ListFieldsPagedResponse> |
listFieldsPagedCallable()
Lists the field configuration and metadata for this database.
|
FirestoreAdminClient.ListIndexesPagedResponse |
listIndexes(CollectionGroupName parent)
Lists composite indexes.
|
FirestoreAdminClient.ListIndexesPagedResponse |
listIndexes(ListIndexesRequest request)
Lists composite indexes.
|
FirestoreAdminClient.ListIndexesPagedResponse |
listIndexes(String parent)
Lists composite indexes.
|
com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,ListIndexesResponse> |
listIndexesCallable()
Lists composite indexes.
|
com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,FirestoreAdminClient.ListIndexesPagedResponse> |
listIndexesPagedCallable()
Lists composite indexes.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Database,UpdateDatabaseMetadata> |
updateDatabaseAsync(Database database,
com.google.protobuf.FieldMask updateMask)
Updates a database.
|
com.google.api.gax.longrunning.OperationFuture<Database,UpdateDatabaseMetadata> |
updateDatabaseAsync(UpdateDatabaseRequest request)
Updates a database.
|
com.google.api.gax.rpc.UnaryCallable<UpdateDatabaseRequest,com.google.longrunning.Operation> |
updateDatabaseCallable()
Updates a database.
|
com.google.api.gax.rpc.OperationCallable<UpdateDatabaseRequest,Database,UpdateDatabaseMetadata> |
updateDatabaseOperationCallable()
Updates a database.
|
com.google.api.gax.longrunning.OperationFuture<Field,FieldOperationMetadata> |
updateFieldAsync(Field field)
Updates a field configuration.
|
com.google.api.gax.longrunning.OperationFuture<Field,FieldOperationMetadata> |
updateFieldAsync(UpdateFieldRequest request)
Updates a field configuration.
|
com.google.api.gax.rpc.UnaryCallable<UpdateFieldRequest,com.google.longrunning.Operation> |
updateFieldCallable()
Updates a field configuration.
|
com.google.api.gax.rpc.OperationCallable<UpdateFieldRequest,Field,FieldOperationMetadata> |
updateFieldOperationCallable()
Updates a field configuration.
|
protected FirestoreAdminClient(FirestoreAdminSettings settings) throws IOException
IOException
protected FirestoreAdminClient(FirestoreAdminStub stub)
public static final FirestoreAdminClient create() throws IOException
IOException
public static final FirestoreAdminClient create(FirestoreAdminSettings settings) throws IOException
IOException
public static final FirestoreAdminClient create(FirestoreAdminStub stub)
public final FirestoreAdminSettings getSettings()
public FirestoreAdminStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final com.google.api.gax.longrunning.OperationFuture<Index,IndexOperationMetadata> createIndexAsync(CollectionGroupName parent, Index index)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
CollectionGroupName parent =
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
Index index = Index.newBuilder().build();
Index response = firestoreAdminClient.createIndexAsync(parent, index).get();
}
parent
- Required. A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`index
- Required. The composite index to create.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Index,IndexOperationMetadata> createIndexAsync(String parent, Index index)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString();
Index index = Index.newBuilder().build();
Index response = firestoreAdminClient.createIndexAsync(parent, index).get();
}
parent
- Required. A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`index
- Required. The composite index to create.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Index,IndexOperationMetadata> createIndexAsync(CreateIndexRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
CreateIndexRequest request =
CreateIndexRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setIndex(Index.newBuilder().build())
.build();
Index response = firestoreAdminClient.createIndexAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateIndexRequest,Index,IndexOperationMetadata> createIndexOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
CreateIndexRequest request =
CreateIndexRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setIndex(Index.newBuilder().build())
.build();
OperationFuture<Index, IndexOperationMetadata> future =
firestoreAdminClient.createIndexOperationCallable().futureCall(request);
// Do something.
Index response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateIndexRequest,com.google.longrunning.Operation> createIndexCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
CreateIndexRequest request =
CreateIndexRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setIndex(Index.newBuilder().build())
.build();
ApiFuture<Operation> future = firestoreAdminClient.createIndexCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final FirestoreAdminClient.ListIndexesPagedResponse listIndexes(CollectionGroupName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
CollectionGroupName parent =
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
for (Index element : firestoreAdminClient.listIndexes(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final FirestoreAdminClient.ListIndexesPagedResponse listIndexes(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString();
for (Index element : firestoreAdminClient.listIndexes(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final FirestoreAdminClient.ListIndexesPagedResponse listIndexes(ListIndexesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListIndexesRequest request =
ListIndexesRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Index element : firestoreAdminClient.listIndexes(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,FirestoreAdminClient.ListIndexesPagedResponse> listIndexesPagedCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListIndexesRequest request =
ListIndexesRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Index> future = firestoreAdminClient.listIndexesPagedCallable().futureCall(request);
// Do something.
for (Index element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListIndexesRequest,ListIndexesResponse> listIndexesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListIndexesRequest request =
ListIndexesRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListIndexesResponse response = firestoreAdminClient.listIndexesCallable().call(request);
for (Index element : response.getIndexesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Index getIndex(IndexName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
Index response = firestoreAdminClient.getIndex(name);
}
name
- Required. A name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Index getIndex(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString();
Index response = firestoreAdminClient.getIndex(name);
}
name
- Required. A name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Index getIndex(GetIndexRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
GetIndexRequest request =
GetIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
Index response = firestoreAdminClient.getIndex(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetIndexRequest,Index> getIndexCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
GetIndexRequest request =
GetIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
ApiFuture<Index> future = firestoreAdminClient.getIndexCallable().futureCall(request);
// Do something.
Index response = future.get();
}
public final void deleteIndex(IndexName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
firestoreAdminClient.deleteIndex(name);
}
name
- Required. A name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteIndex(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString();
firestoreAdminClient.deleteIndex(name);
}
name
- Required. A name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteIndex(DeleteIndexRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
DeleteIndexRequest request =
DeleteIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
firestoreAdminClient.deleteIndex(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteIndexRequest,com.google.protobuf.Empty> deleteIndexCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
DeleteIndexRequest request =
DeleteIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
ApiFuture<Empty> future = firestoreAdminClient.deleteIndexCallable().futureCall(request);
// Do something.
future.get();
}
public final Field getField(FieldName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
FieldName name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]");
Field response = firestoreAdminClient.getField(name);
}
name
- Required. A name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Field getField(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String name = FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]").toString();
Field response = firestoreAdminClient.getField(name);
}
name
- Required. A name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Field getField(GetFieldRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
GetFieldRequest request =
GetFieldRequest.newBuilder()
.setName(
FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]").toString())
.build();
Field response = firestoreAdminClient.getField(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetFieldRequest,Field> getFieldCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
GetFieldRequest request =
GetFieldRequest.newBuilder()
.setName(
FieldName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[FIELD]").toString())
.build();
ApiFuture<Field> future = firestoreAdminClient.getFieldCallable().futureCall(request);
// Do something.
Field response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Field,FieldOperationMetadata> updateFieldAsync(Field field)
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
Field field = Field.newBuilder().build();
Field response = firestoreAdminClient.updateFieldAsync(field).get();
}
field
- Required. The field to be updated.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Field,FieldOperationMetadata> updateFieldAsync(UpdateFieldRequest request)
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
UpdateFieldRequest request =
UpdateFieldRequest.newBuilder()
.setField(Field.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Field response = firestoreAdminClient.updateFieldAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateFieldRequest,Field,FieldOperationMetadata> updateFieldOperationCallable()
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
UpdateFieldRequest request =
UpdateFieldRequest.newBuilder()
.setField(Field.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Field, FieldOperationMetadata> future =
firestoreAdminClient.updateFieldOperationCallable().futureCall(request);
// Do something.
Field response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateFieldRequest,com.google.longrunning.Operation> updateFieldCallable()
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
UpdateFieldRequest request =
UpdateFieldRequest.newBuilder()
.setField(Field.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future = firestoreAdminClient.updateFieldCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final FirestoreAdminClient.ListFieldsPagedResponse listFields(CollectionGroupName parent)
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
CollectionGroupName parent =
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]");
for (Field element : firestoreAdminClient.listFields(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final FirestoreAdminClient.ListFieldsPagedResponse listFields(String parent)
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String parent = CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString();
for (Field element : firestoreAdminClient.listFields(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent
- Required. A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final FirestoreAdminClient.ListFieldsPagedResponse listFields(ListFieldsRequest request)
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListFieldsRequest request =
ListFieldsRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Field element : firestoreAdminClient.listFields(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListFieldsRequest,FirestoreAdminClient.ListFieldsPagedResponse> listFieldsPagedCallable()
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListFieldsRequest request =
ListFieldsRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Field> future = firestoreAdminClient.listFieldsPagedCallable().futureCall(request);
// Do something.
for (Field element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListFieldsRequest,ListFieldsResponse> listFieldsCallable()
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:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListFieldsRequest request =
ListFieldsRequest.newBuilder()
.setParent(
CollectionGroupName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]").toString())
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.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 com.google.api.gax.longrunning.OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> exportDocumentsAsync(DatabaseName name)
For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(name).get();
}
name
- Required. Database to export. Should be of the form:
`projects/{project_id}/databases/{database_id}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> exportDocumentsAsync(String name)
For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String name = DatabaseName.of("[PROJECT]", "[DATABASE]").toString();
ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(name).get();
}
name
- Required. Database to export. Should be of the form:
`projects/{project_id}/databases/{database_id}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> exportDocumentsAsync(ExportDocumentsRequest request)
For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ExportDocumentsRequest request =
ExportDocumentsRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.addAllCollectionIds(new ArrayList<String>())
.setOutputUriPrefix("outputUriPrefix499858205")
.build();
ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ExportDocumentsRequest,ExportDocumentsResponse,ExportDocumentsMetadata> exportDocumentsOperationCallable()
For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ExportDocumentsRequest request =
ExportDocumentsRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.addAllCollectionIds(new ArrayList<String>())
.setOutputUriPrefix("outputUriPrefix499858205")
.build();
OperationFuture<ExportDocumentsResponse, ExportDocumentsMetadata> future =
firestoreAdminClient.exportDocumentsOperationCallable().futureCall(request);
// Do something.
ExportDocumentsResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ExportDocumentsRequest,com.google.longrunning.Operation> exportDocumentsCallable()
For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ExportDocumentsRequest request =
ExportDocumentsRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.addAllCollectionIds(new ArrayList<String>())
.setOutputUriPrefix("outputUriPrefix499858205")
.build();
ApiFuture<Operation> future =
firestoreAdminClient.exportDocumentsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDocumentsMetadata> importDocumentsAsync(DatabaseName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
firestoreAdminClient.importDocumentsAsync(name).get();
}
name
- Required. Database to import into. Should be of the form:
`projects/{project_id}/databases/{database_id}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDocumentsMetadata> importDocumentsAsync(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String name = DatabaseName.of("[PROJECT]", "[DATABASE]").toString();
firestoreAdminClient.importDocumentsAsync(name).get();
}
name
- Required. Database to import into. Should be of the form:
`projects/{project_id}/databases/{database_id}`.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,ImportDocumentsMetadata> importDocumentsAsync(ImportDocumentsRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ImportDocumentsRequest request =
ImportDocumentsRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.addAllCollectionIds(new ArrayList<String>())
.setInputUriPrefix("inputUriPrefix-97481100")
.build();
firestoreAdminClient.importDocumentsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ImportDocumentsRequest,com.google.protobuf.Empty,ImportDocumentsMetadata> importDocumentsOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ImportDocumentsRequest request =
ImportDocumentsRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.addAllCollectionIds(new ArrayList<String>())
.setInputUriPrefix("inputUriPrefix-97481100")
.build();
OperationFuture<Empty, ImportDocumentsMetadata> future =
firestoreAdminClient.importDocumentsOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ImportDocumentsRequest,com.google.longrunning.Operation> importDocumentsCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ImportDocumentsRequest request =
ImportDocumentsRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.addAllCollectionIds(new ArrayList<String>())
.setInputUriPrefix("inputUriPrefix-97481100")
.build();
ApiFuture<Operation> future =
firestoreAdminClient.importDocumentsCallable().futureCall(request);
// Do something.
future.get();
}
public final Database getDatabase(DatabaseName name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
DatabaseName name = DatabaseName.of("[PROJECT]", "[DATABASE]");
Database response = firestoreAdminClient.getDatabase(name);
}
name
- Required. A name of the form `projects/{project_id}/databases/{database_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Database getDatabase(String name)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String name = DatabaseName.of("[PROJECT]", "[DATABASE]").toString();
Database response = firestoreAdminClient.getDatabase(name);
}
name
- Required. A name of the form `projects/{project_id}/databases/{database_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Database getDatabase(GetDatabaseRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
GetDatabaseRequest request =
GetDatabaseRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.build();
Database response = firestoreAdminClient.getDatabase(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetDatabaseRequest,Database> getDatabaseCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
GetDatabaseRequest request =
GetDatabaseRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.build();
ApiFuture<Database> future = firestoreAdminClient.getDatabaseCallable().futureCall(request);
// Do something.
Database response = future.get();
}
public final ListDatabasesResponse listDatabases(ProjectName parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
ListDatabasesResponse response = firestoreAdminClient.listDatabases(parent);
}
parent
- Required. A parent name of the form `projects/{project_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ListDatabasesResponse listDatabases(String parent)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
String parent = ProjectName.of("[PROJECT]").toString();
ListDatabasesResponse response = firestoreAdminClient.listDatabases(parent);
}
parent
- Required. A parent name of the form `projects/{project_id}`com.google.api.gax.rpc.ApiException
- if the remote call failspublic final ListDatabasesResponse listDatabases(ListDatabasesRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListDatabasesRequest request =
ListDatabasesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.build();
ListDatabasesResponse response = firestoreAdminClient.listDatabases(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListDatabasesRequest,ListDatabasesResponse> listDatabasesCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ListDatabasesRequest request =
ListDatabasesRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.build();
ApiFuture<ListDatabasesResponse> future =
firestoreAdminClient.listDatabasesCallable().futureCall(request);
// Do something.
ListDatabasesResponse response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Database,UpdateDatabaseMetadata> updateDatabaseAsync(Database database, com.google.protobuf.FieldMask updateMask)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
Database database = Database.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Database response = firestoreAdminClient.updateDatabaseAsync(database, updateMask).get();
}
database
- Required. The database to update.updateMask
- The list of fields to be updated.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Database,UpdateDatabaseMetadata> updateDatabaseAsync(UpdateDatabaseRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
UpdateDatabaseRequest request =
UpdateDatabaseRequest.newBuilder()
.setDatabase(Database.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Database response = firestoreAdminClient.updateDatabaseAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateDatabaseRequest,Database,UpdateDatabaseMetadata> updateDatabaseOperationCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
UpdateDatabaseRequest request =
UpdateDatabaseRequest.newBuilder()
.setDatabase(Database.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture<Database, UpdateDatabaseMetadata> future =
firestoreAdminClient.updateDatabaseOperationCallable().futureCall(request);
// Do something.
Database response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateDatabaseRequest,com.google.longrunning.Operation> updateDatabaseCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
UpdateDatabaseRequest request =
UpdateDatabaseRequest.newBuilder()
.setDatabase(Database.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future =
firestoreAdminClient.updateDatabaseCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2023 Google LLC. All rights reserved.