firestore_admin.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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. syntax = "proto3";
  16. package google.firestore.admin.v1beta1;
  17. import "google/api/annotations.proto";
  18. import "google/firestore/admin/v1beta1/index.proto";
  19. import "google/longrunning/operations.proto";
  20. import "google/protobuf/empty.proto";
  21. import "google/protobuf/timestamp.proto";
  22. import "google/api/client.proto";
  23. option csharp_namespace = "Google.Cloud.Firestore.Admin.V1Beta1";
  24. option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1;admin";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "FirestoreAdminProto";
  27. option java_package = "com.google.firestore.admin.v1beta1";
  28. option objc_class_prefix = "GCFS";
  29. // The Cloud Firestore Admin API.
  30. //
  31. // This API provides several administrative services for Cloud Firestore.
  32. //
  33. // # Concepts
  34. //
  35. // Project, Database, Namespace, Collection, and Document are used as defined in
  36. // the Google Cloud Firestore API.
  37. //
  38. // Operation: An Operation represents work being performed in the background.
  39. //
  40. //
  41. // # Services
  42. //
  43. // ## Index
  44. //
  45. // The index service manages Cloud Firestore indexes.
  46. //
  47. // Index creation is performed asynchronously.
  48. // An Operation resource is created for each such asynchronous operation.
  49. // The state of the operation (including any errors encountered)
  50. // may be queried via the Operation resource.
  51. //
  52. // ## Metadata
  53. //
  54. // Provides metadata and statistical information about data in Cloud Firestore.
  55. // The data provided as part of this API may be stale.
  56. //
  57. // ## Operation
  58. //
  59. // The Operations collection provides a record of actions performed for the
  60. // specified Project (including any Operations in progress). Operations are not
  61. // created directly but through calls on other collections or resources.
  62. //
  63. // An Operation that is not yet done may be cancelled. The request to cancel is
  64. // asynchronous and the Operation may continue to run for some time after the
  65. // request to cancel is made.
  66. //
  67. // An Operation that is done may be deleted so that it is no longer listed as
  68. // part of the Operation collection.
  69. //
  70. // Operations are created by service `FirestoreAdmin`, but are accessed via
  71. // service `google.longrunning.Operations`.
  72. service FirestoreAdmin {
  73. option (google.api.default_host) = "firestore.googleapis.com";
  74. option (google.api.oauth_scopes) =
  75. "https://www.googleapis.com/auth/cloud-platform,"
  76. "https://www.googleapis.com/auth/datastore";
  77. // Creates the specified index.
  78. // A newly created index's initial state is `CREATING`. On completion of the
  79. // returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
  80. // If the index already exists, the call will return an `ALREADY_EXISTS`
  81. // status.
  82. //
  83. // During creation, the process could result in an error, in which case the
  84. // index will move to the `ERROR` state. The process can be recovered by
  85. // fixing the data that caused the error, removing the index with
  86. // [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with
  87. // [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
  88. //
  89. // Indexes with a single field cannot be created.
  90. rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
  91. option (google.api.http) = {
  92. post: "/v1beta1/{parent=projects/*/databases/*}/indexes"
  93. body: "index"
  94. };
  95. }
  96. // Lists the indexes that match the specified filters.
  97. rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
  98. option (google.api.http) = {
  99. get: "/v1beta1/{parent=projects/*/databases/*}/indexes"
  100. };
  101. }
  102. // Gets an index.
  103. rpc GetIndex(GetIndexRequest) returns (Index) {
  104. option (google.api.http) = {
  105. get: "/v1beta1/{name=projects/*/databases/*/indexes/*}"
  106. };
  107. }
  108. // Deletes an index.
  109. rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) {
  110. option (google.api.http) = {
  111. delete: "/v1beta1/{name=projects/*/databases/*/indexes/*}"
  112. };
  113. }
  114. // Exports a copy of all or a subset of documents from Google Cloud Firestore
  115. // to another storage system, such as Google Cloud Storage. Recent updates to
  116. // documents may not be reflected in the export. The export occurs in the
  117. // background and its progress can be monitored and managed via the
  118. // Operation resource that is created. The output of an export may only be
  119. // used once the associated operation is done. If an export operation is
  120. // cancelled before completion it may leave partial data behind in Google
  121. // Cloud Storage.
  122. rpc ExportDocuments(ExportDocumentsRequest) returns (google.longrunning.Operation) {
  123. option (google.api.http) = {
  124. post: "/v1beta1/{name=projects/*/databases/*}:exportDocuments"
  125. body: "*"
  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: "/v1beta1/{name=projects/*/databases/*}:importDocuments"
  136. body: "*"
  137. };
  138. }
  139. }
  140. // Metadata for index operations. This metadata populates
  141. // the metadata field of [google.longrunning.Operation][google.longrunning.Operation].
  142. message IndexOperationMetadata {
  143. // The type of index operation.
  144. enum OperationType {
  145. // Unspecified. Never set by server.
  146. OPERATION_TYPE_UNSPECIFIED = 0;
  147. // The operation is creating the index. Initiated by a `CreateIndex` call.
  148. CREATING_INDEX = 1;
  149. }
  150. // The time that work began on the operation.
  151. google.protobuf.Timestamp start_time = 1;
  152. // The time the operation ended, either successfully or otherwise. Unset if
  153. // the operation is still active.
  154. google.protobuf.Timestamp end_time = 2;
  155. // The index resource that this operation is acting on. For example:
  156. // `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
  157. string index = 3;
  158. // The type of index operation.
  159. OperationType operation_type = 4;
  160. // True if the [google.longrunning.Operation] was cancelled. If the
  161. // cancellation is in progress, cancelled will be true but
  162. // [google.longrunning.Operation.done][google.longrunning.Operation.done] will be false.
  163. bool cancelled = 5;
  164. // Progress of the existing operation, measured in number of documents.
  165. Progress document_progress = 6;
  166. }
  167. // Measures the progress of a particular metric.
  168. message Progress {
  169. // An estimate of how much work has been completed. Note that this may be
  170. // greater than `work_estimated`.
  171. int64 work_completed = 1;
  172. // An estimate of how much work needs to be performed. Zero if the
  173. // work estimate is unavailable. May change as work progresses.
  174. int64 work_estimated = 2;
  175. }
  176. // The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].
  177. message CreateIndexRequest {
  178. // The name of the database this index will apply to. For example:
  179. // `projects/{project_id}/databases/{database_id}`
  180. string parent = 1;
  181. // The index to create. The name and state fields are output only and will be
  182. // ignored. Certain single field indexes cannot be created or deleted.
  183. Index index = 2;
  184. }
  185. // The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1beta1.FirestoreAdmin.GetIndex].
  186. message GetIndexRequest {
  187. // The name of the index. For example:
  188. // `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
  189. string name = 1;
  190. }
  191. // The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes].
  192. message ListIndexesRequest {
  193. // The database name. For example:
  194. // `projects/{project_id}/databases/{database_id}`
  195. string parent = 1;
  196. string filter = 2;
  197. // The standard List page size.
  198. int32 page_size = 3;
  199. // The standard List page token.
  200. string page_token = 4;
  201. }
  202. // The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex].
  203. message DeleteIndexRequest {
  204. // The index name. For example:
  205. // `projects/{project_id}/databases/{database_id}/indexes/{index_id}`
  206. string name = 1;
  207. }
  208. // The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1beta1.FirestoreAdmin.ListIndexes].
  209. message ListIndexesResponse {
  210. // The indexes.
  211. repeated Index indexes = 1;
  212. // The standard List next-page token.
  213. string next_page_token = 2;
  214. }
  215. // The request for [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1beta1.FirestoreAdmin.ExportDocuments].
  216. message ExportDocumentsRequest {
  217. // Database to export. Should be of the form:
  218. // `projects/{project_id}/databases/{database_id}`.
  219. string name = 1;
  220. // Which collection ids to export. Unspecified means all collections.
  221. repeated string collection_ids = 3;
  222. // The output URI. Currently only supports Google Cloud Storage URIs of the
  223. // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
  224. // of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
  225. // Google Cloud Storage namespace path. When
  226. // choosing a name, be sure to consider Google Cloud Storage naming
  227. // guidelines: https://cloud.google.com/storage/docs/naming.
  228. // If the URI is a bucket (without a namespace path), a prefix will be
  229. // generated based on the start time.
  230. string output_uri_prefix = 4;
  231. }
  232. // The request for [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1beta1.FirestoreAdmin.ImportDocuments].
  233. message ImportDocumentsRequest {
  234. // Database to import into. Should be of the form:
  235. // `projects/{project_id}/databases/{database_id}`.
  236. string name = 1;
  237. // Which collection ids to import. Unspecified means all collections included
  238. // in the import.
  239. repeated string collection_ids = 3;
  240. // Location of the exported files.
  241. // This must match the output_uri_prefix of an ExportDocumentsResponse from
  242. // an export that has completed successfully.
  243. // See:
  244. // [google.firestore.admin.v1beta1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1beta1.ExportDocumentsResponse.output_uri_prefix].
  245. string input_uri_prefix = 4;
  246. }
  247. // Returned in the [google.longrunning.Operation][google.longrunning.Operation] response field.
  248. message ExportDocumentsResponse {
  249. // Location of the output files. This can be used to begin an import
  250. // into Cloud Firestore (this project or another project) after the operation
  251. // completes successfully.
  252. string output_uri_prefix = 1;
  253. }
  254. // Metadata for ExportDocuments operations.
  255. message ExportDocumentsMetadata {
  256. // The time that work began on the operation.
  257. google.protobuf.Timestamp start_time = 1;
  258. // The time the operation ended, either successfully or otherwise. Unset if
  259. // the operation is still active.
  260. google.protobuf.Timestamp end_time = 2;
  261. // The state of the export operation.
  262. OperationState operation_state = 3;
  263. // An estimate of the number of documents processed.
  264. Progress progress_documents = 4;
  265. // An estimate of the number of bytes processed.
  266. Progress progress_bytes = 5;
  267. // Which collection ids are being exported.
  268. repeated string collection_ids = 6;
  269. // Where the entities are being exported to.
  270. string output_uri_prefix = 7;
  271. }
  272. // Metadata for ImportDocuments operations.
  273. message ImportDocumentsMetadata {
  274. // The time that work began on the operation.
  275. google.protobuf.Timestamp start_time = 1;
  276. // The time the operation ended, either successfully or otherwise. Unset if
  277. // the operation is still active.
  278. google.protobuf.Timestamp end_time = 2;
  279. // The state of the import operation.
  280. OperationState operation_state = 3;
  281. // An estimate of the number of documents processed.
  282. Progress progress_documents = 4;
  283. // An estimate of the number of bytes processed.
  284. Progress progress_bytes = 5;
  285. // Which collection ids are being imported.
  286. repeated string collection_ids = 6;
  287. // The location of the documents being imported.
  288. string input_uri_prefix = 7;
  289. }
  290. // The various possible states for an ongoing Operation.
  291. enum OperationState {
  292. // Unspecified.
  293. STATE_UNSPECIFIED = 0;
  294. // Request is being prepared for processing.
  295. INITIALIZING = 1;
  296. // Request is actively being processed.
  297. PROCESSING = 2;
  298. // Request is in the process of being cancelled after user called
  299. // google.longrunning.Operations.CancelOperation on the operation.
  300. CANCELLING = 3;
  301. // Request has been processed and is in its finalization stage.
  302. FINALIZING = 4;
  303. // Request has completed successfully.
  304. SUCCESSFUL = 5;
  305. // Request has finished being processed, but encountered an error.
  306. FAILED = 6;
  307. // Request has finished being cancelled after user called
  308. // google.longrunning.Operations.CancelOperation.
  309. CANCELLED = 7;
  310. }