@@ -20,12 +20,14 @@ import "google/api/annotations.proto";
2020import "google/api/client.proto" ;
2121import "google/api/field_behavior.proto" ;
2222import "google/api/resource.proto" ;
23+ import "google/api/routing.proto" ;
2324import "google/firestore/admin/v1/backup.proto" ;
2425import "google/firestore/admin/v1/database.proto" ;
2526import "google/firestore/admin/v1/field.proto" ;
2627import "google/firestore/admin/v1/index.proto" ;
2728import "google/firestore/admin/v1/operation.proto" ;
2829import "google/firestore/admin/v1/schedule.proto" ;
30+ import "google/firestore/admin/v1/snapshot.proto" ;
2931import "google/firestore/admin/v1/user_creds.proto" ;
3032import "google/longrunning/operations.proto" ;
3133import "google/protobuf/empty.proto" ;
@@ -458,6 +460,45 @@ service FirestoreAdmin {
458460 };
459461 option (google.api.method_signature ) = "name" ;
460462 }
463+
464+ // Creates a new database by cloning an existing one.
465+ //
466+ // The new database must be in the same cloud region or multi-region location
467+ // as the existing database. This behaves similar to
468+ // [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase]
469+ // except instead of creating a new empty database, a new database is created
470+ // with the database type, index configuration, and documents from an existing
471+ // database.
472+ //
473+ // The [long-running operation][google.longrunning.Operation] can be used to
474+ // track the progress of the clone, with the Operation's
475+ // [metadata][google.longrunning.Operation.metadata] field type being the
476+ // [CloneDatabaseMetadata][google.firestore.admin.v1.CloneDatabaseMetadata].
477+ // The [response][google.longrunning.Operation.response] type is the
478+ // [Database][google.firestore.admin.v1.Database] if the clone was
479+ // successful. The new database is not readable or writeable until the LRO has
480+ // completed.
481+ rpc CloneDatabase (CloneDatabaseRequest )
482+ returns (google .longrunning .Operation ) {
483+ option (google.api.http ) = {
484+ post : "/v1/{parent=projects/*}/databases:clone"
485+ body : "*"
486+ };
487+ option (google.api.routing ) = {
488+ routing_parameters {
489+ field : "pitr_snapshot.database"
490+ path_template : "projects/{project_id=*}/**"
491+ }
492+ routing_parameters {
493+ field : "pitr_snapshot.database"
494+ path_template : "projects/*/databases/{database_id=*}/**"
495+ }
496+ };
497+ option (google.longrunning.operation_info ) = {
498+ response_type : "Database"
499+ metadata_type : "CloneDatabaseMetadata"
500+ };
501+ }
461502}
462503
463504// A request to list the Firestore Databases in all locations for a project.
@@ -1137,3 +1178,51 @@ message RestoreDatabaseRequest {
11371178 (google.api.field_behavior ) = OPTIONAL
11381179 ];
11391180}
1181+
1182+ // The request message for
1183+ // [FirestoreAdmin.CloneDatabase][google.firestore.admin.v1.FirestoreAdmin.CloneDatabase].
1184+ message CloneDatabaseRequest {
1185+ // Required. The project to clone the database in. Format is
1186+ // `projects/{project_id}`.
1187+ string parent = 1 [
1188+ (google.api.field_behavior ) = REQUIRED ,
1189+ (google.api.resource_reference ) = {
1190+ child_type : "firestore.googleapis.com/Database"
1191+ }
1192+ ];
1193+
1194+ // Required. The ID to use for the database, which will become the final
1195+ // component of the database's resource name. This database ID must not be
1196+ // associated with an existing database.
1197+ //
1198+ // This value should be 4-63 characters. Valid characters are /[a-z][0-9]-/
1199+ // with first character a letter and the last a letter or a number. Must not
1200+ // be UUID-like /[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
1201+ //
1202+ // "(default)" database ID is also valid.
1203+ string database_id = 2 [(google.api.field_behavior ) = REQUIRED ];
1204+
1205+ // Required. Specification of the PITR data to clone from. The source database
1206+ // must exist.
1207+ //
1208+ // The cloned database will be created in the same location as the source
1209+ // database.
1210+ PitrSnapshot pitr_snapshot = 6 [(google.api.field_behavior ) = REQUIRED ];
1211+
1212+ // Optional. Encryption configuration for the cloned database.
1213+ //
1214+ // If this field is not specified, the cloned database will use
1215+ // the same encryption configuration as the source database, namely
1216+ // [use_source_encryption][google.firestore.admin.v1.Database.EncryptionConfig.use_source_encryption].
1217+ Database.EncryptionConfig encryption_config = 4
1218+ [(google.api.field_behavior ) = OPTIONAL ];
1219+
1220+ // Optional. Immutable. Tags to be bound to the cloned database.
1221+ //
1222+ // The tags should be provided in the format of
1223+ // `tagKeys/{tag_key_id} -> tagValues/{tag_value_id}`.
1224+ map <string , string > tags = 5 [
1225+ (google.api.field_behavior ) = IMMUTABLE ,
1226+ (google.api.field_behavior ) = OPTIONAL
1227+ ];
1228+ }
0 commit comments