Skip to main content

mz_catalog_protos/
objects_v88.rs

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