Skip to main content

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