Skip to main content

mz_catalog_protos/
objects_v84.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 ToNewIdV1 {
1576        pub id: String,
1577        pub new_id: String,
1578    }
1579
1580    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1581    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1582    pub struct FromPreviousIdV1 {
1583        pub id: String,
1584        pub previous_id: String,
1585    }
1586
1587    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1588    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1589    pub struct SetV1 {
1590        pub name: String,
1591        pub value: Option<String>,
1592    }
1593
1594    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1595    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1596    pub struct RotateKeysV1 {
1597        pub id: String,
1598        pub name: String,
1599    }
1600
1601    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1602    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1603    pub struct CreateRoleV1 {
1604        pub id: String,
1605        pub name: String,
1606        pub auto_provision_source: Option<String>,
1607    }
1608
1609    #[derive(
1610        Clone,
1611        Copy,
1612        Debug,
1613        PartialEq,
1614        Eq,
1615        Hash,
1616        PartialOrd,
1617        Ord,
1618        Serialize_repr,
1619        Deserialize_repr
1620    )]
1621    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1622    #[repr(u8)]
1623    pub enum EventType {
1624        Unknown = 0,
1625        Create = 1,
1626        Drop = 2,
1627        Alter = 3,
1628        Grant = 4,
1629        Revoke = 5,
1630        Comment = 6,
1631    }
1632
1633    #[derive(
1634        Clone,
1635        Copy,
1636        Debug,
1637        PartialEq,
1638        Eq,
1639        Hash,
1640        PartialOrd,
1641        Ord,
1642        Serialize_repr,
1643        Deserialize_repr
1644    )]
1645    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1646    #[repr(u8)]
1647    pub enum ObjectType {
1648        Unknown = 0,
1649        Cluster = 1,
1650        ClusterReplica = 2,
1651        Connection = 3,
1652        Database = 4,
1653        Func = 5,
1654        Index = 6,
1655        MaterializedView = 7,
1656        Role = 8,
1657        Secret = 9,
1658        Schema = 10,
1659        Sink = 11,
1660        Source = 12,
1661        Table = 13,
1662        Type = 14,
1663        View = 15,
1664        System = 16,
1665        ContinualTask = 17,
1666        NetworkPolicy = 18,
1667    }
1668
1669    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1670    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1671    pub enum Details {
1672        CreateClusterReplicaV1(CreateClusterReplicaV1),
1673        CreateClusterReplicaV2(CreateClusterReplicaV2),
1674        CreateClusterReplicaV3(CreateClusterReplicaV3),
1675        CreateClusterReplicaV4(CreateClusterReplicaV4),
1676        DropClusterReplicaV1(DropClusterReplicaV1),
1677        DropClusterReplicaV2(DropClusterReplicaV2),
1678        DropClusterReplicaV3(DropClusterReplicaV3),
1679        CreateSourceSinkV1(CreateSourceSinkV1),
1680        CreateSourceSinkV2(CreateSourceSinkV2),
1681        AlterSourceSinkV1(AlterSourceSinkV1),
1682        AlterSetClusterV1(AlterSetClusterV1),
1683        GrantRoleV1(GrantRoleV1),
1684        GrantRoleV2(GrantRoleV2),
1685        RevokeRoleV1(RevokeRoleV1),
1686        RevokeRoleV2(RevokeRoleV2),
1687        UpdatePrivilegeV1(UpdatePrivilegeV1),
1688        AlterDefaultPrivilegeV1(AlterDefaultPrivilegeV1),
1689        UpdateOwnerV1(UpdateOwnerV1),
1690        IdFullNameV1(IdFullNameV1),
1691        RenameClusterV1(RenameClusterV1),
1692        RenameClusterReplicaV1(RenameClusterReplicaV1),
1693        RenameItemV1(RenameItemV1),
1694        IdNameV1(IdNameV1),
1695        SchemaV1(SchemaV1),
1696        SchemaV2(SchemaV2),
1697        RenameSchemaV1(RenameSchemaV1),
1698        UpdateItemV1(UpdateItemV1),
1699        CreateSourceSinkV3(CreateSourceSinkV3),
1700        AlterRetainHistoryV1(AlterRetainHistoryV1),
1701        ToNewIdV1(ToNewIdV1),
1702        FromPreviousIdV1(FromPreviousIdV1),
1703        SetV1(SetV1),
1704        ResetAllV1(Empty),
1705        RotateKeysV1(RotateKeysV1),
1706        CreateSourceSinkV4(CreateSourceSinkV4),
1707        CreateIndexV1(CreateIndexV1),
1708        CreateMaterializedViewV1(CreateMaterializedViewV1),
1709        AlterApplyReplacementV1(AlterApplyReplacementV1),
1710        CreateRoleV1(CreateRoleV1),
1711    }
1712}
1713
1714/// The contents of a single state update.
1715#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1716#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1717// Serialize the top-level enum in the persist-backed catalog as internally tagged to set up
1718// persist pushdown statistics for success.
1719#[serde(tag = "kind")]
1720pub enum StateUpdateKind {
1721    AuditLog(AuditLog),
1722    Cluster(Cluster),
1723    ClusterIntrospectionSourceIndex(ClusterIntrospectionSourceIndex),
1724    ClusterReplica(ClusterReplica),
1725    Comment(Comment),
1726    Config(Config),
1727    Database(Database),
1728    DefaultPrivileges(DefaultPrivileges),
1729    FenceToken(FenceToken),
1730    GidMapping(GidMapping),
1731    IdAlloc(IdAlloc),
1732    Item(Item),
1733    NetworkPolicy(NetworkPolicy),
1734    Role(Role),
1735    RoleAuth(RoleAuth),
1736    Schema(Schema),
1737    ServerConfiguration(ServerConfiguration),
1738    Setting(Setting),
1739    SourceReferences(SourceReferences),
1740    StorageCollectionMetadata(StorageCollectionMetadata),
1741    SystemPrivileges(SystemPrivileges),
1742    TxnWalShard(TxnWalShard),
1743    UnfinalizedShard(UnfinalizedShard),
1744}
1745
1746#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1747#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1748pub struct AuditLog {
1749    pub key: AuditLogKey,
1750}
1751
1752#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1753#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1754pub struct Cluster {
1755    pub key: ClusterKey,
1756    pub value: ClusterValue,
1757}
1758
1759#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1760#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1761pub struct ClusterReplica {
1762    pub key: ClusterReplicaKey,
1763    pub value: ClusterReplicaValue,
1764}
1765
1766#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1767#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1768pub struct Comment {
1769    pub key: CommentKey,
1770    pub value: CommentValue,
1771}
1772
1773#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1774#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1775pub struct Config {
1776    pub key: ConfigKey,
1777    pub value: ConfigValue,
1778}
1779
1780#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1781#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1782pub struct Database {
1783    pub key: DatabaseKey,
1784    pub value: DatabaseValue,
1785}
1786
1787#[derive(
1788    Clone,
1789    Copy,
1790    Debug,
1791    PartialEq,
1792    Eq,
1793    PartialOrd,
1794    Ord,
1795    Serialize,
1796    Deserialize
1797)]
1798#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1799pub struct DefaultPrivileges {
1800    pub key: DefaultPrivilegesKey,
1801    pub value: DefaultPrivilegesValue,
1802}
1803
1804#[derive(
1805    Clone,
1806    Copy,
1807    Debug,
1808    PartialEq,
1809    Eq,
1810    PartialOrd,
1811    Ord,
1812    Serialize,
1813    Deserialize
1814)]
1815#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1816pub struct FenceToken {
1817    pub deploy_generation: u64,
1818    pub epoch: i64,
1819}
1820
1821#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1822#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1823pub struct IdAlloc {
1824    pub key: IdAllocKey,
1825    pub value: IdAllocValue,
1826}
1827
1828#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1829#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1830pub struct ClusterIntrospectionSourceIndex {
1831    pub key: ClusterIntrospectionSourceIndexKey,
1832    pub value: ClusterIntrospectionSourceIndexValue,
1833}
1834
1835#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1836#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1837pub struct Item {
1838    pub key: ItemKey,
1839    pub value: ItemValue,
1840}
1841
1842#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1843#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1844pub struct Role {
1845    pub key: RoleKey,
1846    pub value: RoleValue,
1847}
1848
1849#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1850#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1851pub struct RoleAuth {
1852    pub key: RoleAuthKey,
1853    pub value: RoleAuthValue,
1854}
1855
1856#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1857#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1858pub struct NetworkPolicy {
1859    pub key: NetworkPolicyKey,
1860    pub value: NetworkPolicyValue,
1861}
1862
1863#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1864#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1865pub struct Schema {
1866    pub key: SchemaKey,
1867    pub value: SchemaValue,
1868}
1869
1870#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1871#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1872pub struct Setting {
1873    pub key: SettingKey,
1874    pub value: SettingValue,
1875}
1876
1877#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1878#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1879pub struct ServerConfiguration {
1880    pub key: ServerConfigurationKey,
1881    pub value: ServerConfigurationValue,
1882}
1883
1884#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1885#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1886pub struct SourceReferences {
1887    pub key: SourceReferencesKey,
1888    pub value: SourceReferencesValue,
1889}
1890
1891#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1892#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1893pub struct GidMapping {
1894    pub key: GidMappingKey,
1895    pub value: GidMappingValue,
1896}
1897
1898#[derive(
1899    Clone,
1900    Copy,
1901    Debug,
1902    PartialEq,
1903    Eq,
1904    PartialOrd,
1905    Ord,
1906    Serialize,
1907    Deserialize
1908)]
1909#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1910pub struct SystemPrivileges {
1911    pub key: SystemPrivilegesKey,
1912    pub value: SystemPrivilegesValue,
1913}
1914
1915#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1916#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1917pub struct StorageCollectionMetadata {
1918    pub key: StorageCollectionMetadataKey,
1919    pub value: StorageCollectionMetadataValue,
1920}
1921
1922#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1923#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1924pub struct UnfinalizedShard {
1925    pub key: UnfinalizedShardKey,
1926}
1927
1928#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1929#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1930pub struct TxnWalShard {
1931    pub value: TxnWalShardValue,
1932}
1933
1934#[derive(
1935    Clone,
1936    Copy,
1937    Debug,
1938    PartialEq,
1939    Eq,
1940    Hash,
1941    PartialOrd,
1942    Ord,
1943    Serialize_repr,
1944    Deserialize_repr
1945)]
1946#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1947#[repr(u8)]
1948pub enum CatalogItemType {
1949    Unknown = 0,
1950    Table = 1,
1951    Source = 2,
1952    Sink = 3,
1953    View = 4,
1954    MaterializedView = 5,
1955    Index = 6,
1956    Type = 7,
1957    Func = 8,
1958    Secret = 9,
1959    Connection = 10,
1960}
1961
1962#[derive(
1963    Clone,
1964    Copy,
1965    Debug,
1966    PartialEq,
1967    Eq,
1968    Hash,
1969    PartialOrd,
1970    Ord,
1971    Serialize_repr,
1972    Deserialize_repr
1973)]
1974#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1975#[repr(u8)]
1976pub enum ObjectType {
1977    Unknown = 0,
1978    Table = 1,
1979    View = 2,
1980    MaterializedView = 3,
1981    Source = 4,
1982    Sink = 5,
1983    Index = 6,
1984    Type = 7,
1985    Role = 8,
1986    Cluster = 9,
1987    ClusterReplica = 10,
1988    Secret = 11,
1989    Connection = 12,
1990    Database = 13,
1991    Schema = 14,
1992    Func = 15,
1993    NetworkPolicy = 17,
1994}