Skip to main content

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