|
38 | 38 | use Google\Cloud\Firestore\Admin\V1\Backup; |
39 | 39 | use Google\Cloud\Firestore\Admin\V1\BackupSchedule; |
40 | 40 | use Google\Cloud\Firestore\Admin\V1\BulkDeleteDocumentsRequest; |
| 41 | +use Google\Cloud\Firestore\Admin\V1\CloneDatabaseMetadata; |
| 42 | +use Google\Cloud\Firestore\Admin\V1\CloneDatabaseRequest; |
41 | 43 | use Google\Cloud\Firestore\Admin\V1\CreateBackupScheduleRequest; |
42 | 44 | use Google\Cloud\Firestore\Admin\V1\CreateDatabaseRequest; |
43 | 45 | use Google\Cloud\Firestore\Admin\V1\CreateIndexRequest; |
|
122 | 124 | * contained within formatted names that are returned by the API. |
123 | 125 | * |
124 | 126 | * @method PromiseInterface<OperationResponse> bulkDeleteDocumentsAsync(BulkDeleteDocumentsRequest $request, array $optionalArgs = []) |
| 127 | + * @method PromiseInterface<OperationResponse> cloneDatabaseAsync(CloneDatabaseRequest $request, array $optionalArgs = []) |
125 | 128 | * @method PromiseInterface<BackupSchedule> createBackupScheduleAsync(CreateBackupScheduleRequest $request, array $optionalArgs = []) |
126 | 129 | * @method PromiseInterface<OperationResponse> createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = []) |
127 | 130 | * @method PromiseInterface<OperationResponse> createIndexAsync(CreateIndexRequest $request, array $optionalArgs = []) |
@@ -566,6 +569,48 @@ public function bulkDeleteDocuments(BulkDeleteDocumentsRequest $request, array $ |
566 | 569 | return $this->startApiCall('BulkDeleteDocuments', $request, $callOptions)->wait(); |
567 | 570 | } |
568 | 571 |
|
| 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 | + |
569 | 614 | /** |
570 | 615 | * Creates a backup schedule on a database. |
571 | 616 | * At most two backup schedules can be configured on a database, one daily |
|
0 commit comments