1use mz_audit_log::{
17 AlterAddColumnV1, AlterApplyReplacementV1, AlterClusterReconfigurationV1,
18 AlterDefaultPrivilegeV1, AlterRetainHistoryV1, AlterSetClusterV1, AlterSourceSinkV1,
19 AlterSourceTimestampIntervalV1, BurstFinishCauseV1, ClusterHydrationBurstV1,
20 ClusterReplicaLoggingV1, CreateClusterReplicaV1, CreateClusterReplicaV2,
21 CreateClusterReplicaV3, CreateClusterReplicaV4, CreateIndexV1, CreateMaterializedViewV1,
22 CreateOrDropClusterReplicaReasonV1, CreateRoleV1, CreateSourceSinkV1, CreateSourceSinkV2,
23 CreateSourceSinkV3, CreateSourceSinkV4, DropClusterReplicaV1, DropClusterReplicaV2,
24 DropClusterReplicaV3, EventDetails, EventType, EventV1, FromPreviousIdV1, FullNameV1,
25 GrantRoleV1, GrantRoleV2, HydrationBurstLifecycleV1, IdFullNameV1, IdNameV1,
26 ReconfigurationLifecycleV1, RefreshDecisionWithReasonV1, RefreshDecisionWithReasonV2,
27 RenameClusterReplicaV1, RenameClusterV1, RenameItemV1, RenameSchemaV1, RevokeRoleV1,
28 RevokeRoleV2, RotateKeysV1, SchedulingDecisionV1, SchedulingDecisionsWithReasonsV1,
29 SchedulingDecisionsWithReasonsV2, SchemaV1, SchemaV2, SetV1, ToNewIdV1, UpdateItemV1,
30 UpdateOwnerV1, UpdatePrivilegeV1, VersionedEvent,
31};
32use mz_proto::{ProtoType, RustType, TryFromProtoError};
33
34use crate::objects::Empty;
35
36impl RustType<crate::objects::AuditLogEvent> for VersionedEvent {
37 fn into_proto(&self) -> crate::objects::AuditLogEvent {
38 match self {
39 VersionedEvent::V1(event) => crate::objects::AuditLogEvent::V1(event.into_proto()),
40 }
41 }
42
43 fn from_proto(proto: crate::objects::AuditLogEvent) -> Result<Self, TryFromProtoError> {
44 match proto {
45 crate::objects::AuditLogEvent::V1(event) => Ok(VersionedEvent::V1(event.into_rust()?)),
46 }
47 }
48}
49
50impl RustType<crate::objects::audit_log_event_v1::EventType> for EventType {
51 fn into_proto(&self) -> crate::objects::audit_log_event_v1::EventType {
52 match self {
53 EventType::Create => crate::objects::audit_log_event_v1::EventType::Create,
54 EventType::Drop => crate::objects::audit_log_event_v1::EventType::Drop,
55 EventType::Alter => crate::objects::audit_log_event_v1::EventType::Alter,
56 EventType::Grant => crate::objects::audit_log_event_v1::EventType::Grant,
57 EventType::Revoke => crate::objects::audit_log_event_v1::EventType::Revoke,
58 EventType::Comment => crate::objects::audit_log_event_v1::EventType::Comment,
59 }
60 }
61
62 fn from_proto(
63 proto: crate::objects::audit_log_event_v1::EventType,
64 ) -> Result<Self, TryFromProtoError> {
65 match proto {
66 crate::objects::audit_log_event_v1::EventType::Create => Ok(EventType::Create),
67 crate::objects::audit_log_event_v1::EventType::Drop => Ok(EventType::Drop),
68 crate::objects::audit_log_event_v1::EventType::Alter => Ok(EventType::Alter),
69 crate::objects::audit_log_event_v1::EventType::Grant => Ok(EventType::Grant),
70 crate::objects::audit_log_event_v1::EventType::Revoke => Ok(EventType::Revoke),
71 crate::objects::audit_log_event_v1::EventType::Comment => Ok(EventType::Comment),
72 crate::objects::audit_log_event_v1::EventType::Unknown => Err(
73 TryFromProtoError::unknown_enum_variant("EventType::Unknown"),
74 ),
75 }
76 }
77}
78
79impl RustType<crate::objects::audit_log_event_v1::ObjectType> for mz_audit_log::ObjectType {
80 fn into_proto(&self) -> crate::objects::audit_log_event_v1::ObjectType {
81 match self {
82 mz_audit_log::ObjectType::Cluster => {
83 crate::objects::audit_log_event_v1::ObjectType::Cluster
84 }
85 mz_audit_log::ObjectType::ClusterReplica => {
86 crate::objects::audit_log_event_v1::ObjectType::ClusterReplica
87 }
88 mz_audit_log::ObjectType::Connection => {
89 crate::objects::audit_log_event_v1::ObjectType::Connection
90 }
91 mz_audit_log::ObjectType::ContinualTask => {
92 crate::objects::audit_log_event_v1::ObjectType::ContinualTask
93 }
94 mz_audit_log::ObjectType::Database => {
95 crate::objects::audit_log_event_v1::ObjectType::Database
96 }
97 mz_audit_log::ObjectType::Func => crate::objects::audit_log_event_v1::ObjectType::Func,
98 mz_audit_log::ObjectType::Index => {
99 crate::objects::audit_log_event_v1::ObjectType::Index
100 }
101 mz_audit_log::ObjectType::MaterializedView => {
102 crate::objects::audit_log_event_v1::ObjectType::MaterializedView
103 }
104 mz_audit_log::ObjectType::MetricSink => {
105 crate::objects::audit_log_event_v1::ObjectType::MetricSink
106 }
107 mz_audit_log::ObjectType::NetworkPolicy => {
108 crate::objects::audit_log_event_v1::ObjectType::NetworkPolicy
109 }
110 mz_audit_log::ObjectType::Role => crate::objects::audit_log_event_v1::ObjectType::Role,
111 mz_audit_log::ObjectType::Secret => {
112 crate::objects::audit_log_event_v1::ObjectType::Secret
113 }
114 mz_audit_log::ObjectType::Schema => {
115 crate::objects::audit_log_event_v1::ObjectType::Schema
116 }
117 mz_audit_log::ObjectType::Sink => crate::objects::audit_log_event_v1::ObjectType::Sink,
118 mz_audit_log::ObjectType::Source => {
119 crate::objects::audit_log_event_v1::ObjectType::Source
120 }
121 mz_audit_log::ObjectType::System => {
122 crate::objects::audit_log_event_v1::ObjectType::System
123 }
124 mz_audit_log::ObjectType::Table => {
125 crate::objects::audit_log_event_v1::ObjectType::Table
126 }
127 mz_audit_log::ObjectType::Type => crate::objects::audit_log_event_v1::ObjectType::Type,
128 mz_audit_log::ObjectType::View => crate::objects::audit_log_event_v1::ObjectType::View,
129 }
130 }
131
132 fn from_proto(
133 proto: crate::objects::audit_log_event_v1::ObjectType,
134 ) -> Result<Self, TryFromProtoError> {
135 match proto {
136 crate::objects::audit_log_event_v1::ObjectType::Cluster => {
137 Ok(mz_audit_log::ObjectType::Cluster)
138 }
139 crate::objects::audit_log_event_v1::ObjectType::ClusterReplica => {
140 Ok(mz_audit_log::ObjectType::ClusterReplica)
141 }
142 crate::objects::audit_log_event_v1::ObjectType::Connection => {
143 Ok(mz_audit_log::ObjectType::Connection)
144 }
145 crate::objects::audit_log_event_v1::ObjectType::ContinualTask => {
146 Ok(mz_audit_log::ObjectType::ContinualTask)
147 }
148 crate::objects::audit_log_event_v1::ObjectType::Database => {
149 Ok(mz_audit_log::ObjectType::Database)
150 }
151 crate::objects::audit_log_event_v1::ObjectType::Func => {
152 Ok(mz_audit_log::ObjectType::Func)
153 }
154 crate::objects::audit_log_event_v1::ObjectType::Index => {
155 Ok(mz_audit_log::ObjectType::Index)
156 }
157 crate::objects::audit_log_event_v1::ObjectType::MaterializedView => {
158 Ok(mz_audit_log::ObjectType::MaterializedView)
159 }
160 crate::objects::audit_log_event_v1::ObjectType::MetricSink => {
161 Ok(mz_audit_log::ObjectType::MetricSink)
162 }
163 crate::objects::audit_log_event_v1::ObjectType::NetworkPolicy => {
164 Ok(mz_audit_log::ObjectType::NetworkPolicy)
165 }
166 crate::objects::audit_log_event_v1::ObjectType::Role => {
167 Ok(mz_audit_log::ObjectType::Role)
168 }
169 crate::objects::audit_log_event_v1::ObjectType::Secret => {
170 Ok(mz_audit_log::ObjectType::Secret)
171 }
172 crate::objects::audit_log_event_v1::ObjectType::Schema => {
173 Ok(mz_audit_log::ObjectType::Schema)
174 }
175 crate::objects::audit_log_event_v1::ObjectType::Sink => {
176 Ok(mz_audit_log::ObjectType::Sink)
177 }
178 crate::objects::audit_log_event_v1::ObjectType::Source => {
179 Ok(mz_audit_log::ObjectType::Source)
180 }
181 crate::objects::audit_log_event_v1::ObjectType::System => {
182 Ok(mz_audit_log::ObjectType::System)
183 }
184 crate::objects::audit_log_event_v1::ObjectType::Table => {
185 Ok(mz_audit_log::ObjectType::Table)
186 }
187 crate::objects::audit_log_event_v1::ObjectType::Type => {
188 Ok(mz_audit_log::ObjectType::Type)
189 }
190 crate::objects::audit_log_event_v1::ObjectType::View => {
191 Ok(mz_audit_log::ObjectType::View)
192 }
193 crate::objects::audit_log_event_v1::ObjectType::Unknown => Err(
194 TryFromProtoError::unknown_enum_variant("ObjectType::Unknown"),
195 ),
196 }
197 }
198}
199
200impl RustType<crate::objects::audit_log_event_v1::IdFullNameV1> for IdFullNameV1 {
201 fn into_proto(&self) -> crate::objects::audit_log_event_v1::IdFullNameV1 {
202 crate::objects::audit_log_event_v1::IdFullNameV1 {
203 id: self.id.to_string(),
204 name: self.name.into_proto(),
205 }
206 }
207
208 fn from_proto(
209 proto: crate::objects::audit_log_event_v1::IdFullNameV1,
210 ) -> Result<Self, TryFromProtoError> {
211 Ok(IdFullNameV1 {
212 id: proto.id,
213 name: proto.name.into_rust()?,
214 })
215 }
216}
217
218impl RustType<crate::objects::audit_log_event_v1::FullNameV1> for FullNameV1 {
219 fn into_proto(&self) -> crate::objects::audit_log_event_v1::FullNameV1 {
220 crate::objects::audit_log_event_v1::FullNameV1 {
221 database: self.database.to_string(),
222 schema: self.schema.to_string(),
223 item: self.item.to_string(),
224 }
225 }
226
227 fn from_proto(
228 proto: crate::objects::audit_log_event_v1::FullNameV1,
229 ) -> Result<Self, TryFromProtoError> {
230 Ok(FullNameV1 {
231 database: proto.database,
232 schema: proto.schema,
233 item: proto.item,
234 })
235 }
236}
237
238impl RustType<crate::objects::audit_log_event_v1::IdNameV1> for IdNameV1 {
239 fn into_proto(&self) -> crate::objects::audit_log_event_v1::IdNameV1 {
240 crate::objects::audit_log_event_v1::IdNameV1 {
241 id: self.id.to_string(),
242 name: self.name.to_string(),
243 }
244 }
245
246 fn from_proto(
247 proto: crate::objects::audit_log_event_v1::IdNameV1,
248 ) -> Result<Self, TryFromProtoError> {
249 Ok(IdNameV1 {
250 id: proto.id,
251 name: proto.name,
252 })
253 }
254}
255
256impl RustType<crate::objects::audit_log_event_v1::RenameItemV1> for RenameItemV1 {
257 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RenameItemV1 {
258 crate::objects::audit_log_event_v1::RenameItemV1 {
259 id: self.id.to_string(),
260 old_name: self.old_name.into_proto(),
261 new_name: self.new_name.into_proto(),
262 }
263 }
264
265 fn from_proto(
266 proto: crate::objects::audit_log_event_v1::RenameItemV1,
267 ) -> Result<Self, TryFromProtoError> {
268 Ok(RenameItemV1 {
269 id: proto.id,
270 old_name: proto.old_name.into_rust()?,
271 new_name: proto.new_name.into_rust()?,
272 })
273 }
274}
275
276impl RustType<crate::objects::audit_log_event_v1::RenameClusterV1> for RenameClusterV1 {
277 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RenameClusterV1 {
278 crate::objects::audit_log_event_v1::RenameClusterV1 {
279 id: self.id.to_string(),
280 old_name: self.old_name.into_proto(),
281 new_name: self.new_name.into_proto(),
282 }
283 }
284
285 fn from_proto(
286 proto: crate::objects::audit_log_event_v1::RenameClusterV1,
287 ) -> Result<Self, TryFromProtoError> {
288 Ok(RenameClusterV1 {
289 id: proto.id,
290 old_name: proto.old_name,
291 new_name: proto.new_name,
292 })
293 }
294}
295
296impl RustType<crate::objects::audit_log_event_v1::RenameClusterReplicaV1>
297 for RenameClusterReplicaV1
298{
299 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RenameClusterReplicaV1 {
300 crate::objects::audit_log_event_v1::RenameClusterReplicaV1 {
301 cluster_id: self.cluster_id.to_string(),
302 replica_id: self.replica_id.to_string(),
303 old_name: self.old_name.into_proto(),
304 new_name: self.new_name.into_proto(),
305 }
306 }
307
308 fn from_proto(
309 proto: crate::objects::audit_log_event_v1::RenameClusterReplicaV1,
310 ) -> Result<Self, TryFromProtoError> {
311 Ok(RenameClusterReplicaV1 {
312 cluster_id: proto.cluster_id,
313 replica_id: proto.replica_id,
314 old_name: proto.old_name,
315 new_name: proto.new_name,
316 })
317 }
318}
319
320impl RustType<crate::objects::audit_log_event_v1::ReconfigurationLifecycleV1>
321 for ReconfigurationLifecycleV1
322{
323 fn into_proto(&self) -> crate::objects::audit_log_event_v1::ReconfigurationLifecycleV1 {
324 use crate::objects::audit_log_event_v1::reconfiguration_lifecycle_v1::Transition;
325 let transition = match self {
326 ReconfigurationLifecycleV1::Started => Transition::Started(Empty {}),
327 ReconfigurationLifecycleV1::Finalized => Transition::Finalized(Empty {}),
328 ReconfigurationLifecycleV1::TimedOut => Transition::TimedOut(Empty {}),
329 ReconfigurationLifecycleV1::Cancelled => Transition::Cancelled(Empty {}),
330 ReconfigurationLifecycleV1::ResourceExhausted => {
331 Transition::ResourceExhausted(Empty {})
332 }
333 };
334 crate::objects::audit_log_event_v1::ReconfigurationLifecycleV1 { transition }
335 }
336
337 fn from_proto(
338 proto: crate::objects::audit_log_event_v1::ReconfigurationLifecycleV1,
339 ) -> Result<Self, TryFromProtoError> {
340 use crate::objects::audit_log_event_v1::reconfiguration_lifecycle_v1::Transition;
341 Ok(match proto.transition {
342 Transition::Started(_) => ReconfigurationLifecycleV1::Started,
343 Transition::Finalized(_) => ReconfigurationLifecycleV1::Finalized,
344 Transition::TimedOut(_) => ReconfigurationLifecycleV1::TimedOut,
345 Transition::Cancelled(_) => ReconfigurationLifecycleV1::Cancelled,
346 Transition::ResourceExhausted(_) => ReconfigurationLifecycleV1::ResourceExhausted,
347 })
348 }
349}
350
351impl RustType<crate::objects::audit_log_event_v1::AlterClusterReconfigurationV1>
352 for AlterClusterReconfigurationV1
353{
354 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterClusterReconfigurationV1 {
355 crate::objects::audit_log_event_v1::AlterClusterReconfigurationV1 {
356 cluster_id: self.cluster_id.to_string(),
357 cluster_name: self.cluster_name.to_string(),
358 transition: self.transition.into_proto(),
359 forced: self.forced,
360 target_size: self.target_size.to_string(),
361 target_replication_factor: self.target_replication_factor,
362 target_availability_zones: self.target_availability_zones.clone(),
363 target_logging: self.target_logging.into_proto(),
364 deadline: self.deadline,
365 }
366 }
367
368 fn from_proto(
369 proto: crate::objects::audit_log_event_v1::AlterClusterReconfigurationV1,
370 ) -> Result<Self, TryFromProtoError> {
371 Ok(AlterClusterReconfigurationV1 {
372 cluster_id: proto.cluster_id,
373 cluster_name: proto.cluster_name,
374 transition: proto.transition.into_rust()?,
375 forced: proto.forced,
376 target_size: proto.target_size,
377 target_replication_factor: proto.target_replication_factor,
378 target_availability_zones: proto.target_availability_zones,
379 target_logging: proto.target_logging.into_rust()?,
380 deadline: proto.deadline,
381 })
382 }
383}
384
385impl RustType<crate::objects::audit_log_event_v1::ClusterReplicaLoggingV1>
386 for ClusterReplicaLoggingV1
387{
388 fn into_proto(&self) -> crate::objects::audit_log_event_v1::ClusterReplicaLoggingV1 {
389 crate::objects::audit_log_event_v1::ClusterReplicaLoggingV1 {
390 log_logging: self.log_logging,
391 interval: self.interval.into_proto(),
392 }
393 }
394
395 fn from_proto(
396 proto: crate::objects::audit_log_event_v1::ClusterReplicaLoggingV1,
397 ) -> Result<Self, TryFromProtoError> {
398 Ok(ClusterReplicaLoggingV1 {
399 log_logging: proto.log_logging,
400 interval: proto.interval.into_rust()?,
401 })
402 }
403}
404
405impl RustType<crate::objects::audit_log_event_v1::HydrationBurstLifecycleV1>
406 for HydrationBurstLifecycleV1
407{
408 fn into_proto(&self) -> crate::objects::audit_log_event_v1::HydrationBurstLifecycleV1 {
409 use crate::objects::audit_log_event_v1::hydration_burst_lifecycle_v1::Transition;
410 let transition = match self {
411 HydrationBurstLifecycleV1::Started => Transition::Started(Empty {}),
412 HydrationBurstLifecycleV1::Finished => Transition::Finished(Empty {}),
413 };
414 crate::objects::audit_log_event_v1::HydrationBurstLifecycleV1 { transition }
415 }
416
417 fn from_proto(
418 proto: crate::objects::audit_log_event_v1::HydrationBurstLifecycleV1,
419 ) -> Result<Self, TryFromProtoError> {
420 use crate::objects::audit_log_event_v1::hydration_burst_lifecycle_v1::Transition;
421 Ok(match proto.transition {
422 Transition::Started(_) => HydrationBurstLifecycleV1::Started,
423 Transition::Finished(_) => HydrationBurstLifecycleV1::Finished,
424 })
425 }
426}
427
428impl RustType<crate::objects::audit_log_event_v1::BurstFinishCauseV1> for BurstFinishCauseV1 {
429 fn into_proto(&self) -> crate::objects::audit_log_event_v1::BurstFinishCauseV1 {
430 use crate::objects::audit_log_event_v1::burst_finish_cause_v1::Cause;
431 let cause = match self {
432 BurstFinishCauseV1::LingerElapsed => Cause::LingerElapsed(Empty {}),
433 BurstFinishCauseV1::NoLongerWarranted => Cause::NoLongerWarranted(Empty {}),
434 };
435 crate::objects::audit_log_event_v1::BurstFinishCauseV1 { cause }
436 }
437
438 fn from_proto(
439 proto: crate::objects::audit_log_event_v1::BurstFinishCauseV1,
440 ) -> Result<Self, TryFromProtoError> {
441 use crate::objects::audit_log_event_v1::burst_finish_cause_v1::Cause;
442 Ok(match proto.cause {
443 Cause::LingerElapsed(_) => BurstFinishCauseV1::LingerElapsed,
444 Cause::NoLongerWarranted(_) => BurstFinishCauseV1::NoLongerWarranted,
445 })
446 }
447}
448
449impl RustType<crate::objects::audit_log_event_v1::ClusterHydrationBurstV1>
450 for ClusterHydrationBurstV1
451{
452 fn into_proto(&self) -> crate::objects::audit_log_event_v1::ClusterHydrationBurstV1 {
453 crate::objects::audit_log_event_v1::ClusterHydrationBurstV1 {
454 cluster_id: self.cluster_id.to_string(),
455 cluster_name: self.cluster_name.to_string(),
456 transition: self.transition.into_proto(),
457 finish_cause: self.finish_cause.map(|cause| cause.into_proto()),
458 burst_size: self.burst_size.to_string(),
459 }
460 }
461
462 fn from_proto(
463 proto: crate::objects::audit_log_event_v1::ClusterHydrationBurstV1,
464 ) -> Result<Self, TryFromProtoError> {
465 Ok(ClusterHydrationBurstV1 {
466 cluster_id: proto.cluster_id,
467 cluster_name: proto.cluster_name,
468 transition: proto.transition.into_rust()?,
469 finish_cause: proto
470 .finish_cause
471 .map(|cause| cause.into_rust())
472 .transpose()?,
473 burst_size: proto.burst_size,
474 })
475 }
476}
477
478impl RustType<crate::objects::audit_log_event_v1::DropClusterReplicaV1> for DropClusterReplicaV1 {
479 fn into_proto(&self) -> crate::objects::audit_log_event_v1::DropClusterReplicaV1 {
480 crate::objects::audit_log_event_v1::DropClusterReplicaV1 {
481 cluster_id: self.cluster_id.to_string(),
482 cluster_name: self.cluster_name.to_string(),
483 replica_id: self
484 .replica_id
485 .as_ref()
486 .map(|id| crate::objects::StringWrapper {
487 inner: id.to_string(),
488 }),
489 replica_name: self.replica_name.to_string(),
490 }
491 }
492
493 fn from_proto(
494 proto: crate::objects::audit_log_event_v1::DropClusterReplicaV1,
495 ) -> Result<Self, TryFromProtoError> {
496 Ok(DropClusterReplicaV1 {
497 cluster_id: proto.cluster_id,
498 cluster_name: proto.cluster_name,
499 replica_id: proto.replica_id.map(|s| s.inner),
500 replica_name: proto.replica_name,
501 })
502 }
503}
504
505impl RustType<crate::objects::audit_log_event_v1::DropClusterReplicaV2> for DropClusterReplicaV2 {
506 fn into_proto(&self) -> crate::objects::audit_log_event_v1::DropClusterReplicaV2 {
507 crate::objects::audit_log_event_v1::DropClusterReplicaV2 {
508 cluster_id: self.cluster_id.to_string(),
509 cluster_name: self.cluster_name.to_string(),
510 replica_id: self
511 .replica_id
512 .as_ref()
513 .map(|id| crate::objects::StringWrapper {
514 inner: id.to_string(),
515 }),
516 replica_name: self.replica_name.to_string(),
517 reason: self.reason.into_proto(),
518 scheduling_policies: self.scheduling_policies.into_proto(),
519 }
520 }
521
522 fn from_proto(
523 proto: crate::objects::audit_log_event_v1::DropClusterReplicaV2,
524 ) -> Result<Self, TryFromProtoError> {
525 Ok(DropClusterReplicaV2 {
526 cluster_id: proto.cluster_id,
527 cluster_name: proto.cluster_name,
528 replica_id: proto.replica_id.map(|s| s.inner),
529 replica_name: proto.replica_name,
530 reason: proto.reason.into_rust()?,
531 scheduling_policies: proto.scheduling_policies.into_rust()?,
532 })
533 }
534}
535
536impl RustType<crate::objects::audit_log_event_v1::DropClusterReplicaV3> for DropClusterReplicaV3 {
537 fn into_proto(&self) -> crate::objects::audit_log_event_v1::DropClusterReplicaV3 {
538 crate::objects::audit_log_event_v1::DropClusterReplicaV3 {
539 cluster_id: self.cluster_id.to_string(),
540 cluster_name: self.cluster_name.to_string(),
541 replica_id: self
542 .replica_id
543 .as_ref()
544 .map(|id| crate::objects::StringWrapper {
545 inner: id.to_string(),
546 }),
547 replica_name: self.replica_name.to_string(),
548 reason: self.reason.into_proto(),
549 scheduling_policies: self.scheduling_policies.into_proto(),
550 }
551 }
552
553 fn from_proto(
554 proto: crate::objects::audit_log_event_v1::DropClusterReplicaV3,
555 ) -> Result<Self, TryFromProtoError> {
556 Ok(DropClusterReplicaV3 {
557 cluster_id: proto.cluster_id,
558 cluster_name: proto.cluster_name,
559 replica_id: proto.replica_id.map(|s| s.inner),
560 replica_name: proto.replica_name,
561 reason: proto.reason.into_rust()?,
562 scheduling_policies: proto.scheduling_policies.into_rust()?,
563 })
564 }
565}
566
567impl RustType<crate::objects::audit_log_event_v1::CreateClusterReplicaV1>
568 for CreateClusterReplicaV1
569{
570 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateClusterReplicaV1 {
571 crate::objects::audit_log_event_v1::CreateClusterReplicaV1 {
572 cluster_id: self.cluster_id.to_string(),
573 cluster_name: self.cluster_name.to_string(),
574 replica_id: self
575 .replica_id
576 .as_ref()
577 .map(|id| crate::objects::StringWrapper {
578 inner: id.to_string(),
579 }),
580 replica_name: self.replica_name.to_string(),
581 logical_size: self.logical_size.to_string(),
582 disk: self.disk,
583 billed_as: self.billed_as.clone(),
584 internal: self.internal,
585 }
586 }
587
588 fn from_proto(
589 proto: crate::objects::audit_log_event_v1::CreateClusterReplicaV1,
590 ) -> Result<Self, TryFromProtoError> {
591 Ok(CreateClusterReplicaV1 {
592 cluster_id: proto.cluster_id,
593 cluster_name: proto.cluster_name,
594 replica_id: proto.replica_id.map(|id| id.inner),
595 replica_name: proto.replica_name,
596 logical_size: proto.logical_size,
597 disk: proto.disk,
598 billed_as: proto.billed_as,
599 internal: proto.internal,
600 })
601 }
602}
603
604impl RustType<crate::objects::audit_log_event_v1::CreateClusterReplicaV2>
605 for CreateClusterReplicaV2
606{
607 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateClusterReplicaV2 {
608 crate::objects::audit_log_event_v1::CreateClusterReplicaV2 {
609 cluster_id: self.cluster_id.to_string(),
610 cluster_name: self.cluster_name.to_string(),
611 replica_id: self
612 .replica_id
613 .as_ref()
614 .map(|id| crate::objects::StringWrapper {
615 inner: id.to_string(),
616 }),
617 replica_name: self.replica_name.to_string(),
618 logical_size: self.logical_size.to_string(),
619 disk: self.disk,
620 billed_as: self.billed_as.clone(),
621 internal: self.internal,
622 reason: self.reason.into_proto(),
623 scheduling_policies: self.scheduling_policies.into_proto(),
624 }
625 }
626
627 fn from_proto(
628 proto: crate::objects::audit_log_event_v1::CreateClusterReplicaV2,
629 ) -> Result<Self, TryFromProtoError> {
630 Ok(CreateClusterReplicaV2 {
631 cluster_id: proto.cluster_id,
632 cluster_name: proto.cluster_name,
633 replica_id: proto.replica_id.map(|id| id.inner),
634 replica_name: proto.replica_name,
635 logical_size: proto.logical_size,
636 disk: proto.disk,
637 billed_as: proto.billed_as,
638 internal: proto.internal,
639 reason: proto.reason.into_rust()?,
640 scheduling_policies: proto.scheduling_policies.into_rust()?,
641 })
642 }
643}
644
645impl RustType<crate::objects::audit_log_event_v1::CreateClusterReplicaV3>
646 for CreateClusterReplicaV3
647{
648 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateClusterReplicaV3 {
649 crate::objects::audit_log_event_v1::CreateClusterReplicaV3 {
650 cluster_id: self.cluster_id.to_string(),
651 cluster_name: self.cluster_name.to_string(),
652 replica_id: self
653 .replica_id
654 .as_ref()
655 .map(|id| crate::objects::StringWrapper {
656 inner: id.to_string(),
657 }),
658 replica_name: self.replica_name.to_string(),
659 logical_size: self.logical_size.to_string(),
660 disk: self.disk,
661 billed_as: self.billed_as.clone(),
662 internal: self.internal,
663 reason: self.reason.into_proto(),
664 scheduling_policies: self.scheduling_policies.into_proto(),
665 }
666 }
667
668 fn from_proto(
669 proto: crate::objects::audit_log_event_v1::CreateClusterReplicaV3,
670 ) -> Result<Self, TryFromProtoError> {
671 Ok(CreateClusterReplicaV3 {
672 cluster_id: proto.cluster_id,
673 cluster_name: proto.cluster_name,
674 replica_id: proto.replica_id.map(|id| id.inner),
675 replica_name: proto.replica_name,
676 logical_size: proto.logical_size,
677 disk: proto.disk,
678 billed_as: proto.billed_as,
679 internal: proto.internal,
680 reason: proto.reason.into_rust()?,
681 scheduling_policies: proto.scheduling_policies.into_rust()?,
682 })
683 }
684}
685
686impl RustType<crate::objects::audit_log_event_v1::CreateClusterReplicaV4>
687 for CreateClusterReplicaV4
688{
689 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateClusterReplicaV4 {
690 crate::objects::audit_log_event_v1::CreateClusterReplicaV4 {
691 cluster_id: self.cluster_id.to_string(),
692 cluster_name: self.cluster_name.to_string(),
693 replica_id: self
694 .replica_id
695 .as_ref()
696 .map(|id| crate::objects::StringWrapper {
697 inner: id.to_string(),
698 }),
699 replica_name: self.replica_name.to_string(),
700 logical_size: self.logical_size.to_string(),
701 billed_as: self.billed_as.clone(),
702 internal: self.internal,
703 reason: self.reason.into_proto(),
704 scheduling_policies: self.scheduling_policies.into_proto(),
705 }
706 }
707
708 fn from_proto(
709 proto: crate::objects::audit_log_event_v1::CreateClusterReplicaV4,
710 ) -> Result<Self, TryFromProtoError> {
711 Ok(CreateClusterReplicaV4 {
712 cluster_id: proto.cluster_id,
713 cluster_name: proto.cluster_name,
714 replica_id: proto.replica_id.map(|id| id.inner),
715 replica_name: proto.replica_name,
716 logical_size: proto.logical_size,
717 billed_as: proto.billed_as,
718 internal: proto.internal,
719 reason: proto.reason.into_rust()?,
720 scheduling_policies: proto.scheduling_policies.into_rust()?,
721 })
722 }
723}
724
725impl RustType<crate::objects::audit_log_event_v1::CreateOrDropClusterReplicaReasonV1>
726 for CreateOrDropClusterReplicaReasonV1
727{
728 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateOrDropClusterReplicaReasonV1 {
729 match self {
730 CreateOrDropClusterReplicaReasonV1::Manual => {
731 use crate::objects::audit_log_event_v1 as ev;
732 ev::CreateOrDropClusterReplicaReasonV1 {
733 reason: ev::CreateOrDropClusterReplicaReasonV1Reason::Manual(Empty {}),
734 }
735 }
736 CreateOrDropClusterReplicaReasonV1::Schedule => {
737 use crate::objects::audit_log_event_v1 as ev;
738 ev::CreateOrDropClusterReplicaReasonV1 {
739 reason: ev::CreateOrDropClusterReplicaReasonV1Reason::Schedule(Empty {}),
740 }
741 }
742 CreateOrDropClusterReplicaReasonV1::System => {
743 use crate::objects::audit_log_event_v1 as ev;
744 ev::CreateOrDropClusterReplicaReasonV1 {
745 reason: ev::CreateOrDropClusterReplicaReasonV1Reason::System(Empty {}),
746 }
747 }
748 CreateOrDropClusterReplicaReasonV1::Reconfiguration => {
749 use crate::objects::audit_log_event_v1 as ev;
750 ev::CreateOrDropClusterReplicaReasonV1 {
751 reason: ev::CreateOrDropClusterReplicaReasonV1Reason::Reconfiguration(Empty {}),
752 }
753 }
754 CreateOrDropClusterReplicaReasonV1::HydrationBurst => {
755 use crate::objects::audit_log_event_v1 as ev;
756 ev::CreateOrDropClusterReplicaReasonV1 {
757 reason: ev::CreateOrDropClusterReplicaReasonV1Reason::HydrationBurst(Empty {}),
758 }
759 }
760 CreateOrDropClusterReplicaReasonV1::Retired => {
761 use crate::objects::audit_log_event_v1 as ev;
762 ev::CreateOrDropClusterReplicaReasonV1 {
763 reason: ev::CreateOrDropClusterReplicaReasonV1Reason::Retired(Empty {}),
764 }
765 }
766 }
767 }
768
769 fn from_proto(
770 proto: crate::objects::audit_log_event_v1::CreateOrDropClusterReplicaReasonV1,
771 ) -> Result<Self, TryFromProtoError> {
772 use crate::objects::audit_log_event_v1::CreateOrDropClusterReplicaReasonV1Reason as Reason;
773 match proto.reason {
774 Reason::Manual(Empty {}) => Ok(CreateOrDropClusterReplicaReasonV1::Manual),
775 Reason::Schedule(Empty {}) => Ok(CreateOrDropClusterReplicaReasonV1::Schedule),
776 Reason::System(Empty {}) => Ok(CreateOrDropClusterReplicaReasonV1::System),
777 Reason::Reconfiguration(Empty {}) => {
778 Ok(CreateOrDropClusterReplicaReasonV1::Reconfiguration)
779 }
780 Reason::HydrationBurst(Empty {}) => {
781 Ok(CreateOrDropClusterReplicaReasonV1::HydrationBurst)
782 }
783 Reason::Retired(Empty {}) => Ok(CreateOrDropClusterReplicaReasonV1::Retired),
784 }
785 }
786}
787
788impl RustType<crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV1>
789 for SchedulingDecisionsWithReasonsV1
790{
791 fn into_proto(&self) -> crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV1 {
792 crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV1 {
793 on_refresh: self.on_refresh.into_proto(),
794 }
795 }
796
797 fn from_proto(
798 proto: crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV1,
799 ) -> Result<Self, TryFromProtoError> {
800 Ok(SchedulingDecisionsWithReasonsV1 {
801 on_refresh: proto.on_refresh.into_rust()?,
802 })
803 }
804}
805
806impl RustType<crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV2>
807 for SchedulingDecisionsWithReasonsV2
808{
809 fn into_proto(&self) -> crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV2 {
810 crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV2 {
811 on_refresh: self.on_refresh.into_proto(),
812 }
813 }
814
815 fn from_proto(
816 proto: crate::objects::audit_log_event_v1::SchedulingDecisionsWithReasonsV2,
817 ) -> Result<Self, TryFromProtoError> {
818 Ok(SchedulingDecisionsWithReasonsV2 {
819 on_refresh: proto.on_refresh.into_rust()?,
820 })
821 }
822}
823
824impl RustType<crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV1>
825 for RefreshDecisionWithReasonV1
826{
827 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV1 {
828 let decision = match &self.decision {
829 SchedulingDecisionV1::On => {
830 crate::objects::audit_log_event_v1::RefreshDecision::On(Empty {})
831 }
832 SchedulingDecisionV1::Off => {
833 crate::objects::audit_log_event_v1::RefreshDecision::Off(Empty {})
834 }
835 };
836 crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV1 {
837 decision,
838 objects_needing_refresh: self.objects_needing_refresh.clone(),
839 rehydration_time_estimate: self.hydration_time_estimate.clone(),
840 }
841 }
842
843 fn from_proto(
844 proto: crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV1,
845 ) -> Result<Self, TryFromProtoError> {
846 let decision = match proto.decision {
847 crate::objects::audit_log_event_v1::RefreshDecision::On(Empty {}) => {
848 SchedulingDecisionV1::On
849 }
850 crate::objects::audit_log_event_v1::RefreshDecision::Off(Empty {}) => {
851 SchedulingDecisionV1::Off
852 }
853 };
854 Ok(RefreshDecisionWithReasonV1 {
855 decision,
856 objects_needing_refresh: proto.objects_needing_refresh,
857 hydration_time_estimate: proto.rehydration_time_estimate,
858 })
859 }
860}
861
862impl RustType<crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV2>
863 for RefreshDecisionWithReasonV2
864{
865 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV2 {
866 let decision = match &self.decision {
867 SchedulingDecisionV1::On => {
868 crate::objects::audit_log_event_v1::RefreshDecision::On(Empty {})
869 }
870 SchedulingDecisionV1::Off => {
871 crate::objects::audit_log_event_v1::RefreshDecision::Off(Empty {})
872 }
873 };
874 crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV2 {
875 decision,
876 objects_needing_refresh: self.objects_needing_refresh.clone(),
877 objects_needing_compaction: self.objects_needing_compaction.clone(),
878 rehydration_time_estimate: self.hydration_time_estimate.clone(),
879 }
880 }
881
882 fn from_proto(
883 proto: crate::objects::audit_log_event_v1::RefreshDecisionWithReasonV2,
884 ) -> Result<Self, TryFromProtoError> {
885 let decision = match proto.decision {
886 crate::objects::audit_log_event_v1::RefreshDecision::On(Empty {}) => {
887 SchedulingDecisionV1::On
888 }
889 crate::objects::audit_log_event_v1::RefreshDecision::Off(Empty {}) => {
890 SchedulingDecisionV1::Off
891 }
892 };
893 Ok(RefreshDecisionWithReasonV2 {
894 decision,
895 objects_needing_refresh: proto.objects_needing_refresh,
896 objects_needing_compaction: proto.objects_needing_compaction,
897 hydration_time_estimate: proto.rehydration_time_estimate,
898 })
899 }
900}
901
902impl RustType<crate::objects::audit_log_event_v1::CreateSourceSinkV1> for CreateSourceSinkV1 {
903 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateSourceSinkV1 {
904 crate::objects::audit_log_event_v1::CreateSourceSinkV1 {
905 id: self.id.to_string(),
906 name: self.name.into_proto(),
907 size: self.size.as_ref().map(|s| crate::objects::StringWrapper {
908 inner: s.to_string(),
909 }),
910 }
911 }
912
913 fn from_proto(
914 proto: crate::objects::audit_log_event_v1::CreateSourceSinkV1,
915 ) -> Result<Self, TryFromProtoError> {
916 Ok(CreateSourceSinkV1 {
917 id: proto.id,
918 name: proto.name.into_rust()?,
919 size: proto.size.map(|s| s.inner),
920 })
921 }
922}
923
924impl RustType<crate::objects::audit_log_event_v1::CreateSourceSinkV2> for CreateSourceSinkV2 {
925 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateSourceSinkV2 {
926 crate::objects::audit_log_event_v1::CreateSourceSinkV2 {
927 id: self.id.to_string(),
928 name: self.name.into_proto(),
929 size: self.size.as_ref().map(|s| crate::objects::StringWrapper {
930 inner: s.to_string(),
931 }),
932 external_type: self.external_type.to_string(),
933 }
934 }
935
936 fn from_proto(
937 proto: crate::objects::audit_log_event_v1::CreateSourceSinkV2,
938 ) -> Result<Self, TryFromProtoError> {
939 Ok(CreateSourceSinkV2 {
940 id: proto.id,
941 name: proto.name.into_rust()?,
942 size: proto.size.map(|s| s.inner),
943 external_type: proto.external_type,
944 })
945 }
946}
947
948impl RustType<crate::objects::audit_log_event_v1::CreateSourceSinkV3> for CreateSourceSinkV3 {
949 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateSourceSinkV3 {
950 crate::objects::audit_log_event_v1::CreateSourceSinkV3 {
951 id: self.id.to_string(),
952 name: self.name.into_proto(),
953 external_type: self.external_type.to_string(),
954 }
955 }
956
957 fn from_proto(
958 proto: crate::objects::audit_log_event_v1::CreateSourceSinkV3,
959 ) -> Result<Self, TryFromProtoError> {
960 Ok(CreateSourceSinkV3 {
961 id: proto.id,
962 name: proto.name.into_rust()?,
963 external_type: proto.external_type,
964 })
965 }
966}
967
968impl RustType<crate::objects::audit_log_event_v1::CreateSourceSinkV4> for CreateSourceSinkV4 {
969 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateSourceSinkV4 {
970 crate::objects::audit_log_event_v1::CreateSourceSinkV4 {
971 id: self.id.to_string(),
972 cluster_id: self
973 .cluster_id
974 .as_ref()
975 .map(|id| crate::objects::StringWrapper {
976 inner: id.to_string(),
977 }),
978 name: self.name.into_proto(),
979 external_type: self.external_type.to_string(),
980 }
981 }
982
983 fn from_proto(
984 proto: crate::objects::audit_log_event_v1::CreateSourceSinkV4,
985 ) -> Result<Self, TryFromProtoError> {
986 Ok(CreateSourceSinkV4 {
987 id: proto.id,
988 cluster_id: proto.cluster_id.map(|s| s.inner),
989 name: proto.name.into_rust()?,
990 external_type: proto.external_type,
991 })
992 }
993}
994
995impl RustType<crate::objects::audit_log_event_v1::CreateIndexV1> for CreateIndexV1 {
996 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateIndexV1 {
997 crate::objects::audit_log_event_v1::CreateIndexV1 {
998 id: self.id.to_string(),
999 cluster_id: self.cluster_id.to_string(),
1000 name: self.name.into_proto(),
1001 }
1002 }
1003
1004 fn from_proto(
1005 proto: crate::objects::audit_log_event_v1::CreateIndexV1,
1006 ) -> Result<Self, TryFromProtoError> {
1007 Ok(CreateIndexV1 {
1008 id: proto.id,
1009 cluster_id: proto.cluster_id,
1010 name: proto.name.into_rust()?,
1011 })
1012 }
1013}
1014
1015impl RustType<crate::objects::audit_log_event_v1::CreateMaterializedViewV1>
1016 for CreateMaterializedViewV1
1017{
1018 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateMaterializedViewV1 {
1019 crate::objects::audit_log_event_v1::CreateMaterializedViewV1 {
1020 id: self.id.to_string(),
1021 cluster_id: self.cluster_id.to_string(),
1022 name: self.name.into_proto(),
1023 replacement_target_id: self.replacement_target_id.into_proto(),
1024 }
1025 }
1026
1027 fn from_proto(
1028 proto: crate::objects::audit_log_event_v1::CreateMaterializedViewV1,
1029 ) -> Result<Self, TryFromProtoError> {
1030 Ok(CreateMaterializedViewV1 {
1031 id: proto.id,
1032 cluster_id: proto.cluster_id,
1033 name: proto.name.into_rust()?,
1034 replacement_target_id: proto.replacement_target_id,
1035 })
1036 }
1037}
1038
1039impl RustType<crate::objects::audit_log_event_v1::AlterApplyReplacementV1>
1040 for AlterApplyReplacementV1
1041{
1042 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterApplyReplacementV1 {
1043 crate::objects::audit_log_event_v1::AlterApplyReplacementV1 {
1044 target: self.target.into_proto(),
1045 replacement: self.replacement.into_proto(),
1046 }
1047 }
1048
1049 fn from_proto(
1050 proto: crate::objects::audit_log_event_v1::AlterApplyReplacementV1,
1051 ) -> Result<Self, TryFromProtoError> {
1052 Ok(AlterApplyReplacementV1 {
1053 target: proto.target.into_rust()?,
1054 replacement: proto.replacement.into_rust()?,
1055 })
1056 }
1057}
1058
1059impl RustType<crate::objects::audit_log_event_v1::AlterSourceSinkV1> for AlterSourceSinkV1 {
1060 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterSourceSinkV1 {
1061 crate::objects::audit_log_event_v1::AlterSourceSinkV1 {
1062 id: self.id.to_string(),
1063 name: self.name.into_proto(),
1064 old_size: self
1065 .old_size
1066 .as_ref()
1067 .map(|s| crate::objects::StringWrapper {
1068 inner: s.to_string(),
1069 }),
1070 new_size: self
1071 .new_size
1072 .as_ref()
1073 .map(|s| crate::objects::StringWrapper {
1074 inner: s.to_string(),
1075 }),
1076 }
1077 }
1078
1079 fn from_proto(
1080 proto: crate::objects::audit_log_event_v1::AlterSourceSinkV1,
1081 ) -> Result<Self, TryFromProtoError> {
1082 Ok(AlterSourceSinkV1 {
1083 id: proto.id,
1084 name: proto.name.into_rust()?,
1085 old_size: proto.old_size.map(|s| s.inner),
1086 new_size: proto.new_size.map(|s| s.inner),
1087 })
1088 }
1089}
1090
1091impl RustType<crate::objects::audit_log_event_v1::AlterSetClusterV1> for AlterSetClusterV1 {
1092 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterSetClusterV1 {
1093 crate::objects::audit_log_event_v1::AlterSetClusterV1 {
1094 id: self.id.to_string(),
1095 name: self.name.into_proto(),
1096 old_cluster_id: self.old_cluster_id.into_proto(),
1097 new_cluster_id: self.new_cluster_id.into_proto(),
1098 }
1099 }
1100
1101 fn from_proto(
1102 proto: crate::objects::audit_log_event_v1::AlterSetClusterV1,
1103 ) -> Result<Self, TryFromProtoError> {
1104 Ok(Self {
1105 id: proto.id,
1106 name: proto.name.into_rust()?,
1107 old_cluster_id: proto.old_cluster_id,
1108 new_cluster_id: proto.new_cluster_id,
1109 })
1110 }
1111}
1112
1113impl RustType<crate::objects::audit_log_event_v1::GrantRoleV1> for GrantRoleV1 {
1114 fn into_proto(&self) -> crate::objects::audit_log_event_v1::GrantRoleV1 {
1115 crate::objects::audit_log_event_v1::GrantRoleV1 {
1116 role_id: self.role_id.to_string(),
1117 member_id: self.member_id.to_string(),
1118 grantor_id: self.grantor_id.to_string(),
1119 }
1120 }
1121
1122 fn from_proto(
1123 proto: crate::objects::audit_log_event_v1::GrantRoleV1,
1124 ) -> Result<Self, TryFromProtoError> {
1125 Ok(GrantRoleV1 {
1126 role_id: proto.role_id,
1127 member_id: proto.member_id,
1128 grantor_id: proto.grantor_id,
1129 })
1130 }
1131}
1132
1133impl RustType<crate::objects::audit_log_event_v1::GrantRoleV2> for GrantRoleV2 {
1134 fn into_proto(&self) -> crate::objects::audit_log_event_v1::GrantRoleV2 {
1135 crate::objects::audit_log_event_v1::GrantRoleV2 {
1136 role_id: self.role_id.to_string(),
1137 member_id: self.member_id.to_string(),
1138 grantor_id: self.grantor_id.to_string(),
1139 executed_by: self.executed_by.to_string(),
1140 }
1141 }
1142
1143 fn from_proto(
1144 proto: crate::objects::audit_log_event_v1::GrantRoleV2,
1145 ) -> Result<Self, TryFromProtoError> {
1146 Ok(GrantRoleV2 {
1147 role_id: proto.role_id,
1148 member_id: proto.member_id,
1149 grantor_id: proto.grantor_id,
1150 executed_by: proto.executed_by,
1151 })
1152 }
1153}
1154
1155impl RustType<crate::objects::audit_log_event_v1::RevokeRoleV1> for RevokeRoleV1 {
1156 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RevokeRoleV1 {
1157 crate::objects::audit_log_event_v1::RevokeRoleV1 {
1158 role_id: self.role_id.to_string(),
1159 member_id: self.member_id.to_string(),
1160 }
1161 }
1162
1163 fn from_proto(
1164 proto: crate::objects::audit_log_event_v1::RevokeRoleV1,
1165 ) -> Result<Self, TryFromProtoError> {
1166 Ok(RevokeRoleV1 {
1167 role_id: proto.role_id,
1168 member_id: proto.member_id,
1169 })
1170 }
1171}
1172
1173impl RustType<crate::objects::audit_log_event_v1::RevokeRoleV2> for RevokeRoleV2 {
1174 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RevokeRoleV2 {
1175 crate::objects::audit_log_event_v1::RevokeRoleV2 {
1176 role_id: self.role_id.to_string(),
1177 member_id: self.member_id.to_string(),
1178 grantor_id: self.grantor_id.to_string(),
1179 executed_by: self.executed_by.to_string(),
1180 }
1181 }
1182
1183 fn from_proto(
1184 proto: crate::objects::audit_log_event_v1::RevokeRoleV2,
1185 ) -> Result<Self, TryFromProtoError> {
1186 Ok(RevokeRoleV2 {
1187 role_id: proto.role_id,
1188 member_id: proto.member_id,
1189 grantor_id: proto.grantor_id,
1190 executed_by: proto.executed_by,
1191 })
1192 }
1193}
1194
1195impl RustType<crate::objects::audit_log_event_v1::UpdatePrivilegeV1> for UpdatePrivilegeV1 {
1196 fn into_proto(&self) -> crate::objects::audit_log_event_v1::UpdatePrivilegeV1 {
1197 crate::objects::audit_log_event_v1::UpdatePrivilegeV1 {
1198 object_id: self.object_id.to_string(),
1199 grantee_id: self.grantee_id.to_string(),
1200 grantor_id: self.grantor_id.to_string(),
1201 privileges: self.privileges.to_string(),
1202 }
1203 }
1204
1205 fn from_proto(
1206 proto: crate::objects::audit_log_event_v1::UpdatePrivilegeV1,
1207 ) -> Result<Self, TryFromProtoError> {
1208 Ok(UpdatePrivilegeV1 {
1209 object_id: proto.object_id,
1210 grantee_id: proto.grantee_id,
1211 grantor_id: proto.grantor_id,
1212 privileges: proto.privileges,
1213 })
1214 }
1215}
1216
1217impl RustType<crate::objects::audit_log_event_v1::AlterDefaultPrivilegeV1>
1218 for AlterDefaultPrivilegeV1
1219{
1220 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterDefaultPrivilegeV1 {
1221 crate::objects::audit_log_event_v1::AlterDefaultPrivilegeV1 {
1222 role_id: self.role_id.to_string(),
1223 database_id: self
1224 .database_id
1225 .as_ref()
1226 .map(|id| crate::objects::StringWrapper {
1227 inner: id.to_string(),
1228 }),
1229 schema_id: self
1230 .schema_id
1231 .as_ref()
1232 .map(|id| crate::objects::StringWrapper {
1233 inner: id.to_string(),
1234 }),
1235 grantee_id: self.grantee_id.to_string(),
1236 privileges: self.privileges.to_string(),
1237 }
1238 }
1239
1240 fn from_proto(
1241 proto: crate::objects::audit_log_event_v1::AlterDefaultPrivilegeV1,
1242 ) -> Result<Self, TryFromProtoError> {
1243 Ok(AlterDefaultPrivilegeV1 {
1244 role_id: proto.role_id,
1245 database_id: proto.database_id.map(|id| id.inner),
1246 schema_id: proto.schema_id.map(|id| id.inner),
1247 grantee_id: proto.grantee_id,
1248 privileges: proto.privileges,
1249 })
1250 }
1251}
1252
1253impl RustType<crate::objects::audit_log_event_v1::UpdateOwnerV1> for UpdateOwnerV1 {
1254 fn into_proto(&self) -> crate::objects::audit_log_event_v1::UpdateOwnerV1 {
1255 crate::objects::audit_log_event_v1::UpdateOwnerV1 {
1256 object_id: self.object_id.to_string(),
1257 old_owner_id: self.old_owner_id.to_string(),
1258 new_owner_id: self.new_owner_id.to_string(),
1259 }
1260 }
1261
1262 fn from_proto(
1263 proto: crate::objects::audit_log_event_v1::UpdateOwnerV1,
1264 ) -> Result<Self, TryFromProtoError> {
1265 Ok(UpdateOwnerV1 {
1266 object_id: proto.object_id,
1267 old_owner_id: proto.old_owner_id,
1268 new_owner_id: proto.new_owner_id,
1269 })
1270 }
1271}
1272
1273impl RustType<crate::objects::audit_log_event_v1::SchemaV1> for SchemaV1 {
1274 fn into_proto(&self) -> crate::objects::audit_log_event_v1::SchemaV1 {
1275 crate::objects::audit_log_event_v1::SchemaV1 {
1276 id: self.id.to_string(),
1277 name: self.name.to_string(),
1278 database_name: self.database_name.to_string(),
1279 }
1280 }
1281
1282 fn from_proto(
1283 proto: crate::objects::audit_log_event_v1::SchemaV1,
1284 ) -> Result<Self, TryFromProtoError> {
1285 Ok(SchemaV1 {
1286 id: proto.id,
1287 name: proto.name,
1288 database_name: proto.database_name,
1289 })
1290 }
1291}
1292
1293impl RustType<crate::objects::audit_log_event_v1::SchemaV2> for SchemaV2 {
1294 fn into_proto(&self) -> crate::objects::audit_log_event_v1::SchemaV2 {
1295 crate::objects::audit_log_event_v1::SchemaV2 {
1296 id: self.id.to_string(),
1297 name: self.name.to_string(),
1298 database_name: self
1299 .database_name
1300 .as_ref()
1301 .map(|d| crate::objects::StringWrapper {
1302 inner: d.to_string(),
1303 }),
1304 }
1305 }
1306
1307 fn from_proto(
1308 proto: crate::objects::audit_log_event_v1::SchemaV2,
1309 ) -> Result<Self, TryFromProtoError> {
1310 Ok(SchemaV2 {
1311 id: proto.id,
1312 name: proto.name,
1313 database_name: proto.database_name.map(|d| d.inner),
1314 })
1315 }
1316}
1317
1318impl RustType<crate::objects::audit_log_event_v1::RenameSchemaV1> for RenameSchemaV1 {
1319 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RenameSchemaV1 {
1320 crate::objects::audit_log_event_v1::RenameSchemaV1 {
1321 id: self.id.to_string(),
1322 database_name: self.database_name.clone(),
1323 old_name: self.old_name.clone(),
1324 new_name: self.new_name.clone(),
1325 }
1326 }
1327
1328 fn from_proto(
1329 proto: crate::objects::audit_log_event_v1::RenameSchemaV1,
1330 ) -> Result<Self, TryFromProtoError> {
1331 Ok(RenameSchemaV1 {
1332 id: proto.id,
1333 database_name: proto.database_name,
1334 old_name: proto.old_name,
1335 new_name: proto.new_name,
1336 })
1337 }
1338}
1339
1340impl RustType<crate::objects::audit_log_event_v1::UpdateItemV1> for UpdateItemV1 {
1341 fn into_proto(&self) -> crate::objects::audit_log_event_v1::UpdateItemV1 {
1342 crate::objects::audit_log_event_v1::UpdateItemV1 {
1343 id: self.id.to_string(),
1344 name: self.name.into_proto(),
1345 }
1346 }
1347
1348 fn from_proto(
1349 proto: crate::objects::audit_log_event_v1::UpdateItemV1,
1350 ) -> Result<Self, TryFromProtoError> {
1351 Ok(UpdateItemV1 {
1352 id: proto.id,
1353 name: proto.name.into_rust()?,
1354 })
1355 }
1356}
1357
1358impl RustType<crate::objects::audit_log_event_v1::AlterRetainHistoryV1> for AlterRetainHistoryV1 {
1359 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterRetainHistoryV1 {
1360 crate::objects::audit_log_event_v1::AlterRetainHistoryV1 {
1361 id: self.id.to_string(),
1362 old_history: self.old_history.clone(),
1363 new_history: self.new_history.clone(),
1364 }
1365 }
1366
1367 fn from_proto(
1368 proto: crate::objects::audit_log_event_v1::AlterRetainHistoryV1,
1369 ) -> Result<Self, TryFromProtoError> {
1370 Ok(AlterRetainHistoryV1 {
1371 id: proto.id,
1372 old_history: proto.old_history,
1373 new_history: proto.new_history,
1374 })
1375 }
1376}
1377
1378impl RustType<crate::objects::audit_log_event_v1::AlterAddColumnV1> for AlterAddColumnV1 {
1379 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterAddColumnV1 {
1380 crate::objects::audit_log_event_v1::AlterAddColumnV1 {
1381 id: self.id.to_string(),
1382 column: self.column.clone(),
1383 column_type: self.column_type.clone(),
1384 nullable: self.nullable,
1385 }
1386 }
1387
1388 fn from_proto(
1389 proto: crate::objects::audit_log_event_v1::AlterAddColumnV1,
1390 ) -> Result<Self, TryFromProtoError> {
1391 Ok(AlterAddColumnV1 {
1392 id: proto.id,
1393 column: proto.column,
1394 column_type: proto.column_type,
1395 nullable: proto.nullable,
1396 })
1397 }
1398}
1399
1400impl RustType<crate::objects::audit_log_event_v1::AlterSourceTimestampIntervalV1>
1401 for AlterSourceTimestampIntervalV1
1402{
1403 fn into_proto(&self) -> crate::objects::audit_log_event_v1::AlterSourceTimestampIntervalV1 {
1404 crate::objects::audit_log_event_v1::AlterSourceTimestampIntervalV1 {
1405 id: self.id.to_string(),
1406 old_interval: self.old_interval.clone(),
1407 new_interval: self.new_interval.clone(),
1408 }
1409 }
1410
1411 fn from_proto(
1412 proto: crate::objects::audit_log_event_v1::AlterSourceTimestampIntervalV1,
1413 ) -> Result<Self, TryFromProtoError> {
1414 Ok(AlterSourceTimestampIntervalV1 {
1415 id: proto.id,
1416 old_interval: proto.old_interval,
1417 new_interval: proto.new_interval,
1418 })
1419 }
1420}
1421
1422impl RustType<crate::objects::audit_log_event_v1::ToNewIdV1> for ToNewIdV1 {
1423 fn into_proto(&self) -> crate::objects::audit_log_event_v1::ToNewIdV1 {
1424 crate::objects::audit_log_event_v1::ToNewIdV1 {
1425 id: self.id.to_string(),
1426 new_id: self.new_id.to_string(),
1427 }
1428 }
1429
1430 fn from_proto(
1431 proto: crate::objects::audit_log_event_v1::ToNewIdV1,
1432 ) -> Result<Self, TryFromProtoError> {
1433 Ok(ToNewIdV1 {
1434 id: proto.id,
1435 new_id: proto.new_id,
1436 })
1437 }
1438}
1439
1440impl RustType<crate::objects::audit_log_event_v1::FromPreviousIdV1> for FromPreviousIdV1 {
1441 fn into_proto(&self) -> crate::objects::audit_log_event_v1::FromPreviousIdV1 {
1442 crate::objects::audit_log_event_v1::FromPreviousIdV1 {
1443 id: self.id.to_string(),
1444 previous_id: self.previous_id.to_string(),
1445 }
1446 }
1447
1448 fn from_proto(
1449 proto: crate::objects::audit_log_event_v1::FromPreviousIdV1,
1450 ) -> Result<Self, TryFromProtoError> {
1451 Ok(FromPreviousIdV1 {
1452 id: proto.id,
1453 previous_id: proto.previous_id,
1454 })
1455 }
1456}
1457
1458impl RustType<crate::objects::audit_log_event_v1::SetV1> for SetV1 {
1459 fn into_proto(&self) -> crate::objects::audit_log_event_v1::SetV1 {
1460 crate::objects::audit_log_event_v1::SetV1 {
1461 name: self.name.clone(),
1462 value: self.value.clone(),
1463 }
1464 }
1465
1466 fn from_proto(
1467 proto: crate::objects::audit_log_event_v1::SetV1,
1468 ) -> Result<Self, TryFromProtoError> {
1469 Ok(SetV1 {
1470 name: proto.name,
1471 value: proto.value,
1472 })
1473 }
1474}
1475
1476impl RustType<crate::objects::audit_log_event_v1::RotateKeysV1> for RotateKeysV1 {
1477 fn into_proto(&self) -> crate::objects::audit_log_event_v1::RotateKeysV1 {
1478 crate::objects::audit_log_event_v1::RotateKeysV1 {
1479 id: self.id.clone(),
1480 name: self.name.clone(),
1481 }
1482 }
1483
1484 fn from_proto(
1485 proto: crate::objects::audit_log_event_v1::RotateKeysV1,
1486 ) -> Result<Self, TryFromProtoError> {
1487 Ok(RotateKeysV1 {
1488 id: proto.id,
1489 name: proto.name,
1490 })
1491 }
1492}
1493
1494impl RustType<crate::objects::audit_log_event_v1::CreateRoleV1> for CreateRoleV1 {
1495 fn into_proto(&self) -> crate::objects::audit_log_event_v1::CreateRoleV1 {
1496 crate::objects::audit_log_event_v1::CreateRoleV1 {
1497 id: self.id.clone(),
1498 name: self.name.clone(),
1499 auto_provision_source: self.auto_provision_source.clone(),
1500 }
1501 }
1502
1503 fn from_proto(
1504 proto: crate::objects::audit_log_event_v1::CreateRoleV1,
1505 ) -> Result<Self, TryFromProtoError> {
1506 Ok(CreateRoleV1 {
1507 id: proto.id,
1508 name: proto.name,
1509 auto_provision_source: proto.auto_provision_source,
1510 })
1511 }
1512}
1513
1514impl RustType<crate::objects::audit_log_event_v1::Details> for EventDetails {
1515 fn into_proto(&self) -> crate::objects::audit_log_event_v1::Details {
1516 use crate::objects::audit_log_event_v1::Details::*;
1517
1518 match self {
1519 EventDetails::CreateClusterReplicaV1(details) => {
1520 CreateClusterReplicaV1(details.into_proto())
1521 }
1522 EventDetails::CreateClusterReplicaV2(details) => {
1523 CreateClusterReplicaV2(details.into_proto())
1524 }
1525 EventDetails::CreateClusterReplicaV3(details) => {
1526 CreateClusterReplicaV3(details.into_proto())
1527 }
1528 EventDetails::CreateClusterReplicaV4(details) => {
1529 CreateClusterReplicaV4(details.into_proto())
1530 }
1531 EventDetails::DropClusterReplicaV1(details) => {
1532 DropClusterReplicaV1(details.into_proto())
1533 }
1534 EventDetails::DropClusterReplicaV2(details) => {
1535 DropClusterReplicaV2(details.into_proto())
1536 }
1537 EventDetails::DropClusterReplicaV3(details) => {
1538 DropClusterReplicaV3(details.into_proto())
1539 }
1540 EventDetails::CreateSourceSinkV1(details) => CreateSourceSinkV1(details.into_proto()),
1541 EventDetails::CreateSourceSinkV2(details) => CreateSourceSinkV2(details.into_proto()),
1542 EventDetails::CreateSourceSinkV3(details) => CreateSourceSinkV3(details.into_proto()),
1543 EventDetails::CreateSourceSinkV4(details) => CreateSourceSinkV4(details.into_proto()),
1544 EventDetails::CreateIndexV1(details) => CreateIndexV1(details.into_proto()),
1545 EventDetails::CreateMaterializedViewV1(details) => {
1546 CreateMaterializedViewV1(details.into_proto())
1547 }
1548 EventDetails::AlterApplyReplacementV1(details) => {
1549 AlterApplyReplacementV1(details.into_proto())
1550 }
1551 EventDetails::AlterSourceSinkV1(details) => AlterSourceSinkV1(details.into_proto()),
1552 EventDetails::AlterSetClusterV1(details) => AlterSetClusterV1(details.into_proto()),
1553 EventDetails::GrantRoleV1(details) => GrantRoleV1(details.into_proto()),
1554 EventDetails::GrantRoleV2(details) => GrantRoleV2(details.into_proto()),
1555 EventDetails::RevokeRoleV1(details) => RevokeRoleV1(details.into_proto()),
1556 EventDetails::RevokeRoleV2(details) => RevokeRoleV2(details.into_proto()),
1557 EventDetails::UpdatePrivilegeV1(details) => UpdatePrivilegeV1(details.into_proto()),
1558 EventDetails::AlterDefaultPrivilegeV1(details) => {
1559 AlterDefaultPrivilegeV1(details.into_proto())
1560 }
1561 EventDetails::UpdateOwnerV1(details) => UpdateOwnerV1(details.into_proto()),
1562 EventDetails::IdFullNameV1(details) => IdFullNameV1(details.into_proto()),
1563 EventDetails::RenameClusterV1(details) => RenameClusterV1(details.into_proto()),
1564 EventDetails::RenameClusterReplicaV1(details) => {
1565 RenameClusterReplicaV1(details.into_proto())
1566 }
1567 EventDetails::RenameItemV1(details) => RenameItemV1(details.into_proto()),
1568 EventDetails::IdNameV1(details) => IdNameV1(details.into_proto()),
1569 EventDetails::SchemaV1(details) => SchemaV1(details.into_proto()),
1570 EventDetails::SchemaV2(details) => SchemaV2(details.into_proto()),
1571 EventDetails::RenameSchemaV1(details) => RenameSchemaV1(details.into_proto()),
1572 EventDetails::UpdateItemV1(details) => UpdateItemV1(details.into_proto()),
1573 EventDetails::AlterRetainHistoryV1(details) => {
1574 AlterRetainHistoryV1(details.into_proto())
1575 }
1576 EventDetails::AlterAddColumnV1(details) => AlterAddColumnV1(details.into_proto()),
1577 EventDetails::AlterSourceTimestampIntervalV1(details) => {
1578 AlterSourceTimestampIntervalV1(details.into_proto())
1579 }
1580 EventDetails::AlterClusterReconfigurationV1(details) => {
1581 AlterClusterReconfigurationV1(details.into_proto())
1582 }
1583 EventDetails::ClusterHydrationBurstV1(details) => {
1584 ClusterHydrationBurstV1(details.into_proto())
1585 }
1586 EventDetails::ToNewIdV1(details) => ToNewIdV1(details.into_proto()),
1587 EventDetails::FromPreviousIdV1(details) => FromPreviousIdV1(details.into_proto()),
1588 EventDetails::SetV1(details) => SetV1(details.into_proto()),
1589 EventDetails::ResetAllV1 => ResetAllV1(Empty {}),
1590 EventDetails::RotateKeysV1(details) => RotateKeysV1(details.into_proto()),
1591 EventDetails::CreateRoleV1(details) => CreateRoleV1(details.into_proto()),
1592 }
1593 }
1594
1595 fn from_proto(
1596 proto: crate::objects::audit_log_event_v1::Details,
1597 ) -> Result<Self, TryFromProtoError> {
1598 use crate::objects::audit_log_event_v1::Details::*;
1599
1600 match proto {
1601 CreateClusterReplicaV1(details) => {
1602 Ok(EventDetails::CreateClusterReplicaV1(details.into_rust()?))
1603 }
1604 CreateClusterReplicaV2(details) => {
1605 Ok(EventDetails::CreateClusterReplicaV2(details.into_rust()?))
1606 }
1607 CreateClusterReplicaV3(details) => {
1608 Ok(EventDetails::CreateClusterReplicaV3(details.into_rust()?))
1609 }
1610 CreateClusterReplicaV4(details) => {
1611 Ok(EventDetails::CreateClusterReplicaV4(details.into_rust()?))
1612 }
1613 DropClusterReplicaV1(details) => {
1614 Ok(EventDetails::DropClusterReplicaV1(details.into_rust()?))
1615 }
1616 DropClusterReplicaV2(details) => {
1617 Ok(EventDetails::DropClusterReplicaV2(details.into_rust()?))
1618 }
1619 DropClusterReplicaV3(details) => {
1620 Ok(EventDetails::DropClusterReplicaV3(details.into_rust()?))
1621 }
1622 CreateSourceSinkV1(details) => {
1623 Ok(EventDetails::CreateSourceSinkV1(details.into_rust()?))
1624 }
1625 CreateSourceSinkV2(details) => {
1626 Ok(EventDetails::CreateSourceSinkV2(details.into_rust()?))
1627 }
1628 CreateSourceSinkV3(details) => {
1629 Ok(EventDetails::CreateSourceSinkV3(details.into_rust()?))
1630 }
1631 CreateSourceSinkV4(details) => {
1632 Ok(EventDetails::CreateSourceSinkV4(details.into_rust()?))
1633 }
1634 CreateIndexV1(details) => Ok(EventDetails::CreateIndexV1(details.into_rust()?)),
1635 CreateMaterializedViewV1(details) => {
1636 Ok(EventDetails::CreateMaterializedViewV1(details.into_rust()?))
1637 }
1638 AlterApplyReplacementV1(details) => {
1639 Ok(EventDetails::AlterApplyReplacementV1(details.into_rust()?))
1640 }
1641 AlterSourceSinkV1(details) => Ok(EventDetails::AlterSourceSinkV1(details.into_rust()?)),
1642 AlterSetClusterV1(details) => Ok(EventDetails::AlterSetClusterV1(details.into_rust()?)),
1643 GrantRoleV1(details) => Ok(EventDetails::GrantRoleV1(details.into_rust()?)),
1644 GrantRoleV2(details) => Ok(EventDetails::GrantRoleV2(details.into_rust()?)),
1645 RevokeRoleV1(details) => Ok(EventDetails::RevokeRoleV1(details.into_rust()?)),
1646 RevokeRoleV2(details) => Ok(EventDetails::RevokeRoleV2(details.into_rust()?)),
1647 UpdatePrivilegeV1(details) => Ok(EventDetails::UpdatePrivilegeV1(details.into_rust()?)),
1648 AlterDefaultPrivilegeV1(details) => {
1649 Ok(EventDetails::AlterDefaultPrivilegeV1(details.into_rust()?))
1650 }
1651 UpdateOwnerV1(details) => Ok(EventDetails::UpdateOwnerV1(details.into_rust()?)),
1652 IdFullNameV1(details) => Ok(EventDetails::IdFullNameV1(details.into_rust()?)),
1653 RenameClusterV1(details) => Ok(EventDetails::RenameClusterV1(details.into_rust()?)),
1654 RenameClusterReplicaV1(details) => {
1655 Ok(EventDetails::RenameClusterReplicaV1(details.into_rust()?))
1656 }
1657 RenameItemV1(details) => Ok(EventDetails::RenameItemV1(details.into_rust()?)),
1658 IdNameV1(details) => Ok(EventDetails::IdNameV1(details.into_rust()?)),
1659 SchemaV1(details) => Ok(EventDetails::SchemaV1(details.into_rust()?)),
1660 SchemaV2(details) => Ok(EventDetails::SchemaV2(details.into_rust()?)),
1661 RenameSchemaV1(details) => Ok(EventDetails::RenameSchemaV1(details.into_rust()?)),
1662 UpdateItemV1(details) => Ok(EventDetails::UpdateItemV1(details.into_rust()?)),
1663 AlterRetainHistoryV1(details) => {
1664 Ok(EventDetails::AlterRetainHistoryV1(details.into_rust()?))
1665 }
1666 ToNewIdV1(details) => Ok(EventDetails::ToNewIdV1(details.into_rust()?)),
1667 FromPreviousIdV1(details) => Ok(EventDetails::FromPreviousIdV1(details.into_rust()?)),
1668 SetV1(details) => Ok(EventDetails::SetV1(details.into_rust()?)),
1669 ResetAllV1(Empty {}) => Ok(EventDetails::ResetAllV1),
1670 RotateKeysV1(details) => Ok(EventDetails::RotateKeysV1(details.into_rust()?)),
1671 CreateRoleV1(details) => Ok(EventDetails::CreateRoleV1(details.into_rust()?)),
1672 AlterAddColumnV1(details) => Ok(EventDetails::AlterAddColumnV1(details.into_rust()?)),
1673 AlterSourceTimestampIntervalV1(details) => Ok(
1674 EventDetails::AlterSourceTimestampIntervalV1(details.into_rust()?),
1675 ),
1676 AlterClusterReconfigurationV1(details) => Ok(
1677 EventDetails::AlterClusterReconfigurationV1(details.into_rust()?),
1678 ),
1679 ClusterHydrationBurstV1(details) => {
1680 Ok(EventDetails::ClusterHydrationBurstV1(details.into_rust()?))
1681 }
1682 }
1683 }
1684}
1685
1686impl RustType<crate::objects::AuditLogEventV1> for EventV1 {
1687 fn into_proto(&self) -> crate::objects::AuditLogEventV1 {
1688 crate::objects::AuditLogEventV1 {
1689 id: self.id,
1690 event_type: self.event_type.into_proto(),
1691 object_type: self.object_type.into_proto(),
1692 user: self.user.as_ref().map(|u| crate::objects::StringWrapper {
1693 inner: u.to_string(),
1694 }),
1695 occurred_at: crate::objects::EpochMillis {
1696 millis: self.occurred_at,
1697 },
1698 details: self.details.into_proto(),
1699 }
1700 }
1701
1702 fn from_proto(proto: crate::objects::AuditLogEventV1) -> Result<Self, TryFromProtoError> {
1703 Ok(EventV1 {
1704 id: proto.id,
1705 event_type: proto.event_type.into_rust()?,
1706 object_type: proto.object_type.into_rust()?,
1707 details: proto.details.into_rust()?,
1708 user: proto.user.map(|u| u.inner),
1709 occurred_at: proto.occurred_at.into_rust()?,
1710 })
1711 }
1712}