Skip to content

Commit 3c18e62

Browse files
yoshi-code-botcopybara-github
authored andcommitted
Added Firebase Data Connect event schema.
PiperOrigin-RevId: 770825868
1 parent 002e821 commit 3c18e62

File tree

2 files changed

+402
-0
lines changed

2 files changed

+402
-0
lines changed
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
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+
// https://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+
17+
package google.events.firebase.dataconnect.v1;
18+
19+
import "google/protobuf/timestamp.proto";
20+
21+
option csharp_namespace = "Google.Events.Protobuf.Firebase.DataConnect.V1";
22+
option php_namespace = "Google\\Events\\Firebase\\DataConnect\\V1";
23+
option ruby_package = "Google::Events::Firebase::DataConnect::V1";
24+
25+
// A Firebase Data Connect service.
26+
message Service {
27+
// Identifier. The relative resource name of the Firebase Data Connect
28+
// service, in the format:
29+
// ```
30+
// projects/{project}/locations/{location}/services/{service}
31+
// ```
32+
// Note that the service ID is specific to Firebase Data Connect and does not
33+
// correspond to any of the instance IDs of the underlying data source
34+
// connections.
35+
string name = 1;
36+
37+
// Output only. [Output only] Create time stamp.
38+
google.protobuf.Timestamp create_time = 2;
39+
40+
// Output only. [Output only] Update time stamp.
41+
google.protobuf.Timestamp update_time = 3;
42+
43+
// Optional. Labels as key value pairs.
44+
map<string, string> labels = 4;
45+
46+
// Optional. Stores small amounts of arbitrary data.
47+
map<string, string> annotations = 5;
48+
49+
// Output only. System-assigned, unique identifier.
50+
string uid = 6;
51+
52+
// Output only. A field that if true, indicates that the system is working
53+
// update the service.
54+
bool reconciling = 7;
55+
56+
// Optional. Mutable human-readable name. 63 character limit.
57+
string display_name = 8;
58+
59+
// Output only. This checksum is computed by the server based on the value of
60+
// other fields, and may be sent on update and delete requests to ensure the
61+
// client has an up-to-date value before proceeding.
62+
// [AIP-154](https://google.aip.dev/154)
63+
string etag = 99;
64+
}
65+
66+
// A data source that backs Firebase Data Connect services.
67+
message Datasource {
68+
// Settings and configurations of the underlying data source.
69+
oneof configuration {
70+
// PostgreSQL configurations.
71+
PostgreSql postgresql = 2;
72+
}
73+
}
74+
75+
// Settings for PostgreSQL data source.
76+
message PostgreSql {
77+
// Configure the behavior before deploying this schema.
78+
// Default to `schema_validation=STRICT` if not specified.
79+
oneof before_deploy {
80+
// Optional. Configure how much Postgresql schema validation to perform.
81+
SqlSchemaValidation schema_validation = 3;
82+
83+
// Optional. Configure how to perform Postgresql schema migration.
84+
SqlSchemaMigration schema_migration = 5;
85+
}
86+
87+
// Settings and configurations of the underlying database.
88+
oneof configuration {
89+
// No Postgres data source is linked.
90+
// If set, don't allow `database` and `schema_validation` to be configured.
91+
bool unlinked = 4;
92+
93+
// Cloud SQL configurations.
94+
CloudSqlInstance cloud_sql = 2;
95+
}
96+
97+
// Required. Name of the PostgreSQL database.
98+
string database = 1;
99+
}
100+
101+
// Settings for CloudSQL instance configuration.
102+
message CloudSqlInstance {
103+
// Required. Name of the CloudSQL instance, in the format:
104+
// ```
105+
// projects/{project}/locations/{location}/instances/{instance}
106+
// ```
107+
string instance = 1;
108+
}
109+
110+
// The application schema of a Firebase Data Connect service.
111+
message Schema {
112+
// Identifier. The relative resource name of the schema, in the format:
113+
// ```
114+
// projects/{project}/locations/{location}/services/{service}/schemas/{schema}
115+
// ```
116+
// Right now, the only supported schema is "main".
117+
string name = 1;
118+
119+
// Output only. [Output only] Create time stamp.
120+
google.protobuf.Timestamp create_time = 2;
121+
122+
// Output only. [Output only] Update time stamp.
123+
google.protobuf.Timestamp update_time = 3;
124+
125+
// Optional. Labels as key value pairs.
126+
map<string, string> labels = 4;
127+
128+
// Optional. Stores small amounts of arbitrary data.
129+
map<string, string> annotations = 5;
130+
131+
// Required. The data sources linked in the schema.
132+
repeated Datasource datasources = 11;
133+
134+
// Required. The source files that comprise the application schema.
135+
Source source = 7;
136+
137+
// Output only. System-assigned, unique identifier.
138+
string uid = 8;
139+
140+
// Output only. A field that if true, indicates that the system is working to
141+
// compile and deploy the schema.
142+
bool reconciling = 9;
143+
144+
// Optional. Mutable human-readable name. 63 character limit.
145+
string display_name = 10;
146+
147+
// Output only. This checksum is computed by the server based on the value of
148+
// other fields, and may be sent on update and delete requests to ensure the
149+
// client has an up-to-date value before proceeding.
150+
// [AIP-154](https://google.aip.dev/154)
151+
string etag = 99;
152+
}
153+
154+
// Connector consists of a set of operations, i.e. queries and mutations.
155+
message Connector {
156+
// Identifier. The relative resource name of the connector, in the format:
157+
// ```
158+
// projects/{project}/locations/{location}/services/{service}/connectors/{connector}
159+
// ```
160+
string name = 1;
161+
162+
// Output only. [Output only] Create time stamp.
163+
google.protobuf.Timestamp create_time = 2;
164+
165+
// Output only. [Output only] Update time stamp.
166+
google.protobuf.Timestamp update_time = 3;
167+
168+
// Optional. Labels as key value pairs.
169+
map<string, string> labels = 4;
170+
171+
// Optional. Stores small amounts of arbitrary data.
172+
map<string, string> annotations = 5;
173+
174+
// Required. The source files that comprise the connector.
175+
Source source = 6;
176+
177+
// Output only. System-assigned, unique identifier.
178+
string uid = 7;
179+
180+
// Output only. A field that if true, indicates that the system is working to
181+
// compile and deploy the connector.
182+
bool reconciling = 8;
183+
184+
// Optional. Mutable human-readable name. 63 character limit.
185+
string display_name = 9;
186+
187+
// Output only. This checksum is computed by the server based on the value of
188+
// other fields, and may be sent on update and delete requests to ensure the
189+
// client has an up-to-date value before proceeding.
190+
// [AIP-154](https://google.aip.dev/154)
191+
string etag = 99;
192+
}
193+
194+
// Used to represent a set of source files.
195+
message Source {
196+
// Required. The files that comprise the source set.
197+
repeated File files = 1;
198+
}
199+
200+
// Individual files.
201+
message File {
202+
// Required. The file name including folder path, if applicable. The path
203+
// should be relative to a local workspace (e.g.
204+
// dataconnect/(schema|connector)/*.gql) and not an absolute path (e.g.
205+
// /absolute/path/(schema|connector)/*.gql).
206+
string path = 1;
207+
208+
// Required. The file's textual content.
209+
string content = 2;
210+
}
211+
212+
// Configure how much SQL Schema to perform for the given schema.
213+
enum SqlSchemaValidation {
214+
// Unspecified SQL schema validation.
215+
// Default to STRICT.
216+
SQL_SCHEMA_VALIDATION_UNSPECIFIED = 0;
217+
218+
// Skip no SQL schema validation. Use it with extreme caution.
219+
// CreateSchema or UpdateSchema will succeed even if SQL database is
220+
// unavailable or SQL schema is incompatible.
221+
// Generated SQL may fail at execution time.
222+
NONE = 1;
223+
224+
// Connect to the SQL database and validate that the SQL DDL matches the
225+
// schema exactly. Surface any discrepancies as `FAILED_PRECONDITION` with an
226+
// `IncompatibleSqlSchemaError` error detail.
227+
STRICT = 2;
228+
229+
// Connect to the SQL database and validate that the SQL DDL has all the SQL
230+
// resources used in the given Firebase Data Connect Schema. Surface any
231+
// missing resources as `FAILED_PRECONDITION` with an
232+
// `IncompatibleSqlSchemaError` error detail. Succeed even if there are
233+
// unknown tables and columns.
234+
COMPATIBLE = 3;
235+
}
236+
237+
// Configure how to perform SQL Schema migration before deploying the Schema.
238+
enum SqlSchemaMigration {
239+
// Unspecified SQL schema migration.
240+
SQL_SCHEMA_MIGRATION_UNSPECIFIED = 0;
241+
242+
// Connect to the SQL database and identify any missing SQL resources used
243+
// in the given Firebase Data Connect Schema.
244+
// Automatically create necessary SQL resources (SQL table, column, etc)
245+
// before deploying the schema.
246+
// During migration steps, the SQL Schema must comply with the previous
247+
// before_deploy setting in case the migration is interrupted.
248+
// Therefore, the previous before_deploy setting must not be
249+
// `schema_validation=STRICT`.
250+
MIGRATE_COMPATIBLE = 1;
251+
}
252+
253+
// The data within all Service events.
254+
message ServiceEventData {
255+
// Optional. The Service event payload. Unset for deletion events.
256+
Service payload = 1;
257+
}
258+
259+
// The data within all Schema events.
260+
message SchemaEventData {
261+
// Optional. The Schema event payload. Unset for deletion events.
262+
Schema payload = 1;
263+
}
264+
265+
// The data within all Connector events.
266+
message ConnectorEventData {
267+
// Optional. The Connector event payload. Unset for deletion events.
268+
Connector payload = 1;
269+
}

0 commit comments

Comments
 (0)