datastore_admin.proto 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. // Copyright 2022 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. syntax = "proto3";
  15. package google.datastore.admin.v1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/datastore/admin/v1/index.proto";
  20. import "google/datastore/admin/v1/migration.proto";
  21. import "google/longrunning/operations.proto";
  22. import "google/protobuf/timestamp.proto";
  23. option csharp_namespace = "Google.Cloud.Datastore.Admin.V1";
  24. option go_package = "google.golang.org/genproto/googleapis/datastore/admin/v1;admin";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "DatastoreAdminProto";
  27. option java_package = "com.google.datastore.admin.v1";
  28. option php_namespace = "Google\\Cloud\\Datastore\\Admin\\V1";
  29. option ruby_package = "Google::Cloud::Datastore::Admin::V1";
  30. // Google Cloud Datastore Admin API
  31. //
  32. //
  33. // The Datastore Admin API provides several admin services for Cloud Datastore.
  34. //
  35. // -----------------------------------------------------------------------------
  36. // ## Concepts
  37. //
  38. // Project, namespace, kind, and entity as defined in the Google Cloud Datastore
  39. // API.
  40. //
  41. // Operation: An Operation represents work being performed in the background.
  42. //
  43. // EntityFilter: Allows specifying a subset of entities in a project. This is
  44. // specified as a combination of kinds and namespaces (either or both of which
  45. // may be all).
  46. //
  47. // -----------------------------------------------------------------------------
  48. // ## Services
  49. //
  50. // # Export/Import
  51. //
  52. // The Export/Import service provides the ability to copy all or a subset of
  53. // entities to/from Google Cloud Storage.
  54. //
  55. // Exported data may be imported into Cloud Datastore for any Google Cloud
  56. // Platform project. It is not restricted to the export source project. It is
  57. // possible to export from one project and then import into another.
  58. //
  59. // Exported data can also be loaded into Google BigQuery for analysis.
  60. //
  61. // Exports and imports are performed asynchronously. An Operation resource is
  62. // created for each export/import. The state (including any errors encountered)
  63. // of the export/import may be queried via the Operation resource.
  64. //
  65. // # Index
  66. //
  67. // The index service manages Cloud Datastore composite indexes.
  68. //
  69. // Index creation and deletion are performed asynchronously.
  70. // An Operation resource is created for each such asynchronous operation.
  71. // The state of the operation (including any errors encountered)
  72. // may be queried via the Operation resource.
  73. //
  74. // # Operation
  75. //
  76. // The Operations collection provides a record of actions performed for the
  77. // specified project (including any operations in progress). Operations are not
  78. // created directly but through calls on other collections or resources.
  79. //
  80. // An operation that is not yet done may be cancelled. The request to cancel is
  81. // asynchronous and the operation may continue to run for some time after the
  82. // request to cancel is made.
  83. //
  84. // An operation that is done may be deleted so that it is no longer listed as
  85. // part of the Operation collection.
  86. //
  87. // ListOperations returns all pending operations, but not completed operations.
  88. //
  89. // Operations are created by service DatastoreAdmin,
  90. // but are accessed via service google.longrunning.Operations.
  91. service DatastoreAdmin {
  92. option (google.api.default_host) = "datastore.googleapis.com";
  93. option (google.api.oauth_scopes) =
  94. "https://www.googleapis.com/auth/cloud-platform,"
  95. "https://www.googleapis.com/auth/datastore";
  96. // Exports a copy of all or a subset of entities from Google Cloud Datastore
  97. // to another storage system, such as Google Cloud Storage. Recent updates to
  98. // entities may not be reflected in the export. The export occurs in the
  99. // background and its progress can be monitored and managed via the
  100. // Operation resource that is created. The output of an export may only be
  101. // used once the associated operation is done. If an export operation is
  102. // cancelled before completion it may leave partial data behind in Google
  103. // Cloud Storage.
  104. rpc ExportEntities(ExportEntitiesRequest) returns (google.longrunning.Operation) {
  105. option (google.api.http) = {
  106. post: "/v1/projects/{project_id}:export"
  107. body: "*"
  108. };
  109. option (google.api.method_signature) = "project_id,labels,entity_filter,output_url_prefix";
  110. option (google.longrunning.operation_info) = {
  111. response_type: "ExportEntitiesResponse"
  112. metadata_type: "ExportEntitiesMetadata"
  113. };
  114. }
  115. // Imports entities into Google Cloud Datastore. Existing entities with the
  116. // same key are overwritten. The import occurs in the background and its
  117. // progress can be monitored and managed via the Operation resource that is
  118. // created. If an ImportEntities operation is cancelled, it is possible
  119. // that a subset of the data has already been imported to Cloud Datastore.
  120. rpc ImportEntities(ImportEntitiesRequest) returns (google.longrunning.Operation) {
  121. option (google.api.http) = {
  122. post: "/v1/projects/{project_id}:import"
  123. body: "*"
  124. };
  125. option (google.api.method_signature) = "project_id,labels,input_url,entity_filter";
  126. option (google.longrunning.operation_info) = {
  127. response_type: "google.protobuf.Empty"
  128. metadata_type: "ImportEntitiesMetadata"
  129. };
  130. }
  131. // Creates the specified index.
  132. // A newly created index's initial state is `CREATING`. On completion of the
  133. // returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
  134. // If the index already exists, the call will return an `ALREADY_EXISTS`
  135. // status.
  136. //
  137. // During index creation, the process could result in an error, in which
  138. // case the index will move to the `ERROR` state. The process can be recovered
  139. // by fixing the data that caused the error, removing the index with
  140. // [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex], then
  141. // re-creating the index with [create]
  142. // [google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
  143. //
  144. // Indexes with a single property cannot be created.
  145. rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) {
  146. option (google.api.http) = {
  147. post: "/v1/projects/{project_id}/indexes"
  148. body: "index"
  149. };
  150. option (google.longrunning.operation_info) = {
  151. response_type: "Index"
  152. metadata_type: "IndexOperationMetadata"
  153. };
  154. }
  155. // Deletes an existing index.
  156. // An index can only be deleted if it is in a `READY` or `ERROR` state. On
  157. // successful execution of the request, the index will be in a `DELETING`
  158. // [state][google.datastore.admin.v1.Index.State]. And on completion of the
  159. // returned [google.longrunning.Operation][google.longrunning.Operation], the index will be removed.
  160. //
  161. // During index deletion, the process could result in an error, in which
  162. // case the index will move to the `ERROR` state. The process can be recovered
  163. // by fixing the data that caused the error, followed by calling
  164. // [delete][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex] again.
  165. rpc DeleteIndex(DeleteIndexRequest) returns (google.longrunning.Operation) {
  166. option (google.api.http) = {
  167. delete: "/v1/projects/{project_id}/indexes/{index_id}"
  168. };
  169. option (google.longrunning.operation_info) = {
  170. response_type: "Index"
  171. metadata_type: "IndexOperationMetadata"
  172. };
  173. }
  174. // Gets an index.
  175. rpc GetIndex(GetIndexRequest) returns (Index) {
  176. option (google.api.http) = {
  177. get: "/v1/projects/{project_id}/indexes/{index_id}"
  178. };
  179. }
  180. // Lists the indexes that match the specified filters. Datastore uses an
  181. // eventually consistent query to fetch the list of indexes and may
  182. // occasionally return stale results.
  183. rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
  184. option (google.api.http) = {
  185. get: "/v1/projects/{project_id}/indexes"
  186. };
  187. }
  188. }
  189. // Metadata common to all Datastore Admin operations.
  190. message CommonMetadata {
  191. // The various possible states for an ongoing Operation.
  192. enum State {
  193. // Unspecified.
  194. STATE_UNSPECIFIED = 0;
  195. // Request is being prepared for processing.
  196. INITIALIZING = 1;
  197. // Request is actively being processed.
  198. PROCESSING = 2;
  199. // Request is in the process of being cancelled after user called
  200. // google.longrunning.Operations.CancelOperation on the operation.
  201. CANCELLING = 3;
  202. // Request has been processed and is in its finalization stage.
  203. FINALIZING = 4;
  204. // Request has completed successfully.
  205. SUCCESSFUL = 5;
  206. // Request has finished being processed, but encountered an error.
  207. FAILED = 6;
  208. // Request has finished being cancelled after user called
  209. // google.longrunning.Operations.CancelOperation.
  210. CANCELLED = 7;
  211. }
  212. // The time that work began on the operation.
  213. google.protobuf.Timestamp start_time = 1;
  214. // The time the operation ended, either successfully or otherwise.
  215. google.protobuf.Timestamp end_time = 2;
  216. // The type of the operation. Can be used as a filter in
  217. // ListOperationsRequest.
  218. OperationType operation_type = 3;
  219. // The client-assigned labels which were provided when the operation was
  220. // created. May also include additional labels.
  221. map<string, string> labels = 4;
  222. // The current state of the Operation.
  223. State state = 5;
  224. }
  225. // Measures the progress of a particular metric.
  226. message Progress {
  227. // The amount of work that has been completed. Note that this may be greater
  228. // than work_estimated.
  229. int64 work_completed = 1;
  230. // An estimate of how much work needs to be performed. May be zero if the
  231. // work estimate is unavailable.
  232. int64 work_estimated = 2;
  233. }
  234. // The request for
  235. // [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
  236. message ExportEntitiesRequest {
  237. // Required. Project ID against which to make the request.
  238. string project_id = 1 [(google.api.field_behavior) = REQUIRED];
  239. // Client-assigned labels.
  240. map<string, string> labels = 2;
  241. // Description of what data from the project is included in the export.
  242. EntityFilter entity_filter = 3;
  243. // Required. Location for the export metadata and data files.
  244. //
  245. // The full resource URL of the external storage location. Currently, only
  246. // Google Cloud Storage is supported. So output_url_prefix should be of the
  247. // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the
  248. // name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud
  249. // Storage namespace path (this is not a Cloud Datastore namespace). For more
  250. // information about Cloud Storage namespace paths, see
  251. // [Object name
  252. // considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
  253. //
  254. // The resulting files will be nested deeper than the specified URL prefix.
  255. // The final output URL will be provided in the
  256. // [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field. That
  257. // value should be used for subsequent ImportEntities operations.
  258. //
  259. // By nesting the data files deeper, the same Cloud Storage bucket can be used
  260. // in multiple ExportEntities operations without conflict.
  261. string output_url_prefix = 4 [(google.api.field_behavior) = REQUIRED];
  262. }
  263. // The request for
  264. // [google.datastore.admin.v1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1.DatastoreAdmin.ImportEntities].
  265. message ImportEntitiesRequest {
  266. // Required. Project ID against which to make the request.
  267. string project_id = 1 [(google.api.field_behavior) = REQUIRED];
  268. // Client-assigned labels.
  269. map<string, string> labels = 2;
  270. // Required. The full resource URL of the external storage location. Currently, only
  271. // Google Cloud Storage is supported. So input_url should be of the form:
  272. // `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where
  273. // `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is
  274. // an optional Cloud Storage namespace path (this is not a Cloud Datastore
  275. // namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written
  276. // by the ExportEntities operation. For more information about Cloud Storage
  277. // namespace paths, see
  278. // [Object name
  279. // considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
  280. //
  281. // For more information, see
  282. // [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
  283. string input_url = 3 [(google.api.field_behavior) = REQUIRED];
  284. // Optionally specify which kinds/namespaces are to be imported. If provided,
  285. // the list must be a subset of the EntityFilter used in creating the export,
  286. // otherwise a FAILED_PRECONDITION error will be returned. If no filter is
  287. // specified then all entities from the export are imported.
  288. EntityFilter entity_filter = 4;
  289. }
  290. // The response for
  291. // [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities].
  292. message ExportEntitiesResponse {
  293. // Location of the output metadata file. This can be used to begin an import
  294. // into Cloud Datastore (this project or another project). See
  295. // [google.datastore.admin.v1.ImportEntitiesRequest.input_url][google.datastore.admin.v1.ImportEntitiesRequest.input_url].
  296. // Only present if the operation completed successfully.
  297. string output_url = 1;
  298. }
  299. // Metadata for ExportEntities operations.
  300. message ExportEntitiesMetadata {
  301. // Metadata common to all Datastore Admin operations.
  302. CommonMetadata common = 1;
  303. // An estimate of the number of entities processed.
  304. Progress progress_entities = 2;
  305. // An estimate of the number of bytes processed.
  306. Progress progress_bytes = 3;
  307. // Description of which entities are being exported.
  308. EntityFilter entity_filter = 4;
  309. // Location for the export metadata and data files. This will be the same
  310. // value as the
  311. // [google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1.ExportEntitiesRequest.output_url_prefix]
  312. // field. The final output location is provided in
  313. // [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url].
  314. string output_url_prefix = 5;
  315. }
  316. // Metadata for ImportEntities operations.
  317. message ImportEntitiesMetadata {
  318. // Metadata common to all Datastore Admin operations.
  319. CommonMetadata common = 1;
  320. // An estimate of the number of entities processed.
  321. Progress progress_entities = 2;
  322. // An estimate of the number of bytes processed.
  323. Progress progress_bytes = 3;
  324. // Description of which entities are being imported.
  325. EntityFilter entity_filter = 4;
  326. // The location of the import metadata file. This will be the same value as
  327. // the [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url] field.
  328. string input_url = 5;
  329. }
  330. // Identifies a subset of entities in a project. This is specified as
  331. // combinations of kinds and namespaces (either or both of which may be all, as
  332. // described in the following examples).
  333. // Example usage:
  334. //
  335. // Entire project:
  336. // kinds=[], namespace_ids=[]
  337. //
  338. // Kinds Foo and Bar in all namespaces:
  339. // kinds=['Foo', 'Bar'], namespace_ids=[]
  340. //
  341. // Kinds Foo and Bar only in the default namespace:
  342. // kinds=['Foo', 'Bar'], namespace_ids=['']
  343. //
  344. // Kinds Foo and Bar in both the default and Baz namespaces:
  345. // kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
  346. //
  347. // The entire Baz namespace:
  348. // kinds=[], namespace_ids=['Baz']
  349. message EntityFilter {
  350. // If empty, then this represents all kinds.
  351. repeated string kinds = 1;
  352. // An empty list represents all namespaces. This is the preferred
  353. // usage for projects that don't use namespaces.
  354. //
  355. // An empty string element represents the default namespace. This should be
  356. // used if the project has data in non-default namespaces, but doesn't want to
  357. // include them.
  358. // Each namespace in this list must be unique.
  359. repeated string namespace_ids = 2;
  360. }
  361. // The request for
  362. // [google.datastore.admin.v1.DatastoreAdmin.CreateIndex][google.datastore.admin.v1.DatastoreAdmin.CreateIndex].
  363. message CreateIndexRequest {
  364. // Project ID against which to make the request.
  365. string project_id = 1;
  366. // The index to create. The name and state fields are output only and will be
  367. // ignored. Single property indexes cannot be created or deleted.
  368. Index index = 3;
  369. }
  370. // The request for
  371. // [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex].
  372. message DeleteIndexRequest {
  373. // Project ID against which to make the request.
  374. string project_id = 1;
  375. // The resource ID of the index to delete.
  376. string index_id = 3;
  377. }
  378. // The request for [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex].
  379. message GetIndexRequest {
  380. // Project ID against which to make the request.
  381. string project_id = 1;
  382. // The resource ID of the index to get.
  383. string index_id = 3;
  384. }
  385. // The request for
  386. // [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
  387. message ListIndexesRequest {
  388. // Project ID against which to make the request.
  389. string project_id = 1;
  390. string filter = 3;
  391. // The maximum number of items to return. If zero, then all results will be
  392. // returned.
  393. int32 page_size = 4;
  394. // The next_page_token value returned from a previous List request, if any.
  395. string page_token = 5;
  396. }
  397. // The response for
  398. // [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes].
  399. message ListIndexesResponse {
  400. // The indexes.
  401. repeated Index indexes = 1;
  402. // The standard List next-page token.
  403. string next_page_token = 2;
  404. }
  405. // Metadata for Index operations.
  406. message IndexOperationMetadata {
  407. // Metadata common to all Datastore Admin operations.
  408. CommonMetadata common = 1;
  409. // An estimate of the number of entities processed.
  410. Progress progress_entities = 2;
  411. // The index resource ID that this operation is acting on.
  412. string index_id = 3;
  413. }
  414. // Metadata for Datastore to Firestore migration operations.
  415. //
  416. // The DatastoreFirestoreMigration operation is not started by the end-user via
  417. // an explicit "creation" method. This is an intentional deviation from the LRO
  418. // design pattern.
  419. //
  420. // This singleton resource can be accessed at:
  421. // "projects/{project_id}/operations/datastore-firestore-migration"
  422. message DatastoreFirestoreMigrationMetadata {
  423. // The current state of migration from Cloud Datastore to Cloud Firestore in
  424. // Datastore mode.
  425. MigrationState migration_state = 1;
  426. // The current step of migration from Cloud Datastore to Cloud Firestore in
  427. // Datastore mode.
  428. MigrationStep migration_step = 2;
  429. }
  430. // Operation types.
  431. enum OperationType {
  432. // Unspecified.
  433. OPERATION_TYPE_UNSPECIFIED = 0;
  434. // ExportEntities.
  435. EXPORT_ENTITIES = 1;
  436. // ImportEntities.
  437. IMPORT_ENTITIES = 2;
  438. // CreateIndex.
  439. CREATE_INDEX = 3;
  440. // DeleteIndex.
  441. DELETE_INDEX = 4;
  442. }