xref: /aosp_15_r20/external/googleapis/google/firestore/admin/v1/database.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/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/protobuf/duration.proto";
22import "google/protobuf/timestamp.proto";
23
24option csharp_namespace = "Google.Cloud.Firestore.Admin.V1";
25option go_package = "cloud.google.com/go/firestore/apiv1/admin/adminpb;adminpb";
26option java_multiple_files = true;
27option java_outer_classname = "DatabaseProto";
28option java_package = "com.google.firestore.admin.v1";
29option objc_class_prefix = "GCFS";
30option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
31option ruby_package = "Google::Cloud::Firestore::Admin::V1";
32
33// A Cloud Firestore Database.
34message Database {
35  option (google.api.resource) = {
36    type: "firestore.googleapis.com/Database"
37    pattern: "projects/{project}/databases/{database}"
38    style: DECLARATIVE_FRIENDLY
39  };
40
41  // The type of the database.
42  // See https://cloud.google.com/datastore/docs/firestore-or-datastore for
43  // information about how to choose.
44  //
45  // Mode changes are only allowed if the database is empty.
46  enum DatabaseType {
47    // The default value. This value is used if the database type is omitted.
48    DATABASE_TYPE_UNSPECIFIED = 0;
49
50    // Firestore Native Mode
51    FIRESTORE_NATIVE = 1;
52
53    // Firestore in Datastore Mode.
54    DATASTORE_MODE = 2;
55  }
56
57  // The type of concurrency control mode for transactions.
58  enum ConcurrencyMode {
59    // Not used.
60    CONCURRENCY_MODE_UNSPECIFIED = 0;
61
62    // Use optimistic concurrency control by default. This mode is available
63    // for Cloud Firestore databases.
64    OPTIMISTIC = 1;
65
66    // Use pessimistic concurrency control by default. This mode is available
67    // for Cloud Firestore databases.
68    //
69    // This is the default setting for Cloud Firestore.
70    PESSIMISTIC = 2;
71
72    // Use optimistic concurrency control with entity groups by default.
73    //
74    // This is the only available mode for Cloud Datastore.
75    //
76    // This mode is also available for Cloud Firestore with Datastore Mode but
77    // is not recommended.
78    OPTIMISTIC_WITH_ENTITY_GROUPS = 3;
79  }
80
81  // Point In Time Recovery feature enablement.
82  enum PointInTimeRecoveryEnablement {
83    // Not used.
84    POINT_IN_TIME_RECOVERY_ENABLEMENT_UNSPECIFIED = 0;
85
86    // Reads are supported on selected versions of the data from within the past
87    // 7 days:
88    //
89    // * Reads against any timestamp within the past hour
90    // * Reads against 1-minute snapshots beyond 1 hour and within 7 days
91    //
92    // `version_retention_period` and `earliest_version_time` can be
93    // used to determine the supported versions.
94    POINT_IN_TIME_RECOVERY_ENABLED = 1;
95
96    // Reads are supported on any version of the data from within the past 1
97    // hour.
98    POINT_IN_TIME_RECOVERY_DISABLED = 2;
99  }
100
101  // The type of App Engine integration mode.
102  enum AppEngineIntegrationMode {
103    // Not used.
104    APP_ENGINE_INTEGRATION_MODE_UNSPECIFIED = 0;
105
106    // If an App Engine application exists in the same region as this database,
107    // App Engine configuration will impact this database. This includes
108    // disabling of the application & database, as well as disabling writes to
109    // the database.
110    ENABLED = 1;
111
112    // App Engine has no effect on the ability of this database to serve
113    // requests.
114    //
115    // This is the default setting for databases created with the Firestore API.
116    DISABLED = 2;
117  }
118
119  // The delete protection state of the database.
120  enum DeleteProtectionState {
121    // The default value. Delete protection type is not specified
122    DELETE_PROTECTION_STATE_UNSPECIFIED = 0;
123
124    // Delete protection is disabled
125    DELETE_PROTECTION_DISABLED = 1;
126
127    // Delete protection is enabled
128    DELETE_PROTECTION_ENABLED = 2;
129  }
130
131  // The resource name of the Database.
132  // Format: `projects/{project}/databases/{database}`
133  string name = 1;
134
135  // Output only. The system-generated UUID4 for this Database.
136  string uid = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
137
138  // Output only. The timestamp at which this database was created. Databases
139  // created before 2016 do not populate create_time.
140  google.protobuf.Timestamp create_time = 5
141      [(google.api.field_behavior) = OUTPUT_ONLY];
142
143  // Output only. The timestamp at which this database was most recently
144  // updated. Note this only includes updates to the database resource and not
145  // data contained by the database.
146  google.protobuf.Timestamp update_time = 6
147      [(google.api.field_behavior) = OUTPUT_ONLY];
148
149  // The location of the database. Available locations are listed at
150  // https://cloud.google.com/firestore/docs/locations.
151  string location_id = 9;
152
153  // The type of the database.
154  // See https://cloud.google.com/datastore/docs/firestore-or-datastore for
155  // information about how to choose.
156  DatabaseType type = 10;
157
158  // The concurrency control mode to use for this database.
159  ConcurrencyMode concurrency_mode = 15;
160
161  // Output only. The period during which past versions of data are retained in
162  // the database.
163  //
164  // Any [read][google.firestore.v1.GetDocumentRequest.read_time]
165  // or [query][google.firestore.v1.ListDocumentsRequest.read_time] can specify
166  // a `read_time` within this window, and will read the state of the database
167  // at that time.
168  //
169  // If the PITR feature is enabled, the retention period is 7 days. Otherwise,
170  // the retention period is 1 hour.
171  google.protobuf.Duration version_retention_period = 17
172      [(google.api.field_behavior) = OUTPUT_ONLY];
173
174  // Output only. The earliest timestamp at which older versions of the data can
175  // be read from the database. See [version_retention_period] above; this field
176  // is populated with `now - version_retention_period`.
177  //
178  // This value is continuously updated, and becomes stale the moment it is
179  // queried. If you are using this value to recover data, make sure to account
180  // for the time from the moment when the value is queried to the moment when
181  // you initiate the recovery.
182  google.protobuf.Timestamp earliest_version_time = 18
183      [(google.api.field_behavior) = OUTPUT_ONLY];
184
185  // Whether to enable the PITR feature on this database.
186  PointInTimeRecoveryEnablement point_in_time_recovery_enablement = 21;
187
188  // The App Engine integration mode to use for this database.
189  AppEngineIntegrationMode app_engine_integration_mode = 19;
190
191  // Output only. The key_prefix for this database. This key_prefix is used, in
192  // combination with the project id ("<key prefix>~<project id>") to construct
193  // the application id that is returned from the Cloud Datastore APIs in Google
194  // App Engine first generation runtimes.
195  //
196  // This value may be empty in which case the appid to use for URL-encoded keys
197  // is the project_id (eg: foo instead of v~foo).
198  string key_prefix = 20 [(google.api.field_behavior) = OUTPUT_ONLY];
199
200  // State of delete protection for the database.
201  DeleteProtectionState delete_protection_state = 22;
202
203  // This checksum is computed by the server based on the value of other
204  // fields, and may be sent on update and delete requests to ensure the
205  // client has an up-to-date value before proceeding.
206  string etag = 99;
207}
208