Skip to content

Commit b4481e1

Browse files
Google APIscopybara-github
authored andcommitted
feat: add CreateDatabase API
PiperOrigin-RevId: 537397252
1 parent 1cdf48a commit b4481e1

File tree

1 file changed

+105
-50
lines changed

1 file changed

+105
-50
lines changed

google/firestore/admin/v1/firestore_admin.proto

Lines changed: 105 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Google LLC
1+
// Copyright 2023 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -78,9 +78,11 @@ service FirestoreAdmin {
7878
"https://www.googleapis.com/auth/cloud-platform,"
7979
"https://www.googleapis.com/auth/datastore";
8080

81-
// Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation]
82-
// which may be used to track the status of the creation. The metadata for
83-
// the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
81+
// Creates a composite index. This returns a
82+
// [google.longrunning.Operation][google.longrunning.Operation] which may be
83+
// used to track the status of the creation. The metadata for the operation
84+
// will be the type
85+
// [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
8486
rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
8587
option (google.api.http) = {
8688
post: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes"
@@ -127,13 +129,16 @@ service FirestoreAdmin {
127129

128130
// Updates a field configuration. Currently, field updates apply only to
129131
// single field index configuration. However, calls to
130-
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should provide a field mask to avoid
131-
// changing any configuration that the caller isn't aware of. The field mask
132-
// should be specified as: `{ paths: "index_config" }`.
132+
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]
133+
// should provide a field mask to avoid changing any configuration that the
134+
// caller isn't aware of. The field mask should be specified as: `{ paths:
135+
// "index_config" }`.
133136
//
134-
// This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to
135-
// track the status of the field update. The metadata for
136-
// the operation will be the type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
137+
// This call returns a
138+
// [google.longrunning.Operation][google.longrunning.Operation] which may be
139+
// used to track the status of the field update. The metadata for the
140+
// operation will be the type
141+
// [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata].
137142
//
138143
// To configure the default field settings for the database, use
139144
// the special `Field` with resource name:
@@ -152,10 +157,12 @@ service FirestoreAdmin {
152157

153158
// Lists the field configuration and metadata for this database.
154159
//
155-
// Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields
156-
// that have been explicitly overridden. To issue this query, call
157-
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the filter set to
158-
// `indexConfig.usesAncestorConfig:false` .
160+
// Currently,
161+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
162+
// only supports listing fields that have been explicitly overridden. To issue
163+
// this query, call
164+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
165+
// with the filter set to `indexConfig.usesAncestorConfig:false` .
159166
rpc ListFields(ListFieldsRequest) returns (ListFieldsResponse) {
160167
option (google.api.http) = {
161168
get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields"
@@ -174,7 +181,8 @@ service FirestoreAdmin {
174181
//
175182
// For more details on export behavior and output format, refer to:
176183
// https://cloud.google.com/firestore/docs/manage-data/export-import
177-
rpc ExportDocuments(ExportDocumentsRequest) returns (google.longrunning.Operation) {
184+
rpc ExportDocuments(ExportDocumentsRequest)
185+
returns (google.longrunning.Operation) {
178186
option (google.api.http) = {
179187
post: "/v1/{name=projects/*/databases/*}:exportDocuments"
180188
body: "*"
@@ -191,7 +199,8 @@ service FirestoreAdmin {
191199
// progress can be monitored and managed via the Operation resource that is
192200
// created. If an ImportDocuments operation is cancelled, it is possible
193201
// that a subset of the data has already been imported to Cloud Firestore.
194-
rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) {
202+
rpc ImportDocuments(ImportDocumentsRequest)
203+
returns (google.longrunning.Operation) {
195204
option (google.api.http) = {
196205
post: "/v1/{name=projects/*/databases/*}:importDocuments"
197206
body: "*"
@@ -203,6 +212,20 @@ service FirestoreAdmin {
203212
};
204213
}
205214

215+
// Create a database.
216+
rpc CreateDatabase(CreateDatabaseRequest)
217+
returns (google.longrunning.Operation) {
218+
option (google.api.http) = {
219+
post: "/v1/{parent=projects/*}/databases"
220+
body: "database"
221+
};
222+
option (google.api.method_signature) = "parent,database,database_id";
223+
option (google.longrunning.operation_info) = {
224+
response_type: "Database"
225+
metadata_type: "CreateDatabaseMetadata"
226+
};
227+
}
228+
206229
// Gets information about a database.
207230
rpc GetDatabase(GetDatabaseRequest) returns (Database) {
208231
option (google.api.http) = {
@@ -220,7 +243,8 @@ service FirestoreAdmin {
220243
}
221244

222245
// Updates a database.
223-
rpc UpdateDatabase(UpdateDatabaseRequest) returns (google.longrunning.Operation) {
246+
rpc UpdateDatabase(UpdateDatabaseRequest)
247+
returns (google.longrunning.Operation) {
224248
option (google.api.http) = {
225249
patch: "/v1/{database.name=projects/*/databases/*}"
226250
body: "database"
@@ -245,13 +269,39 @@ message ListDatabasesRequest {
245269
];
246270
}
247271

272+
// The request for
273+
// [FirestoreAdmin.CreateDatabase][google.firestore.admin.v1.FirestoreAdmin.CreateDatabase].
274+
message CreateDatabaseRequest {
275+
// Required. A parent name of the form
276+
// `projects/{project_id}`
277+
string parent = 1 [
278+
(google.api.field_behavior) = REQUIRED,
279+
(google.api.resource_reference) = {
280+
child_type: "firestore.googleapis.com/Database"
281+
}
282+
];
283+
284+
// Required. The Database to create.
285+
Database database = 2 [(google.api.field_behavior) = REQUIRED];
286+
287+
// Required. The ID to use for the database, which will become the final
288+
// component of the database's resource name.
289+
//
290+
// The value must be set to "(default)".
291+
string database_id = 3 [(google.api.field_behavior) = REQUIRED];
292+
}
293+
294+
// Metadata related to the create database operation.
295+
message CreateDatabaseMetadata {}
296+
248297
// The list of databases for a project.
249298
message ListDatabasesResponse {
250299
// The databases in the project.
251300
repeated Database databases = 1;
252301
}
253302

254-
// The request for [FirestoreAdmin.GetDatabase][google.firestore.admin.v1.FirestoreAdmin.GetDatabase].
303+
// The request for
304+
// [FirestoreAdmin.GetDatabase][google.firestore.admin.v1.FirestoreAdmin.GetDatabase].
255305
message GetDatabaseRequest {
256306
// Required. A name of the form
257307
// `projects/{project_id}/databases/{database_id}`
@@ -263,7 +313,8 @@ message GetDatabaseRequest {
263313
];
264314
}
265315

266-
// The request for [FirestoreAdmin.UpdateDatabase][google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase].
316+
// The request for
317+
// [FirestoreAdmin.UpdateDatabase][google.firestore.admin.v1.FirestoreAdmin.UpdateDatabase].
267318
message UpdateDatabaseRequest {
268319
// Required. The database to update.
269320
Database database = 1 [(google.api.field_behavior) = REQUIRED];
@@ -273,11 +324,10 @@ message UpdateDatabaseRequest {
273324
}
274325

275326
// Metadata related to the update database operation.
276-
message UpdateDatabaseMetadata {
327+
message UpdateDatabaseMetadata {}
277328

278-
}
279-
280-
// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
329+
// The request for
330+
// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
281331
message CreateIndexRequest {
282332
// Required. A parent name of the form
283333
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
@@ -292,7 +342,8 @@ message CreateIndexRequest {
292342
Index index = 2 [(google.api.field_behavior) = REQUIRED];
293343
}
294344

295-
// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
345+
// The request for
346+
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
296347
message ListIndexesRequest {
297348
// Required. A parent name of the form
298349
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
@@ -310,12 +361,13 @@ message ListIndexesRequest {
310361
int32 page_size = 3;
311362

312363
// A page token, returned from a previous call to
313-
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes], that may be used to get the next
314-
// page of results.
364+
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes],
365+
// that may be used to get the next page of results.
315366
string page_token = 4;
316367
}
317368

318-
// The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
369+
// The response for
370+
// [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
319371
message ListIndexesResponse {
320372
// The requested indexes.
321373
repeated Index indexes = 1;
@@ -325,31 +377,30 @@ message ListIndexesResponse {
325377
string next_page_token = 2;
326378
}
327379

328-
// The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex].
380+
// The request for
381+
// [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex].
329382
message GetIndexRequest {
330383
// Required. A name of the form
331384
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
332385
string name = 1 [
333386
(google.api.field_behavior) = REQUIRED,
334-
(google.api.resource_reference) = {
335-
type: "firestore.googleapis.com/Index"
336-
}
387+
(google.api.resource_reference) = { type: "firestore.googleapis.com/Index" }
337388
];
338389
}
339390

340-
// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex].
391+
// The request for
392+
// [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex].
341393
message DeleteIndexRequest {
342394
// Required. A name of the form
343395
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
344396
string name = 1 [
345397
(google.api.field_behavior) = REQUIRED,
346-
(google.api.resource_reference) = {
347-
type: "firestore.googleapis.com/Index"
348-
}
398+
(google.api.resource_reference) = { type: "firestore.googleapis.com/Index" }
349399
];
350400
}
351401

352-
// The request for [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
402+
// The request for
403+
// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
353404
message UpdateFieldRequest {
354405
// Required. The field to be updated.
355406
Field field = 1 [(google.api.field_behavior) = REQUIRED];
@@ -359,19 +410,19 @@ message UpdateFieldRequest {
359410
google.protobuf.FieldMask update_mask = 2;
360411
}
361412

362-
// The request for [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField].
413+
// The request for
414+
// [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField].
363415
message GetFieldRequest {
364416
// Required. A name of the form
365417
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
366418
string name = 1 [
367419
(google.api.field_behavior) = REQUIRED,
368-
(google.api.resource_reference) = {
369-
type: "firestore.googleapis.com/Field"
370-
}
420+
(google.api.resource_reference) = { type: "firestore.googleapis.com/Field" }
371421
];
372422
}
373423

374-
// The request for [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
424+
// The request for
425+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
375426
message ListFieldsRequest {
376427
// Required. A parent name of the form
377428
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
@@ -383,22 +434,24 @@ message ListFieldsRequest {
383434
];
384435

385436
// The filter to apply to list results. Currently,
386-
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields
387-
// that have been explicitly overridden. To issue this query, call
388-
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with a filter that includes
389-
// `indexConfig.usesAncestorConfig:false` .
437+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
438+
// only supports listing fields that have been explicitly overridden. To issue
439+
// this query, call
440+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]
441+
// with a filter that includes `indexConfig.usesAncestorConfig:false` .
390442
string filter = 2;
391443

392444
// The number of results to return.
393445
int32 page_size = 3;
394446

395447
// A page token, returned from a previous call to
396-
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields], that may be used to get the next
397-
// page of results.
448+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields],
449+
// that may be used to get the next page of results.
398450
string page_token = 4;
399451
}
400452

401-
// The response for [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
453+
// The response for
454+
// [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
402455
message ListFieldsResponse {
403456
// The requested fields.
404457
repeated Field fields = 1;
@@ -408,7 +461,8 @@ message ListFieldsResponse {
408461
string next_page_token = 2;
409462
}
410463

411-
// The request for [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
464+
// The request for
465+
// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
412466
message ExportDocumentsRequest {
413467
// Required. Database to export. Should be of the form:
414468
// `projects/{project_id}/databases/{database_id}`.
@@ -433,7 +487,8 @@ message ExportDocumentsRequest {
433487
string output_uri_prefix = 3;
434488
}
435489

436-
// The request for [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
490+
// The request for
491+
// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
437492
message ImportDocumentsRequest {
438493
// Required. Database to import into. Should be of the form:
439494
// `projects/{project_id}/databases/{database_id}`.

0 commit comments

Comments
 (0)