1// Copyright 2019 Google LLC. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// 15 16syntax = "proto3"; 17 18package google.firestore.admin.v1beta2; 19 20import "google/api/annotations.proto"; 21import "google/firestore/admin/v1beta2/field.proto"; 22import "google/firestore/admin/v1beta2/index.proto"; 23import "google/longrunning/operations.proto"; 24import "google/protobuf/empty.proto"; 25import "google/protobuf/field_mask.proto"; 26import "google/api/client.proto"; 27 28option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta2"; 29option go_package = "cloud.google.com/go/firestore/admin/apiv1beta2/adminpb;adminpb"; 30option java_multiple_files = true; 31option java_outer_classname = "FirestoreAdminProto"; 32option java_package = "com.google.firestore.admin.v1beta2"; 33option objc_class_prefix = "GCFS"; 34 35// Operations are created by service `FirestoreAdmin`, but are accessed via 36// service `google.longrunning.Operations`. 37service FirestoreAdmin { 38 option (google.api.default_host) = "firestore.googleapis.com"; 39 option (google.api.oauth_scopes) = 40 "https://www.googleapis.com/auth/cloud-platform," 41 "https://www.googleapis.com/auth/datastore"; 42 43 // Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation] 44 // which may be used to track the status of the creation. The metadata for 45 // the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1beta2.IndexOperationMetadata]. 46 rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) { 47 option (google.api.http) = { 48 post: "/v1beta2/{parent=projects/*/databases/*/collectionGroups/*}/indexes" 49 body: "index" 50 }; 51 } 52 53 // Lists composite indexes. 54 rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) { 55 option (google.api.http) = { 56 get: "/v1beta2/{parent=projects/*/databases/*/collectionGroups/*}/indexes" 57 }; 58 } 59 60 // Gets a composite index. 61 rpc GetIndex(GetIndexRequest) returns (Index) { 62 option (google.api.http) = { 63 get: "/v1beta2/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" 64 }; 65 } 66 67 // Deletes a composite index. 68 rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) { 69 option (google.api.http) = { 70 delete: "/v1beta2/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" 71 }; 72 } 73 74 // Gets the metadata and configuration for a Field. 75 rpc GetField(GetFieldRequest) returns (Field) { 76 option (google.api.http) = { 77 get: "/v1beta2/{name=projects/*/databases/*/collectionGroups/*/fields/*}" 78 }; 79 } 80 81 // Updates a field configuration. Currently, field updates apply only to 82 // single field index configuration. However, calls to 83 // [FirestoreAdmin.UpdateField][google.firestore.admin.v1beta2.FirestoreAdmin.UpdateField] should provide a field mask to avoid 84 // changing any configuration that the caller isn't aware of. The field mask 85 // should be specified as: `{ paths: "index_config" }`. 86 // 87 // This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to 88 // track the status of the field update. The metadata for 89 // the operation will be the type [FieldOperationMetadata][google.firestore.admin.v1beta2.FieldOperationMetadata]. 90 // 91 // To configure the default field settings for the database, use 92 // the special `Field` with resource name: 93 // `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. 94 rpc UpdateField(UpdateFieldRequest) returns (google.longrunning.Operation) { 95 option (google.api.http) = { 96 patch: "/v1beta2/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}" 97 body: "field" 98 }; 99 } 100 101 // Lists the field configuration and metadata for this database. 102 // 103 // Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields] only supports listing fields 104 // that have been explicitly overridden. To issue this query, call 105 // [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields] with the filter set to 106 // `indexConfig.usesAncestorConfig:false`. 107 rpc ListFields(ListFieldsRequest) returns (ListFieldsResponse) { 108 option (google.api.http) = { 109 get: "/v1beta2/{parent=projects/*/databases/*/collectionGroups/*}/fields" 110 }; 111 } 112 113 // Exports a copy of all or a subset of documents from Google Cloud Firestore 114 // to another storage system, such as Google Cloud Storage. Recent updates to 115 // documents may not be reflected in the export. The export occurs in the 116 // background and its progress can be monitored and managed via the 117 // Operation resource that is created. The output of an export may only be 118 // used once the associated operation is done. If an export operation is 119 // cancelled before completion it may leave partial data behind in Google 120 // Cloud Storage. 121 rpc ExportDocuments(ExportDocumentsRequest) returns (google.longrunning.Operation) { 122 option (google.api.http) = { 123 post: "/v1beta2/{name=projects/*/databases/*}:exportDocuments" 124 body: "*" 125 }; 126 } 127 128 // Imports documents into Google Cloud Firestore. Existing documents with the 129 // same name are overwritten. The import occurs in the background and its 130 // progress can be monitored and managed via the Operation resource that is 131 // created. If an ImportDocuments operation is cancelled, it is possible 132 // that a subset of the data has already been imported to Cloud Firestore. 133 rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { 134 option (google.api.http) = { 135 post: "/v1beta2/{name=projects/*/databases/*}:importDocuments" 136 body: "*" 137 }; 138 } 139} 140 141// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1beta2.FirestoreAdmin.CreateIndex]. 142message CreateIndexRequest { 143 // A parent name of the form 144 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` 145 string parent = 1; 146 147 // The composite index to create. 148 Index index = 2; 149} 150 151// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta2.FirestoreAdmin.ListIndexes]. 152message ListIndexesRequest { 153 // A parent name of the form 154 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` 155 string parent = 1; 156 157 // The filter to apply to list results. 158 string filter = 2; 159 160 // The number of results to return. 161 int32 page_size = 3; 162 163 // A page token, returned from a previous call to 164 // [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta2.FirestoreAdmin.ListIndexes], that may be used to get the next 165 // page of results. 166 string page_token = 4; 167} 168 169// The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta2.FirestoreAdmin.ListIndexes]. 170message ListIndexesResponse { 171 // The requested indexes. 172 repeated Index indexes = 1; 173 174 // A page token that may be used to request another page of results. If blank, 175 // this is the last page. 176 string next_page_token = 2; 177} 178 179// The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1beta2.FirestoreAdmin.GetIndex]. 180message GetIndexRequest { 181 // A name of the form 182 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` 183 string name = 1; 184} 185 186// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1beta2.FirestoreAdmin.DeleteIndex]. 187message DeleteIndexRequest { 188 // A name of the form 189 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` 190 string name = 1; 191} 192 193// The request for [FirestoreAdmin.UpdateField][google.firestore.admin.v1beta2.FirestoreAdmin.UpdateField]. 194message UpdateFieldRequest { 195 // The field to be updated. 196 Field field = 1; 197 198 // A mask, relative to the field. If specified, only configuration specified 199 // by this field_mask will be updated in the field. 200 google.protobuf.FieldMask update_mask = 2; 201} 202 203// The request for [FirestoreAdmin.GetField][google.firestore.admin.v1beta2.FirestoreAdmin.GetField]. 204message GetFieldRequest { 205 // A name of the form 206 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` 207 string name = 1; 208} 209 210// The request for [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields]. 211message ListFieldsRequest { 212 // A parent name of the form 213 // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` 214 string parent = 1; 215 216 // The filter to apply to list results. Currently, 217 // [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields] only supports listing fields 218 // that have been explicitly overridden. To issue this query, call 219 // [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields] with the filter set to 220 // `indexConfig.usesAncestorConfig:false`. 221 string filter = 2; 222 223 // The number of results to return. 224 int32 page_size = 3; 225 226 // A page token, returned from a previous call to 227 // [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields], that may be used to get the next 228 // page of results. 229 string page_token = 4; 230} 231 232// The response for [FirestoreAdmin.ListFields][google.firestore.admin.v1beta2.FirestoreAdmin.ListFields]. 233message ListFieldsResponse { 234 // The requested fields. 235 repeated Field fields = 1; 236 237 // A page token that may be used to request another page of results. If blank, 238 // this is the last page. 239 string next_page_token = 2; 240} 241 242// The request for [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1beta2.FirestoreAdmin.ExportDocuments]. 243message ExportDocumentsRequest { 244 // Database to export. Should be of the form: 245 // `projects/{project_id}/databases/{database_id}`. 246 string name = 1; 247 248 // Which collection ids to export. Unspecified means all collections. 249 repeated string collection_ids = 2; 250 251 // The output URI. Currently only supports Google Cloud Storage URIs of the 252 // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name 253 // of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional 254 // Google Cloud Storage namespace path. When 255 // choosing a name, be sure to consider Google Cloud Storage naming 256 // guidelines: https://cloud.google.com/storage/docs/naming. 257 // If the URI is a bucket (without a namespace path), a prefix will be 258 // generated based on the start time. 259 string output_uri_prefix = 3; 260} 261 262// The request for [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1beta2.FirestoreAdmin.ImportDocuments]. 263message ImportDocumentsRequest { 264 // Database to import into. Should be of the form: 265 // `projects/{project_id}/databases/{database_id}`. 266 string name = 1; 267 268 // Which collection ids to import. Unspecified means all collections included 269 // in the import. 270 repeated string collection_ids = 2; 271 272 // Location of the exported files. 273 // This must match the output_uri_prefix of an ExportDocumentsResponse from 274 // an export that has completed successfully. 275 // See: 276 // [google.firestore.admin.v1beta2.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1beta2.ExportDocumentsResponse.output_uri_prefix]. 277 string input_uri_prefix = 3; 278} 279