Skip to main content

mz_catalog_protos/
objects_v79.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 struct RoleAttributes {
968    pub inherit: bool,
969    pub superuser: Option<bool>,
970    pub login: Option<bool>,
971}
972
973#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
974#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
975pub struct RoleMembership {
976    pub map: Vec<RoleMembershipEntry>,
977}
978
979#[derive(
980    Clone,
981    Copy,
982    Debug,
983    PartialEq,
984    Eq,
985    PartialOrd,
986    Ord,
987    Serialize,
988    Deserialize
989)]
990#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
991pub struct RoleMembershipEntry {
992    pub key: RoleId,
993    pub value: RoleId,
994}
995
996#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
997#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
998pub struct RoleVars {
999    pub entries: Vec<RoleVarsEntry>,
1000}
1001
1002#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1003#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1004pub struct RoleVarsEntry {
1005    pub key: String,
1006    pub val: RoleVar,
1007}
1008
1009#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1010#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1011pub enum RoleVar {
1012    Flat(String),
1013    SqlSet(Vec<String>),
1014}
1015
1016#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1017#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1018pub struct NetworkPolicyRule {
1019    pub name: String,
1020    pub address: String,
1021    pub action: NetworkPolicyRuleAction,
1022    pub direction: NetworkPolicyRuleDirection,
1023}
1024
1025#[derive(
1026    Clone,
1027    Copy,
1028    Debug,
1029    PartialEq,
1030    Eq,
1031    PartialOrd,
1032    Ord,
1033    Serialize,
1034    Deserialize
1035)]
1036#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1037pub enum NetworkPolicyRuleAction {
1038    Allow,
1039}
1040
1041#[derive(
1042    Clone,
1043    Copy,
1044    Debug,
1045    PartialEq,
1046    Eq,
1047    PartialOrd,
1048    Ord,
1049    Serialize,
1050    Deserialize
1051)]
1052#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1053pub enum NetworkPolicyRuleDirection {
1054    Ingress,
1055}
1056
1057#[derive(
1058    Clone,
1059    Copy,
1060    Debug,
1061    PartialEq,
1062    Eq,
1063    PartialOrd,
1064    Ord,
1065    Serialize,
1066    Deserialize
1067)]
1068#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1069pub struct AclMode {
1070    pub bitflags: u64,
1071}
1072
1073#[derive(
1074    Clone,
1075    Copy,
1076    Debug,
1077    PartialEq,
1078    Eq,
1079    PartialOrd,
1080    Ord,
1081    Serialize,
1082    Deserialize
1083)]
1084#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1085pub struct MzAclItem {
1086    pub grantee: RoleId,
1087    pub grantor: RoleId,
1088    pub acl_mode: AclMode,
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 DefaultPrivilegesKey {
1104    pub role_id: RoleId,
1105    pub database_id: Option<DatabaseId>,
1106    pub schema_id: Option<SchemaId>,
1107    pub object_type: ObjectType,
1108    pub grantee: RoleId,
1109}
1110
1111#[derive(
1112    Clone,
1113    Copy,
1114    Debug,
1115    PartialEq,
1116    Eq,
1117    PartialOrd,
1118    Ord,
1119    Serialize,
1120    Deserialize
1121)]
1122#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1123pub struct DefaultPrivilegesValue {
1124    pub privileges: AclMode,
1125}
1126
1127#[derive(
1128    Clone,
1129    Copy,
1130    Debug,
1131    PartialEq,
1132    Eq,
1133    PartialOrd,
1134    Ord,
1135    Serialize,
1136    Deserialize
1137)]
1138#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1139pub struct SystemPrivilegesKey {
1140    pub grantee: RoleId,
1141    pub grantor: RoleId,
1142}
1143
1144#[derive(
1145    Clone,
1146    Copy,
1147    Debug,
1148    PartialEq,
1149    Eq,
1150    PartialOrd,
1151    Ord,
1152    Serialize,
1153    Deserialize
1154)]
1155#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1156pub struct SystemPrivilegesValue {
1157    pub acl_mode: AclMode,
1158}
1159
1160#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1161#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1162pub struct AuditLogEventV1 {
1163    pub id: u64,
1164    pub event_type: audit_log_event_v1::EventType,
1165    pub object_type: audit_log_event_v1::ObjectType,
1166    pub user: Option<StringWrapper>,
1167    pub occurred_at: EpochMillis,
1168    pub details: audit_log_event_v1::Details,
1169}
1170
1171pub mod audit_log_event_v1 {
1172    use super::*;
1173
1174    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1175    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1176    pub struct IdFullNameV1 {
1177        pub id: String,
1178        pub name: FullNameV1,
1179    }
1180
1181    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1182    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1183    pub struct FullNameV1 {
1184        pub database: String,
1185        pub schema: String,
1186        pub item: String,
1187    }
1188
1189    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1190    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1191    pub struct IdNameV1 {
1192        pub id: String,
1193        pub name: String,
1194    }
1195
1196    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1197    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1198    pub struct RenameClusterV1 {
1199        pub id: String,
1200        pub old_name: String,
1201        pub new_name: String,
1202    }
1203
1204    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1205    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1206    pub struct RenameClusterReplicaV1 {
1207        pub cluster_id: String,
1208        pub replica_id: String,
1209        pub old_name: String,
1210        pub new_name: String,
1211    }
1212
1213    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1214    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1215    pub struct RenameItemV1 {
1216        pub id: String,
1217        pub old_name: FullNameV1,
1218        pub new_name: FullNameV1,
1219    }
1220
1221    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1222    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1223    pub struct CreateClusterReplicaV1 {
1224        pub cluster_id: String,
1225        pub cluster_name: String,
1226        pub replica_id: Option<StringWrapper>,
1227        pub replica_name: String,
1228        pub logical_size: String,
1229        pub disk: bool,
1230        pub billed_as: Option<String>,
1231        pub internal: bool,
1232    }
1233
1234    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1235    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1236    pub struct CreateClusterReplicaV2 {
1237        pub cluster_id: String,
1238        pub cluster_name: String,
1239        pub replica_id: Option<StringWrapper>,
1240        pub replica_name: String,
1241        pub logical_size: String,
1242        pub disk: bool,
1243        pub billed_as: Option<String>,
1244        pub internal: bool,
1245        pub reason: CreateOrDropClusterReplicaReasonV1,
1246        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1247    }
1248
1249    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1250    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1251    pub struct CreateClusterReplicaV3 {
1252        pub cluster_id: String,
1253        pub cluster_name: String,
1254        pub replica_id: Option<StringWrapper>,
1255        pub replica_name: String,
1256        pub logical_size: String,
1257        pub disk: bool,
1258        pub billed_as: Option<String>,
1259        pub internal: bool,
1260        pub reason: CreateOrDropClusterReplicaReasonV1,
1261        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1262    }
1263
1264    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1265    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1266    pub struct CreateClusterReplicaV4 {
1267        pub cluster_id: String,
1268        pub cluster_name: String,
1269        pub replica_id: Option<StringWrapper>,
1270        pub replica_name: String,
1271        pub logical_size: String,
1272        pub billed_as: Option<String>,
1273        pub internal: bool,
1274        pub reason: CreateOrDropClusterReplicaReasonV1,
1275        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1276    }
1277
1278    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1279    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1280    pub struct DropClusterReplicaV1 {
1281        pub cluster_id: String,
1282        pub cluster_name: String,
1283        pub replica_id: Option<StringWrapper>,
1284        pub replica_name: String,
1285    }
1286
1287    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1288    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1289    pub struct DropClusterReplicaV2 {
1290        pub cluster_id: String,
1291        pub cluster_name: String,
1292        pub replica_id: Option<StringWrapper>,
1293        pub replica_name: String,
1294        pub reason: CreateOrDropClusterReplicaReasonV1,
1295        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1296    }
1297
1298    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1299    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1300    pub struct DropClusterReplicaV3 {
1301        pub cluster_id: String,
1302        pub cluster_name: String,
1303        pub replica_id: Option<StringWrapper>,
1304        pub replica_name: String,
1305        pub reason: CreateOrDropClusterReplicaReasonV1,
1306        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1307    }
1308
1309    #[derive(
1310        Clone,
1311        Copy,
1312        Debug,
1313        PartialEq,
1314        Eq,
1315        PartialOrd,
1316        Ord,
1317        Serialize,
1318        Deserialize
1319    )]
1320    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1321    pub struct CreateOrDropClusterReplicaReasonV1 {
1322        pub reason: CreateOrDropClusterReplicaReasonV1Reason,
1323    }
1324
1325    #[derive(
1326        Clone,
1327        Copy,
1328        Debug,
1329        PartialEq,
1330        Eq,
1331        PartialOrd,
1332        Ord,
1333        Serialize,
1334        Deserialize
1335    )]
1336    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1337    pub enum CreateOrDropClusterReplicaReasonV1Reason {
1338        Manual(Empty),
1339        Schedule(Empty),
1340        System(Empty),
1341    }
1342
1343    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1344    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1345    pub struct SchedulingDecisionsWithReasonsV1 {
1346        pub on_refresh: RefreshDecisionWithReasonV1,
1347    }
1348
1349    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1350    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1351    pub struct SchedulingDecisionsWithReasonsV2 {
1352        pub on_refresh: RefreshDecisionWithReasonV2,
1353    }
1354
1355    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1356    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1357    pub enum RefreshDecision {
1358        On(Empty),
1359        Off(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 RefreshDecisionWithReasonV1 {
1365        pub objects_needing_refresh: Vec<String>,
1366        pub rehydration_time_estimate: String,
1367        pub decision: RefreshDecision,
1368    }
1369
1370    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1371    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1372    pub struct RefreshDecisionWithReasonV2 {
1373        pub objects_needing_refresh: Vec<String>,
1374        pub objects_needing_compaction: Vec<String>,
1375        pub rehydration_time_estimate: String,
1376        pub decision: RefreshDecision,
1377    }
1378
1379    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1380    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1381    pub struct CreateSourceSinkV1 {
1382        pub id: String,
1383        pub name: FullNameV1,
1384        pub size: Option<StringWrapper>,
1385    }
1386
1387    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1388    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1389    pub struct CreateSourceSinkV2 {
1390        pub id: String,
1391        pub name: FullNameV1,
1392        pub size: Option<StringWrapper>,
1393        pub external_type: String,
1394    }
1395
1396    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1397    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1398    pub struct CreateSourceSinkV3 {
1399        pub id: String,
1400        pub name: FullNameV1,
1401        pub external_type: String,
1402    }
1403
1404    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1405    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1406    pub struct CreateSourceSinkV4 {
1407        pub id: String,
1408        pub cluster_id: Option<StringWrapper>,
1409        pub name: FullNameV1,
1410        pub external_type: String,
1411    }
1412
1413    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1414    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1415    pub struct CreateIndexV1 {
1416        pub id: String,
1417        pub cluster_id: String,
1418        pub name: FullNameV1,
1419    }
1420
1421    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1422    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1423    pub struct CreateMaterializedViewV1 {
1424        pub id: String,
1425        pub cluster_id: String,
1426        pub name: FullNameV1,
1427    }
1428
1429    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1430    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1431    pub struct AlterSourceSinkV1 {
1432        pub id: String,
1433        pub name: FullNameV1,
1434        pub old_size: Option<StringWrapper>,
1435        pub new_size: Option<StringWrapper>,
1436    }
1437
1438    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1439    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1440    pub struct AlterSetClusterV1 {
1441        pub id: String,
1442        pub name: FullNameV1,
1443        pub old_cluster: Option<StringWrapper>,
1444        pub new_cluster: Option<StringWrapper>,
1445    }
1446
1447    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1448    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1449    pub struct GrantRoleV1 {
1450        pub role_id: String,
1451        pub member_id: String,
1452        pub grantor_id: String,
1453    }
1454
1455    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1456    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1457    pub struct GrantRoleV2 {
1458        pub role_id: String,
1459        pub member_id: String,
1460        pub grantor_id: String,
1461        pub executed_by: String,
1462    }
1463
1464    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1465    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1466    pub struct RevokeRoleV1 {
1467        pub role_id: String,
1468        pub member_id: String,
1469    }
1470
1471    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1472    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1473    pub struct RevokeRoleV2 {
1474        pub role_id: String,
1475        pub member_id: String,
1476        pub grantor_id: String,
1477        pub executed_by: String,
1478    }
1479
1480    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1481    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1482    pub struct UpdatePrivilegeV1 {
1483        pub object_id: String,
1484        pub grantee_id: String,
1485        pub grantor_id: String,
1486        pub privileges: String,
1487    }
1488
1489    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1490    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1491    pub struct AlterDefaultPrivilegeV1 {
1492        pub role_id: String,
1493        pub database_id: Option<StringWrapper>,
1494        pub schema_id: Option<StringWrapper>,
1495        pub grantee_id: String,
1496        pub privileges: String,
1497    }
1498
1499    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1500    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1501    pub struct UpdateOwnerV1 {
1502        pub object_id: String,
1503        pub old_owner_id: String,
1504        pub new_owner_id: String,
1505    }
1506
1507    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1508    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1509    pub struct SchemaV1 {
1510        pub id: String,
1511        pub name: String,
1512        pub database_name: 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 SchemaV2 {
1518        pub id: String,
1519        pub name: String,
1520        pub database_name: Option<StringWrapper>,
1521    }
1522
1523    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1524    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1525    pub struct RenameSchemaV1 {
1526        pub id: String,
1527        pub database_name: Option<String>,
1528        pub old_name: String,
1529        pub new_name: String,
1530    }
1531
1532    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1533    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1534    pub struct UpdateItemV1 {
1535        pub id: String,
1536        pub name: FullNameV1,
1537    }
1538
1539    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1540    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1541    pub struct AlterRetainHistoryV1 {
1542        pub id: String,
1543        pub old_history: Option<String>,
1544        pub new_history: Option<String>,
1545    }
1546
1547    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1548    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1549    pub struct ToNewIdV1 {
1550        pub id: String,
1551        pub new_id: String,
1552    }
1553
1554    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1555    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1556    pub struct FromPreviousIdV1 {
1557        pub id: String,
1558        pub previous_id: String,
1559    }
1560
1561    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1562    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1563    pub struct SetV1 {
1564        pub name: String,
1565        pub value: Option<String>,
1566    }
1567
1568    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1569    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1570    pub struct RotateKeysV1 {
1571        pub id: String,
1572        pub name: String,
1573    }
1574
1575    #[derive(
1576        Clone,
1577        Copy,
1578        Debug,
1579        PartialEq,
1580        Eq,
1581        Hash,
1582        PartialOrd,
1583        Ord,
1584        Serialize_repr,
1585        Deserialize_repr
1586    )]
1587    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1588    #[repr(u8)]
1589    pub enum EventType {
1590        Unknown = 0,
1591        Create = 1,
1592        Drop = 2,
1593        Alter = 3,
1594        Grant = 4,
1595        Revoke = 5,
1596        Comment = 6,
1597    }
1598
1599    #[derive(
1600        Clone,
1601        Copy,
1602        Debug,
1603        PartialEq,
1604        Eq,
1605        Hash,
1606        PartialOrd,
1607        Ord,
1608        Serialize_repr,
1609        Deserialize_repr
1610    )]
1611    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1612    #[repr(u8)]
1613    pub enum ObjectType {
1614        Unknown = 0,
1615        Cluster = 1,
1616        ClusterReplica = 2,
1617        Connection = 3,
1618        Database = 4,
1619        Func = 5,
1620        Index = 6,
1621        MaterializedView = 7,
1622        Role = 8,
1623        Secret = 9,
1624        Schema = 10,
1625        Sink = 11,
1626        Source = 12,
1627        Table = 13,
1628        Type = 14,
1629        View = 15,
1630        System = 16,
1631        ContinualTask = 17,
1632        NetworkPolicy = 18,
1633    }
1634
1635    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1636    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1637    pub enum Details {
1638        CreateClusterReplicaV1(CreateClusterReplicaV1),
1639        CreateClusterReplicaV2(CreateClusterReplicaV2),
1640        CreateClusterReplicaV3(CreateClusterReplicaV3),
1641        CreateClusterReplicaV4(CreateClusterReplicaV4),
1642        DropClusterReplicaV1(DropClusterReplicaV1),
1643        DropClusterReplicaV2(DropClusterReplicaV2),
1644        DropClusterReplicaV3(DropClusterReplicaV3),
1645        CreateSourceSinkV1(CreateSourceSinkV1),
1646        CreateSourceSinkV2(CreateSourceSinkV2),
1647        AlterSourceSinkV1(AlterSourceSinkV1),
1648        AlterSetClusterV1(AlterSetClusterV1),
1649        GrantRoleV1(GrantRoleV1),
1650        GrantRoleV2(GrantRoleV2),
1651        RevokeRoleV1(RevokeRoleV1),
1652        RevokeRoleV2(RevokeRoleV2),
1653        UpdatePrivilegeV1(UpdatePrivilegeV1),
1654        AlterDefaultPrivilegeV1(AlterDefaultPrivilegeV1),
1655        UpdateOwnerV1(UpdateOwnerV1),
1656        IdFullNameV1(IdFullNameV1),
1657        RenameClusterV1(RenameClusterV1),
1658        RenameClusterReplicaV1(RenameClusterReplicaV1),
1659        RenameItemV1(RenameItemV1),
1660        IdNameV1(IdNameV1),
1661        SchemaV1(SchemaV1),
1662        SchemaV2(SchemaV2),
1663        RenameSchemaV1(RenameSchemaV1),
1664        UpdateItemV1(UpdateItemV1),
1665        CreateSourceSinkV3(CreateSourceSinkV3),
1666        AlterRetainHistoryV1(AlterRetainHistoryV1),
1667        ToNewIdV1(ToNewIdV1),
1668        FromPreviousIdV1(FromPreviousIdV1),
1669        SetV1(SetV1),
1670        ResetAllV1(Empty),
1671        RotateKeysV1(RotateKeysV1),
1672        CreateSourceSinkV4(CreateSourceSinkV4),
1673        CreateIndexV1(CreateIndexV1),
1674        CreateMaterializedViewV1(CreateMaterializedViewV1),
1675    }
1676}
1677
1678/// The contents of a single state update.
1679#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1680#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1681// Serialize the top-level enum in the persist-backed catalog as internally tagged to set up
1682// persist pushdown statistics for success.
1683#[serde(tag = "kind")]
1684pub enum StateUpdateKind {
1685    AuditLog(AuditLog),
1686    Cluster(Cluster),
1687    ClusterIntrospectionSourceIndex(ClusterIntrospectionSourceIndex),
1688    ClusterReplica(ClusterReplica),
1689    Comment(Comment),
1690    Config(Config),
1691    Database(Database),
1692    DefaultPrivileges(DefaultPrivileges),
1693    FenceToken(FenceToken),
1694    GidMapping(GidMapping),
1695    IdAlloc(IdAlloc),
1696    Item(Item),
1697    NetworkPolicy(NetworkPolicy),
1698    Role(Role),
1699    RoleAuth(RoleAuth),
1700    Schema(Schema),
1701    ServerConfiguration(ServerConfiguration),
1702    Setting(Setting),
1703    SourceReferences(SourceReferences),
1704    StorageCollectionMetadata(StorageCollectionMetadata),
1705    SystemPrivileges(SystemPrivileges),
1706    TxnWalShard(TxnWalShard),
1707    UnfinalizedShard(UnfinalizedShard),
1708}
1709
1710#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1711#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1712pub struct AuditLog {
1713    pub key: AuditLogKey,
1714}
1715
1716#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1717#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1718pub struct Cluster {
1719    pub key: ClusterKey,
1720    pub value: ClusterValue,
1721}
1722
1723#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1724#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1725pub struct ClusterReplica {
1726    pub key: ClusterReplicaKey,
1727    pub value: ClusterReplicaValue,
1728}
1729
1730#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1731#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1732pub struct Comment {
1733    pub key: CommentKey,
1734    pub value: CommentValue,
1735}
1736
1737#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1738#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1739pub struct Config {
1740    pub key: ConfigKey,
1741    pub value: ConfigValue,
1742}
1743
1744#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1745#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1746pub struct Database {
1747    pub key: DatabaseKey,
1748    pub value: DatabaseValue,
1749}
1750
1751#[derive(
1752    Clone,
1753    Copy,
1754    Debug,
1755    PartialEq,
1756    Eq,
1757    PartialOrd,
1758    Ord,
1759    Serialize,
1760    Deserialize
1761)]
1762#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1763pub struct DefaultPrivileges {
1764    pub key: DefaultPrivilegesKey,
1765    pub value: DefaultPrivilegesValue,
1766}
1767
1768#[derive(
1769    Clone,
1770    Copy,
1771    Debug,
1772    PartialEq,
1773    Eq,
1774    PartialOrd,
1775    Ord,
1776    Serialize,
1777    Deserialize
1778)]
1779#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1780pub struct FenceToken {
1781    pub deploy_generation: u64,
1782    pub epoch: i64,
1783}
1784
1785#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1786#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1787pub struct IdAlloc {
1788    pub key: IdAllocKey,
1789    pub value: IdAllocValue,
1790}
1791
1792#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1793#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1794pub struct ClusterIntrospectionSourceIndex {
1795    pub key: ClusterIntrospectionSourceIndexKey,
1796    pub value: ClusterIntrospectionSourceIndexValue,
1797}
1798
1799#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1800#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1801pub struct Item {
1802    pub key: ItemKey,
1803    pub value: ItemValue,
1804}
1805
1806#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1807#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1808pub struct Role {
1809    pub key: RoleKey,
1810    pub value: RoleValue,
1811}
1812
1813#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1814#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1815pub struct RoleAuth {
1816    pub key: RoleAuthKey,
1817    pub value: RoleAuthValue,
1818}
1819
1820#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1821#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1822pub struct NetworkPolicy {
1823    pub key: NetworkPolicyKey,
1824    pub value: NetworkPolicyValue,
1825}
1826
1827#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1828#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1829pub struct Schema {
1830    pub key: SchemaKey,
1831    pub value: SchemaValue,
1832}
1833
1834#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1835#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1836pub struct Setting {
1837    pub key: SettingKey,
1838    pub value: SettingValue,
1839}
1840
1841#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1842#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1843pub struct ServerConfiguration {
1844    pub key: ServerConfigurationKey,
1845    pub value: ServerConfigurationValue,
1846}
1847
1848#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1849#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1850pub struct SourceReferences {
1851    pub key: SourceReferencesKey,
1852    pub value: SourceReferencesValue,
1853}
1854
1855#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1856#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1857pub struct GidMapping {
1858    pub key: GidMappingKey,
1859    pub value: GidMappingValue,
1860}
1861
1862#[derive(
1863    Clone,
1864    Copy,
1865    Debug,
1866    PartialEq,
1867    Eq,
1868    PartialOrd,
1869    Ord,
1870    Serialize,
1871    Deserialize
1872)]
1873#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1874pub struct SystemPrivileges {
1875    pub key: SystemPrivilegesKey,
1876    pub value: SystemPrivilegesValue,
1877}
1878
1879#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1880#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1881pub struct StorageCollectionMetadata {
1882    pub key: StorageCollectionMetadataKey,
1883    pub value: StorageCollectionMetadataValue,
1884}
1885
1886#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1887#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1888pub struct UnfinalizedShard {
1889    pub key: UnfinalizedShardKey,
1890}
1891
1892#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1893#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1894pub struct TxnWalShard {
1895    pub value: TxnWalShardValue,
1896}
1897
1898#[derive(
1899    Clone,
1900    Copy,
1901    Debug,
1902    PartialEq,
1903    Eq,
1904    Hash,
1905    PartialOrd,
1906    Ord,
1907    Serialize_repr,
1908    Deserialize_repr
1909)]
1910#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1911#[repr(u8)]
1912pub enum CatalogItemType {
1913    Unknown = 0,
1914    Table = 1,
1915    Source = 2,
1916    Sink = 3,
1917    View = 4,
1918    MaterializedView = 5,
1919    Index = 6,
1920    Type = 7,
1921    Func = 8,
1922    Secret = 9,
1923    Connection = 10,
1924    ContinualTask = 11,
1925}
1926
1927#[derive(
1928    Clone,
1929    Copy,
1930    Debug,
1931    PartialEq,
1932    Eq,
1933    Hash,
1934    PartialOrd,
1935    Ord,
1936    Serialize_repr,
1937    Deserialize_repr
1938)]
1939#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1940#[repr(u8)]
1941pub enum ObjectType {
1942    Unknown = 0,
1943    Table = 1,
1944    View = 2,
1945    MaterializedView = 3,
1946    Source = 4,
1947    Sink = 5,
1948    Index = 6,
1949    Type = 7,
1950    Role = 8,
1951    Cluster = 9,
1952    ClusterReplica = 10,
1953    Secret = 11,
1954    Connection = 12,
1955    Database = 13,
1956    Schema = 14,
1957    Func = 15,
1958    ContinualTask = 16,
1959    NetworkPolicy = 17,
1960}