Skip to main content

mz_catalog_protos/
objects_v86.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10#[cfg(any(test, feature = "proptest"))]
11use proptest_derive::Arbitrary;
12use serde::{Deserialize, Serialize};
13use serde_repr::{Deserialize_repr, Serialize_repr};
14
15#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
16#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
17pub struct ConfigKey {
18    pub key: String,
19}
20
21#[derive(
22    Clone,
23    Copy,
24    Debug,
25    PartialEq,
26    Eq,
27    PartialOrd,
28    Ord,
29    Serialize,
30    Deserialize
31)]
32#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
33pub struct ConfigValue {
34    pub value: u64,
35}
36
37#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
38#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
39pub struct SettingKey {
40    pub name: String,
41}
42
43#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
44#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
45pub struct SettingValue {
46    pub value: String,
47}
48
49#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
50#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
51pub struct IdAllocKey {
52    pub name: String,
53}
54
55#[derive(
56    Clone,
57    Copy,
58    Debug,
59    PartialEq,
60    Eq,
61    PartialOrd,
62    Ord,
63    Serialize,
64    Deserialize
65)]
66#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
67pub struct IdAllocValue {
68    pub next_id: u64,
69}
70
71#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
72#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
73pub struct GidMappingKey {
74    pub schema_name: String,
75    pub object_type: CatalogItemType,
76    pub object_name: String,
77}
78
79#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
80#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
81pub struct GidMappingValue {
82    pub catalog_id: SystemCatalogItemId,
83    pub global_id: SystemGlobalId,
84    pub fingerprint: String,
85}
86
87#[derive(
88    Clone,
89    Copy,
90    Debug,
91    PartialEq,
92    Eq,
93    PartialOrd,
94    Ord,
95    Serialize,
96    Deserialize
97)]
98#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
99pub struct ClusterKey {
100    pub id: ClusterId,
101}
102
103#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
104#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
105pub struct ClusterValue {
106    pub name: String,
107    pub owner_id: RoleId,
108    pub privileges: Vec<MzAclItem>,
109    pub config: ClusterConfig,
110}
111
112#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
113#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
114pub struct ClusterIntrospectionSourceIndexKey {
115    pub cluster_id: ClusterId,
116    pub name: String,
117}
118
119#[derive(
120    Clone,
121    Copy,
122    Debug,
123    PartialEq,
124    Eq,
125    PartialOrd,
126    Ord,
127    Serialize,
128    Deserialize
129)]
130#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
131pub struct ClusterIntrospectionSourceIndexValue {
132    pub catalog_id: IntrospectionSourceIndexCatalogItemId,
133    pub global_id: IntrospectionSourceIndexGlobalId,
134    pub oid: u32,
135}
136
137#[derive(
138    Clone,
139    Copy,
140    Debug,
141    PartialEq,
142    Eq,
143    PartialOrd,
144    Ord,
145    Serialize,
146    Deserialize
147)]
148#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
149pub struct ClusterReplicaKey {
150    pub id: ReplicaId,
151}
152
153#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
154#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
155pub struct ClusterReplicaValue {
156    pub cluster_id: ClusterId,
157    pub name: String,
158    pub config: ReplicaConfig,
159    pub owner_id: RoleId,
160}
161
162#[derive(
163    Clone,
164    Copy,
165    Debug,
166    PartialEq,
167    Eq,
168    PartialOrd,
169    Ord,
170    Serialize,
171    Deserialize
172)]
173#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
174pub struct DatabaseKey {
175    pub id: DatabaseId,
176}
177
178#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
179#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
180pub struct DatabaseValue {
181    pub name: String,
182    pub owner_id: RoleId,
183    pub privileges: Vec<MzAclItem>,
184    pub oid: u32,
185}
186
187#[derive(
188    Clone,
189    Copy,
190    Debug,
191    PartialEq,
192    Eq,
193    PartialOrd,
194    Ord,
195    Serialize,
196    Deserialize
197)]
198#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
199pub struct SchemaKey {
200    pub id: SchemaId,
201}
202
203#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
204#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
205pub struct SchemaValue {
206    pub database_id: Option<DatabaseId>,
207    pub name: String,
208    pub owner_id: RoleId,
209    pub privileges: Vec<MzAclItem>,
210    pub oid: u32,
211}
212
213#[derive(
214    Clone,
215    Copy,
216    Debug,
217    PartialEq,
218    Eq,
219    PartialOrd,
220    Ord,
221    Serialize,
222    Deserialize
223)]
224#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
225pub struct ItemKey {
226    pub gid: CatalogItemId,
227}
228
229#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
230#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
231pub struct ItemValue {
232    pub schema_id: SchemaId,
233    pub name: String,
234    pub definition: CatalogItem,
235    pub owner_id: RoleId,
236    pub privileges: Vec<MzAclItem>,
237    pub oid: u32,
238    pub global_id: GlobalId,
239    pub extra_versions: Vec<ItemVersion>,
240}
241
242#[derive(
243    Clone,
244    Copy,
245    Debug,
246    PartialEq,
247    Eq,
248    PartialOrd,
249    Ord,
250    Serialize,
251    Deserialize
252)]
253#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
254pub struct ItemVersion {
255    pub global_id: GlobalId,
256    pub version: Version,
257}
258
259#[derive(
260    Clone,
261    Copy,
262    Debug,
263    PartialEq,
264    Eq,
265    PartialOrd,
266    Ord,
267    Serialize,
268    Deserialize
269)]
270#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
271pub struct RoleKey {
272    pub id: RoleId,
273}
274
275#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
276#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
277pub struct RoleValue {
278    pub name: String,
279    pub attributes: RoleAttributes,
280    pub membership: RoleMembership,
281    pub vars: RoleVars,
282    pub oid: u32,
283}
284
285#[derive(
286    Clone,
287    Copy,
288    Debug,
289    PartialEq,
290    Eq,
291    PartialOrd,
292    Ord,
293    Serialize,
294    Deserialize
295)]
296#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
297pub struct RoleAuthKey {
298    pub id: RoleId,
299}
300
301#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
302#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
303pub struct RoleAuthValue {
304    pub password_hash: Option<String>,
305    pub updated_at: EpochMillis,
306}
307
308#[derive(
309    Clone,
310    Copy,
311    Debug,
312    PartialEq,
313    Eq,
314    PartialOrd,
315    Ord,
316    Serialize,
317    Deserialize
318)]
319#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
320pub struct NetworkPolicyKey {
321    pub id: NetworkPolicyId,
322}
323
324#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
325#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
326pub struct NetworkPolicyValue {
327    pub name: String,
328    pub rules: Vec<NetworkPolicyRule>,
329    pub owner_id: RoleId,
330    pub privileges: Vec<MzAclItem>,
331    pub oid: u32,
332}
333
334#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
335#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
336pub struct ServerConfigurationKey {
337    pub name: String,
338}
339
340#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
341#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
342pub struct ServerConfigurationValue {
343    pub value: String,
344}
345
346#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
347#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
348pub struct ClusterSystemConfigurationKey {
349    pub cluster_id: ClusterId,
350    pub name: String,
351}
352
353#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
354#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
355pub struct ClusterSystemConfigurationValue {
356    pub value: String,
357}
358
359#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
360#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
361pub struct ReplicaSystemConfigurationKey {
362    pub replica_id: ReplicaId,
363    pub name: String,
364}
365
366#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
367#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
368pub struct ReplicaSystemConfigurationValue {
369    pub value: String,
370}
371
372#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
373#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
374pub struct AuditLogKey {
375    pub event: AuditLogEvent,
376}
377
378#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
379#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
380pub enum AuditLogEvent {
381    V1(AuditLogEventV1),
382}
383
384#[derive(
385    Clone,
386    Copy,
387    Debug,
388    PartialEq,
389    Eq,
390    PartialOrd,
391    Ord,
392    Serialize,
393    Deserialize
394)]
395#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
396pub struct CommentKey {
397    pub object: CommentObject,
398    pub sub_component: Option<CommentSubComponent>,
399}
400
401#[derive(
402    Clone,
403    Copy,
404    Debug,
405    PartialEq,
406    Eq,
407    PartialOrd,
408    Ord,
409    Serialize,
410    Deserialize
411)]
412#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
413pub enum CommentObject {
414    Table(CatalogItemId),
415    View(CatalogItemId),
416    MaterializedView(CatalogItemId),
417    Source(CatalogItemId),
418    Sink(CatalogItemId),
419    Index(CatalogItemId),
420    Func(CatalogItemId),
421    Connection(CatalogItemId),
422    Type(CatalogItemId),
423    Secret(CatalogItemId),
424    Role(RoleId),
425    Database(DatabaseId),
426    Schema(ResolvedSchema),
427    Cluster(ClusterId),
428    ClusterReplica(ClusterReplicaId),
429    NetworkPolicy(NetworkPolicyId),
430}
431
432#[derive(
433    Clone,
434    Copy,
435    Debug,
436    PartialEq,
437    Eq,
438    PartialOrd,
439    Ord,
440    Serialize,
441    Deserialize
442)]
443#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
444pub enum CommentSubComponent {
445    ColumnPos(u64),
446}
447
448#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
449#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
450pub struct CommentValue {
451    pub comment: String,
452}
453
454#[derive(
455    Clone,
456    Copy,
457    Debug,
458    PartialEq,
459    Eq,
460    PartialOrd,
461    Ord,
462    Serialize,
463    Deserialize
464)]
465#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
466pub struct SourceReferencesKey {
467    pub source: CatalogItemId,
468}
469
470#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
471#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
472pub struct SourceReferencesValue {
473    pub references: Vec<SourceReference>,
474    pub updated_at: EpochMillis,
475}
476
477#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
478#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
479pub struct SourceReference {
480    pub name: String,
481    pub namespace: Option<String>,
482    pub columns: Vec<String>,
483}
484
485#[derive(
486    Clone,
487    Copy,
488    Debug,
489    PartialEq,
490    Eq,
491    PartialOrd,
492    Ord,
493    Serialize,
494    Deserialize
495)]
496#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
497pub struct StorageCollectionMetadataKey {
498    pub id: GlobalId,
499}
500
501#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
502#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
503pub struct StorageCollectionMetadataValue {
504    pub shard: String,
505}
506
507#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
508#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
509pub struct UnfinalizedShardKey {
510    pub shard: String,
511}
512
513#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
514#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
515pub struct TxnWalShardValue {
516    pub shard: String,
517}
518
519#[derive(
520    Clone,
521    Copy,
522    Debug,
523    PartialEq,
524    Eq,
525    PartialOrd,
526    Ord,
527    Serialize,
528    Deserialize
529)]
530#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
531pub struct Empty {}
532
533#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
534#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
535pub struct StringWrapper {
536    pub inner: String,
537}
538
539#[derive(
540    Clone,
541    Copy,
542    Debug,
543    PartialEq,
544    Eq,
545    PartialOrd,
546    Ord,
547    Serialize,
548    Deserialize
549)]
550#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
551pub struct Duration {
552    pub secs: u64,
553    pub nanos: u32,
554}
555
556#[derive(
557    Clone,
558    Copy,
559    Debug,
560    PartialEq,
561    Eq,
562    PartialOrd,
563    Ord,
564    Serialize,
565    Deserialize
566)]
567#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
568pub struct EpochMillis {
569    pub millis: u64,
570}
571
572#[derive(
573    Clone,
574    Copy,
575    Debug,
576    PartialEq,
577    Eq,
578    PartialOrd,
579    Ord,
580    Serialize,
581    Deserialize
582)]
583#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
584pub struct Version {
585    pub value: u64,
586}
587
588#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
589#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
590pub enum CatalogItem {
591    V1(CatalogItemV1),
592}
593
594#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
595#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
596pub struct CatalogItemV1 {
597    pub create_sql: String,
598}
599
600#[derive(
601    Clone,
602    Copy,
603    Debug,
604    PartialEq,
605    Eq,
606    PartialOrd,
607    Ord,
608    Serialize,
609    Deserialize
610)]
611#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
612pub enum CatalogItemId {
613    System(u64),
614    User(u64),
615    Transient(u64),
616    IntrospectionSourceIndex(u64),
617}
618
619#[derive(
620    Clone,
621    Copy,
622    Debug,
623    PartialEq,
624    Eq,
625    PartialOrd,
626    Ord,
627    Serialize,
628    Deserialize
629)]
630#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
631pub struct SystemCatalogItemId(pub u64);
632
633#[derive(
634    Clone,
635    Copy,
636    Debug,
637    PartialEq,
638    Eq,
639    PartialOrd,
640    Ord,
641    Serialize,
642    Deserialize
643)]
644#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
645pub struct IntrospectionSourceIndexCatalogItemId(pub u64);
646
647#[derive(
648    Clone,
649    Copy,
650    Debug,
651    PartialEq,
652    Eq,
653    PartialOrd,
654    Ord,
655    Serialize,
656    Deserialize
657)]
658#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
659pub enum GlobalId {
660    System(u64),
661    User(u64),
662    Transient(u64),
663    Explain,
664    IntrospectionSourceIndex(u64),
665}
666
667#[derive(
668    Clone,
669    Copy,
670    Debug,
671    PartialEq,
672    Eq,
673    PartialOrd,
674    Ord,
675    Serialize,
676    Deserialize
677)]
678#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
679pub struct SystemGlobalId(pub u64);
680
681#[derive(
682    Clone,
683    Copy,
684    Debug,
685    PartialEq,
686    Eq,
687    PartialOrd,
688    Ord,
689    Serialize,
690    Deserialize
691)]
692#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
693pub struct IntrospectionSourceIndexGlobalId(pub u64);
694
695#[derive(
696    Clone,
697    Copy,
698    Debug,
699    PartialEq,
700    Eq,
701    PartialOrd,
702    Ord,
703    Serialize,
704    Deserialize
705)]
706#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
707pub enum ClusterId {
708    System(u64),
709    User(u64),
710}
711
712#[derive(
713    Clone,
714    Copy,
715    Debug,
716    PartialEq,
717    Eq,
718    PartialOrd,
719    Ord,
720    Serialize,
721    Deserialize
722)]
723#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
724pub enum DatabaseId {
725    System(u64),
726    User(u64),
727}
728
729#[derive(
730    Clone,
731    Copy,
732    Debug,
733    PartialEq,
734    Eq,
735    PartialOrd,
736    Ord,
737    Serialize,
738    Deserialize
739)]
740#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
741pub enum ResolvedDatabaseSpecifier {
742    Ambient,
743    Id(DatabaseId),
744}
745
746#[derive(
747    Clone,
748    Copy,
749    Debug,
750    PartialEq,
751    Eq,
752    PartialOrd,
753    Ord,
754    Serialize,
755    Deserialize
756)]
757#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
758pub enum SchemaId {
759    System(u64),
760    User(u64),
761}
762
763#[derive(
764    Clone,
765    Copy,
766    Debug,
767    PartialEq,
768    Eq,
769    PartialOrd,
770    Ord,
771    Serialize,
772    Deserialize
773)]
774#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
775pub enum SchemaSpecifier {
776    Temporary,
777    Id(SchemaId),
778}
779
780#[derive(
781    Clone,
782    Copy,
783    Debug,
784    PartialEq,
785    Eq,
786    PartialOrd,
787    Ord,
788    Serialize,
789    Deserialize
790)]
791#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
792pub struct ResolvedSchema {
793    pub database: ResolvedDatabaseSpecifier,
794    pub schema: SchemaSpecifier,
795}
796
797#[derive(
798    Clone,
799    Copy,
800    Debug,
801    PartialEq,
802    Eq,
803    PartialOrd,
804    Ord,
805    Serialize,
806    Deserialize
807)]
808#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
809pub enum ReplicaId {
810    System(u64),
811    User(u64),
812}
813
814#[derive(
815    Clone,
816    Copy,
817    Debug,
818    PartialEq,
819    Eq,
820    PartialOrd,
821    Ord,
822    Serialize,
823    Deserialize
824)]
825#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
826pub struct ClusterReplicaId {
827    pub cluster_id: ClusterId,
828    pub replica_id: ReplicaId,
829}
830
831#[derive(
832    Clone,
833    Copy,
834    Debug,
835    PartialEq,
836    Eq,
837    PartialOrd,
838    Ord,
839    Serialize,
840    Deserialize
841)]
842#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
843pub enum NetworkPolicyId {
844    System(u64),
845    User(u64),
846}
847
848#[derive(
849    Clone,
850    Copy,
851    Debug,
852    PartialEq,
853    Eq,
854    PartialOrd,
855    Ord,
856    Serialize,
857    Deserialize
858)]
859#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
860pub struct ReplicaLogging {
861    pub log_logging: bool,
862    pub interval: Option<Duration>,
863}
864
865#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
866#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
867pub struct OptimizerFeatureOverride {
868    pub name: String,
869    pub value: String,
870}
871
872#[derive(
873    Clone,
874    Copy,
875    Debug,
876    PartialEq,
877    Eq,
878    PartialOrd,
879    Ord,
880    Serialize,
881    Deserialize
882)]
883#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
884pub struct ClusterScheduleRefreshOptions {
885    pub rehydration_time_estimate: Duration,
886}
887
888#[derive(
889    Clone,
890    Copy,
891    Debug,
892    PartialEq,
893    Eq,
894    PartialOrd,
895    Ord,
896    Serialize,
897    Deserialize
898)]
899#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
900pub enum ClusterSchedule {
901    Manual,
902    Refresh(ClusterScheduleRefreshOptions),
903}
904
905#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
906#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
907pub struct ClusterConfig {
908    pub workload_class: Option<String>,
909    pub variant: ClusterVariant,
910}
911
912#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
913#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
914pub enum ClusterVariant {
915    Unmanaged,
916    Managed(ManagedCluster),
917}
918
919#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
920#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
921pub struct ManagedCluster {
922    pub size: String,
923    pub replication_factor: u32,
924    pub availability_zones: Vec<String>,
925    pub logging: ReplicaLogging,
926    pub optimizer_feature_overrides: Vec<OptimizerFeatureOverride>,
927    pub schedule: ClusterSchedule,
928}
929
930#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
931#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
932pub struct ReplicaConfig {
933    pub logging: ReplicaLogging,
934    pub location: ReplicaLocation,
935}
936
937#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
938#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
939pub struct UnmanagedLocation {
940    pub storagectl_addrs: Vec<String>,
941    pub computectl_addrs: Vec<String>,
942}
943
944#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
945#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
946pub struct ManagedLocation {
947    pub size: String,
948    pub availability_zone: Option<String>,
949    pub internal: bool,
950    pub billed_as: Option<String>,
951    pub pending: bool,
952}
953
954#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
955#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
956pub enum ReplicaLocation {
957    Unmanaged(UnmanagedLocation),
958    Managed(ManagedLocation),
959}
960
961#[derive(
962    Clone,
963    Copy,
964    Debug,
965    PartialEq,
966    Eq,
967    PartialOrd,
968    Ord,
969    Serialize,
970    Deserialize
971)]
972#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
973pub enum RoleId {
974    System(u64),
975    User(u64),
976    Public,
977    Predefined(u64),
978}
979
980#[derive(
981    Clone,
982    Copy,
983    Debug,
984    PartialEq,
985    Eq,
986    PartialOrd,
987    Ord,
988    Serialize,
989    Deserialize
990)]
991#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
992pub enum AutoProvisionSource {
993    Oidc = 0,
994    Frontegg = 1,
995    None = 2,
996}
997
998#[derive(
999    Clone,
1000    Copy,
1001    Debug,
1002    PartialEq,
1003    Eq,
1004    PartialOrd,
1005    Ord,
1006    Serialize,
1007    Deserialize
1008)]
1009#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1010pub struct RoleAttributes {
1011    pub inherit: bool,
1012    pub superuser: Option<bool>,
1013    pub login: Option<bool>,
1014    pub auto_provision_source: Option<AutoProvisionSource>,
1015}
1016
1017#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1018#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1019pub struct RoleMembership {
1020    pub map: Vec<RoleMembershipEntry>,
1021}
1022
1023#[derive(
1024    Clone,
1025    Copy,
1026    Debug,
1027    PartialEq,
1028    Eq,
1029    PartialOrd,
1030    Ord,
1031    Serialize,
1032    Deserialize
1033)]
1034#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1035pub struct RoleMembershipEntry {
1036    pub key: RoleId,
1037    pub value: RoleId,
1038}
1039
1040#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1041#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1042pub struct RoleVars {
1043    pub entries: Vec<RoleVarsEntry>,
1044}
1045
1046#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1047#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1048pub struct RoleVarsEntry {
1049    pub key: String,
1050    pub val: RoleVar,
1051}
1052
1053#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1054#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1055pub enum RoleVar {
1056    Flat(String),
1057    SqlSet(Vec<String>),
1058}
1059
1060#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1061#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1062pub struct NetworkPolicyRule {
1063    pub name: String,
1064    pub address: String,
1065    pub action: NetworkPolicyRuleAction,
1066    pub direction: NetworkPolicyRuleDirection,
1067}
1068
1069#[derive(
1070    Clone,
1071    Copy,
1072    Debug,
1073    PartialEq,
1074    Eq,
1075    PartialOrd,
1076    Ord,
1077    Serialize,
1078    Deserialize
1079)]
1080#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1081pub enum NetworkPolicyRuleAction {
1082    Allow,
1083}
1084
1085#[derive(
1086    Clone,
1087    Copy,
1088    Debug,
1089    PartialEq,
1090    Eq,
1091    PartialOrd,
1092    Ord,
1093    Serialize,
1094    Deserialize
1095)]
1096#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1097pub enum NetworkPolicyRuleDirection {
1098    Ingress,
1099}
1100
1101#[derive(
1102    Clone,
1103    Copy,
1104    Debug,
1105    PartialEq,
1106    Eq,
1107    PartialOrd,
1108    Ord,
1109    Serialize,
1110    Deserialize
1111)]
1112#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1113pub struct AclMode {
1114    pub bitflags: u64,
1115}
1116
1117#[derive(
1118    Clone,
1119    Copy,
1120    Debug,
1121    PartialEq,
1122    Eq,
1123    PartialOrd,
1124    Ord,
1125    Serialize,
1126    Deserialize
1127)]
1128#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1129pub struct MzAclItem {
1130    pub grantee: RoleId,
1131    pub grantor: RoleId,
1132    pub acl_mode: AclMode,
1133}
1134
1135#[derive(
1136    Clone,
1137    Copy,
1138    Debug,
1139    PartialEq,
1140    Eq,
1141    PartialOrd,
1142    Ord,
1143    Serialize,
1144    Deserialize
1145)]
1146#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1147pub struct DefaultPrivilegesKey {
1148    pub role_id: RoleId,
1149    pub database_id: Option<DatabaseId>,
1150    pub schema_id: Option<SchemaId>,
1151    pub object_type: ObjectType,
1152    pub grantee: RoleId,
1153}
1154
1155#[derive(
1156    Clone,
1157    Copy,
1158    Debug,
1159    PartialEq,
1160    Eq,
1161    PartialOrd,
1162    Ord,
1163    Serialize,
1164    Deserialize
1165)]
1166#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1167pub struct DefaultPrivilegesValue {
1168    pub privileges: AclMode,
1169}
1170
1171#[derive(
1172    Clone,
1173    Copy,
1174    Debug,
1175    PartialEq,
1176    Eq,
1177    PartialOrd,
1178    Ord,
1179    Serialize,
1180    Deserialize
1181)]
1182#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1183pub struct SystemPrivilegesKey {
1184    pub grantee: RoleId,
1185    pub grantor: RoleId,
1186}
1187
1188#[derive(
1189    Clone,
1190    Copy,
1191    Debug,
1192    PartialEq,
1193    Eq,
1194    PartialOrd,
1195    Ord,
1196    Serialize,
1197    Deserialize
1198)]
1199#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1200pub struct SystemPrivilegesValue {
1201    pub acl_mode: AclMode,
1202}
1203
1204#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1205#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1206pub struct AuditLogEventV1 {
1207    pub id: u64,
1208    pub event_type: audit_log_event_v1::EventType,
1209    pub object_type: audit_log_event_v1::ObjectType,
1210    pub user: Option<StringWrapper>,
1211    pub occurred_at: EpochMillis,
1212    pub details: audit_log_event_v1::Details,
1213}
1214
1215pub mod audit_log_event_v1 {
1216    use super::*;
1217
1218    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1219    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1220    pub struct IdFullNameV1 {
1221        pub id: String,
1222        pub name: FullNameV1,
1223    }
1224
1225    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1226    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1227    pub struct FullNameV1 {
1228        pub database: String,
1229        pub schema: String,
1230        pub item: String,
1231    }
1232
1233    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1234    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1235    pub struct IdNameV1 {
1236        pub id: String,
1237        pub name: String,
1238    }
1239
1240    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1241    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1242    pub struct RenameClusterV1 {
1243        pub id: String,
1244        pub old_name: String,
1245        pub new_name: String,
1246    }
1247
1248    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1249    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1250    pub struct RenameClusterReplicaV1 {
1251        pub cluster_id: String,
1252        pub replica_id: String,
1253        pub old_name: String,
1254        pub new_name: String,
1255    }
1256
1257    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1258    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1259    pub struct RenameItemV1 {
1260        pub id: String,
1261        pub old_name: FullNameV1,
1262        pub new_name: FullNameV1,
1263    }
1264
1265    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1266    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1267    pub struct CreateClusterReplicaV1 {
1268        pub cluster_id: String,
1269        pub cluster_name: String,
1270        pub replica_id: Option<StringWrapper>,
1271        pub replica_name: String,
1272        pub logical_size: String,
1273        pub disk: bool,
1274        pub billed_as: Option<String>,
1275        pub internal: bool,
1276    }
1277
1278    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1279    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1280    pub struct CreateClusterReplicaV2 {
1281        pub cluster_id: String,
1282        pub cluster_name: String,
1283        pub replica_id: Option<StringWrapper>,
1284        pub replica_name: String,
1285        pub logical_size: String,
1286        pub disk: bool,
1287        pub billed_as: Option<String>,
1288        pub internal: bool,
1289        pub reason: CreateOrDropClusterReplicaReasonV1,
1290        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1291    }
1292
1293    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1294    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1295    pub struct CreateClusterReplicaV3 {
1296        pub cluster_id: String,
1297        pub cluster_name: String,
1298        pub replica_id: Option<StringWrapper>,
1299        pub replica_name: String,
1300        pub logical_size: String,
1301        pub disk: bool,
1302        pub billed_as: Option<String>,
1303        pub internal: bool,
1304        pub reason: CreateOrDropClusterReplicaReasonV1,
1305        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1306    }
1307
1308    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1309    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1310    pub struct CreateClusterReplicaV4 {
1311        pub cluster_id: String,
1312        pub cluster_name: String,
1313        pub replica_id: Option<StringWrapper>,
1314        pub replica_name: String,
1315        pub logical_size: String,
1316        pub billed_as: Option<String>,
1317        pub internal: bool,
1318        pub reason: CreateOrDropClusterReplicaReasonV1,
1319        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1320    }
1321
1322    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1323    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1324    pub struct DropClusterReplicaV1 {
1325        pub cluster_id: String,
1326        pub cluster_name: String,
1327        pub replica_id: Option<StringWrapper>,
1328        pub replica_name: String,
1329    }
1330
1331    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1332    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1333    pub struct DropClusterReplicaV2 {
1334        pub cluster_id: String,
1335        pub cluster_name: String,
1336        pub replica_id: Option<StringWrapper>,
1337        pub replica_name: String,
1338        pub reason: CreateOrDropClusterReplicaReasonV1,
1339        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1340    }
1341
1342    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1343    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1344    pub struct DropClusterReplicaV3 {
1345        pub cluster_id: String,
1346        pub cluster_name: String,
1347        pub replica_id: Option<StringWrapper>,
1348        pub replica_name: String,
1349        pub reason: CreateOrDropClusterReplicaReasonV1,
1350        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1351    }
1352
1353    #[derive(
1354        Clone,
1355        Copy,
1356        Debug,
1357        PartialEq,
1358        Eq,
1359        PartialOrd,
1360        Ord,
1361        Serialize,
1362        Deserialize
1363    )]
1364    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1365    pub struct CreateOrDropClusterReplicaReasonV1 {
1366        pub reason: CreateOrDropClusterReplicaReasonV1Reason,
1367    }
1368
1369    #[derive(
1370        Clone,
1371        Copy,
1372        Debug,
1373        PartialEq,
1374        Eq,
1375        PartialOrd,
1376        Ord,
1377        Serialize,
1378        Deserialize
1379    )]
1380    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1381    pub enum CreateOrDropClusterReplicaReasonV1Reason {
1382        Manual(Empty),
1383        Schedule(Empty),
1384        System(Empty),
1385    }
1386
1387    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1388    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1389    pub struct SchedulingDecisionsWithReasonsV1 {
1390        pub on_refresh: RefreshDecisionWithReasonV1,
1391    }
1392
1393    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1394    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1395    pub struct SchedulingDecisionsWithReasonsV2 {
1396        pub on_refresh: RefreshDecisionWithReasonV2,
1397    }
1398
1399    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1400    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1401    pub enum RefreshDecision {
1402        On(Empty),
1403        Off(Empty),
1404    }
1405
1406    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1407    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1408    pub struct RefreshDecisionWithReasonV1 {
1409        pub objects_needing_refresh: Vec<String>,
1410        pub rehydration_time_estimate: String,
1411        pub decision: RefreshDecision,
1412    }
1413
1414    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1415    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1416    pub struct RefreshDecisionWithReasonV2 {
1417        pub objects_needing_refresh: Vec<String>,
1418        pub objects_needing_compaction: Vec<String>,
1419        pub rehydration_time_estimate: String,
1420        pub decision: RefreshDecision,
1421    }
1422
1423    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1424    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1425    pub struct CreateSourceSinkV1 {
1426        pub id: String,
1427        pub name: FullNameV1,
1428        pub size: Option<StringWrapper>,
1429    }
1430
1431    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1432    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1433    pub struct CreateSourceSinkV2 {
1434        pub id: String,
1435        pub name: FullNameV1,
1436        pub size: Option<StringWrapper>,
1437        pub external_type: String,
1438    }
1439
1440    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1441    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1442    pub struct CreateSourceSinkV3 {
1443        pub id: String,
1444        pub name: FullNameV1,
1445        pub external_type: String,
1446    }
1447
1448    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1449    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1450    pub struct CreateSourceSinkV4 {
1451        pub id: String,
1452        pub cluster_id: Option<StringWrapper>,
1453        pub name: FullNameV1,
1454        pub external_type: String,
1455    }
1456
1457    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1458    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1459    pub struct CreateIndexV1 {
1460        pub id: String,
1461        pub cluster_id: String,
1462        pub name: FullNameV1,
1463    }
1464
1465    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1466    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1467    pub struct CreateMaterializedViewV1 {
1468        pub id: String,
1469        pub cluster_id: String,
1470        pub name: FullNameV1,
1471        pub replacement_target_id: Option<String>,
1472    }
1473
1474    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1475    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1476    pub struct AlterApplyReplacementV1 {
1477        pub target: IdFullNameV1,
1478        pub replacement: IdFullNameV1,
1479    }
1480
1481    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1482    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1483    pub struct AlterSourceSinkV1 {
1484        pub id: String,
1485        pub name: FullNameV1,
1486        pub old_size: Option<StringWrapper>,
1487        pub new_size: Option<StringWrapper>,
1488    }
1489
1490    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1491    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1492    pub struct AlterSetClusterV1 {
1493        pub id: String,
1494        pub name: FullNameV1,
1495        pub old_cluster_id: String,
1496        pub new_cluster_id: String,
1497    }
1498
1499    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1500    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1501    pub struct GrantRoleV1 {
1502        pub role_id: String,
1503        pub member_id: String,
1504        pub grantor_id: String,
1505    }
1506
1507    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1508    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1509    pub struct GrantRoleV2 {
1510        pub role_id: String,
1511        pub member_id: String,
1512        pub grantor_id: String,
1513        pub executed_by: String,
1514    }
1515
1516    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1517    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1518    pub struct RevokeRoleV1 {
1519        pub role_id: String,
1520        pub member_id: String,
1521    }
1522
1523    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1524    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1525    pub struct RevokeRoleV2 {
1526        pub role_id: String,
1527        pub member_id: String,
1528        pub grantor_id: String,
1529        pub executed_by: String,
1530    }
1531
1532    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1533    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1534    pub struct UpdatePrivilegeV1 {
1535        pub object_id: String,
1536        pub grantee_id: String,
1537        pub grantor_id: String,
1538        pub privileges: String,
1539    }
1540
1541    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1542    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1543    pub struct AlterDefaultPrivilegeV1 {
1544        pub role_id: String,
1545        pub database_id: Option<StringWrapper>,
1546        pub schema_id: Option<StringWrapper>,
1547        pub grantee_id: String,
1548        pub privileges: String,
1549    }
1550
1551    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1552    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1553    pub struct UpdateOwnerV1 {
1554        pub object_id: String,
1555        pub old_owner_id: String,
1556        pub new_owner_id: String,
1557    }
1558
1559    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1560    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1561    pub struct SchemaV1 {
1562        pub id: String,
1563        pub name: String,
1564        pub database_name: String,
1565    }
1566
1567    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1568    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1569    pub struct SchemaV2 {
1570        pub id: String,
1571        pub name: String,
1572        pub database_name: Option<StringWrapper>,
1573    }
1574
1575    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1576    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1577    pub struct RenameSchemaV1 {
1578        pub id: String,
1579        pub database_name: Option<String>,
1580        pub old_name: String,
1581        pub new_name: String,
1582    }
1583
1584    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1585    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1586    pub struct UpdateItemV1 {
1587        pub id: String,
1588        pub name: FullNameV1,
1589    }
1590
1591    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1592    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1593    pub struct AlterRetainHistoryV1 {
1594        pub id: String,
1595        pub old_history: Option<String>,
1596        pub new_history: Option<String>,
1597    }
1598
1599    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1600    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1601    pub struct AlterAddColumnV1 {
1602        pub id: String,
1603        pub column: String,
1604        pub column_type: String,
1605        pub nullable: bool,
1606    }
1607
1608    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1609    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1610    pub struct AlterSourceTimestampIntervalV1 {
1611        pub id: String,
1612        pub old_interval: Option<String>,
1613        pub new_interval: Option<String>,
1614    }
1615
1616    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1617    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1618    pub struct ToNewIdV1 {
1619        pub id: String,
1620        pub new_id: String,
1621    }
1622
1623    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1624    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1625    pub struct FromPreviousIdV1 {
1626        pub id: String,
1627        pub previous_id: String,
1628    }
1629
1630    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1631    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1632    pub struct SetV1 {
1633        pub name: String,
1634        pub value: Option<String>,
1635    }
1636
1637    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1638    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1639    pub struct RotateKeysV1 {
1640        pub id: String,
1641        pub name: String,
1642    }
1643
1644    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1645    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1646    pub struct CreateRoleV1 {
1647        pub id: String,
1648        pub name: String,
1649        pub auto_provision_source: Option<String>,
1650    }
1651
1652    #[derive(
1653        Clone,
1654        Copy,
1655        Debug,
1656        PartialEq,
1657        Eq,
1658        Hash,
1659        PartialOrd,
1660        Ord,
1661        Serialize_repr,
1662        Deserialize_repr
1663    )]
1664    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1665    #[repr(u8)]
1666    pub enum EventType {
1667        Unknown = 0,
1668        Create = 1,
1669        Drop = 2,
1670        Alter = 3,
1671        Grant = 4,
1672        Revoke = 5,
1673        Comment = 6,
1674    }
1675
1676    #[derive(
1677        Clone,
1678        Copy,
1679        Debug,
1680        PartialEq,
1681        Eq,
1682        Hash,
1683        PartialOrd,
1684        Ord,
1685        Serialize_repr,
1686        Deserialize_repr
1687    )]
1688    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1689    #[repr(u8)]
1690    pub enum ObjectType {
1691        Unknown = 0,
1692        Cluster = 1,
1693        ClusterReplica = 2,
1694        Connection = 3,
1695        Database = 4,
1696        Func = 5,
1697        Index = 6,
1698        MaterializedView = 7,
1699        Role = 8,
1700        Secret = 9,
1701        Schema = 10,
1702        Sink = 11,
1703        Source = 12,
1704        Table = 13,
1705        Type = 14,
1706        View = 15,
1707        System = 16,
1708        ContinualTask = 17,
1709        NetworkPolicy = 18,
1710    }
1711
1712    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1713    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1714    pub enum Details {
1715        CreateClusterReplicaV1(CreateClusterReplicaV1),
1716        CreateClusterReplicaV2(CreateClusterReplicaV2),
1717        CreateClusterReplicaV3(CreateClusterReplicaV3),
1718        CreateClusterReplicaV4(CreateClusterReplicaV4),
1719        DropClusterReplicaV1(DropClusterReplicaV1),
1720        DropClusterReplicaV2(DropClusterReplicaV2),
1721        DropClusterReplicaV3(DropClusterReplicaV3),
1722        CreateSourceSinkV1(CreateSourceSinkV1),
1723        CreateSourceSinkV2(CreateSourceSinkV2),
1724        AlterSourceSinkV1(AlterSourceSinkV1),
1725        AlterSetClusterV1(AlterSetClusterV1),
1726        GrantRoleV1(GrantRoleV1),
1727        GrantRoleV2(GrantRoleV2),
1728        RevokeRoleV1(RevokeRoleV1),
1729        RevokeRoleV2(RevokeRoleV2),
1730        UpdatePrivilegeV1(UpdatePrivilegeV1),
1731        AlterDefaultPrivilegeV1(AlterDefaultPrivilegeV1),
1732        UpdateOwnerV1(UpdateOwnerV1),
1733        IdFullNameV1(IdFullNameV1),
1734        RenameClusterV1(RenameClusterV1),
1735        RenameClusterReplicaV1(RenameClusterReplicaV1),
1736        RenameItemV1(RenameItemV1),
1737        IdNameV1(IdNameV1),
1738        SchemaV1(SchemaV1),
1739        SchemaV2(SchemaV2),
1740        RenameSchemaV1(RenameSchemaV1),
1741        UpdateItemV1(UpdateItemV1),
1742        CreateSourceSinkV3(CreateSourceSinkV3),
1743        AlterRetainHistoryV1(AlterRetainHistoryV1),
1744        ToNewIdV1(ToNewIdV1),
1745        FromPreviousIdV1(FromPreviousIdV1),
1746        SetV1(SetV1),
1747        ResetAllV1(Empty),
1748        RotateKeysV1(RotateKeysV1),
1749        CreateSourceSinkV4(CreateSourceSinkV4),
1750        CreateIndexV1(CreateIndexV1),
1751        CreateMaterializedViewV1(CreateMaterializedViewV1),
1752        AlterApplyReplacementV1(AlterApplyReplacementV1),
1753        CreateRoleV1(CreateRoleV1),
1754        AlterAddColumnV1(AlterAddColumnV1),
1755        AlterSourceTimestampIntervalV1(AlterSourceTimestampIntervalV1),
1756    }
1757}
1758
1759/// The contents of a single state update.
1760#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1761#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1762// Serialize the top-level enum in the persist-backed catalog as internally tagged to set up
1763// persist pushdown statistics for success.
1764#[serde(tag = "kind")]
1765pub enum StateUpdateKind {
1766    AuditLog(AuditLog),
1767    Cluster(Cluster),
1768    ClusterIntrospectionSourceIndex(ClusterIntrospectionSourceIndex),
1769    ClusterReplica(ClusterReplica),
1770    Comment(Comment),
1771    Config(Config),
1772    Database(Database),
1773    DefaultPrivileges(DefaultPrivileges),
1774    FenceToken(FenceToken),
1775    GidMapping(GidMapping),
1776    IdAlloc(IdAlloc),
1777    Item(Item),
1778    NetworkPolicy(NetworkPolicy),
1779    Role(Role),
1780    RoleAuth(RoleAuth),
1781    Schema(Schema),
1782    ServerConfiguration(ServerConfiguration),
1783    ClusterSystemConfiguration(ClusterSystemConfiguration),
1784    ReplicaSystemConfiguration(ReplicaSystemConfiguration),
1785    Setting(Setting),
1786    SourceReferences(SourceReferences),
1787    StorageCollectionMetadata(StorageCollectionMetadata),
1788    SystemPrivileges(SystemPrivileges),
1789    TxnWalShard(TxnWalShard),
1790    UnfinalizedShard(UnfinalizedShard),
1791}
1792
1793#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1794#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1795pub struct AuditLog {
1796    pub key: AuditLogKey,
1797}
1798
1799#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1800#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1801pub struct Cluster {
1802    pub key: ClusterKey,
1803    pub value: ClusterValue,
1804}
1805
1806#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1807#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1808pub struct ClusterReplica {
1809    pub key: ClusterReplicaKey,
1810    pub value: ClusterReplicaValue,
1811}
1812
1813#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1814#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1815pub struct Comment {
1816    pub key: CommentKey,
1817    pub value: CommentValue,
1818}
1819
1820#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1821#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1822pub struct Config {
1823    pub key: ConfigKey,
1824    pub value: ConfigValue,
1825}
1826
1827#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1828#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1829pub struct Database {
1830    pub key: DatabaseKey,
1831    pub value: DatabaseValue,
1832}
1833
1834#[derive(
1835    Clone,
1836    Copy,
1837    Debug,
1838    PartialEq,
1839    Eq,
1840    PartialOrd,
1841    Ord,
1842    Serialize,
1843    Deserialize
1844)]
1845#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1846pub struct DefaultPrivileges {
1847    pub key: DefaultPrivilegesKey,
1848    pub value: DefaultPrivilegesValue,
1849}
1850
1851#[derive(
1852    Clone,
1853    Copy,
1854    Debug,
1855    PartialEq,
1856    Eq,
1857    PartialOrd,
1858    Ord,
1859    Serialize,
1860    Deserialize
1861)]
1862#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1863pub struct FenceToken {
1864    pub deploy_generation: u64,
1865    pub epoch: i64,
1866}
1867
1868#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1869#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1870pub struct IdAlloc {
1871    pub key: IdAllocKey,
1872    pub value: IdAllocValue,
1873}
1874
1875#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1876#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1877pub struct ClusterIntrospectionSourceIndex {
1878    pub key: ClusterIntrospectionSourceIndexKey,
1879    pub value: ClusterIntrospectionSourceIndexValue,
1880}
1881
1882#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1883#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1884pub struct Item {
1885    pub key: ItemKey,
1886    pub value: ItemValue,
1887}
1888
1889#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1890#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1891pub struct Role {
1892    pub key: RoleKey,
1893    pub value: RoleValue,
1894}
1895
1896#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1897#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1898pub struct RoleAuth {
1899    pub key: RoleAuthKey,
1900    pub value: RoleAuthValue,
1901}
1902
1903#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1904#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1905pub struct NetworkPolicy {
1906    pub key: NetworkPolicyKey,
1907    pub value: NetworkPolicyValue,
1908}
1909
1910#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1911#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1912pub struct Schema {
1913    pub key: SchemaKey,
1914    pub value: SchemaValue,
1915}
1916
1917#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1918#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1919pub struct Setting {
1920    pub key: SettingKey,
1921    pub value: SettingValue,
1922}
1923
1924#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1925#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1926pub struct ServerConfiguration {
1927    pub key: ServerConfigurationKey,
1928    pub value: ServerConfigurationValue,
1929}
1930
1931#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1932#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1933pub struct ClusterSystemConfiguration {
1934    pub key: ClusterSystemConfigurationKey,
1935    pub value: ClusterSystemConfigurationValue,
1936}
1937
1938#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1939#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1940pub struct ReplicaSystemConfiguration {
1941    pub key: ReplicaSystemConfigurationKey,
1942    pub value: ReplicaSystemConfigurationValue,
1943}
1944
1945#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1946#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1947pub struct SourceReferences {
1948    pub key: SourceReferencesKey,
1949    pub value: SourceReferencesValue,
1950}
1951
1952#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1953#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1954pub struct GidMapping {
1955    pub key: GidMappingKey,
1956    pub value: GidMappingValue,
1957}
1958
1959#[derive(
1960    Clone,
1961    Copy,
1962    Debug,
1963    PartialEq,
1964    Eq,
1965    PartialOrd,
1966    Ord,
1967    Serialize,
1968    Deserialize
1969)]
1970#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1971pub struct SystemPrivileges {
1972    pub key: SystemPrivilegesKey,
1973    pub value: SystemPrivilegesValue,
1974}
1975
1976#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1977#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1978pub struct StorageCollectionMetadata {
1979    pub key: StorageCollectionMetadataKey,
1980    pub value: StorageCollectionMetadataValue,
1981}
1982
1983#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1984#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1985pub struct UnfinalizedShard {
1986    pub key: UnfinalizedShardKey,
1987}
1988
1989#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1990#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1991pub struct TxnWalShard {
1992    pub value: TxnWalShardValue,
1993}
1994
1995#[derive(
1996    Clone,
1997    Copy,
1998    Debug,
1999    PartialEq,
2000    Eq,
2001    Hash,
2002    PartialOrd,
2003    Ord,
2004    Serialize_repr,
2005    Deserialize_repr
2006)]
2007#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2008#[repr(u8)]
2009pub enum CatalogItemType {
2010    Unknown = 0,
2011    Table = 1,
2012    Source = 2,
2013    Sink = 3,
2014    View = 4,
2015    MaterializedView = 5,
2016    Index = 6,
2017    Type = 7,
2018    Func = 8,
2019    Secret = 9,
2020    Connection = 10,
2021}
2022
2023#[derive(
2024    Clone,
2025    Copy,
2026    Debug,
2027    PartialEq,
2028    Eq,
2029    Hash,
2030    PartialOrd,
2031    Ord,
2032    Serialize_repr,
2033    Deserialize_repr
2034)]
2035#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2036#[repr(u8)]
2037pub enum ObjectType {
2038    Unknown = 0,
2039    Table = 1,
2040    View = 2,
2041    MaterializedView = 3,
2042    Source = 4,
2043    Sink = 5,
2044    Index = 6,
2045    Type = 7,
2046    Role = 8,
2047    Cluster = 9,
2048    ClusterReplica = 10,
2049    Secret = 11,
2050    Connection = 12,
2051    Database = 13,
2052    Schema = 14,
2053    Func = 15,
2054    NetworkPolicy = 17,
2055}