xref: /aosp_15_r20/external/googleapis/google/firestore/admin/v1/operation.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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
15syntax = "proto3";
16
17package google.firestore.admin.v1;
18
19import "google/api/resource.proto";
20import "google/firestore/admin/v1/index.proto";
21import "google/protobuf/timestamp.proto";
22
23option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
24option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
25option java_multiple_files = true;
26option java_outer_classname = "OperationProto";
27option java_package = "com.google.firestore.admin.v1";
28option objc_class_prefix = "GCFS";
29option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
30option ruby_package = "Google::Cloud::Firestore::Admin::V1";
31
32// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
33// results from
34// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
35message IndexOperationMetadata {
36  // The time this operation started.
37  google.protobuf.Timestamp start_time = 1;
38
39  // The time this operation completed. Will be unset if operation still in
40  // progress.
41  google.protobuf.Timestamp end_time = 2;
42
43  // The index resource that this operation is acting on. For example:
44  // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
45  string index = 3;
46
47  // The state of the operation.
48  OperationState state = 4;
49
50  // The progress, in documents, of this operation.
51  Progress progress_documents = 5;
52
53  // The progress, in bytes, of this operation.
54  Progress progress_bytes = 6;
55}
56
57// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
58// results from
59// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
60message FieldOperationMetadata {
61  // Information about an index configuration change.
62  message IndexConfigDelta {
63    // Specifies how the index is changing.
64    enum ChangeType {
65      // The type of change is not specified or known.
66      CHANGE_TYPE_UNSPECIFIED = 0;
67
68      // The single field index is being added.
69      ADD = 1;
70
71      // The single field index is being removed.
72      REMOVE = 2;
73    }
74
75    // Specifies how the index is changing.
76    ChangeType change_type = 1;
77
78    // The index being changed.
79    Index index = 2;
80  }
81
82  // Information about a TTL configuration change.
83  message TtlConfigDelta {
84    // Specifies how the TTL config is changing.
85    enum ChangeType {
86      // The type of change is not specified or known.
87      CHANGE_TYPE_UNSPECIFIED = 0;
88
89      // The TTL config is being added.
90      ADD = 1;
91
92      // The TTL config is being removed.
93      REMOVE = 2;
94    }
95
96    // Specifies how the TTL configuration is changing.
97    ChangeType change_type = 1;
98  }
99
100  // The time this operation started.
101  google.protobuf.Timestamp start_time = 1;
102
103  // The time this operation completed. Will be unset if operation still in
104  // progress.
105  google.protobuf.Timestamp end_time = 2;
106
107  // The field resource that this operation is acting on. For example:
108  // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}`
109  string field = 3;
110
111  // A list of
112  // [IndexConfigDelta][google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta],
113  // which describe the intent of this operation.
114  repeated IndexConfigDelta index_config_deltas = 4;
115
116  // The state of the operation.
117  OperationState state = 5;
118
119  // The progress, in documents, of this operation.
120  Progress progress_documents = 6;
121
122  // The progress, in bytes, of this operation.
123  Progress progress_bytes = 7;
124
125  // Describes the deltas of TTL configuration.
126  TtlConfigDelta ttl_config_delta = 8;
127}
128
129// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
130// results from
131// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments].
132message ExportDocumentsMetadata {
133  // The time this operation started.
134  google.protobuf.Timestamp start_time = 1;
135
136  // The time this operation completed. Will be unset if operation still in
137  // progress.
138  google.protobuf.Timestamp end_time = 2;
139
140  // The state of the export operation.
141  OperationState operation_state = 3;
142
143  // The progress, in documents, of this operation.
144  Progress progress_documents = 4;
145
146  // The progress, in bytes, of this operation.
147  Progress progress_bytes = 5;
148
149  // Which collection ids are being exported.
150  repeated string collection_ids = 6;
151
152  // Where the documents are being exported to.
153  string output_uri_prefix = 7;
154
155  // Which namespace ids are being exported.
156  repeated string namespace_ids = 8;
157
158  // The timestamp that corresponds to the version of the database that is being
159  // exported. If unspecified, there are no guarantees about the consistency of
160  // the documents being exported.
161  google.protobuf.Timestamp snapshot_time = 9;
162}
163
164// Metadata for [google.longrunning.Operation][google.longrunning.Operation]
165// results from
166// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments].
167message ImportDocumentsMetadata {
168  // The time this operation started.
169  google.protobuf.Timestamp start_time = 1;
170
171  // The time this operation completed. Will be unset if operation still in
172  // progress.
173  google.protobuf.Timestamp end_time = 2;
174
175  // The state of the import operation.
176  OperationState operation_state = 3;
177
178  // The progress, in documents, of this operation.
179  Progress progress_documents = 4;
180
181  // The progress, in bytes, of this operation.
182  Progress progress_bytes = 5;
183
184  // Which collection ids are being imported.
185  repeated string collection_ids = 6;
186
187  // The location of the documents being imported.
188  string input_uri_prefix = 7;
189
190  // Which namespace ids are being imported.
191  repeated string namespace_ids = 8;
192}
193
194// Returned in the [google.longrunning.Operation][google.longrunning.Operation]
195// response field.
196message ExportDocumentsResponse {
197  // Location of the output files. This can be used to begin an import
198  // into Cloud Firestore (this project or another project) after the operation
199  // completes successfully.
200  string output_uri_prefix = 1;
201}
202
203// Metadata for the [long-running operation][google.longrunning.Operation] from
204// the [RestoreDatabase][google.firestore.admin.v1.RestoreDatabase] request.
205message RestoreDatabaseMetadata {
206  // The time the restore was started.
207  google.protobuf.Timestamp start_time = 1;
208
209  // The time the restore finished, unset for ongoing restores.
210  google.protobuf.Timestamp end_time = 2;
211
212  // The operation state of the restore.
213  OperationState operation_state = 3;
214
215  // The name of the database being restored to.
216  string database = 4 [(google.api.resource_reference) = {
217    type: "firestore.googleapis.com/Database"
218  }];
219
220  // The name of the backup restoring from.
221  string backup = 5 [(google.api.resource_reference) = {
222    type: "firestore.googleapis.com/Backup"
223  }];
224
225  // How far along the restore is as an estimated percentage of remaining time.
226  Progress progress_percentage = 8;
227}
228
229// Describes the progress of the operation.
230// Unit of work is generic and must be interpreted based on where
231// [Progress][google.firestore.admin.v1.Progress] is used.
232message Progress {
233  // The amount of work estimated.
234  int64 estimated_work = 1;
235
236  // The amount of work completed.
237  int64 completed_work = 2;
238}
239
240// Describes the state of the operation.
241enum OperationState {
242  // Unspecified.
243  OPERATION_STATE_UNSPECIFIED = 0;
244
245  // Request is being prepared for processing.
246  INITIALIZING = 1;
247
248  // Request is actively being processed.
249  PROCESSING = 2;
250
251  // Request is in the process of being cancelled after user called
252  // google.longrunning.Operations.CancelOperation on the operation.
253  CANCELLING = 3;
254
255  // Request has been processed and is in its finalization stage.
256  FINALIZING = 4;
257
258  // Request has completed successfully.
259  SUCCESSFUL = 5;
260
261  // Request has finished being processed, but encountered an error.
262  FAILED = 6;
263
264  // Request has finished being cancelled after user called
265  // google.longrunning.Operations.CancelOperation.
266  CANCELLED = 7;
267}
268