Skip to main content

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