Skip to main content

mz_catalog_protos/
objects_v95.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 ClusterReplicaSizeKey {
437    pub id: ClusterReplicaSizeId,
438}
439
440#[derive(
441    Clone,
442    Copy,
443    Debug,
444    PartialEq,
445    Eq,
446    PartialOrd,
447    Ord,
448    Serialize,
449    Deserialize
450)]
451#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
452pub enum ClusterReplicaSizeId {
453    System(u64),
454    User(u64),
455}
456
457#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
458#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
459pub struct ClusterReplicaSizeValue {
460    /// The human-readable name of the size.
461    pub name: String,
462    /// The memory limit for each process, in bytes.
463    pub memory_limit: Option<u64>,
464    /// The CPU limit for each process, in nanocpus.
465    pub cpu_limit: Option<u64>,
466    /// The CPU request for each process, in nanocpus.
467    pub cpu_request: Option<u64>,
468    /// The disk limit for each process, in bytes.
469    pub disk_limit: Option<u64>,
470    /// The number of processes in the replica.
471    pub scale: u16,
472    /// The number of worker threads per process.
473    pub workers: u64,
474    /// The number of credits per hour that the replica consumes.
475    pub credits_per_hour: String,
476    /// Whether each process has exclusive access to its CPU cores.
477    pub cpu_exclusive: bool,
478    /// Whether this size represents a modern "cc" size rather than a legacy T-shirt size.
479    pub is_cc: bool,
480    /// The size family, e.g. `D` for `D.1-xsmall`.
481    pub family: Option<String>,
482    /// Whether instances of this type use swap as the spill-to-disk mechanism.
483    pub swap_enabled: bool,
484    /// Whether instances of this type can be created.
485    pub disabled: bool,
486    /// Additional node selectors.
487    pub selectors: std::collections::BTreeMap<String, String>,
488}
489
490#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
491#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
492pub struct ServerConfigurationKey {
493    pub name: String,
494}
495
496#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
497#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
498pub struct ServerConfigurationValue {
499    pub value: String,
500}
501
502#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
503#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
504pub struct ClusterSystemConfigurationKey {
505    pub cluster_id: ClusterId,
506    pub name: String,
507}
508
509#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
510#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
511pub struct ClusterSystemConfigurationValue {
512    pub value: String,
513}
514
515#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
516#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
517pub struct ReplicaSystemConfigurationKey {
518    pub replica_id: ReplicaId,
519    pub name: String,
520}
521
522#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
523#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
524pub struct ReplicaSystemConfigurationValue {
525    pub value: String,
526}
527
528#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
529#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
530pub struct AuditLogKey {
531    pub event: AuditLogEvent,
532}
533
534#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
535#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
536pub enum AuditLogEvent {
537    V1(AuditLogEventV1),
538}
539
540#[derive(
541    Clone,
542    Copy,
543    Debug,
544    PartialEq,
545    Eq,
546    PartialOrd,
547    Ord,
548    Serialize,
549    Deserialize
550)]
551#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
552pub struct CommentKey {
553    pub object: CommentObject,
554    pub sub_component: Option<CommentSubComponent>,
555}
556
557#[derive(
558    Clone,
559    Copy,
560    Debug,
561    PartialEq,
562    Eq,
563    PartialOrd,
564    Ord,
565    Serialize,
566    Deserialize
567)]
568#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
569pub enum CommentObject {
570    Table(CatalogItemId),
571    View(CatalogItemId),
572    MaterializedView(CatalogItemId),
573    Source(CatalogItemId),
574    Sink(CatalogItemId),
575    MetricSink(CatalogItemId),
576    Index(CatalogItemId),
577    Func(CatalogItemId),
578    Connection(CatalogItemId),
579    Type(CatalogItemId),
580    Secret(CatalogItemId),
581    Role(RoleId),
582    Database(DatabaseId),
583    Schema(ResolvedSchema),
584    Cluster(ClusterId),
585    ClusterReplica(ClusterReplicaId),
586    NetworkPolicy(NetworkPolicyId),
587}
588
589#[derive(
590    Clone,
591    Copy,
592    Debug,
593    PartialEq,
594    Eq,
595    PartialOrd,
596    Ord,
597    Serialize,
598    Deserialize
599)]
600#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
601pub enum CommentSubComponent {
602    ColumnPos(u64),
603}
604
605#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
606#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
607pub struct CommentValue {
608    pub comment: String,
609}
610
611#[derive(
612    Clone,
613    Copy,
614    Debug,
615    PartialEq,
616    Eq,
617    PartialOrd,
618    Ord,
619    Serialize,
620    Deserialize
621)]
622#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
623pub struct SourceReferencesKey {
624    pub source: CatalogItemId,
625}
626
627#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
628#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
629pub struct SourceReferencesValue {
630    pub references: Vec<SourceReference>,
631    pub updated_at: EpochMillis,
632}
633
634#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
635#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
636pub struct SourceReference {
637    pub name: String,
638    pub namespace: Option<String>,
639    pub columns: Vec<String>,
640}
641
642#[derive(
643    Clone,
644    Copy,
645    Debug,
646    PartialEq,
647    Eq,
648    PartialOrd,
649    Ord,
650    Serialize,
651    Deserialize
652)]
653#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
654pub struct StorageCollectionMetadataKey {
655    pub id: GlobalId,
656}
657
658#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
659#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
660pub struct StorageCollectionMetadataValue {
661    pub shard: String,
662}
663
664#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
665#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
666pub struct UnfinalizedShardKey {
667    pub shard: String,
668}
669
670#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
671#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
672pub struct TxnWalShardValue {
673    pub shard: String,
674}
675
676#[derive(
677    Clone,
678    Copy,
679    Debug,
680    PartialEq,
681    Eq,
682    PartialOrd,
683    Ord,
684    Serialize,
685    Deserialize
686)]
687#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
688pub struct Empty {}
689
690#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
691#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
692pub struct StringWrapper {
693    pub inner: String,
694}
695
696#[derive(
697    Clone,
698    Copy,
699    Debug,
700    PartialEq,
701    Eq,
702    PartialOrd,
703    Ord,
704    Serialize,
705    Deserialize
706)]
707#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
708pub struct Duration {
709    pub secs: u64,
710    pub nanos: u32,
711}
712
713#[derive(
714    Clone,
715    Copy,
716    Debug,
717    PartialEq,
718    Eq,
719    PartialOrd,
720    Ord,
721    Serialize,
722    Deserialize
723)]
724#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
725pub struct EpochMillis {
726    pub millis: 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 struct Version {
742    pub value: u64,
743}
744
745#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
746#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
747pub enum CatalogItem {
748    V1(CatalogItemV1),
749}
750
751#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
752#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
753pub struct CatalogItemV1 {
754    pub create_sql: String,
755}
756
757#[derive(
758    Clone,
759    Copy,
760    Debug,
761    PartialEq,
762    Eq,
763    PartialOrd,
764    Ord,
765    Serialize,
766    Deserialize
767)]
768#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
769pub enum CatalogItemId {
770    System(u64),
771    User(u64),
772    Transient(u64),
773    IntrospectionSourceIndex(u64),
774}
775
776#[derive(
777    Clone,
778    Copy,
779    Debug,
780    PartialEq,
781    Eq,
782    PartialOrd,
783    Ord,
784    Serialize,
785    Deserialize
786)]
787#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
788pub struct SystemCatalogItemId(pub u64);
789
790#[derive(
791    Clone,
792    Copy,
793    Debug,
794    PartialEq,
795    Eq,
796    PartialOrd,
797    Ord,
798    Serialize,
799    Deserialize
800)]
801#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
802pub struct IntrospectionSourceIndexCatalogItemId(pub u64);
803
804#[derive(
805    Clone,
806    Copy,
807    Debug,
808    PartialEq,
809    Eq,
810    PartialOrd,
811    Ord,
812    Serialize,
813    Deserialize
814)]
815#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
816pub enum GlobalId {
817    System(u64),
818    User(u64),
819    Transient(u64),
820    Explain,
821    IntrospectionSourceIndex(u64),
822}
823
824#[derive(
825    Clone,
826    Copy,
827    Debug,
828    PartialEq,
829    Eq,
830    PartialOrd,
831    Ord,
832    Serialize,
833    Deserialize
834)]
835#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
836pub struct SystemGlobalId(pub u64);
837
838#[derive(
839    Clone,
840    Copy,
841    Debug,
842    PartialEq,
843    Eq,
844    PartialOrd,
845    Ord,
846    Serialize,
847    Deserialize
848)]
849#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
850pub struct IntrospectionSourceIndexGlobalId(pub u64);
851
852#[derive(
853    Clone,
854    Copy,
855    Debug,
856    PartialEq,
857    Eq,
858    PartialOrd,
859    Ord,
860    Serialize,
861    Deserialize
862)]
863#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
864pub enum ClusterId {
865    System(u64),
866    User(u64),
867}
868
869#[derive(
870    Clone,
871    Copy,
872    Debug,
873    PartialEq,
874    Eq,
875    PartialOrd,
876    Ord,
877    Serialize,
878    Deserialize
879)]
880#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
881pub enum DatabaseId {
882    System(u64),
883    User(u64),
884}
885
886#[derive(
887    Clone,
888    Copy,
889    Debug,
890    PartialEq,
891    Eq,
892    PartialOrd,
893    Ord,
894    Serialize,
895    Deserialize
896)]
897#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
898pub enum ResolvedDatabaseSpecifier {
899    Ambient,
900    Id(DatabaseId),
901}
902
903#[derive(
904    Clone,
905    Copy,
906    Debug,
907    PartialEq,
908    Eq,
909    PartialOrd,
910    Ord,
911    Serialize,
912    Deserialize
913)]
914#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
915pub enum SchemaId {
916    System(u64),
917    User(u64),
918}
919
920#[derive(
921    Clone,
922    Copy,
923    Debug,
924    PartialEq,
925    Eq,
926    PartialOrd,
927    Ord,
928    Serialize,
929    Deserialize
930)]
931#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
932pub enum SchemaSpecifier {
933    Temporary,
934    Id(SchemaId),
935}
936
937#[derive(
938    Clone,
939    Copy,
940    Debug,
941    PartialEq,
942    Eq,
943    PartialOrd,
944    Ord,
945    Serialize,
946    Deserialize
947)]
948#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
949pub struct ResolvedSchema {
950    pub database: ResolvedDatabaseSpecifier,
951    pub schema: SchemaSpecifier,
952}
953
954#[derive(
955    Clone,
956    Copy,
957    Debug,
958    PartialEq,
959    Eq,
960    PartialOrd,
961    Ord,
962    Serialize,
963    Deserialize
964)]
965#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
966pub enum ReplicaId {
967    System(u64),
968    User(u64),
969}
970
971#[derive(
972    Clone,
973    Copy,
974    Debug,
975    PartialEq,
976    Eq,
977    PartialOrd,
978    Ord,
979    Serialize,
980    Deserialize
981)]
982#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
983pub struct ClusterReplicaId {
984    pub cluster_id: ClusterId,
985    pub replica_id: ReplicaId,
986}
987
988#[derive(
989    Clone,
990    Copy,
991    Debug,
992    PartialEq,
993    Eq,
994    PartialOrd,
995    Ord,
996    Serialize,
997    Deserialize
998)]
999#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1000pub enum NetworkPolicyId {
1001    System(u64),
1002    User(u64),
1003}
1004
1005#[derive(
1006    Clone,
1007    Copy,
1008    Debug,
1009    PartialEq,
1010    Eq,
1011    PartialOrd,
1012    Ord,
1013    Serialize,
1014    Deserialize
1015)]
1016#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1017pub struct ReplicaLogging {
1018    pub log_logging: bool,
1019    pub interval: Option<Duration>,
1020}
1021
1022#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1023#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1024pub struct OptimizerFeatureOverride {
1025    pub name: String,
1026    pub value: String,
1027}
1028
1029#[derive(
1030    Clone,
1031    Copy,
1032    Debug,
1033    PartialEq,
1034    Eq,
1035    PartialOrd,
1036    Ord,
1037    Serialize,
1038    Deserialize
1039)]
1040#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1041pub struct ClusterScheduleRefreshOptions {
1042    pub rehydration_time_estimate: Duration,
1043}
1044
1045#[derive(
1046    Clone,
1047    Copy,
1048    Debug,
1049    PartialEq,
1050    Eq,
1051    PartialOrd,
1052    Ord,
1053    Serialize,
1054    Deserialize
1055)]
1056#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1057pub enum ClusterSchedule {
1058    Manual,
1059    Refresh(ClusterScheduleRefreshOptions),
1060}
1061
1062#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1063#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1064pub struct ClusterConfig {
1065    pub workload_class: Option<String>,
1066    pub variant: ClusterVariant,
1067}
1068
1069#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1070#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1071pub enum ClusterVariant {
1072    Unmanaged,
1073    Managed(ManagedCluster),
1074}
1075
1076#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1077#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1078pub struct ManagedCluster {
1079    pub size: String,
1080    pub replication_factor: u32,
1081    pub availability_zones: Vec<String>,
1082    pub logging: ReplicaLogging,
1083    pub arrangement_compression: bool,
1084    pub optimizer_feature_overrides: Vec<OptimizerFeatureOverride>,
1085    pub schedule: ClusterSchedule,
1086    /// User-configured autoscaling policy, distinct from the in-flight runtime
1087    /// records below.
1088    pub auto_scaling_strategy: Option<AutoScalingStrategy>,
1089    /// Latest graceful reconfiguration record, if one has been written.
1090    pub reconfiguration: Option<ReconfigurationState>,
1091    /// In-flight hydration burst the controller is running.
1092    pub burst: Option<BurstState>,
1093}
1094
1095/// The user-configured autoscaling policy of a managed cluster.
1096///
1097/// Extensible: future strategies are added as additional optional sub-policies.
1098#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1099#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1100pub struct AutoScalingStrategy {
1101    pub on_hydration: Option<OnHydration>,
1102}
1103
1104/// The `ON HYDRATION` autoscaling sub-policy.
1105#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1106#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1107pub struct OnHydration {
1108    pub hydration_size: String,
1109    pub linger_duration: Option<Duration>,
1110}
1111
1112/// Latest graceful reconfiguration record, including the target shape, deadline,
1113/// timeout action, and lifecycle status.
1114#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1115#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1116pub struct ReconfigurationState {
1117    pub target: ReconfigurationTarget,
1118    /// Deadline as an `mz_repr::Timestamp`.
1119    pub deadline: u64,
1120    /// What to do if the deadline passes before the target hydrates.
1121    pub on_timeout: OnTimeoutAction,
1122    pub status: ReconfigurationStatus,
1123}
1124
1125/// The lifecycle status of the latest graceful reconfiguration.
1126///
1127/// NOTE: the serde serialization of these variant names is what the
1128/// `mz_internal.mz_cluster_reconfigurations` builtin view matches on. When
1129/// adding a variant, extend that view's `status` CASE mapping, or the new
1130/// variant surfaces verbatim (`SomeNewStatus`) instead of snake_case.
1131#[derive(
1132    Clone,
1133    Copy,
1134    Debug,
1135    PartialEq,
1136    Eq,
1137    PartialOrd,
1138    Ord,
1139    Serialize,
1140    Deserialize
1141)]
1142#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1143pub enum ReconfigurationStatus {
1144    InProgress,
1145    Finalized,
1146    TimedOut,
1147    Cancelled,
1148    ResourceExhausted,
1149}
1150
1151/// The action a graceful reconfiguration applies if its deadline passes before
1152/// the target replicas hydrate. Mirrors `mz_sql::plan::OnTimeoutAction`.
1153///
1154/// NOTE: like `ReconfigurationStatus`, the serde variant names feed the
1155/// `on_timeout` CASE mapping in `mz_internal.mz_cluster_reconfigurations`.
1156#[derive(
1157    Clone,
1158    Copy,
1159    Debug,
1160    PartialEq,
1161    Eq,
1162    PartialOrd,
1163    Ord,
1164    Serialize,
1165    Deserialize
1166)]
1167#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1168pub enum OnTimeoutAction {
1169    /// Cut over to the (not-yet-hydrated) target anyway.
1170    Commit,
1171    /// Drop the target replica set, reverting to the pre-reconfiguration shape.
1172    Rollback,
1173}
1174
1175/// The full config shape a reconfiguration is moving the cluster to, so a
1176/// combined size + replication-factor + availability-zone change is one record.
1177#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1178#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1179pub struct ReconfigurationTarget {
1180    pub size: String,
1181    pub replication_factor: u32,
1182    pub availability_zones: Vec<String>,
1183    pub logging: ReplicaLogging,
1184    pub arrangement_compression: bool,
1185}
1186
1187/// An active hydration burst.
1188#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1189#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1190pub struct BurstState {
1191    pub burst_size: String,
1192    pub linger_duration: Duration,
1193    /// Start of the current observed readiness period for the steady set, as an
1194    /// `mz_repr::Timestamp`. Cleared after a failed readiness check.
1195    pub steady_ready_at: Option<u64>,
1196}
1197
1198#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1199#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1200pub struct ReplicaConfig {
1201    pub logging: ReplicaLogging,
1202    pub location: ReplicaLocation,
1203    pub arrangement_compression: bool,
1204}
1205
1206#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1207#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1208pub struct UnmanagedLocation {
1209    pub storagectl_addrs: Vec<String>,
1210    pub computectl_addrs: Vec<String>,
1211}
1212
1213#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1214#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1215pub struct ManagedLocation {
1216    pub size: String,
1217    /// The availability zones the replica was provisioned under.
1218    ///
1219    /// For a replica of a managed cluster this is the cluster's
1220    /// `AVAILABILITY ZONES` pool at provision time; the cluster controller
1221    /// compares it against a cluster's target `availability_zones` to tell
1222    /// realized- from target-shape replicas (including an `AVAILABILITY ZONES`
1223    /// divergence). For a replica of an unmanaged cluster it is the user-pinned
1224    /// `AVAILABILITY ZONE`, as a zero- or one-element list. Empty when no zones
1225    /// constrain placement.
1226    pub availability_zones: Vec<String>,
1227    pub internal: bool,
1228    pub billed_as: Option<String>,
1229    pub pending: bool,
1230}
1231
1232#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1233#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1234pub enum ReplicaLocation {
1235    Unmanaged(UnmanagedLocation),
1236    Managed(ManagedLocation),
1237}
1238
1239#[derive(
1240    Clone,
1241    Copy,
1242    Debug,
1243    PartialEq,
1244    Eq,
1245    PartialOrd,
1246    Ord,
1247    Serialize,
1248    Deserialize
1249)]
1250#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1251pub enum RoleId {
1252    System(u64),
1253    User(u64),
1254    Public,
1255    Predefined(u64),
1256}
1257
1258#[derive(
1259    Clone,
1260    Copy,
1261    Debug,
1262    PartialEq,
1263    Eq,
1264    PartialOrd,
1265    Ord,
1266    Serialize,
1267    Deserialize
1268)]
1269#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1270pub enum AutoProvisionSource {
1271    Oidc = 0,
1272    Frontegg = 1,
1273    None = 2,
1274}
1275
1276#[derive(
1277    Clone,
1278    Copy,
1279    Debug,
1280    PartialEq,
1281    Eq,
1282    PartialOrd,
1283    Ord,
1284    Serialize,
1285    Deserialize
1286)]
1287#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1288pub struct RoleAttributes {
1289    pub inherit: bool,
1290    pub superuser: Option<bool>,
1291    pub login: Option<bool>,
1292    pub auto_provision_source: Option<AutoProvisionSource>,
1293}
1294
1295#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1296#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1297pub struct RoleMembership {
1298    pub map: Vec<RoleMembershipEntry>,
1299}
1300
1301#[derive(
1302    Clone,
1303    Copy,
1304    Debug,
1305    PartialEq,
1306    Eq,
1307    PartialOrd,
1308    Ord,
1309    Serialize,
1310    Deserialize
1311)]
1312#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1313pub struct RoleMembershipEntry {
1314    pub key: RoleId,
1315    pub value: RoleId,
1316}
1317
1318#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1319#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1320pub struct RoleVars {
1321    pub entries: Vec<RoleVarsEntry>,
1322}
1323
1324#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1325#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1326pub struct RoleVarsEntry {
1327    pub key: String,
1328    pub val: RoleVar,
1329}
1330
1331#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1332#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1333pub enum RoleVar {
1334    Flat(String),
1335    SqlSet(Vec<String>),
1336}
1337
1338#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1339#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1340pub struct NetworkPolicyRule {
1341    pub name: String,
1342    pub address: String,
1343    pub action: NetworkPolicyRuleAction,
1344    pub direction: NetworkPolicyRuleDirection,
1345}
1346
1347#[derive(
1348    Clone,
1349    Copy,
1350    Debug,
1351    PartialEq,
1352    Eq,
1353    PartialOrd,
1354    Ord,
1355    Serialize,
1356    Deserialize
1357)]
1358#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1359pub enum NetworkPolicyRuleAction {
1360    Allow,
1361}
1362
1363#[derive(
1364    Clone,
1365    Copy,
1366    Debug,
1367    PartialEq,
1368    Eq,
1369    PartialOrd,
1370    Ord,
1371    Serialize,
1372    Deserialize
1373)]
1374#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1375pub enum NetworkPolicyRuleDirection {
1376    Ingress,
1377}
1378
1379#[derive(
1380    Clone,
1381    Copy,
1382    Debug,
1383    PartialEq,
1384    Eq,
1385    PartialOrd,
1386    Ord,
1387    Serialize,
1388    Deserialize
1389)]
1390#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1391pub struct AclMode {
1392    pub bitflags: u64,
1393}
1394
1395#[derive(
1396    Clone,
1397    Copy,
1398    Debug,
1399    PartialEq,
1400    Eq,
1401    PartialOrd,
1402    Ord,
1403    Serialize,
1404    Deserialize
1405)]
1406#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1407pub struct MzAclItem {
1408    pub grantee: RoleId,
1409    pub grantor: RoleId,
1410    pub acl_mode: AclMode,
1411}
1412
1413#[derive(
1414    Clone,
1415    Copy,
1416    Debug,
1417    PartialEq,
1418    Eq,
1419    PartialOrd,
1420    Ord,
1421    Serialize,
1422    Deserialize
1423)]
1424#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1425pub struct DefaultPrivilegesKey {
1426    pub role_id: RoleId,
1427    pub database_id: Option<DatabaseId>,
1428    pub schema_id: Option<SchemaId>,
1429    pub object_type: ObjectType,
1430    pub grantee: RoleId,
1431}
1432
1433#[derive(
1434    Clone,
1435    Copy,
1436    Debug,
1437    PartialEq,
1438    Eq,
1439    PartialOrd,
1440    Ord,
1441    Serialize,
1442    Deserialize
1443)]
1444#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1445pub struct DefaultPrivilegesValue {
1446    pub privileges: AclMode,
1447}
1448
1449#[derive(
1450    Clone,
1451    Copy,
1452    Debug,
1453    PartialEq,
1454    Eq,
1455    PartialOrd,
1456    Ord,
1457    Serialize,
1458    Deserialize
1459)]
1460#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1461pub struct SystemPrivilegesKey {
1462    pub grantee: RoleId,
1463    pub grantor: RoleId,
1464}
1465
1466#[derive(
1467    Clone,
1468    Copy,
1469    Debug,
1470    PartialEq,
1471    Eq,
1472    PartialOrd,
1473    Ord,
1474    Serialize,
1475    Deserialize
1476)]
1477#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1478pub struct SystemPrivilegesValue {
1479    pub acl_mode: AclMode,
1480}
1481
1482#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1483#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1484pub struct AuditLogEventV1 {
1485    pub id: u64,
1486    pub event_type: audit_log_event_v1::EventType,
1487    pub object_type: audit_log_event_v1::ObjectType,
1488    pub user: Option<StringWrapper>,
1489    pub occurred_at: EpochMillis,
1490    pub details: audit_log_event_v1::Details,
1491}
1492
1493pub mod audit_log_event_v1 {
1494    use super::*;
1495
1496    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1497    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1498    pub struct IdFullNameV1 {
1499        pub id: String,
1500        pub name: FullNameV1,
1501    }
1502
1503    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1504    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1505    pub struct FullNameV1 {
1506        pub database: String,
1507        pub schema: String,
1508        pub item: String,
1509    }
1510
1511    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1512    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1513    pub struct IdNameV1 {
1514        pub id: String,
1515        pub name: String,
1516    }
1517
1518    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1519    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1520    pub struct RenameClusterV1 {
1521        pub id: String,
1522        pub old_name: String,
1523        pub new_name: String,
1524    }
1525
1526    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1527    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1528    pub struct RenameClusterReplicaV1 {
1529        pub cluster_id: String,
1530        pub replica_id: String,
1531        pub old_name: String,
1532        pub new_name: 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 AlterClusterReconfigurationV1 {
1538        pub cluster_id: String,
1539        pub cluster_name: String,
1540        pub transition: ReconfigurationLifecycleV1,
1541        /// On a `finalized` transition: whether the cut-over was forced by `ON
1542        /// TIMEOUT COMMIT` at the deadline rather than reached by hydration.
1543        #[serde(default)]
1544        pub forced: Option<bool>,
1545        pub target_size: String,
1546        pub target_replication_factor: u32,
1547        pub target_availability_zones: Vec<String>,
1548        pub target_logging: ClusterReplicaLoggingV1,
1549        pub deadline: Option<u64>,
1550    }
1551
1552    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1553    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1554    pub struct ClusterReplicaLoggingV1 {
1555        pub log_logging: bool,
1556        pub interval: Option<Duration>,
1557    }
1558
1559    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1560    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1561    pub struct ReconfigurationLifecycleV1 {
1562        pub transition: reconfiguration_lifecycle_v1::Transition,
1563    }
1564
1565    pub mod reconfiguration_lifecycle_v1 {
1566        use super::*;
1567
1568        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1569        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1570        pub enum Transition {
1571            Started(Empty),
1572            Finalized(Empty),
1573            TimedOut(Empty),
1574            Cancelled(Empty),
1575            ResourceExhausted(Empty),
1576        }
1577    }
1578
1579    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1580    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1581    pub struct ClusterHydrationBurstV1 {
1582        pub cluster_id: String,
1583        pub cluster_name: String,
1584        pub transition: HydrationBurstLifecycleV1,
1585        /// On a `finished` transition: why the burst tore down.
1586        #[serde(default)]
1587        pub finish_cause: Option<BurstFinishCauseV1>,
1588        pub burst_size: String,
1589    }
1590
1591    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1592    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1593    pub struct HydrationBurstLifecycleV1 {
1594        pub transition: hydration_burst_lifecycle_v1::Transition,
1595    }
1596
1597    pub mod hydration_burst_lifecycle_v1 {
1598        use super::*;
1599
1600        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1601        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1602        pub enum Transition {
1603            Started(Empty),
1604            Finished(Empty),
1605        }
1606    }
1607
1608    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1609    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1610    pub struct BurstFinishCauseV1 {
1611        pub cause: burst_finish_cause_v1::Cause,
1612    }
1613
1614    pub mod burst_finish_cause_v1 {
1615        use super::*;
1616
1617        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1618        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1619        pub enum Cause {
1620            LingerElapsed(Empty),
1621            NoLongerWarranted(Empty),
1622        }
1623    }
1624
1625    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1626    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1627    pub struct RenameItemV1 {
1628        pub id: String,
1629        pub old_name: FullNameV1,
1630        pub new_name: FullNameV1,
1631    }
1632
1633    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1634    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1635    pub struct CreateClusterReplicaV1 {
1636        pub cluster_id: String,
1637        pub cluster_name: String,
1638        pub replica_id: Option<StringWrapper>,
1639        pub replica_name: String,
1640        pub logical_size: String,
1641        pub disk: bool,
1642        pub billed_as: Option<String>,
1643        pub internal: bool,
1644    }
1645
1646    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1647    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1648    pub struct CreateClusterReplicaV2 {
1649        pub cluster_id: String,
1650        pub cluster_name: String,
1651        pub replica_id: Option<StringWrapper>,
1652        pub replica_name: String,
1653        pub logical_size: String,
1654        pub disk: bool,
1655        pub billed_as: Option<String>,
1656        pub internal: bool,
1657        pub reason: CreateOrDropClusterReplicaReasonV1,
1658        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1659    }
1660
1661    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1662    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1663    pub struct CreateClusterReplicaV3 {
1664        pub cluster_id: String,
1665        pub cluster_name: String,
1666        pub replica_id: Option<StringWrapper>,
1667        pub replica_name: String,
1668        pub logical_size: String,
1669        pub disk: bool,
1670        pub billed_as: Option<String>,
1671        pub internal: bool,
1672        pub reason: CreateOrDropClusterReplicaReasonV1,
1673        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1674    }
1675
1676    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1677    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1678    pub struct CreateClusterReplicaV4 {
1679        pub cluster_id: String,
1680        pub cluster_name: String,
1681        pub replica_id: Option<StringWrapper>,
1682        pub replica_name: String,
1683        pub logical_size: String,
1684        pub billed_as: Option<String>,
1685        pub internal: bool,
1686        pub reason: CreateOrDropClusterReplicaReasonV1,
1687        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1688    }
1689
1690    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1691    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1692    pub struct DropClusterReplicaV1 {
1693        pub cluster_id: String,
1694        pub cluster_name: String,
1695        pub replica_id: Option<StringWrapper>,
1696        pub replica_name: String,
1697    }
1698
1699    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1700    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1701    pub struct DropClusterReplicaV2 {
1702        pub cluster_id: String,
1703        pub cluster_name: String,
1704        pub replica_id: Option<StringWrapper>,
1705        pub replica_name: String,
1706        pub reason: CreateOrDropClusterReplicaReasonV1,
1707        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1708    }
1709
1710    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1711    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1712    pub struct DropClusterReplicaV3 {
1713        pub cluster_id: String,
1714        pub cluster_name: String,
1715        pub replica_id: Option<StringWrapper>,
1716        pub replica_name: String,
1717        pub reason: CreateOrDropClusterReplicaReasonV1,
1718        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1719    }
1720
1721    #[derive(
1722        Clone,
1723        Copy,
1724        Debug,
1725        PartialEq,
1726        Eq,
1727        PartialOrd,
1728        Ord,
1729        Serialize,
1730        Deserialize
1731    )]
1732    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1733    pub struct CreateOrDropClusterReplicaReasonV1 {
1734        pub reason: CreateOrDropClusterReplicaReasonV1Reason,
1735    }
1736
1737    #[derive(
1738        Clone,
1739        Copy,
1740        Debug,
1741        PartialEq,
1742        Eq,
1743        PartialOrd,
1744        Ord,
1745        Serialize,
1746        Deserialize
1747    )]
1748    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1749    pub enum CreateOrDropClusterReplicaReasonV1Reason {
1750        Manual(Empty),
1751        Schedule(Empty),
1752        System(Empty),
1753        Reconfiguration(Empty),
1754        HydrationBurst(Empty),
1755        Retired(Empty),
1756    }
1757
1758    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1759    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1760    pub struct SchedulingDecisionsWithReasonsV1 {
1761        pub on_refresh: RefreshDecisionWithReasonV1,
1762    }
1763
1764    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1765    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1766    pub struct SchedulingDecisionsWithReasonsV2 {
1767        pub on_refresh: RefreshDecisionWithReasonV2,
1768    }
1769
1770    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1771    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1772    pub enum RefreshDecision {
1773        On(Empty),
1774        Off(Empty),
1775    }
1776
1777    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1778    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1779    pub struct RefreshDecisionWithReasonV1 {
1780        pub objects_needing_refresh: Vec<String>,
1781        pub rehydration_time_estimate: String,
1782        pub decision: RefreshDecision,
1783    }
1784
1785    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1786    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1787    pub struct RefreshDecisionWithReasonV2 {
1788        pub objects_needing_refresh: Vec<String>,
1789        pub objects_needing_compaction: Vec<String>,
1790        pub rehydration_time_estimate: String,
1791        pub decision: RefreshDecision,
1792    }
1793
1794    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1795    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1796    pub struct CreateSourceSinkV1 {
1797        pub id: String,
1798        pub name: FullNameV1,
1799        pub size: Option<StringWrapper>,
1800    }
1801
1802    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1803    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1804    pub struct CreateSourceSinkV2 {
1805        pub id: String,
1806        pub name: FullNameV1,
1807        pub size: Option<StringWrapper>,
1808        pub external_type: String,
1809    }
1810
1811    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1812    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1813    pub struct CreateSourceSinkV3 {
1814        pub id: String,
1815        pub name: FullNameV1,
1816        pub external_type: String,
1817    }
1818
1819    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1820    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1821    pub struct CreateSourceSinkV4 {
1822        pub id: String,
1823        pub cluster_id: Option<StringWrapper>,
1824        pub name: FullNameV1,
1825        pub external_type: String,
1826    }
1827
1828    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1829    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1830    pub struct CreateIndexV1 {
1831        pub id: String,
1832        pub cluster_id: String,
1833        pub name: FullNameV1,
1834    }
1835
1836    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1837    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1838    pub struct CreateMaterializedViewV1 {
1839        pub id: String,
1840        pub cluster_id: String,
1841        pub name: FullNameV1,
1842        pub replacement_target_id: Option<String>,
1843    }
1844
1845    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1846    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1847    pub struct AlterApplyReplacementV1 {
1848        pub target: IdFullNameV1,
1849        pub replacement: IdFullNameV1,
1850    }
1851
1852    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1853    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1854    pub struct AlterSourceSinkV1 {
1855        pub id: String,
1856        pub name: FullNameV1,
1857        pub old_size: Option<StringWrapper>,
1858        pub new_size: Option<StringWrapper>,
1859    }
1860
1861    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1862    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1863    pub struct AlterSetClusterV1 {
1864        pub id: String,
1865        pub name: FullNameV1,
1866        pub old_cluster_id: String,
1867        pub new_cluster_id: String,
1868    }
1869
1870    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1871    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1872    pub struct GrantRoleV1 {
1873        pub role_id: String,
1874        pub member_id: String,
1875        pub grantor_id: String,
1876    }
1877
1878    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1879    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1880    pub struct GrantRoleV2 {
1881        pub role_id: String,
1882        pub member_id: String,
1883        pub grantor_id: String,
1884        pub executed_by: String,
1885    }
1886
1887    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1888    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1889    pub struct RevokeRoleV1 {
1890        pub role_id: String,
1891        pub member_id: String,
1892    }
1893
1894    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1895    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1896    pub struct RevokeRoleV2 {
1897        pub role_id: String,
1898        pub member_id: String,
1899        pub grantor_id: String,
1900        pub executed_by: String,
1901    }
1902
1903    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1904    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1905    pub struct UpdatePrivilegeV1 {
1906        pub object_id: String,
1907        pub grantee_id: String,
1908        pub grantor_id: String,
1909        pub privileges: String,
1910    }
1911
1912    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1913    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1914    pub struct AlterDefaultPrivilegeV1 {
1915        pub role_id: String,
1916        pub database_id: Option<StringWrapper>,
1917        pub schema_id: Option<StringWrapper>,
1918        pub grantee_id: String,
1919        pub privileges: String,
1920    }
1921
1922    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1923    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1924    pub struct UpdateOwnerV1 {
1925        pub object_id: String,
1926        pub old_owner_id: String,
1927        pub new_owner_id: String,
1928    }
1929
1930    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1931    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1932    pub struct SchemaV1 {
1933        pub id: String,
1934        pub name: String,
1935        pub database_name: 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 SchemaV2 {
1941        pub id: String,
1942        pub name: String,
1943        pub database_name: Option<StringWrapper>,
1944    }
1945
1946    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1947    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1948    pub struct RenameSchemaV1 {
1949        pub id: String,
1950        pub database_name: Option<String>,
1951        pub old_name: String,
1952        pub new_name: String,
1953    }
1954
1955    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1956    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1957    pub struct UpdateItemV1 {
1958        pub id: String,
1959        pub name: FullNameV1,
1960    }
1961
1962    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1963    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1964    pub struct AlterRetainHistoryV1 {
1965        pub id: String,
1966        pub old_history: Option<String>,
1967        pub new_history: Option<String>,
1968    }
1969
1970    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1971    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1972    pub struct AlterAddColumnV1 {
1973        pub id: String,
1974        pub column: String,
1975        pub column_type: String,
1976        pub nullable: bool,
1977    }
1978
1979    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1980    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1981    pub struct AlterSourceTimestampIntervalV1 {
1982        pub id: String,
1983        pub old_interval: Option<String>,
1984        pub new_interval: Option<String>,
1985    }
1986
1987    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1988    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1989    pub struct ToNewIdV1 {
1990        pub id: String,
1991        pub new_id: String,
1992    }
1993
1994    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1995    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1996    pub struct FromPreviousIdV1 {
1997        pub id: String,
1998        pub previous_id: String,
1999    }
2000
2001    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2002    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2003    pub struct SetV1 {
2004        pub name: String,
2005        pub value: Option<String>,
2006    }
2007
2008    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2009    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2010    pub struct RotateKeysV1 {
2011        pub id: String,
2012        pub name: String,
2013    }
2014
2015    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2016    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2017    pub struct CreateRoleV1 {
2018        pub id: String,
2019        pub name: String,
2020        pub auto_provision_source: Option<String>,
2021    }
2022
2023    #[derive(
2024        Clone,
2025        Copy,
2026        Debug,
2027        PartialEq,
2028        Eq,
2029        Hash,
2030        PartialOrd,
2031        Ord,
2032        Serialize_repr,
2033        Deserialize_repr
2034    )]
2035    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2036    #[repr(u8)]
2037    pub enum EventType {
2038        Unknown = 0,
2039        Create = 1,
2040        Drop = 2,
2041        Alter = 3,
2042        Grant = 4,
2043        Revoke = 5,
2044        Comment = 6,
2045    }
2046
2047    #[derive(
2048        Clone,
2049        Copy,
2050        Debug,
2051        PartialEq,
2052        Eq,
2053        Hash,
2054        PartialOrd,
2055        Ord,
2056        Serialize_repr,
2057        Deserialize_repr
2058    )]
2059    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2060    #[repr(u8)]
2061    pub enum ObjectType {
2062        Unknown = 0,
2063        Cluster = 1,
2064        ClusterReplica = 2,
2065        Connection = 3,
2066        Database = 4,
2067        Func = 5,
2068        Index = 6,
2069        MaterializedView = 7,
2070        Role = 8,
2071        Secret = 9,
2072        Schema = 10,
2073        Sink = 11,
2074        Source = 12,
2075        Table = 13,
2076        Type = 14,
2077        View = 15,
2078        System = 16,
2079        ContinualTask = 17,
2080        NetworkPolicy = 18,
2081        MetricSink = 19,
2082    }
2083
2084    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2085    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2086    pub enum Details {
2087        CreateClusterReplicaV1(CreateClusterReplicaV1),
2088        CreateClusterReplicaV2(CreateClusterReplicaV2),
2089        CreateClusterReplicaV3(CreateClusterReplicaV3),
2090        CreateClusterReplicaV4(CreateClusterReplicaV4),
2091        DropClusterReplicaV1(DropClusterReplicaV1),
2092        DropClusterReplicaV2(DropClusterReplicaV2),
2093        DropClusterReplicaV3(DropClusterReplicaV3),
2094        CreateSourceSinkV1(CreateSourceSinkV1),
2095        CreateSourceSinkV2(CreateSourceSinkV2),
2096        AlterSourceSinkV1(AlterSourceSinkV1),
2097        AlterSetClusterV1(AlterSetClusterV1),
2098        GrantRoleV1(GrantRoleV1),
2099        GrantRoleV2(GrantRoleV2),
2100        RevokeRoleV1(RevokeRoleV1),
2101        RevokeRoleV2(RevokeRoleV2),
2102        UpdatePrivilegeV1(UpdatePrivilegeV1),
2103        AlterDefaultPrivilegeV1(AlterDefaultPrivilegeV1),
2104        UpdateOwnerV1(UpdateOwnerV1),
2105        IdFullNameV1(IdFullNameV1),
2106        RenameClusterV1(RenameClusterV1),
2107        RenameClusterReplicaV1(RenameClusterReplicaV1),
2108        RenameItemV1(RenameItemV1),
2109        IdNameV1(IdNameV1),
2110        SchemaV1(SchemaV1),
2111        SchemaV2(SchemaV2),
2112        RenameSchemaV1(RenameSchemaV1),
2113        UpdateItemV1(UpdateItemV1),
2114        CreateSourceSinkV3(CreateSourceSinkV3),
2115        AlterRetainHistoryV1(AlterRetainHistoryV1),
2116        ToNewIdV1(ToNewIdV1),
2117        FromPreviousIdV1(FromPreviousIdV1),
2118        SetV1(SetV1),
2119        ResetAllV1(Empty),
2120        RotateKeysV1(RotateKeysV1),
2121        CreateSourceSinkV4(CreateSourceSinkV4),
2122        CreateIndexV1(CreateIndexV1),
2123        CreateMaterializedViewV1(CreateMaterializedViewV1),
2124        AlterApplyReplacementV1(AlterApplyReplacementV1),
2125        CreateRoleV1(CreateRoleV1),
2126        AlterAddColumnV1(AlterAddColumnV1),
2127        AlterSourceTimestampIntervalV1(AlterSourceTimestampIntervalV1),
2128        AlterClusterReconfigurationV1(AlterClusterReconfigurationV1),
2129        ClusterHydrationBurstV1(ClusterHydrationBurstV1),
2130    }
2131}
2132
2133/// The contents of a single state update.
2134#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2135#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2136// Serialize the top-level enum in the persist-backed catalog as internally tagged to set up
2137// persist pushdown statistics for success.
2138#[serde(tag = "kind")]
2139pub enum StateUpdateKind {
2140    AuditLog(AuditLog),
2141    Cluster(Cluster),
2142    ClusterIntrospectionSourceIndex(ClusterIntrospectionSourceIndex),
2143    ClusterReplica(ClusterReplica),
2144    ClusterReplicaSize(ClusterReplicaSize),
2145    Comment(Comment),
2146    Config(Config),
2147    Database(Database),
2148    DefaultPrivileges(DefaultPrivileges),
2149    FenceToken(FenceToken),
2150    GidMapping(GidMapping),
2151    IdAlloc(IdAlloc),
2152    IndexColumns(IndexColumns),
2153    Item(Item),
2154    ItemColumns(ItemColumns),
2155    NetworkPolicy(NetworkPolicy),
2156    Role(Role),
2157    RoleAuth(RoleAuth),
2158    Schema(Schema),
2159    ServerConfiguration(ServerConfiguration),
2160    ClusterSystemConfiguration(ClusterSystemConfiguration),
2161    ReplicaSystemConfiguration(ReplicaSystemConfiguration),
2162    Setting(Setting),
2163    SourceReferences(SourceReferences),
2164    StorageCollectionMetadata(StorageCollectionMetadata),
2165    SystemPrivileges(SystemPrivileges),
2166    TxnWalShard(TxnWalShard),
2167    UnfinalizedShard(UnfinalizedShard),
2168}
2169
2170#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2171#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2172pub struct AuditLog {
2173    pub key: AuditLogKey,
2174}
2175
2176#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2177#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2178pub struct Cluster {
2179    pub key: ClusterKey,
2180    pub value: ClusterValue,
2181}
2182
2183#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2184#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2185pub struct ClusterReplica {
2186    pub key: ClusterReplicaKey,
2187    pub value: ClusterReplicaValue,
2188}
2189
2190#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2191#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2192pub struct Comment {
2193    pub key: CommentKey,
2194    pub value: CommentValue,
2195}
2196
2197#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2198#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2199pub struct Config {
2200    pub key: ConfigKey,
2201    pub value: ConfigValue,
2202}
2203
2204#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2205#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2206pub struct Database {
2207    pub key: DatabaseKey,
2208    pub value: DatabaseValue,
2209}
2210
2211#[derive(
2212    Clone,
2213    Copy,
2214    Debug,
2215    PartialEq,
2216    Eq,
2217    PartialOrd,
2218    Ord,
2219    Serialize,
2220    Deserialize
2221)]
2222#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2223pub struct DefaultPrivileges {
2224    pub key: DefaultPrivilegesKey,
2225    pub value: DefaultPrivilegesValue,
2226}
2227
2228#[derive(
2229    Clone,
2230    Copy,
2231    Debug,
2232    PartialEq,
2233    Eq,
2234    PartialOrd,
2235    Ord,
2236    Serialize,
2237    Deserialize
2238)]
2239#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2240pub struct FenceToken {
2241    pub deploy_generation: u64,
2242    pub epoch: i64,
2243}
2244
2245#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2246#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2247pub struct IdAlloc {
2248    pub key: IdAllocKey,
2249    pub value: IdAllocValue,
2250}
2251
2252#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2253#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2254pub struct ClusterIntrospectionSourceIndex {
2255    pub key: ClusterIntrospectionSourceIndexKey,
2256    pub value: ClusterIntrospectionSourceIndexValue,
2257}
2258
2259#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2260#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2261pub struct IndexColumns {
2262    pub key: IndexColumnsKey,
2263    pub value: IndexColumnsValue,
2264}
2265
2266#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2267#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2268pub struct Item {
2269    pub key: ItemKey,
2270    pub value: ItemValue,
2271}
2272
2273#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2274#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2275pub struct ItemColumns {
2276    pub key: ItemColumnsKey,
2277    pub value: ItemColumnsValue,
2278}
2279
2280#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2281#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2282pub struct Role {
2283    pub key: RoleKey,
2284    pub value: RoleValue,
2285}
2286
2287#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2288#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2289pub struct RoleAuth {
2290    pub key: RoleAuthKey,
2291    pub value: RoleAuthValue,
2292}
2293
2294#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2295#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2296pub struct NetworkPolicy {
2297    pub key: NetworkPolicyKey,
2298    pub value: NetworkPolicyValue,
2299}
2300
2301#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2302#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2303pub struct ClusterReplicaSize {
2304    pub key: ClusterReplicaSizeKey,
2305    pub value: ClusterReplicaSizeValue,
2306}
2307
2308#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2309#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2310pub struct Schema {
2311    pub key: SchemaKey,
2312    pub value: SchemaValue,
2313}
2314
2315#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2316#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2317pub struct Setting {
2318    pub key: SettingKey,
2319    pub value: SettingValue,
2320}
2321
2322#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2323#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2324pub struct ServerConfiguration {
2325    pub key: ServerConfigurationKey,
2326    pub value: ServerConfigurationValue,
2327}
2328
2329#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2330#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2331pub struct ClusterSystemConfiguration {
2332    pub key: ClusterSystemConfigurationKey,
2333    pub value: ClusterSystemConfigurationValue,
2334}
2335
2336#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2337#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2338pub struct ReplicaSystemConfiguration {
2339    pub key: ReplicaSystemConfigurationKey,
2340    pub value: ReplicaSystemConfigurationValue,
2341}
2342
2343#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2344#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2345pub struct SourceReferences {
2346    pub key: SourceReferencesKey,
2347    pub value: SourceReferencesValue,
2348}
2349
2350#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2351#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2352pub struct GidMapping {
2353    pub key: GidMappingKey,
2354    pub value: GidMappingValue,
2355}
2356
2357#[derive(
2358    Clone,
2359    Copy,
2360    Debug,
2361    PartialEq,
2362    Eq,
2363    PartialOrd,
2364    Ord,
2365    Serialize,
2366    Deserialize
2367)]
2368#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2369pub struct SystemPrivileges {
2370    pub key: SystemPrivilegesKey,
2371    pub value: SystemPrivilegesValue,
2372}
2373
2374#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2375#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2376pub struct StorageCollectionMetadata {
2377    pub key: StorageCollectionMetadataKey,
2378    pub value: StorageCollectionMetadataValue,
2379}
2380
2381#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2382#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2383pub struct UnfinalizedShard {
2384    pub key: UnfinalizedShardKey,
2385}
2386
2387#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2388#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2389pub struct TxnWalShard {
2390    pub value: TxnWalShardValue,
2391}
2392
2393#[derive(
2394    Clone,
2395    Copy,
2396    Debug,
2397    PartialEq,
2398    Eq,
2399    Hash,
2400    PartialOrd,
2401    Ord,
2402    Serialize_repr,
2403    Deserialize_repr
2404)]
2405#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2406#[repr(u8)]
2407pub enum CatalogItemType {
2408    Unknown = 0,
2409    Table = 1,
2410    Source = 2,
2411    Sink = 3,
2412    View = 4,
2413    MaterializedView = 5,
2414    Index = 6,
2415    Type = 7,
2416    Func = 8,
2417    Secret = 9,
2418    Connection = 10,
2419    MetricSink = 11,
2420}
2421
2422#[derive(
2423    Clone,
2424    Copy,
2425    Debug,
2426    PartialEq,
2427    Eq,
2428    Hash,
2429    PartialOrd,
2430    Ord,
2431    Serialize_repr,
2432    Deserialize_repr
2433)]
2434#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2435#[repr(u8)]
2436pub enum ObjectType {
2437    Unknown = 0,
2438    Table = 1,
2439    View = 2,
2440    MaterializedView = 3,
2441    Source = 4,
2442    Sink = 5,
2443    Index = 6,
2444    Type = 7,
2445    Role = 8,
2446    Cluster = 9,
2447    ClusterReplica = 10,
2448    Secret = 11,
2449    Connection = 12,
2450    Database = 13,
2451    Schema = 14,
2452    Func = 15,
2453    NetworkPolicy = 17,
2454    MetricSink = 18,
2455}