Skip to content

Commit 4b5783a

Browse files
feat: [Firestore] add Firestore CloneDatabase support (#8485)
* feat: add Firestore CloneDatabase support PiperOrigin-RevId: 789807783 Source-Link: googleapis/googleapis@3d37c58 Source-Link: googleapis/googleapis-gen@66d3f2f Copy-Tag: eyJwIjoiRmlyZXN0b3JlLy5Pd2xCb3QueWFtbCIsImgiOiI2NmQzZjJmM2FhNTdkMjQyNTM0YTFmMzcyNmI1OThmNjRiYTY5ZmNiIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a8a7980 commit 4b5783a

14 files changed

Lines changed: 1294 additions & 4 deletions

Firestore/metadata/Admin/V1/FirestoreAdmin.php

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
488 Bytes
Binary file not shown.

Firestore/metadata/Admin/V1/Snapshot.php

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Firestore/src/Admin/V1/Client/FirestoreAdminClient.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
use Google\Cloud\Firestore\Admin\V1\Backup;
3939
use Google\Cloud\Firestore\Admin\V1\BackupSchedule;
4040
use Google\Cloud\Firestore\Admin\V1\BulkDeleteDocumentsRequest;
41+
use Google\Cloud\Firestore\Admin\V1\CloneDatabaseMetadata;
42+
use Google\Cloud\Firestore\Admin\V1\CloneDatabaseRequest;
4143
use Google\Cloud\Firestore\Admin\V1\CreateBackupScheduleRequest;
4244
use Google\Cloud\Firestore\Admin\V1\CreateDatabaseRequest;
4345
use Google\Cloud\Firestore\Admin\V1\CreateIndexRequest;
@@ -122,6 +124,7 @@
122124
* contained within formatted names that are returned by the API.
123125
*
124126
* @method PromiseInterface<OperationResponse> bulkDeleteDocumentsAsync(BulkDeleteDocumentsRequest $request, array $optionalArgs = [])
127+
* @method PromiseInterface<OperationResponse> cloneDatabaseAsync(CloneDatabaseRequest $request, array $optionalArgs = [])
125128
* @method PromiseInterface<BackupSchedule> createBackupScheduleAsync(CreateBackupScheduleRequest $request, array $optionalArgs = [])
126129
* @method PromiseInterface<OperationResponse> createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = [])
127130
* @method PromiseInterface<OperationResponse> createIndexAsync(CreateIndexRequest $request, array $optionalArgs = [])
@@ -566,6 +569,48 @@ public function bulkDeleteDocuments(BulkDeleteDocumentsRequest $request, array $
566569
return $this->startApiCall('BulkDeleteDocuments', $request, $callOptions)->wait();
567570
}
568571

572+
/**
573+
* Creates a new database by cloning an existing one.
574+
*
575+
* The new database must be in the same cloud region or multi-region location
576+
* as the existing database. This behaves similar to
577+
* [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]
578+
* except instead of creating a new empty database, a new database is created
579+
* with the database type, index configuration, and documents from an existing
580+
* database.
581+
*
582+
* The [long-running operation][google.longrunning.Operation] can be used to
583+
* track the progress of the clone, with the Operation's
584+
* [metadata][google.longrunning.Operation.metadata] field type being the
585+
* [CloneDatabaseMetadata][google.firestore.admin.v1.CloneDatabaseMetadata].
586+
* The [response][google.longrunning.Operation.response] type is the
587+
* [Database][google.firestore.admin.v1.Database] if the clone was
588+
* successful. The new database is not readable or writeable until the LRO has
589+
* completed.
590+
*
591+
* The async variant is {@see FirestoreAdminClient::cloneDatabaseAsync()} .
592+
*
593+
* @example samples/V1/FirestoreAdminClient/clone_database.php
594+
*
595+
* @param CloneDatabaseRequest $request A request to house fields associated with the call.
596+
* @param array $callOptions {
597+
* Optional.
598+
*
599+
* @type RetrySettings|array $retrySettings
600+
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
601+
* associative array of retry settings parameters. See the documentation on
602+
* {@see RetrySettings} for example usage.
603+
* }
604+
*
605+
* @return OperationResponse
606+
*
607+
* @throws ApiException Thrown if the API call fails.
608+
*/
609+
public function cloneDatabase(CloneDatabaseRequest $request, array $callOptions = []): OperationResponse
610+
{
611+
return $this->startApiCall('CloneDatabase', $request, $callOptions)->wait();
612+
}
613+
569614
/**
570615
* Creates a backup schedule on a database.
571616
* At most two backup schedules can be configured on a database, one daily

0 commit comments

Comments
 (0)