Skip to main content

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