public class FirestoreAdminClient implements BackgroundResource
Service Description: The Cloud Firestore Admin API.
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().
Method | Description | Method Variants |
---|---|---|
CreateIndex | Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListIndexes | Lists composite indexes. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIndex | Gets a composite index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteIndex | Deletes a composite index. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetField | Gets the metadata and configuration for a Field. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateField | Updates a field configuration. Currently, field updates apply only to single field index configuration. However, calls to 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: This call returns a 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. To configure the default field settings for the database, use the special |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListFields | Lists the field configuration and metadata for this database. Currently, FirestoreAdmin.ListFields only supports listing fields that have been explicitly overridden. To issue this query, call FirestoreAdmin.ListFields with the filter set to |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportDocuments | 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. For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportDocuments | 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. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateDatabase | Create a database. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetDatabase | Gets information about a database. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListDatabases | List all the databases in the project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateDatabase | Updates a database. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteDatabase | Deletes a database. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetBackup | Gets information about a backup. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBackups | Lists all the backups. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteBackup | Deletes a backup. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RestoreDatabase | Creates a new database by restoring from an existing backup. The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup. The long-running operation can be used to track the progress of the restore, with the Operation's metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateBackupSchedule | Creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule with retention up to 7 days and one weekly backup schedule with retention up to 14 weeks. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetBackupSchedule | Gets information about a backup schedule. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListBackupSchedules | List backup schedules. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateBackupSchedule | Updates a backup schedule. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteBackupSchedule | Deletes a backup schedule. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Implements
BackgroundResourceStatic Methods
create()
public static final FirestoreAdminClient create()
Constructs an instance of FirestoreAdminClient with default settings.
Returns | |
---|---|
Type | Description |
FirestoreAdminClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(FirestoreAdminSettings settings)
public static final FirestoreAdminClient create(FirestoreAdminSettings settings)
Constructs an instance of FirestoreAdminClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Parameter | |
---|---|
Name | Description |
settings | FirestoreAdminSettings |
Returns | |
---|---|
Type | Description |
FirestoreAdminClient |
Exceptions | |
---|---|
Type | Description |
IOException |
create(FirestoreAdminStub stub)
public static final FirestoreAdminClient create(FirestoreAdminStub stub)
Constructs an instance of FirestoreAdminClient, using the given stub for making calls. This is for advanced usage - prefer using create(FirestoreAdminSettings).
Parameter | |
---|---|
Name | Description |
stub | FirestoreAdminStub |
Returns | |
---|---|
Type | Description |
FirestoreAdminClient |
Constructors
FirestoreAdminClient(FirestoreAdminSettings settings)
protected FirestoreAdminClient(FirestoreAdminSettings settings)
Constructs an instance of FirestoreAdminClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Parameter | |
---|---|
Name | Description |
settings | FirestoreAdminSettings |
FirestoreAdminClient(FirestoreAdminStub stub)
protected FirestoreAdminClient(FirestoreAdminStub stub)
Parameter | |
---|---|
Name | Description |
stub | FirestoreAdminStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
InterruptedException |
close()
public final void close()
createBackupSchedule(CreateBackupScheduleRequest request)
public final BackupSchedule createBackupSchedule(CreateBackupScheduleRequest request)
Creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule with retention up to 7 days and one weekly backup schedule with retention up to 14 weeks.
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()) {
CreateBackupScheduleRequest request =
CreateBackupScheduleRequest.newBuilder()
.setParent(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.setBackupSchedule(BackupSchedule.newBuilder().build())
.build();
BackupSchedule response = firestoreAdminClient.createBackupSchedule(request);
}
Parameter | |
---|---|
Name | Description |
request | CreateBackupScheduleRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
BackupSchedule |
createBackupSchedule(DatabaseName parent, BackupSchedule backupSchedule)
public final BackupSchedule createBackupSchedule(DatabaseName parent, BackupSchedule backupSchedule)
Creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule with retention up to 7 days and one weekly backup schedule with retention up to 14 weeks.
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 parent = DatabaseName.of("[PROJECT]", "[DATABASE]");
BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
BackupSchedule response = firestoreAdminClient.createBackupSchedule(parent, backupSchedule);
}
Parameters | |
---|---|
Name | Description |
parent | DatabaseName Required. The parent database. Format |
backupSchedule | BackupSchedule Required. The backup schedule to create. |
Returns | |
---|---|
Type | Description |
BackupSchedule |
createBackupSchedule(String parent, BackupSchedule backupSchedule)
public final BackupSchedule createBackupSchedule(String parent, BackupSchedule backupSchedule)
Creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule with retention up to 7 days and one weekly backup schedule with retention up to 14 weeks.
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 = DatabaseName.of("[PROJECT]", "[DATABASE]").toString();
BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
BackupSchedule response = firestoreAdminClient.createBackupSchedule(parent, backupSchedule);
}
Parameters | |
---|---|
Name | Description |
parent | String Required. The parent database. Format |
backupSchedule | BackupSchedule Required. The backup schedule to create. |
Returns | |
---|---|
Type | Description |
BackupSchedule |
createBackupScheduleCallable()
public final UnaryCallable<CreateBackupScheduleRequest,BackupSchedule> createBackupScheduleCallable()
Creates a backup schedule on a database. At most two backup schedules can be configured on a database, one daily backup schedule with retention up to 7 days and one weekly backup schedule with retention up to 14 weeks.
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()) {
CreateBackupScheduleRequest request =
CreateBackupScheduleRequest.newBuilder()
.setParent(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.setBackupSchedule(BackupSchedule.newBuilder().build())
.build();
ApiFuture<BackupSchedule> future =
firestoreAdminClient.createBackupScheduleCallable().futureCall(request);
// Do something.
BackupSchedule response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateBackupScheduleRequest,BackupSchedule> |
createDatabaseAsync(CreateDatabaseRequest request)
public final OperationFuture<Database,CreateDatabaseMetadata> createDatabaseAsync(CreateDatabaseRequest request)
Create a database.
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()) {
CreateDatabaseRequest request =
CreateDatabaseRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setDatabase(Database.newBuilder().build())
.setDatabaseId("databaseId1688905718")
.build();
Database response = firestoreAdminClient.createDatabaseAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | CreateDatabaseRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,CreateDatabaseMetadata> |
createDatabaseAsync(ProjectName parent, Database database, String databaseId)
public final OperationFuture<Database,CreateDatabaseMetadata> createDatabaseAsync(ProjectName parent, Database database, String databaseId)
Create a database.
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]");
Database database = Database.newBuilder().build();
String databaseId = "databaseId1688905718";
Database response =
firestoreAdminClient.createDatabaseAsync(parent, database, databaseId).get();
}
Parameters | |
---|---|
Name | Description |
parent | ProjectName Required. A parent name of the form |
database | Database Required. The Database to create. |
databaseId | String Required. The ID to use for the database, which will become the final component of the database's resource name. This value should be 4-63 characters. Valid characters are /a-z-/ with first character a letter and the last a letter or a number. Must not be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. "(default)" database id is also valid. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,CreateDatabaseMetadata> |
createDatabaseAsync(String parent, Database database, String databaseId)
public final OperationFuture<Database,CreateDatabaseMetadata> createDatabaseAsync(String parent, Database database, String databaseId)
Create a database.
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();
Database database = Database.newBuilder().build();
String databaseId = "databaseId1688905718";
Database response =
firestoreAdminClient.createDatabaseAsync(parent, database, databaseId).get();
}
Parameters | |
---|---|
Name | Description |
parent | String Required. A parent name of the form |
database | Database Required. The Database to create. |
databaseId | String Required. The ID to use for the database, which will become the final component of the database's resource name. This value should be 4-63 characters. Valid characters are /a-z-/ with first character a letter and the last a letter or a number. Must not be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/. "(default)" database id is also valid. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,CreateDatabaseMetadata> |
createDatabaseCallable()
public final UnaryCallable<CreateDatabaseRequest,Operation> createDatabaseCallable()
Create a database.
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()) {
CreateDatabaseRequest request =
CreateDatabaseRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setDatabase(Database.newBuilder().build())
.setDatabaseId("databaseId1688905718")
.build();
ApiFuture<Operation> future =
firestoreAdminClient.createDatabaseCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateDatabaseRequest,Operation> |
createDatabaseOperationCallable()
public final OperationCallable<CreateDatabaseRequest,Database,CreateDatabaseMetadata> createDatabaseOperationCallable()
Create a database.
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()) {
CreateDatabaseRequest request =
CreateDatabaseRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setDatabase(Database.newBuilder().build())
.setDatabaseId("databaseId1688905718")
.build();
OperationFuture<Database, CreateDatabaseMetadata> future =
firestoreAdminClient.createDatabaseOperationCallable().futureCall(request);
// Do something.
Database response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateDatabaseRequest,Database,CreateDatabaseMetadata> |
createIndexAsync(CollectionGroupName parent, Index index)
public final OperationFuture<Index,IndexOperationMetadata> createIndexAsync(CollectionGroupName parent, Index index)
Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
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();
}
Parameters | |
---|---|
Name | Description |
parent | CollectionGroupName Required. A parent name of the form
|
index | Index Required. The composite index to create. |
Returns | |
---|---|
Type | Description |
OperationFuture<Index,IndexOperationMetadata> |
createIndexAsync(CreateIndexRequest request)
public final OperationFuture<Index,IndexOperationMetadata> createIndexAsync(CreateIndexRequest request)
Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
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();
}
Parameter | |
---|---|
Name | Description |
request | CreateIndexRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Index,IndexOperationMetadata> |
createIndexAsync(String parent, Index index)
public final OperationFuture<Index,IndexOperationMetadata> createIndexAsync(String parent, Index index)
Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
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();
}
Parameters | |
---|---|
Name | Description |
parent | String Required. A parent name of the form
|
index | Index Required. The composite index to create. |
Returns | |
---|---|
Type | Description |
OperationFuture<Index,IndexOperationMetadata> |
createIndexCallable()
public final UnaryCallable<CreateIndexRequest,Operation> createIndexCallable()
Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<CreateIndexRequest,Operation> |
createIndexOperationCallable()
public final OperationCallable<CreateIndexRequest,Index,IndexOperationMetadata> createIndexOperationCallable()
Creates a composite index. This returns a google.longrunning.Operation which may be used to track the status of the creation. The metadata for the operation will be the type IndexOperationMetadata.
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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<CreateIndexRequest,Index,IndexOperationMetadata> |
deleteBackup(BackupName name)
public final void deleteBackup(BackupName name)
Deletes a backup.
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()) {
BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]");
firestoreAdminClient.deleteBackup(name);
}
Parameter | |
---|---|
Name | Description |
name | BackupName Required. Name of the backup to delete. format is |
deleteBackup(DeleteBackupRequest request)
public final void deleteBackup(DeleteBackupRequest request)
Deletes a backup.
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()) {
DeleteBackupRequest request =
DeleteBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
firestoreAdminClient.deleteBackup(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteBackupRequest The request object containing all of the parameters for the API call. |
deleteBackup(String name)
public final void deleteBackup(String name)
Deletes a backup.
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 = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString();
firestoreAdminClient.deleteBackup(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the backup to delete. format is |
deleteBackupCallable()
public final UnaryCallable<DeleteBackupRequest,Empty> deleteBackupCallable()
Deletes a backup.
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()) {
DeleteBackupRequest request =
DeleteBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
ApiFuture<Empty> future = firestoreAdminClient.deleteBackupCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteBackupRequest,Empty> |
deleteBackupSchedule(BackupScheduleName name)
public final void deleteBackupSchedule(BackupScheduleName name)
Deletes a backup schedule.
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()) {
BackupScheduleName name =
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]");
firestoreAdminClient.deleteBackupSchedule(name);
}
Parameter | |
---|---|
Name | Description |
name | BackupScheduleName Required. The name of backup schedule. Format |
deleteBackupSchedule(DeleteBackupScheduleRequest request)
public final void deleteBackupSchedule(DeleteBackupScheduleRequest request)
Deletes a backup schedule.
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()) {
DeleteBackupScheduleRequest request =
DeleteBackupScheduleRequest.newBuilder()
.setName(
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]").toString())
.build();
firestoreAdminClient.deleteBackupSchedule(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteBackupScheduleRequest The request object containing all of the parameters for the API call. |
deleteBackupSchedule(String name)
public final void deleteBackupSchedule(String name)
Deletes a backup schedule.
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 =
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]").toString();
firestoreAdminClient.deleteBackupSchedule(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of backup schedule. Format |
deleteBackupScheduleCallable()
public final UnaryCallable<DeleteBackupScheduleRequest,Empty> deleteBackupScheduleCallable()
Deletes a backup schedule.
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()) {
DeleteBackupScheduleRequest request =
DeleteBackupScheduleRequest.newBuilder()
.setName(
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]").toString())
.build();
ApiFuture<Empty> future =
firestoreAdminClient.deleteBackupScheduleCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteBackupScheduleRequest,Empty> |
deleteDatabaseAsync(DatabaseName name)
public final OperationFuture<Database,DeleteDatabaseMetadata> deleteDatabaseAsync(DatabaseName name)
Deletes a database.
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.deleteDatabaseAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | DatabaseName Required. A name of the form |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,DeleteDatabaseMetadata> |
deleteDatabaseAsync(DeleteDatabaseRequest request)
public final OperationFuture<Database,DeleteDatabaseMetadata> deleteDatabaseAsync(DeleteDatabaseRequest request)
Deletes a database.
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()) {
DeleteDatabaseRequest request =
DeleteDatabaseRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.setEtag("etag3123477")
.build();
Database response = firestoreAdminClient.deleteDatabaseAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | DeleteDatabaseRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,DeleteDatabaseMetadata> |
deleteDatabaseAsync(String name)
public final OperationFuture<Database,DeleteDatabaseMetadata> deleteDatabaseAsync(String name)
Deletes a database.
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.deleteDatabaseAsync(name).get();
}
Parameter | |
---|---|
Name | Description |
name | String Required. A name of the form |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,DeleteDatabaseMetadata> |
deleteDatabaseCallable()
public final UnaryCallable<DeleteDatabaseRequest,Operation> deleteDatabaseCallable()
Deletes a database.
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()) {
DeleteDatabaseRequest request =
DeleteDatabaseRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.setEtag("etag3123477")
.build();
ApiFuture<Operation> future =
firestoreAdminClient.deleteDatabaseCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteDatabaseRequest,Operation> |
deleteDatabaseOperationCallable()
public final OperationCallable<DeleteDatabaseRequest,Database,DeleteDatabaseMetadata> deleteDatabaseOperationCallable()
Deletes a database.
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()) {
DeleteDatabaseRequest request =
DeleteDatabaseRequest.newBuilder()
.setName(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.setEtag("etag3123477")
.build();
OperationFuture<Database, DeleteDatabaseMetadata> future =
firestoreAdminClient.deleteDatabaseOperationCallable().futureCall(request);
// Do something.
Database response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<DeleteDatabaseRequest,Database,DeleteDatabaseMetadata> |
deleteIndex(DeleteIndexRequest request)
public final void deleteIndex(DeleteIndexRequest request)
Deletes a composite 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()) {
DeleteIndexRequest request =
DeleteIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
firestoreAdminClient.deleteIndex(request);
}
Parameter | |
---|---|
Name | Description |
request | DeleteIndexRequest The request object containing all of the parameters for the API call. |
deleteIndex(IndexName name)
public final void deleteIndex(IndexName name)
Deletes a composite 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()) {
IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
firestoreAdminClient.deleteIndex(name);
}
Parameter | |
---|---|
Name | Description |
name | IndexName Required. A name of the form
|
deleteIndex(String name)
public final void deleteIndex(String name)
Deletes a composite 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 name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString();
firestoreAdminClient.deleteIndex(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. A name of the form
|
deleteIndexCallable()
public final UnaryCallable<DeleteIndexRequest,Empty> deleteIndexCallable()
Deletes a composite 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()) {
DeleteIndexRequest request =
DeleteIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
ApiFuture<Empty> future = firestoreAdminClient.deleteIndexCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<DeleteIndexRequest,Empty> |
exportDocumentsAsync(DatabaseName name)
public final 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. 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.
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();
}
Parameter | |
---|---|
Name | Description |
name | DatabaseName Required. Database to export. Should be of the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsAsync(ExportDocumentsRequest request)
public final 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. 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.
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")
.addAllNamespaceIds(new ArrayList<String>())
.setSnapshotTime(Timestamp.newBuilder().build())
.build();
ExportDocumentsResponse response = firestoreAdminClient.exportDocumentsAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | ExportDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsAsync(String name)
public final 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. 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.
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();
}
Parameter | |
---|---|
Name | Description |
name | String Required. Database to export. Should be of the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<ExportDocumentsResponse,ExportDocumentsMetadata> |
exportDocumentsCallable()
public final UnaryCallable<ExportDocumentsRequest,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. 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.
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")
.addAllNamespaceIds(new ArrayList<String>())
.setSnapshotTime(Timestamp.newBuilder().build())
.build();
ApiFuture<Operation> future =
firestoreAdminClient.exportDocumentsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ExportDocumentsRequest,Operation> |
exportDocumentsOperationCallable()
public final 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. 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.
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")
.addAllNamespaceIds(new ArrayList<String>())
.setSnapshotTime(Timestamp.newBuilder().build())
.build();
OperationFuture<ExportDocumentsResponse, ExportDocumentsMetadata> future =
firestoreAdminClient.exportDocumentsOperationCallable().futureCall(request);
// Do something.
ExportDocumentsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<ExportDocumentsRequest,ExportDocumentsResponse,ExportDocumentsMetadata> |
getBackup(BackupName name)
public final Backup getBackup(BackupName name)
Gets information about a backup.
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()) {
BackupName name = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]");
Backup response = firestoreAdminClient.getBackup(name);
}
Parameter | |
---|---|
Name | Description |
name | BackupName Required. Name of the backup to fetch. Format is |
Returns | |
---|---|
Type | Description |
Backup |
getBackup(GetBackupRequest request)
public final Backup getBackup(GetBackupRequest request)
Gets information about a backup.
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()) {
GetBackupRequest request =
GetBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
Backup response = firestoreAdminClient.getBackup(request);
}
Parameter | |
---|---|
Name | Description |
request | GetBackupRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Backup |
getBackup(String name)
public final Backup getBackup(String name)
Gets information about a backup.
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 = BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString();
Backup response = firestoreAdminClient.getBackup(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. Name of the backup to fetch. Format is |
Returns | |
---|---|
Type | Description |
Backup |
getBackupCallable()
public final UnaryCallable<GetBackupRequest,Backup> getBackupCallable()
Gets information about a backup.
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()) {
GetBackupRequest request =
GetBackupRequest.newBuilder()
.setName(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
ApiFuture<Backup> future = firestoreAdminClient.getBackupCallable().futureCall(request);
// Do something.
Backup response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetBackupRequest,Backup> |
getBackupSchedule(BackupScheduleName name)
public final BackupSchedule getBackupSchedule(BackupScheduleName name)
Gets information about a backup schedule.
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()) {
BackupScheduleName name =
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]");
BackupSchedule response = firestoreAdminClient.getBackupSchedule(name);
}
Parameter | |
---|---|
Name | Description |
name | BackupScheduleName Required. The name of the backup schedule. Format |
Returns | |
---|---|
Type | Description |
BackupSchedule |
getBackupSchedule(GetBackupScheduleRequest request)
public final BackupSchedule getBackupSchedule(GetBackupScheduleRequest request)
Gets information about a backup schedule.
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()) {
GetBackupScheduleRequest request =
GetBackupScheduleRequest.newBuilder()
.setName(
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]").toString())
.build();
BackupSchedule response = firestoreAdminClient.getBackupSchedule(request);
}
Parameter | |
---|---|
Name | Description |
request | GetBackupScheduleRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
BackupSchedule |
getBackupSchedule(String name)
public final BackupSchedule getBackupSchedule(String name)
Gets information about a backup schedule.
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 =
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]").toString();
BackupSchedule response = firestoreAdminClient.getBackupSchedule(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. The name of the backup schedule. Format |
Returns | |
---|---|
Type | Description |
BackupSchedule |
getBackupScheduleCallable()
public final UnaryCallable<GetBackupScheduleRequest,BackupSchedule> getBackupScheduleCallable()
Gets information about a backup schedule.
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()) {
GetBackupScheduleRequest request =
GetBackupScheduleRequest.newBuilder()
.setName(
BackupScheduleName.of("[PROJECT]", "[DATABASE]", "[BACKUP_SCHEDULE]").toString())
.build();
ApiFuture<BackupSchedule> future =
firestoreAdminClient.getBackupScheduleCallable().futureCall(request);
// Do something.
BackupSchedule response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetBackupScheduleRequest,BackupSchedule> |
getDatabase(DatabaseName name)
public final Database getDatabase(DatabaseName name)
Gets information about a database.
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);
}
Parameter | |
---|---|
Name | Description |
name | DatabaseName Required. A name of the form |
Returns | |
---|---|
Type | Description |
Database |
getDatabase(GetDatabaseRequest request)
public final Database getDatabase(GetDatabaseRequest request)
Gets information about a database.
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);
}
Parameter | |
---|---|
Name | Description |
request | GetDatabaseRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Database |
getDatabase(String name)
public final Database getDatabase(String name)
Gets information about a database.
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);
}
Parameter | |
---|---|
Name | Description |
name | String Required. A name of the form |
Returns | |
---|---|
Type | Description |
Database |
getDatabaseCallable()
public final UnaryCallable<GetDatabaseRequest,Database> getDatabaseCallable()
Gets information about a database.
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetDatabaseRequest,Database> |
getField(FieldName name)
public final Field getField(FieldName name)
Gets the metadata and configuration for a Field.
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);
}
Parameter | |
---|---|
Name | Description |
name | FieldName Required. A name of the form
|
Returns | |
---|---|
Type | Description |
Field |
getField(GetFieldRequest request)
public final Field getField(GetFieldRequest request)
Gets the metadata and configuration for a Field.
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);
}
Parameter | |
---|---|
Name | Description |
request | GetFieldRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Field |
getField(String name)
public final Field getField(String name)
Gets the metadata and configuration for a Field.
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);
}
Parameter | |
---|---|
Name | Description |
name | String Required. A name of the form
|
Returns | |
---|---|
Type | Description |
Field |
getFieldCallable()
public final UnaryCallable<GetFieldRequest,Field> getFieldCallable()
Gets the metadata and configuration for a Field.
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetFieldRequest,Field> |
getHttpJsonOperationsClient()
public final OperationsClient getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getIndex(GetIndexRequest request)
public final Index getIndex(GetIndexRequest request)
Gets a composite 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()) {
GetIndexRequest request =
GetIndexRequest.newBuilder()
.setName(
IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString())
.build();
Index response = firestoreAdminClient.getIndex(request);
}
Parameter | |
---|---|
Name | Description |
request | GetIndexRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
Index |
getIndex(IndexName name)
public final Index getIndex(IndexName name)
Gets a composite 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()) {
IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
Index response = firestoreAdminClient.getIndex(name);
}
Parameter | |
---|---|
Name | Description |
name | IndexName Required. A name of the form
|
Returns | |
---|---|
Type | Description |
Index |
getIndex(String name)
public final Index getIndex(String name)
Gets a composite 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 name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString();
Index response = firestoreAdminClient.getIndex(name);
}
Parameter | |
---|---|
Name | Description |
name | String Required. A name of the form
|
Returns | |
---|---|
Type | Description |
Index |
getIndexCallable()
public final UnaryCallable<GetIndexRequest,Index> getIndexCallable()
Gets a composite 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()) {
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<GetIndexRequest,Index> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Returns | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final FirestoreAdminSettings getSettings()
Returns | |
---|---|
Type | Description |
FirestoreAdminSettings |
getStub()
public FirestoreAdminStub getStub()
Returns | |
---|---|
Type | Description |
FirestoreAdminStub |
importDocumentsAsync(DatabaseName name)
public final OperationFuture<Empty,ImportDocumentsMetadata> importDocumentsAsync(DatabaseName name)
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:
// 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();
}
Parameter | |
---|---|
Name | Description |
name | DatabaseName Required. Database to import into. Should be of the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,ImportDocumentsMetadata> |
importDocumentsAsync(ImportDocumentsRequest request)
public final OperationFuture<Empty,ImportDocumentsMetadata> importDocumentsAsync(ImportDocumentsRequest request)
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:
// 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")
.addAllNamespaceIds(new ArrayList<String>())
.build();
firestoreAdminClient.importDocumentsAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | ImportDocumentsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,ImportDocumentsMetadata> |
importDocumentsAsync(String name)
public final OperationFuture<Empty,ImportDocumentsMetadata> importDocumentsAsync(String name)
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:
// 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();
}
Parameter | |
---|---|
Name | Description |
name | String Required. Database to import into. Should be of the form:
|
Returns | |
---|---|
Type | Description |
OperationFuture<Empty,ImportDocumentsMetadata> |
importDocumentsCallable()
public final UnaryCallable<ImportDocumentsRequest,Operation> importDocumentsCallable()
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:
// 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")
.addAllNamespaceIds(new ArrayList<String>())
.build();
ApiFuture<Operation> future =
firestoreAdminClient.importDocumentsCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ImportDocumentsRequest,Operation> |
importDocumentsOperationCallable()
public final OperationCallable<ImportDocumentsRequest,Empty,ImportDocumentsMetadata> importDocumentsOperationCallable()
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:
// 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")
.addAllNamespaceIds(new ArrayList<String>())
.build();
OperationFuture<Empty, ImportDocumentsMetadata> future =
firestoreAdminClient.importDocumentsOperationCallable().futureCall(request);
// Do something.
future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<ImportDocumentsRequest,Empty,ImportDocumentsMetadata> |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
boolean |
listBackupSchedules(DatabaseName parent)
public final ListBackupSchedulesResponse listBackupSchedules(DatabaseName parent)
List backup schedules.
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 parent = DatabaseName.of("[PROJECT]", "[DATABASE]");
ListBackupSchedulesResponse response = firestoreAdminClient.listBackupSchedules(parent);
}
Parameter | |
---|---|
Name | Description |
parent | DatabaseName Required. The parent database. Format is |
Returns | |
---|---|
Type | Description |
ListBackupSchedulesResponse |
listBackupSchedules(ListBackupSchedulesRequest request)
public final ListBackupSchedulesResponse listBackupSchedules(ListBackupSchedulesRequest request)
List backup schedules.
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()) {
ListBackupSchedulesRequest request =
ListBackupSchedulesRequest.newBuilder()
.setParent(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.build();
ListBackupSchedulesResponse response = firestoreAdminClient.listBackupSchedules(request);
}
Parameter | |
---|---|
Name | Description |
request | ListBackupSchedulesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ListBackupSchedulesResponse |
listBackupSchedules(String parent)
public final ListBackupSchedulesResponse listBackupSchedules(String parent)
List backup schedules.
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 = DatabaseName.of("[PROJECT]", "[DATABASE]").toString();
ListBackupSchedulesResponse response = firestoreAdminClient.listBackupSchedules(parent);
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The parent database. Format is |
Returns | |
---|---|
Type | Description |
ListBackupSchedulesResponse |
listBackupSchedulesCallable()
public final UnaryCallable<ListBackupSchedulesRequest,ListBackupSchedulesResponse> listBackupSchedulesCallable()
List backup schedules.
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()) {
ListBackupSchedulesRequest request =
ListBackupSchedulesRequest.newBuilder()
.setParent(DatabaseName.of("[PROJECT]", "[DATABASE]").toString())
.build();
ApiFuture<ListBackupSchedulesResponse> future =
firestoreAdminClient.listBackupSchedulesCallable().futureCall(request);
// Do something.
ListBackupSchedulesResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListBackupSchedulesRequest,ListBackupSchedulesResponse> |
listBackups(ListBackupsRequest request)
public final ListBackupsResponse listBackups(ListBackupsRequest request)
Lists all the backups.
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()) {
ListBackupsRequest request =
ListBackupsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ListBackupsResponse response = firestoreAdminClient.listBackups(request);
}
Parameter | |
---|---|
Name | Description |
request | ListBackupsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ListBackupsResponse |
listBackups(LocationName parent)
public final ListBackupsResponse listBackups(LocationName parent)
Lists all the backups.
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()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListBackupsResponse response = firestoreAdminClient.listBackups(parent);
}
Parameter | |
---|---|
Name | Description |
parent | LocationName Required. The location to list backups from. Format is |
Returns | |
---|---|
Type | Description |
ListBackupsResponse |
listBackups(String parent)
public final ListBackupsResponse listBackups(String parent)
Lists all the backups.
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 = LocationName.of("[PROJECT]", "[LOCATION]").toString();
ListBackupsResponse response = firestoreAdminClient.listBackups(parent);
}
Parameter | |
---|---|
Name | Description |
parent | String Required. The location to list backups from. Format is |
Returns | |
---|---|
Type | Description |
ListBackupsResponse |
listBackupsCallable()
public final UnaryCallable<ListBackupsRequest,ListBackupsResponse> listBackupsCallable()
Lists all the backups.
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()) {
ListBackupsRequest request =
ListBackupsRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.build();
ApiFuture<ListBackupsResponse> future =
firestoreAdminClient.listBackupsCallable().futureCall(request);
// Do something.
ListBackupsResponse response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListBackupsRequest,ListBackupsResponse> |
listDatabases(ListDatabasesRequest request)
public final ListDatabasesResponse listDatabases(ListDatabasesRequest request)
List all the databases in the project.
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);
}
Parameter | |
---|---|
Name | Description |
request | ListDatabasesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
ListDatabasesResponse |
listDatabases(ProjectName parent)
public final ListDatabasesResponse listDatabases(ProjectName parent)
List all the databases in the project.
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);
}
Parameter | |
---|---|
Name | Description |
parent | ProjectName Required. A parent name of the form |
Returns | |
---|---|
Type | Description |
ListDatabasesResponse |
listDatabases(String parent)
public final ListDatabasesResponse listDatabases(String parent)
List all the databases in the project.
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);
}
Parameter | |
---|---|
Name | Description |
parent | String Required. A parent name of the form |
Returns | |
---|---|
Type | Description |
ListDatabasesResponse |
listDatabasesCallable()
public final UnaryCallable<ListDatabasesRequest,ListDatabasesResponse> listDatabasesCallable()
List all the databases in the project.
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListDatabasesRequest,ListDatabasesResponse> |
listFields(CollectionGroupName parent)
public final FirestoreAdminClient.ListFieldsPagedResponse listFields(CollectionGroupName parent)
Lists the field configuration and metadata for this database.
Currently, FirestoreAdmin.ListFields
only supports listing fields that have been explicitly overridden. To issue this query, call
FirestoreAdmin.ListFields with the
filter set to indexConfig.usesAncestorConfig:false
or ttlConfig:*
.
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | CollectionGroupName Required. A parent name of the form
|
Returns | |
---|---|
Type | Description |
FirestoreAdminClient.ListFieldsPagedResponse |
listFields(ListFieldsRequest request)
public final FirestoreAdminClient.ListFieldsPagedResponse listFields(ListFieldsRequest request)
Lists the field configuration and metadata for this database.
Currently, FirestoreAdmin.ListFields
only supports listing fields that have been explicitly overridden. To issue this query, call
FirestoreAdmin.ListFields with the
filter set to indexConfig.usesAncestorConfig:false
or ttlConfig:*
.
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);
}
}
Parameter | |
---|---|
Name | Description |
request | ListFieldsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
FirestoreAdminClient.ListFieldsPagedResponse |
listFields(String parent)
public final FirestoreAdminClient.ListFieldsPagedResponse listFields(String parent)
Lists the field configuration and metadata for this database.
Currently, FirestoreAdmin.ListFields
only supports listing fields that have been explicitly overridden. To issue this query, call
FirestoreAdmin.ListFields with the
filter set to indexConfig.usesAncestorConfig:false
or ttlConfig:*
.
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. A parent name of the form
|
Returns | |
---|---|
Type | Description |
FirestoreAdminClient.ListFieldsPagedResponse |
listFieldsCallable()
public final UnaryCallable<ListFieldsRequest,ListFieldsResponse> listFieldsCallable()
Lists the field configuration and metadata for this database.
Currently, FirestoreAdmin.ListFields
only supports listing fields that have been explicitly overridden. To issue this query, call
FirestoreAdmin.ListFields with the
filter set to indexConfig.usesAncestorConfig:false
or ttlConfig:*
.
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListFieldsRequest,ListFieldsResponse> |
listFieldsPagedCallable()
public final UnaryCallable<ListFieldsRequest,FirestoreAdminClient.ListFieldsPagedResponse> listFieldsPagedCallable()
Lists the field configuration and metadata for this database.
Currently, FirestoreAdmin.ListFields
only supports listing fields that have been explicitly overridden. To issue this query, call
FirestoreAdmin.ListFields with the
filter set to indexConfig.usesAncestorConfig:false
or ttlConfig:*
.
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListFieldsRequest,ListFieldsPagedResponse> |
listIndexes(CollectionGroupName parent)
public final FirestoreAdminClient.ListIndexesPagedResponse listIndexes(CollectionGroupName parent)
Lists composite indexes.
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | CollectionGroupName Required. A parent name of the form
|
Returns | |
---|---|
Type | Description |
FirestoreAdminClient.ListIndexesPagedResponse |
listIndexes(ListIndexesRequest request)
public final FirestoreAdminClient.ListIndexesPagedResponse listIndexes(ListIndexesRequest request)
Lists composite indexes.
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);
}
}
Parameter | |
---|---|
Name | Description |
request | ListIndexesRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
FirestoreAdminClient.ListIndexesPagedResponse |
listIndexes(String parent)
public final FirestoreAdminClient.ListIndexesPagedResponse listIndexes(String parent)
Lists composite indexes.
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);
}
}
Parameter | |
---|---|
Name | Description |
parent | String Required. A parent name of the form
|
Returns | |
---|---|
Type | Description |
FirestoreAdminClient.ListIndexesPagedResponse |
listIndexesCallable()
public final UnaryCallable<ListIndexesRequest,ListIndexesResponse> listIndexesCallable()
Lists composite indexes.
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;
}
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListIndexesRequest,ListIndexesResponse> |
listIndexesPagedCallable()
public final UnaryCallable<ListIndexesRequest,FirestoreAdminClient.ListIndexesPagedResponse> listIndexesPagedCallable()
Lists composite indexes.
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);
}
}
Returns | |
---|---|
Type | Description |
UnaryCallable<ListIndexesRequest,ListIndexesPagedResponse> |
restoreDatabaseAsync(RestoreDatabaseRequest request)
public final OperationFuture<Database,RestoreDatabaseMetadata> restoreDatabaseAsync(RestoreDatabaseRequest request)
Creates a new database by restoring from an existing backup.
The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup.
The long-running operation can be used to track the progress of the restore, with the Operation's metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed.
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()) {
RestoreDatabaseRequest request =
RestoreDatabaseRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setDatabaseId("databaseId1688905718")
.setBackup(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
Database response = firestoreAdminClient.restoreDatabaseAsync(request).get();
}
Parameter | |
---|---|
Name | Description |
request | RestoreDatabaseRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,RestoreDatabaseMetadata> |
restoreDatabaseCallable()
public final UnaryCallable<RestoreDatabaseRequest,Operation> restoreDatabaseCallable()
Creates a new database by restoring from an existing backup.
The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup.
The long-running operation can be used to track the progress of the restore, with the Operation's metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed.
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()) {
RestoreDatabaseRequest request =
RestoreDatabaseRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setDatabaseId("databaseId1688905718")
.setBackup(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
ApiFuture<Operation> future =
firestoreAdminClient.restoreDatabaseCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<RestoreDatabaseRequest,Operation> |
restoreDatabaseOperationCallable()
public final OperationCallable<RestoreDatabaseRequest,Database,RestoreDatabaseMetadata> restoreDatabaseOperationCallable()
Creates a new database by restoring from an existing backup.
The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup.
The long-running operation can be used to track the progress of the restore, with the Operation's metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed.
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()) {
RestoreDatabaseRequest request =
RestoreDatabaseRequest.newBuilder()
.setParent(ProjectName.of("[PROJECT]").toString())
.setDatabaseId("databaseId1688905718")
.setBackup(BackupName.of("[PROJECT]", "[LOCATION]", "[BACKUP]").toString())
.build();
OperationFuture<Database, RestoreDatabaseMetadata> future =
firestoreAdminClient.restoreDatabaseOperationCallable().futureCall(request);
// Do something.
Database response = future.get();
}
Returns | |
---|---|
Type | Description |
OperationCallable<RestoreDatabaseRequest,Database,RestoreDatabaseMetadata> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateBackupSchedule(BackupSchedule backupSchedule, FieldMask updateMask)
public final BackupSchedule updateBackupSchedule(BackupSchedule backupSchedule, FieldMask updateMask)
Updates a backup schedule.
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()) {
BackupSchedule backupSchedule = BackupSchedule.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
BackupSchedule response =
firestoreAdminClient.updateBackupSchedule(backupSchedule, updateMask);
}
Parameters | |
---|---|
Name | Description |
backupSchedule | BackupSchedule Required. The backup schedule to update. |
updateMask | FieldMask The list of fields to be updated. |
Returns | |
---|---|
Type | Description |
BackupSchedule |
updateBackupSchedule(UpdateBackupScheduleRequest request)
public final BackupSchedule updateBackupSchedule(UpdateBackupScheduleRequest request)
Updates a backup schedule.
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()) {
UpdateBackupScheduleRequest request =
UpdateBackupScheduleRequest.newBuilder()
.setBackupSchedule(BackupSchedule.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
BackupSchedule response = firestoreAdminClient.updateBackupSchedule(request);
}
Parameter | |
---|---|
Name | Description |
request | UpdateBackupScheduleRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
BackupSchedule |
updateBackupScheduleCallable()
public final UnaryCallable<UpdateBackupScheduleRequest,BackupSchedule> updateBackupScheduleCallable()
Updates a backup schedule.
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()) {
UpdateBackupScheduleRequest request =
UpdateBackupScheduleRequest.newBuilder()
.setBackupSchedule(BackupSchedule.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<BackupSchedule> future =
firestoreAdminClient.updateBackupScheduleCallable().futureCall(request);
// Do something.
BackupSchedule response = future.get();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateBackupScheduleRequest,BackupSchedule> |
updateDatabaseAsync(Database database, FieldMask updateMask)
public final OperationFuture<Database,UpdateDatabaseMetadata> updateDatabaseAsync(Database database, FieldMask updateMask)
Updates a database.
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();
}
Parameters | |
---|---|
Name | Description |
database | Database Required. The database to update. |
updateMask | FieldMask The list of fields to be updated. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,UpdateDatabaseMetadata> |
updateDatabaseAsync(UpdateDatabaseRequest request)
public final OperationFuture<Database,UpdateDatabaseMetadata> updateDatabaseAsync(UpdateDatabaseRequest request)
Updates a database.
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();
}
Parameter | |
---|---|
Name | Description |
request | UpdateDatabaseRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Database,UpdateDatabaseMetadata> |
updateDatabaseCallable()
public final UnaryCallable<UpdateDatabaseRequest,Operation> updateDatabaseCallable()
Updates a database.
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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateDatabaseRequest,Operation> |
updateDatabaseOperationCallable()
public final OperationCallable<UpdateDatabaseRequest,Database,UpdateDatabaseMetadata> updateDatabaseOperationCallable()
Updates a database.
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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdateDatabaseRequest,Database,UpdateDatabaseMetadata> |
updateFieldAsync(Field field)
public final OperationFuture<Field,FieldOperationMetadata> updateFieldAsync(Field field)
Updates a field configuration. Currently, field updates apply only to single field index
configuration. However, calls to
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 which may be used to track the status of the field update. The metadata for the operation will be the type 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();
}
Parameter | |
---|---|
Name | Description |
field | Field Required. The field to be updated. |
Returns | |
---|---|
Type | Description |
OperationFuture<Field,FieldOperationMetadata> |
updateFieldAsync(UpdateFieldRequest request)
public final OperationFuture<Field,FieldOperationMetadata> updateFieldAsync(UpdateFieldRequest request)
Updates a field configuration. Currently, field updates apply only to single field index
configuration. However, calls to
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 which may be used to track the status of the field update. The metadata for the operation will be the type 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();
}
Parameter | |
---|---|
Name | Description |
request | UpdateFieldRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
OperationFuture<Field,FieldOperationMetadata> |
updateFieldCallable()
public final UnaryCallable<UpdateFieldRequest,Operation> updateFieldCallable()
Updates a field configuration. Currently, field updates apply only to single field index
configuration. However, calls to
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 which may be used to track the status of the field update. The metadata for the operation will be the type 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();
}
Returns | |
---|---|
Type | Description |
UnaryCallable<UpdateFieldRequest,Operation> |
updateFieldOperationCallable()
public final OperationCallable<UpdateFieldRequest,Field,FieldOperationMetadata> updateFieldOperationCallable()
Updates a field configuration. Currently, field updates apply only to single field index
configuration. However, calls to
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 which may be used to track the status of the field update. The metadata for the operation will be the type 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();
}
Returns | |
---|---|
Type | Description |
OperationCallable<UpdateFieldRequest,Field,FieldOperationMetadata> |