datastore_admin.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. // Copyright 2018 Google Inc.
  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.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/longrunning/operations.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option csharp_namespace = "Google.Cloud.Datastore.Admin.V1Beta1";
  20. option go_package = "google.golang.org/genproto/googleapis/datastore/admin/v1beta1;admin";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "DatastoreAdminProto";
  23. option java_package = "com.google.datastore.admin.v1beta1";
  24. option ruby_package = "Google::Cloud::Datastore::Admin::V1beta1";
  25. // Google Cloud Datastore Admin API
  26. //
  27. // The Datastore Admin API provides several admin services for Cloud Datastore.
  28. //
  29. // -----------------------------------------------------------------------------
  30. // ## Concepts
  31. //
  32. // Project, namespace, kind, and entity as defined in the Google Cloud Datastore
  33. // API.
  34. //
  35. // Operation: An Operation represents work being performed in the background.
  36. //
  37. // EntityFilter: Allows specifying a subset of entities in a project. This is
  38. // specified as a combination of kinds and namespaces (either or both of which
  39. // may be all).
  40. //
  41. // -----------------------------------------------------------------------------
  42. // ## Services
  43. //
  44. // # Export/Import
  45. //
  46. // The Export/Import service provides the ability to copy all or a subset of
  47. // entities to/from Google Cloud Storage.
  48. //
  49. // Exported data may be imported into Cloud Datastore for any Google Cloud
  50. // Platform project. It is not restricted to the export source project. It is
  51. // possible to export from one project and then import into another.
  52. //
  53. // Exported data can also be loaded into Google BigQuery for analysis.
  54. //
  55. // Exports and imports are performed asynchronously. An Operation resource is
  56. // created for each export/import. The state (including any errors encountered)
  57. // of the export/import may be queried via the Operation resource.
  58. //
  59. // # Operation
  60. //
  61. // The Operations collection provides a record of actions performed for the
  62. // specified project (including any operations in progress). Operations are not
  63. // created directly but through calls on other collections or resources.
  64. //
  65. // An operation that is not yet done may be cancelled. The request to cancel is
  66. // asynchronous and the operation may continue to run for some time after the
  67. // request to cancel is made.
  68. //
  69. // An operation that is done may be deleted so that it is no longer listed as
  70. // part of the Operation collection.
  71. //
  72. // ListOperations returns all pending operations, but not completed operations.
  73. //
  74. // Operations are created by service DatastoreAdmin,
  75. // but are accessed via service google.longrunning.Operations.
  76. service DatastoreAdmin {
  77. // Exports a copy of all or a subset of entities from Google Cloud Datastore
  78. // to another storage system, such as Google Cloud Storage. Recent updates to
  79. // entities may not be reflected in the export. The export occurs in the
  80. // background and its progress can be monitored and managed via the
  81. // Operation resource that is created. The output of an export may only be
  82. // used once the associated operation is done. If an export operation is
  83. // cancelled before completion it may leave partial data behind in Google
  84. // Cloud Storage.
  85. rpc ExportEntities(ExportEntitiesRequest)
  86. returns (google.longrunning.Operation) {
  87. option (google.api.http) = {
  88. post: "/v1beta1/projects/{project_id}:export"
  89. body: "*"
  90. };
  91. }
  92. // Imports entities into Google Cloud Datastore. Existing entities with the
  93. // same key are overwritten. The import occurs in the background and its
  94. // progress can be monitored and managed via the Operation resource that is
  95. // created. If an ImportEntities operation is cancelled, it is possible
  96. // that a subset of the data has already been imported to Cloud Datastore.
  97. rpc ImportEntities(ImportEntitiesRequest)
  98. returns (google.longrunning.Operation) {
  99. option (google.api.http) = {
  100. post: "/v1beta1/projects/{project_id}:import"
  101. body: "*"
  102. };
  103. }
  104. }
  105. // Metadata common to all Datastore Admin operations.
  106. message CommonMetadata {
  107. // The various possible states for an ongoing Operation.
  108. enum State {
  109. // Unspecified.
  110. STATE_UNSPECIFIED = 0;
  111. // Request is being prepared for processing.
  112. INITIALIZING = 1;
  113. // Request is actively being processed.
  114. PROCESSING = 2;
  115. // Request is in the process of being cancelled after user called
  116. // google.longrunning.Operations.CancelOperation on the operation.
  117. CANCELLING = 3;
  118. // Request has been processed and is in its finalization stage.
  119. FINALIZING = 4;
  120. // Request has completed successfully.
  121. SUCCESSFUL = 5;
  122. // Request has finished being processed, but encountered an error.
  123. FAILED = 6;
  124. // Request has finished being cancelled after user called
  125. // google.longrunning.Operations.CancelOperation.
  126. CANCELLED = 7;
  127. }
  128. // The time that work began on the operation.
  129. google.protobuf.Timestamp start_time = 1;
  130. // The time the operation ended, either successfully or otherwise.
  131. google.protobuf.Timestamp end_time = 2;
  132. // The type of the operation. Can be used as a filter in
  133. // ListOperationsRequest.
  134. OperationType operation_type = 3;
  135. // The client-assigned labels which were provided when the operation was
  136. // created. May also include additional labels.
  137. map<string, string> labels = 4;
  138. // The current state of the Operation.
  139. State state = 5;
  140. }
  141. // Measures the progress of a particular metric.
  142. message Progress {
  143. // The amount of work that has been completed. Note that this may be greater
  144. // than work_estimated.
  145. int64 work_completed = 1;
  146. // An estimate of how much work needs to be performed. May be zero if the
  147. // work estimate is unavailable.
  148. int64 work_estimated = 2;
  149. }
  150. // The request for
  151. // [google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities].
  152. message ExportEntitiesRequest {
  153. // Project ID against which to make the request.
  154. string project_id = 1;
  155. // Client-assigned labels.
  156. map<string, string> labels = 2;
  157. // Description of what data from the project is included in the export.
  158. EntityFilter entity_filter = 3;
  159. // Location for the export metadata and data files.
  160. //
  161. // The full resource URL of the external storage location. Currently, only
  162. // Google Cloud Storage is supported. So output_url_prefix should be of the
  163. // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the
  164. // name of the Cloud Storage bucket and `NAMESPACE_PATH` is an optional Cloud
  165. // Storage namespace path (this is not a Cloud Datastore namespace). For more
  166. // information about Cloud Storage namespace paths, see
  167. // [Object name
  168. // considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
  169. //
  170. // The resulting files will be nested deeper than the specified URL prefix.
  171. // The final output URL will be provided in the
  172. // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url]
  173. // field. That value should be used for subsequent ImportEntities operations.
  174. //
  175. // By nesting the data files deeper, the same Cloud Storage bucket can be used
  176. // in multiple ExportEntities operations without conflict.
  177. string output_url_prefix = 4;
  178. }
  179. // The request for
  180. // [google.datastore.admin.v1beta1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1beta1.DatastoreAdmin.ImportEntities].
  181. message ImportEntitiesRequest {
  182. // Project ID against which to make the request.
  183. string project_id = 1;
  184. // Client-assigned labels.
  185. map<string, string> labels = 2;
  186. // The full resource URL of the external storage location. Currently, only
  187. // Google Cloud Storage is supported. So input_url should be of the form:
  188. // `gs://BUCKET_NAME[/NAMESPACE_PATH]/OVERALL_EXPORT_METADATA_FILE`, where
  189. // `BUCKET_NAME` is the name of the Cloud Storage bucket, `NAMESPACE_PATH` is
  190. // an optional Cloud Storage namespace path (this is not a Cloud Datastore
  191. // namespace), and `OVERALL_EXPORT_METADATA_FILE` is the metadata file written
  192. // by the ExportEntities operation. For more information about Cloud Storage
  193. // namespace paths, see
  194. // [Object name
  195. // considerations](https://cloud.google.com/storage/docs/naming#object-considerations).
  196. //
  197. // For more information, see
  198. // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url].
  199. string input_url = 3;
  200. // Optionally specify which kinds/namespaces are to be imported. If provided,
  201. // the list must be a subset of the EntityFilter used in creating the export,
  202. // otherwise a FAILED_PRECONDITION error will be returned. If no filter is
  203. // specified then all entities from the export are imported.
  204. EntityFilter entity_filter = 4;
  205. }
  206. // The response for
  207. // [google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1beta1.DatastoreAdmin.ExportEntities].
  208. message ExportEntitiesResponse {
  209. // Location of the output metadata file. This can be used to begin an import
  210. // into Cloud Datastore (this project or another project). See
  211. // [google.datastore.admin.v1beta1.ImportEntitiesRequest.input_url][google.datastore.admin.v1beta1.ImportEntitiesRequest.input_url].
  212. // Only present if the operation completed successfully.
  213. string output_url = 1;
  214. }
  215. // Metadata for ExportEntities operations.
  216. message ExportEntitiesMetadata {
  217. // Metadata common to all Datastore Admin operations.
  218. CommonMetadata common = 1;
  219. // An estimate of the number of entities processed.
  220. Progress progress_entities = 2;
  221. // An estimate of the number of bytes processed.
  222. Progress progress_bytes = 3;
  223. // Description of which entities are being exported.
  224. EntityFilter entity_filter = 4;
  225. // Location for the export metadata and data files. This will be the same
  226. // value as the
  227. // [google.datastore.admin.v1beta1.ExportEntitiesRequest.output_url_prefix][google.datastore.admin.v1beta1.ExportEntitiesRequest.output_url_prefix]
  228. // field. The final output location is provided in
  229. // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url].
  230. string output_url_prefix = 5;
  231. }
  232. // Metadata for ImportEntities operations.
  233. message ImportEntitiesMetadata {
  234. // Metadata common to all Datastore Admin operations.
  235. CommonMetadata common = 1;
  236. // An estimate of the number of entities processed.
  237. Progress progress_entities = 2;
  238. // An estimate of the number of bytes processed.
  239. Progress progress_bytes = 3;
  240. // Description of which entities are being imported.
  241. EntityFilter entity_filter = 4;
  242. // The location of the import metadata file. This will be the same value as
  243. // the
  244. // [google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url][google.datastore.admin.v1beta1.ExportEntitiesResponse.output_url]
  245. // field.
  246. string input_url = 5;
  247. }
  248. // Identifies a subset of entities in a project. This is specified as
  249. // combinations of kinds and namespaces (either or both of which may be all, as
  250. // described in the following examples).
  251. // Example usage:
  252. //
  253. // Entire project:
  254. // kinds=[], namespace_ids=[]
  255. //
  256. // Kinds Foo and Bar in all namespaces:
  257. // kinds=['Foo', 'Bar'], namespace_ids=[]
  258. //
  259. // Kinds Foo and Bar only in the default namespace:
  260. // kinds=['Foo', 'Bar'], namespace_ids=['']
  261. //
  262. // Kinds Foo and Bar in both the default and Baz namespaces:
  263. // kinds=['Foo', 'Bar'], namespace_ids=['', 'Baz']
  264. //
  265. // The entire Baz namespace:
  266. // kinds=[], namespace_ids=['Baz']
  267. message EntityFilter {
  268. // If empty, then this represents all kinds.
  269. repeated string kinds = 1;
  270. // An empty list represents all namespaces. This is the preferred
  271. // usage for projects that don't use namespaces.
  272. //
  273. // An empty string element represents the default namespace. This should be
  274. // used if the project has data in non-default namespaces, but doesn't want to
  275. // include them.
  276. // Each namespace in this list must be unique.
  277. repeated string namespace_ids = 2;
  278. }
  279. // Operation types.
  280. enum OperationType {
  281. // Unspecified.
  282. OPERATION_TYPE_UNSPECIFIED = 0;
  283. // ExportEntities.
  284. EXPORT_ENTITIES = 1;
  285. // ImportEntities.
  286. IMPORT_ENTITIES = 2;
  287. }