1#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
5#[repr(i32)]
6pub enum PolicyType {
7 POLICY_TYPE_UNSPECIFIED = 0i32,
8 POLICY_TYPE_ROW_FILTER = 1i32,
10 POLICY_TYPE_COLUMN_MASK = 2i32,
12}
13impl PolicyType {
14 #[allow(non_upper_case_globals)]
16 pub const Unspecified: Self = Self::POLICY_TYPE_UNSPECIFIED;
17 #[allow(non_upper_case_globals)]
19 pub const RowFilter: Self = Self::POLICY_TYPE_ROW_FILTER;
20 #[allow(non_upper_case_globals)]
22 pub const ColumnMask: Self = Self::POLICY_TYPE_COLUMN_MASK;
23}
24impl ::core::default::Default for PolicyType {
25 fn default() -> Self {
26 Self::POLICY_TYPE_UNSPECIFIED
27 }
28}
29impl ::serde::Serialize for PolicyType {
30 fn serialize<S: ::serde::Serializer>(
31 &self,
32 s: S,
33 ) -> ::core::result::Result<S::Ok, S::Error> {
34 s.serialize_str(::buffa::Enumeration::proto_name(self))
35 }
36}
37impl<'de> ::serde::Deserialize<'de> for PolicyType {
38 fn deserialize<D: ::serde::Deserializer<'de>>(
39 d: D,
40 ) -> ::core::result::Result<Self, D::Error> {
41 struct _V;
42 impl ::serde::de::Visitor<'_> for _V {
43 type Value = PolicyType;
44 fn expecting(
45 &self,
46 f: &mut ::core::fmt::Formatter<'_>,
47 ) -> ::core::fmt::Result {
48 f.write_str(
49 concat!("a string, integer, or null for ", stringify!(PolicyType)),
50 )
51 }
52 fn visit_str<E: ::serde::de::Error>(
53 self,
54 v: &str,
55 ) -> ::core::result::Result<PolicyType, E> {
56 <PolicyType as ::buffa::Enumeration>::from_proto_name(v)
57 .ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
58 }
59 fn visit_i64<E: ::serde::de::Error>(
60 self,
61 v: i64,
62 ) -> ::core::result::Result<PolicyType, E> {
63 let v32 = i32::try_from(v)
64 .map_err(|_| {
65 ::serde::de::Error::custom(
66 ::buffa::alloc::format!("enum value {v} out of i32 range"),
67 )
68 })?;
69 <PolicyType as ::buffa::Enumeration>::from_i32(v32)
70 .ok_or_else(|| {
71 ::serde::de::Error::custom(
72 ::buffa::alloc::format!("unknown enum value {v32}"),
73 )
74 })
75 }
76 fn visit_u64<E: ::serde::de::Error>(
77 self,
78 v: u64,
79 ) -> ::core::result::Result<PolicyType, E> {
80 let v32 = i32::try_from(v)
81 .map_err(|_| {
82 ::serde::de::Error::custom(
83 ::buffa::alloc::format!("enum value {v} out of i32 range"),
84 )
85 })?;
86 <PolicyType as ::buffa::Enumeration>::from_i32(v32)
87 .ok_or_else(|| {
88 ::serde::de::Error::custom(
89 ::buffa::alloc::format!("unknown enum value {v32}"),
90 )
91 })
92 }
93 fn visit_unit<E: ::serde::de::Error>(
94 self,
95 ) -> ::core::result::Result<PolicyType, E> {
96 ::core::result::Result::Ok(::core::default::Default::default())
97 }
98 }
99 d.deserialize_any(_V)
100 }
101}
102impl ::buffa::json_helpers::ProtoElemJson for PolicyType {
103 fn serialize_proto_json<S: ::serde::Serializer>(
104 v: &Self,
105 s: S,
106 ) -> ::core::result::Result<S::Ok, S::Error> {
107 ::serde::Serialize::serialize(v, s)
108 }
109 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
110 d: D,
111 ) -> ::core::result::Result<Self, D::Error> {
112 <Self as ::serde::Deserialize>::deserialize(d)
113 }
114}
115impl ::buffa::Enumeration for PolicyType {
116 fn from_i32(value: i32) -> ::core::option::Option<Self> {
117 match value {
118 0i32 => ::core::option::Option::Some(Self::POLICY_TYPE_UNSPECIFIED),
119 1i32 => ::core::option::Option::Some(Self::POLICY_TYPE_ROW_FILTER),
120 2i32 => ::core::option::Option::Some(Self::POLICY_TYPE_COLUMN_MASK),
121 _ => ::core::option::Option::None,
122 }
123 }
124 fn to_i32(&self) -> i32 {
125 *self as i32
126 }
127 fn proto_name(&self) -> &'static str {
128 match self {
129 Self::POLICY_TYPE_UNSPECIFIED => "POLICY_TYPE_UNSPECIFIED",
130 Self::POLICY_TYPE_ROW_FILTER => "POLICY_TYPE_ROW_FILTER",
131 Self::POLICY_TYPE_COLUMN_MASK => "POLICY_TYPE_COLUMN_MASK",
132 }
133 }
134 fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
135 match name {
136 "POLICY_TYPE_UNSPECIFIED" => {
137 ::core::option::Option::Some(Self::POLICY_TYPE_UNSPECIFIED)
138 }
139 "POLICY_TYPE_ROW_FILTER" => {
140 ::core::option::Option::Some(Self::POLICY_TYPE_ROW_FILTER)
141 }
142 "POLICY_TYPE_COLUMN_MASK" => {
143 ::core::option::Option::Some(Self::POLICY_TYPE_COLUMN_MASK)
144 }
145 _ => ::core::option::Option::None,
146 }
147 }
148 fn values() -> &'static [Self] {
149 &[
150 Self::POLICY_TYPE_UNSPECIFIED,
151 Self::POLICY_TYPE_ROW_FILTER,
152 Self::POLICY_TYPE_COLUMN_MASK,
153 ]
154 }
155}
156#[derive(Clone, PartialEq, Default)]
159#[derive(::serde::Serialize, ::serde::Deserialize)]
160#[serde(default)]
161pub struct MatchColumn {
162 #[serde(
167 rename = "alias",
168 with = "::buffa::json_helpers::proto_string",
169 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
170 )]
171 pub alias: ::buffa::alloc::string::String,
172 #[serde(
176 rename = "condition",
177 with = "::buffa::json_helpers::proto_string",
178 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
179 )]
180 pub condition: ::buffa::alloc::string::String,
181 #[serde(skip)]
182 #[doc(hidden)]
183 pub __buffa_unknown_fields: ::buffa::UnknownFields,
184}
185impl ::core::fmt::Debug for MatchColumn {
186 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
187 f.debug_struct("MatchColumn")
188 .field("alias", &self.alias)
189 .field("condition", &self.condition)
190 .finish()
191 }
192}
193impl MatchColumn {
194 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.MatchColumn";
199}
200impl ::buffa::DefaultInstance for MatchColumn {
201 fn default_instance() -> &'static Self {
202 static VALUE: ::buffa::__private::OnceBox<MatchColumn> = ::buffa::__private::OnceBox::new();
203 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
204 }
205}
206impl ::buffa::MessageName for MatchColumn {
207 const PACKAGE: &'static str = "unitycatalog.policies.v1";
208 const NAME: &'static str = "MatchColumn";
209 const FULL_NAME: &'static str = "unitycatalog.policies.v1.MatchColumn";
210 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.MatchColumn";
211}
212impl ::buffa::Message for MatchColumn {
213 #[allow(clippy::let_and_return)]
219 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
220 #[allow(unused_imports)]
221 use ::buffa::Enumeration as _;
222 let mut size = 0u32;
223 if !self.alias.is_empty() {
224 size += 1u32 + ::buffa::types::string_encoded_len(&self.alias) as u32;
225 }
226 if !self.condition.is_empty() {
227 size += 1u32 + ::buffa::types::string_encoded_len(&self.condition) as u32;
228 }
229 size += self.__buffa_unknown_fields.encoded_len() as u32;
230 size
231 }
232 fn write_to(
233 &self,
234 _cache: &mut ::buffa::SizeCache,
235 buf: &mut impl ::buffa::bytes::BufMut,
236 ) {
237 #[allow(unused_imports)]
238 use ::buffa::Enumeration as _;
239 if !self.alias.is_empty() {
240 ::buffa::encoding::Tag::new(
241 1u32,
242 ::buffa::encoding::WireType::LengthDelimited,
243 )
244 .encode(buf);
245 ::buffa::types::encode_string(&self.alias, buf);
246 }
247 if !self.condition.is_empty() {
248 ::buffa::encoding::Tag::new(
249 2u32,
250 ::buffa::encoding::WireType::LengthDelimited,
251 )
252 .encode(buf);
253 ::buffa::types::encode_string(&self.condition, buf);
254 }
255 self.__buffa_unknown_fields.write_to(buf);
256 }
257 fn merge_field(
258 &mut self,
259 tag: ::buffa::encoding::Tag,
260 buf: &mut impl ::buffa::bytes::Buf,
261 depth: u32,
262 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
263 #[allow(unused_imports)]
264 use ::buffa::bytes::Buf as _;
265 #[allow(unused_imports)]
266 use ::buffa::Enumeration as _;
267 match tag.field_number() {
268 1u32 => {
269 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
270 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
271 field_number: 1u32,
272 expected: 2u8,
273 actual: tag.wire_type() as u8,
274 });
275 }
276 ::buffa::types::merge_string(&mut self.alias, buf)?;
277 }
278 2u32 => {
279 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
280 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
281 field_number: 2u32,
282 expected: 2u8,
283 actual: tag.wire_type() as u8,
284 });
285 }
286 ::buffa::types::merge_string(&mut self.condition, buf)?;
287 }
288 _ => {
289 self.__buffa_unknown_fields
290 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
291 }
292 }
293 ::core::result::Result::Ok(())
294 }
295 fn clear(&mut self) {
296 self.alias.clear();
297 self.condition.clear();
298 self.__buffa_unknown_fields.clear();
299 }
300}
301impl ::buffa::ExtensionSet for MatchColumn {
302 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.MatchColumn";
303 fn unknown_fields(&self) -> &::buffa::UnknownFields {
304 &self.__buffa_unknown_fields
305 }
306 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
307 &mut self.__buffa_unknown_fields
308 }
309}
310impl ::buffa::json_helpers::ProtoElemJson for MatchColumn {
311 fn serialize_proto_json<S: ::serde::Serializer>(
312 v: &Self,
313 s: S,
314 ) -> ::core::result::Result<S::Ok, S::Error> {
315 ::serde::Serialize::serialize(v, s)
316 }
317 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
318 d: D,
319 ) -> ::core::result::Result<Self, D::Error> {
320 <Self as ::serde::Deserialize>::deserialize(d)
321 }
322}
323#[doc(hidden)]
324pub const __MATCH_COLUMN_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
325 type_url: "type.googleapis.com/unitycatalog.policies.v1.MatchColumn",
326 to_json: ::buffa::type_registry::any_to_json::<MatchColumn>,
327 from_json: ::buffa::type_registry::any_from_json::<MatchColumn>,
328 is_wkt: false,
329};
330#[derive(Clone, PartialEq, Default)]
332#[derive(::serde::Serialize)]
333#[serde(default)]
334pub struct FunctionArg {
335 #[serde(flatten)]
336 pub value: ::core::option::Option<__buffa::oneof::function_arg::Value>,
337 #[serde(skip)]
338 #[doc(hidden)]
339 pub __buffa_unknown_fields: ::buffa::UnknownFields,
340}
341impl ::core::fmt::Debug for FunctionArg {
342 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
343 f.debug_struct("FunctionArg").field("value", &self.value).finish()
344 }
345}
346impl FunctionArg {
347 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.FunctionArg";
352}
353impl ::buffa::DefaultInstance for FunctionArg {
354 fn default_instance() -> &'static Self {
355 static VALUE: ::buffa::__private::OnceBox<FunctionArg> = ::buffa::__private::OnceBox::new();
356 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
357 }
358}
359impl ::buffa::MessageName for FunctionArg {
360 const PACKAGE: &'static str = "unitycatalog.policies.v1";
361 const NAME: &'static str = "FunctionArg";
362 const FULL_NAME: &'static str = "unitycatalog.policies.v1.FunctionArg";
363 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.FunctionArg";
364}
365impl ::buffa::Message for FunctionArg {
366 #[allow(clippy::let_and_return)]
372 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
373 #[allow(unused_imports)]
374 use ::buffa::Enumeration as _;
375 let mut size = 0u32;
376 if let ::core::option::Option::Some(ref v) = self.value {
377 match v {
378 __buffa::oneof::function_arg::Value::Alias(x) => {
379 size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
380 }
381 __buffa::oneof::function_arg::Value::Constant(x) => {
382 size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
383 }
384 }
385 }
386 size += self.__buffa_unknown_fields.encoded_len() as u32;
387 size
388 }
389 fn write_to(
390 &self,
391 _cache: &mut ::buffa::SizeCache,
392 buf: &mut impl ::buffa::bytes::BufMut,
393 ) {
394 #[allow(unused_imports)]
395 use ::buffa::Enumeration as _;
396 if let ::core::option::Option::Some(ref v) = self.value {
397 match v {
398 __buffa::oneof::function_arg::Value::Alias(x) => {
399 ::buffa::encoding::Tag::new(
400 1u32,
401 ::buffa::encoding::WireType::LengthDelimited,
402 )
403 .encode(buf);
404 ::buffa::types::encode_string(x, buf);
405 }
406 __buffa::oneof::function_arg::Value::Constant(x) => {
407 ::buffa::encoding::Tag::new(
408 2u32,
409 ::buffa::encoding::WireType::LengthDelimited,
410 )
411 .encode(buf);
412 ::buffa::types::encode_string(x, buf);
413 }
414 }
415 }
416 self.__buffa_unknown_fields.write_to(buf);
417 }
418 fn merge_field(
419 &mut self,
420 tag: ::buffa::encoding::Tag,
421 buf: &mut impl ::buffa::bytes::Buf,
422 depth: u32,
423 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
424 #[allow(unused_imports)]
425 use ::buffa::bytes::Buf as _;
426 #[allow(unused_imports)]
427 use ::buffa::Enumeration as _;
428 match tag.field_number() {
429 1u32 => {
430 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
431 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
432 field_number: 1u32,
433 expected: 2u8,
434 actual: tag.wire_type() as u8,
435 });
436 }
437 self.value = ::core::option::Option::Some(
438 __buffa::oneof::function_arg::Value::Alias(
439 ::buffa::types::decode_string(buf)?,
440 ),
441 );
442 }
443 2u32 => {
444 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
445 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
446 field_number: 2u32,
447 expected: 2u8,
448 actual: tag.wire_type() as u8,
449 });
450 }
451 self.value = ::core::option::Option::Some(
452 __buffa::oneof::function_arg::Value::Constant(
453 ::buffa::types::decode_string(buf)?,
454 ),
455 );
456 }
457 _ => {
458 self.__buffa_unknown_fields
459 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
460 }
461 }
462 ::core::result::Result::Ok(())
463 }
464 fn clear(&mut self) {
465 self.value = ::core::option::Option::None;
466 self.__buffa_unknown_fields.clear();
467 }
468}
469impl ::buffa::ExtensionSet for FunctionArg {
470 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.FunctionArg";
471 fn unknown_fields(&self) -> &::buffa::UnknownFields {
472 &self.__buffa_unknown_fields
473 }
474 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
475 &mut self.__buffa_unknown_fields
476 }
477}
478impl<'de> serde::Deserialize<'de> for FunctionArg {
479 fn deserialize<D: serde::Deserializer<'de>>(
480 d: D,
481 ) -> ::core::result::Result<Self, D::Error> {
482 struct _V;
483 impl<'de> serde::de::Visitor<'de> for _V {
484 type Value = FunctionArg;
485 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
486 f.write_str("struct FunctionArg")
487 }
488 #[allow(clippy::field_reassign_with_default)]
489 fn visit_map<A: serde::de::MapAccess<'de>>(
490 self,
491 mut map: A,
492 ) -> ::core::result::Result<FunctionArg, A::Error> {
493 let mut __oneof_value: ::core::option::Option<
494 __buffa::oneof::function_arg::Value,
495 > = None;
496 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
497 match key.as_str() {
498 "alias" => {
499 let v: ::core::option::Option<
500 ::buffa::alloc::string::String,
501 > = map
502 .next_value_seed(
503 ::buffa::json_helpers::NullableDeserializeSeed(
504 ::buffa::json_helpers::DefaultDeserializeSeed::<
505 ::buffa::alloc::string::String,
506 >::new(),
507 ),
508 )?;
509 if let Some(v) = v {
510 if __oneof_value.is_some() {
511 return Err(
512 serde::de::Error::custom(
513 "multiple oneof fields set for 'value'",
514 ),
515 );
516 }
517 __oneof_value = Some(
518 __buffa::oneof::function_arg::Value::Alias(v),
519 );
520 }
521 }
522 "constant" => {
523 let v: ::core::option::Option<
524 ::buffa::alloc::string::String,
525 > = map
526 .next_value_seed(
527 ::buffa::json_helpers::NullableDeserializeSeed(
528 ::buffa::json_helpers::DefaultDeserializeSeed::<
529 ::buffa::alloc::string::String,
530 >::new(),
531 ),
532 )?;
533 if let Some(v) = v {
534 if __oneof_value.is_some() {
535 return Err(
536 serde::de::Error::custom(
537 "multiple oneof fields set for 'value'",
538 ),
539 );
540 }
541 __oneof_value = Some(
542 __buffa::oneof::function_arg::Value::Constant(v),
543 );
544 }
545 }
546 _ => {
547 map.next_value::<serde::de::IgnoredAny>()?;
548 }
549 }
550 }
551 let mut __r = <FunctionArg as ::core::default::Default>::default();
552 __r.value = __oneof_value;
553 Ok(__r)
554 }
555 }
556 d.deserialize_map(_V)
557 }
558}
559impl ::buffa::json_helpers::ProtoElemJson for FunctionArg {
560 fn serialize_proto_json<S: ::serde::Serializer>(
561 v: &Self,
562 s: S,
563 ) -> ::core::result::Result<S::Ok, S::Error> {
564 ::serde::Serialize::serialize(v, s)
565 }
566 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
567 d: D,
568 ) -> ::core::result::Result<Self, D::Error> {
569 <Self as ::serde::Deserialize>::deserialize(d)
570 }
571}
572#[doc(hidden)]
573pub const __FUNCTION_ARG_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
574 type_url: "type.googleapis.com/unitycatalog.policies.v1.FunctionArg",
575 to_json: ::buffa::type_registry::any_to_json::<FunctionArg>,
576 from_json: ::buffa::type_registry::any_from_json::<FunctionArg>,
577 is_wkt: false,
578};
579pub mod function_arg {
580 #[allow(unused_imports)]
581 use super::*;
582 #[doc(inline)]
583 pub use super::__buffa::oneof::function_arg::Value;
584 #[doc(inline)]
585 pub use super::__buffa::view::oneof::function_arg::Value as ValueView;
586}
587#[derive(Clone, PartialEq, Default)]
590#[derive(::serde::Serialize, ::serde::Deserialize)]
591#[serde(default)]
592pub struct FunctionRef {
593 #[serde(
597 rename = "function_name",
598 alias = "functionName",
599 with = "::buffa::json_helpers::proto_string",
600 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
601 )]
602 pub function_name: ::buffa::alloc::string::String,
603 #[serde(
607 rename = "using",
608 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
609 deserialize_with = "::buffa::json_helpers::null_as_default"
610 )]
611 pub using: ::buffa::alloc::vec::Vec<FunctionArg>,
612 #[serde(skip)]
613 #[doc(hidden)]
614 pub __buffa_unknown_fields: ::buffa::UnknownFields,
615}
616impl ::core::fmt::Debug for FunctionRef {
617 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
618 f.debug_struct("FunctionRef")
619 .field("function_name", &self.function_name)
620 .field("using", &self.using)
621 .finish()
622 }
623}
624impl FunctionRef {
625 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.FunctionRef";
630}
631impl ::buffa::DefaultInstance for FunctionRef {
632 fn default_instance() -> &'static Self {
633 static VALUE: ::buffa::__private::OnceBox<FunctionRef> = ::buffa::__private::OnceBox::new();
634 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
635 }
636}
637impl ::buffa::MessageName for FunctionRef {
638 const PACKAGE: &'static str = "unitycatalog.policies.v1";
639 const NAME: &'static str = "FunctionRef";
640 const FULL_NAME: &'static str = "unitycatalog.policies.v1.FunctionRef";
641 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.FunctionRef";
642}
643impl ::buffa::Message for FunctionRef {
644 #[allow(clippy::let_and_return)]
650 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
651 #[allow(unused_imports)]
652 use ::buffa::Enumeration as _;
653 let mut size = 0u32;
654 if !self.function_name.is_empty() {
655 size
656 += 1u32 + ::buffa::types::string_encoded_len(&self.function_name) as u32;
657 }
658 for v in &self.using {
659 let __slot = __cache.reserve();
660 let inner_size = v.compute_size(__cache);
661 __cache.set(__slot, inner_size);
662 size
663 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
664 + inner_size;
665 }
666 size += self.__buffa_unknown_fields.encoded_len() as u32;
667 size
668 }
669 fn write_to(
670 &self,
671 __cache: &mut ::buffa::SizeCache,
672 buf: &mut impl ::buffa::bytes::BufMut,
673 ) {
674 #[allow(unused_imports)]
675 use ::buffa::Enumeration as _;
676 if !self.function_name.is_empty() {
677 ::buffa::encoding::Tag::new(
678 1u32,
679 ::buffa::encoding::WireType::LengthDelimited,
680 )
681 .encode(buf);
682 ::buffa::types::encode_string(&self.function_name, buf);
683 }
684 for v in &self.using {
685 ::buffa::encoding::Tag::new(
686 2u32,
687 ::buffa::encoding::WireType::LengthDelimited,
688 )
689 .encode(buf);
690 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
691 v.write_to(__cache, buf);
692 }
693 self.__buffa_unknown_fields.write_to(buf);
694 }
695 fn merge_field(
696 &mut self,
697 tag: ::buffa::encoding::Tag,
698 buf: &mut impl ::buffa::bytes::Buf,
699 depth: u32,
700 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
701 #[allow(unused_imports)]
702 use ::buffa::bytes::Buf as _;
703 #[allow(unused_imports)]
704 use ::buffa::Enumeration as _;
705 match tag.field_number() {
706 1u32 => {
707 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
708 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
709 field_number: 1u32,
710 expected: 2u8,
711 actual: tag.wire_type() as u8,
712 });
713 }
714 ::buffa::types::merge_string(&mut self.function_name, buf)?;
715 }
716 2u32 => {
717 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
718 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
719 field_number: 2u32,
720 expected: 2u8,
721 actual: tag.wire_type() as u8,
722 });
723 }
724 let mut elem = ::core::default::Default::default();
725 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
726 self.using.push(elem);
727 }
728 _ => {
729 self.__buffa_unknown_fields
730 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
731 }
732 }
733 ::core::result::Result::Ok(())
734 }
735 fn clear(&mut self) {
736 self.function_name.clear();
737 self.using.clear();
738 self.__buffa_unknown_fields.clear();
739 }
740}
741impl ::buffa::ExtensionSet for FunctionRef {
742 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.FunctionRef";
743 fn unknown_fields(&self) -> &::buffa::UnknownFields {
744 &self.__buffa_unknown_fields
745 }
746 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
747 &mut self.__buffa_unknown_fields
748 }
749}
750impl ::buffa::json_helpers::ProtoElemJson for FunctionRef {
751 fn serialize_proto_json<S: ::serde::Serializer>(
752 v: &Self,
753 s: S,
754 ) -> ::core::result::Result<S::Ok, S::Error> {
755 ::serde::Serialize::serialize(v, s)
756 }
757 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
758 d: D,
759 ) -> ::core::result::Result<Self, D::Error> {
760 <Self as ::serde::Deserialize>::deserialize(d)
761 }
762}
763#[doc(hidden)]
764pub const __FUNCTION_REF_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
765 type_url: "type.googleapis.com/unitycatalog.policies.v1.FunctionRef",
766 to_json: ::buffa::type_registry::any_to_json::<FunctionRef>,
767 from_json: ::buffa::type_registry::any_from_json::<FunctionRef>,
768 is_wkt: false,
769};
770#[derive(Clone, PartialEq, Default)]
776#[derive(::serde::Serialize)]
777#[serde(default)]
778pub struct PolicyInfo {
779 #[serde(
783 rename = "name",
784 with = "::buffa::json_helpers::proto_string",
785 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
786 )]
787 pub name: ::buffa::alloc::string::String,
788 #[serde(rename = "id", skip_serializing_if = "::core::option::Option::is_none")]
792 pub id: ::core::option::Option<::buffa::alloc::string::String>,
793 #[serde(
799 rename = "on_securable_type",
800 alias = "onSecurableType",
801 with = "::buffa::json_helpers::proto_string",
802 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
803 )]
804 pub on_securable_type: ::buffa::alloc::string::String,
805 #[serde(
809 rename = "on_securable_fullname",
810 alias = "onSecurableFullname",
811 with = "::buffa::json_helpers::proto_string",
812 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
813 )]
814 pub on_securable_fullname: ::buffa::alloc::string::String,
815 #[serde(
819 rename = "policy_type",
820 alias = "policyType",
821 with = "::buffa::json_helpers::proto_enum",
822 skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
823 )]
824 pub policy_type: ::buffa::EnumValue<PolicyType>,
825 #[serde(
829 rename = "to_principals",
830 alias = "toPrincipals",
831 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
832 deserialize_with = "::buffa::json_helpers::null_as_default"
833 )]
834 pub to_principals: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
835 #[serde(
839 rename = "except_principals",
840 alias = "exceptPrincipals",
841 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
842 deserialize_with = "::buffa::json_helpers::null_as_default"
843 )]
844 pub except_principals: ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
845 #[serde(
850 rename = "when_condition",
851 alias = "whenCondition",
852 skip_serializing_if = "::core::option::Option::is_none"
853 )]
854 pub when_condition: ::core::option::Option<::buffa::alloc::string::String>,
855 #[serde(
860 rename = "match_columns",
861 alias = "matchColumns",
862 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
863 deserialize_with = "::buffa::json_helpers::null_as_default"
864 )]
865 pub match_columns: ::buffa::alloc::vec::Vec<MatchColumn>,
866 #[serde(rename = "comment", skip_serializing_if = "::core::option::Option::is_none")]
870 pub comment: ::core::option::Option<::buffa::alloc::string::String>,
871 #[serde(
875 rename = "created_at",
876 alias = "createdAt",
877 with = "::buffa::json_helpers::opt_int64",
878 skip_serializing_if = "::core::option::Option::is_none"
879 )]
880 pub created_at: ::core::option::Option<i64>,
881 #[serde(
885 rename = "updated_at",
886 alias = "updatedAt",
887 with = "::buffa::json_helpers::opt_int64",
888 skip_serializing_if = "::core::option::Option::is_none"
889 )]
890 pub updated_at: ::core::option::Option<i64>,
891 #[serde(flatten)]
892 pub function: ::core::option::Option<__buffa::oneof::policy_info::Function>,
893 #[serde(skip)]
894 #[doc(hidden)]
895 pub __buffa_unknown_fields: ::buffa::UnknownFields,
896}
897impl ::core::fmt::Debug for PolicyInfo {
898 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
899 f.debug_struct("PolicyInfo")
900 .field("name", &self.name)
901 .field("id", &self.id)
902 .field("on_securable_type", &self.on_securable_type)
903 .field("on_securable_fullname", &self.on_securable_fullname)
904 .field("policy_type", &self.policy_type)
905 .field("to_principals", &self.to_principals)
906 .field("except_principals", &self.except_principals)
907 .field("when_condition", &self.when_condition)
908 .field("match_columns", &self.match_columns)
909 .field("comment", &self.comment)
910 .field("created_at", &self.created_at)
911 .field("updated_at", &self.updated_at)
912 .field("function", &self.function)
913 .finish()
914 }
915}
916impl PolicyInfo {
917 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.PolicyInfo";
922}
923impl PolicyInfo {
924 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
925 #[inline]
926 pub fn with_id(mut self, value: impl Into<::buffa::alloc::string::String>) -> Self {
928 self.id = Some(value.into());
929 self
930 }
931 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
932 #[inline]
933 pub fn with_when_condition(
935 mut self,
936 value: impl Into<::buffa::alloc::string::String>,
937 ) -> Self {
938 self.when_condition = Some(value.into());
939 self
940 }
941 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
942 #[inline]
943 pub fn with_comment(
945 mut self,
946 value: impl Into<::buffa::alloc::string::String>,
947 ) -> Self {
948 self.comment = Some(value.into());
949 self
950 }
951 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
952 #[inline]
953 pub fn with_created_at(mut self, value: i64) -> Self {
955 self.created_at = Some(value);
956 self
957 }
958 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
959 #[inline]
960 pub fn with_updated_at(mut self, value: i64) -> Self {
962 self.updated_at = Some(value);
963 self
964 }
965}
966impl ::buffa::DefaultInstance for PolicyInfo {
967 fn default_instance() -> &'static Self {
968 static VALUE: ::buffa::__private::OnceBox<PolicyInfo> = ::buffa::__private::OnceBox::new();
969 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
970 }
971}
972impl ::buffa::MessageName for PolicyInfo {
973 const PACKAGE: &'static str = "unitycatalog.policies.v1";
974 const NAME: &'static str = "PolicyInfo";
975 const FULL_NAME: &'static str = "unitycatalog.policies.v1.PolicyInfo";
976 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.PolicyInfo";
977}
978impl ::buffa::Message for PolicyInfo {
979 #[allow(clippy::let_and_return)]
985 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
986 #[allow(unused_imports)]
987 use ::buffa::Enumeration as _;
988 let mut size = 0u32;
989 if !self.name.is_empty() {
990 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
991 }
992 if let Some(ref v) = self.id {
993 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
994 }
995 if !self.on_securable_type.is_empty() {
996 size
997 += 1u32
998 + ::buffa::types::string_encoded_len(&self.on_securable_type) as u32;
999 }
1000 if !self.on_securable_fullname.is_empty() {
1001 size
1002 += 1u32
1003 + ::buffa::types::string_encoded_len(&self.on_securable_fullname)
1004 as u32;
1005 }
1006 {
1007 let val = self.policy_type.to_i32();
1008 if val != 0 {
1009 size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
1010 }
1011 }
1012 for v in &self.to_principals {
1013 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1014 }
1015 for v in &self.except_principals {
1016 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1017 }
1018 if let Some(ref v) = self.when_condition {
1019 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1020 }
1021 for v in &self.match_columns {
1022 let __slot = __cache.reserve();
1023 let inner_size = v.compute_size(__cache);
1024 __cache.set(__slot, inner_size);
1025 size
1026 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
1027 + inner_size;
1028 }
1029 if let ::core::option::Option::Some(ref v) = self.function {
1030 match v {
1031 __buffa::oneof::policy_info::Function::RowFilter(x) => {
1032 let __slot = __cache.reserve();
1033 let inner = x.compute_size(__cache);
1034 __cache.set(__slot, inner);
1035 size
1036 += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
1037 + inner;
1038 }
1039 __buffa::oneof::policy_info::Function::ColumnMask(x) => {
1040 let __slot = __cache.reserve();
1041 let inner = x.compute_size(__cache);
1042 __cache.set(__slot, inner);
1043 size
1044 += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
1045 + inner;
1046 }
1047 }
1048 }
1049 if let Some(ref v) = self.comment {
1050 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1051 }
1052 if let Some(v) = self.created_at {
1053 size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
1054 }
1055 if let Some(v) = self.updated_at {
1056 size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
1057 }
1058 size += self.__buffa_unknown_fields.encoded_len() as u32;
1059 size
1060 }
1061 fn write_to(
1062 &self,
1063 __cache: &mut ::buffa::SizeCache,
1064 buf: &mut impl ::buffa::bytes::BufMut,
1065 ) {
1066 #[allow(unused_imports)]
1067 use ::buffa::Enumeration as _;
1068 if !self.name.is_empty() {
1069 ::buffa::encoding::Tag::new(
1070 1u32,
1071 ::buffa::encoding::WireType::LengthDelimited,
1072 )
1073 .encode(buf);
1074 ::buffa::types::encode_string(&self.name, buf);
1075 }
1076 if let Some(ref v) = self.id {
1077 ::buffa::encoding::Tag::new(
1078 2u32,
1079 ::buffa::encoding::WireType::LengthDelimited,
1080 )
1081 .encode(buf);
1082 ::buffa::types::encode_string(v, buf);
1083 }
1084 if !self.on_securable_type.is_empty() {
1085 ::buffa::encoding::Tag::new(
1086 3u32,
1087 ::buffa::encoding::WireType::LengthDelimited,
1088 )
1089 .encode(buf);
1090 ::buffa::types::encode_string(&self.on_securable_type, buf);
1091 }
1092 if !self.on_securable_fullname.is_empty() {
1093 ::buffa::encoding::Tag::new(
1094 4u32,
1095 ::buffa::encoding::WireType::LengthDelimited,
1096 )
1097 .encode(buf);
1098 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
1099 }
1100 {
1101 let val = self.policy_type.to_i32();
1102 if val != 0 {
1103 ::buffa::encoding::Tag::new(5u32, ::buffa::encoding::WireType::Varint)
1104 .encode(buf);
1105 ::buffa::types::encode_int32(val, buf);
1106 }
1107 }
1108 for v in &self.to_principals {
1109 ::buffa::encoding::Tag::new(
1110 6u32,
1111 ::buffa::encoding::WireType::LengthDelimited,
1112 )
1113 .encode(buf);
1114 ::buffa::types::encode_string(v, buf);
1115 }
1116 for v in &self.except_principals {
1117 ::buffa::encoding::Tag::new(
1118 7u32,
1119 ::buffa::encoding::WireType::LengthDelimited,
1120 )
1121 .encode(buf);
1122 ::buffa::types::encode_string(v, buf);
1123 }
1124 if let Some(ref v) = self.when_condition {
1125 ::buffa::encoding::Tag::new(
1126 8u32,
1127 ::buffa::encoding::WireType::LengthDelimited,
1128 )
1129 .encode(buf);
1130 ::buffa::types::encode_string(v, buf);
1131 }
1132 for v in &self.match_columns {
1133 ::buffa::encoding::Tag::new(
1134 9u32,
1135 ::buffa::encoding::WireType::LengthDelimited,
1136 )
1137 .encode(buf);
1138 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1139 v.write_to(__cache, buf);
1140 }
1141 if let ::core::option::Option::Some(ref v) = self.function {
1142 match v {
1143 __buffa::oneof::policy_info::Function::RowFilter(x) => {
1144 ::buffa::encoding::Tag::new(
1145 10u32,
1146 ::buffa::encoding::WireType::LengthDelimited,
1147 )
1148 .encode(buf);
1149 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1150 x.write_to(__cache, buf);
1151 }
1152 __buffa::oneof::policy_info::Function::ColumnMask(x) => {
1153 ::buffa::encoding::Tag::new(
1154 11u32,
1155 ::buffa::encoding::WireType::LengthDelimited,
1156 )
1157 .encode(buf);
1158 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
1159 x.write_to(__cache, buf);
1160 }
1161 }
1162 }
1163 if let Some(ref v) = self.comment {
1164 ::buffa::encoding::Tag::new(
1165 12u32,
1166 ::buffa::encoding::WireType::LengthDelimited,
1167 )
1168 .encode(buf);
1169 ::buffa::types::encode_string(v, buf);
1170 }
1171 if let Some(v) = self.created_at {
1172 ::buffa::encoding::Tag::new(13u32, ::buffa::encoding::WireType::Varint)
1173 .encode(buf);
1174 ::buffa::types::encode_int64(v, buf);
1175 }
1176 if let Some(v) = self.updated_at {
1177 ::buffa::encoding::Tag::new(14u32, ::buffa::encoding::WireType::Varint)
1178 .encode(buf);
1179 ::buffa::types::encode_int64(v, buf);
1180 }
1181 self.__buffa_unknown_fields.write_to(buf);
1182 }
1183 fn merge_field(
1184 &mut self,
1185 tag: ::buffa::encoding::Tag,
1186 buf: &mut impl ::buffa::bytes::Buf,
1187 depth: u32,
1188 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1189 #[allow(unused_imports)]
1190 use ::buffa::bytes::Buf as _;
1191 #[allow(unused_imports)]
1192 use ::buffa::Enumeration as _;
1193 match tag.field_number() {
1194 1u32 => {
1195 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1196 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1197 field_number: 1u32,
1198 expected: 2u8,
1199 actual: tag.wire_type() as u8,
1200 });
1201 }
1202 ::buffa::types::merge_string(&mut self.name, buf)?;
1203 }
1204 2u32 => {
1205 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1206 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1207 field_number: 2u32,
1208 expected: 2u8,
1209 actual: tag.wire_type() as u8,
1210 });
1211 }
1212 ::buffa::types::merge_string(
1213 self.id.get_or_insert_with(::buffa::alloc::string::String::new),
1214 buf,
1215 )?;
1216 }
1217 3u32 => {
1218 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1219 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1220 field_number: 3u32,
1221 expected: 2u8,
1222 actual: tag.wire_type() as u8,
1223 });
1224 }
1225 ::buffa::types::merge_string(&mut self.on_securable_type, buf)?;
1226 }
1227 4u32 => {
1228 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1229 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1230 field_number: 4u32,
1231 expected: 2u8,
1232 actual: tag.wire_type() as u8,
1233 });
1234 }
1235 ::buffa::types::merge_string(&mut self.on_securable_fullname, buf)?;
1236 }
1237 5u32 => {
1238 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1239 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1240 field_number: 5u32,
1241 expected: 0u8,
1242 actual: tag.wire_type() as u8,
1243 });
1244 }
1245 self.policy_type = ::buffa::EnumValue::from(
1246 ::buffa::types::decode_int32(buf)?,
1247 );
1248 }
1249 6u32 => {
1250 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1251 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1252 field_number: 6u32,
1253 expected: 2u8,
1254 actual: tag.wire_type() as u8,
1255 });
1256 }
1257 self.to_principals.push(::buffa::types::decode_string(buf)?);
1258 }
1259 7u32 => {
1260 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1261 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1262 field_number: 7u32,
1263 expected: 2u8,
1264 actual: tag.wire_type() as u8,
1265 });
1266 }
1267 self.except_principals.push(::buffa::types::decode_string(buf)?);
1268 }
1269 8u32 => {
1270 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1271 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1272 field_number: 8u32,
1273 expected: 2u8,
1274 actual: tag.wire_type() as u8,
1275 });
1276 }
1277 ::buffa::types::merge_string(
1278 self
1279 .when_condition
1280 .get_or_insert_with(::buffa::alloc::string::String::new),
1281 buf,
1282 )?;
1283 }
1284 9u32 => {
1285 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1286 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1287 field_number: 9u32,
1288 expected: 2u8,
1289 actual: tag.wire_type() as u8,
1290 });
1291 }
1292 let mut elem = ::core::default::Default::default();
1293 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
1294 self.match_columns.push(elem);
1295 }
1296 10u32 => {
1297 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1298 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1299 field_number: 10u32,
1300 expected: 2u8,
1301 actual: tag.wire_type() as u8,
1302 });
1303 }
1304 if let ::core::option::Option::Some(
1305 __buffa::oneof::policy_info::Function::RowFilter(ref mut existing),
1306 ) = self.function
1307 {
1308 ::buffa::Message::merge_length_delimited(
1309 &mut **existing,
1310 buf,
1311 depth,
1312 )?;
1313 } else {
1314 let mut val = ::core::default::Default::default();
1315 ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
1316 self.function = ::core::option::Option::Some(
1317 __buffa::oneof::policy_info::Function::RowFilter(
1318 ::buffa::alloc::boxed::Box::new(val),
1319 ),
1320 );
1321 }
1322 }
1323 11u32 => {
1324 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1325 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1326 field_number: 11u32,
1327 expected: 2u8,
1328 actual: tag.wire_type() as u8,
1329 });
1330 }
1331 if let ::core::option::Option::Some(
1332 __buffa::oneof::policy_info::Function::ColumnMask(ref mut existing),
1333 ) = self.function
1334 {
1335 ::buffa::Message::merge_length_delimited(
1336 &mut **existing,
1337 buf,
1338 depth,
1339 )?;
1340 } else {
1341 let mut val = ::core::default::Default::default();
1342 ::buffa::Message::merge_length_delimited(&mut val, buf, depth)?;
1343 self.function = ::core::option::Option::Some(
1344 __buffa::oneof::policy_info::Function::ColumnMask(
1345 ::buffa::alloc::boxed::Box::new(val),
1346 ),
1347 );
1348 }
1349 }
1350 12u32 => {
1351 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1352 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1353 field_number: 12u32,
1354 expected: 2u8,
1355 actual: tag.wire_type() as u8,
1356 });
1357 }
1358 ::buffa::types::merge_string(
1359 self.comment.get_or_insert_with(::buffa::alloc::string::String::new),
1360 buf,
1361 )?;
1362 }
1363 13u32 => {
1364 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1365 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1366 field_number: 13u32,
1367 expected: 0u8,
1368 actual: tag.wire_type() as u8,
1369 });
1370 }
1371 self.created_at = ::core::option::Option::Some(
1372 ::buffa::types::decode_int64(buf)?,
1373 );
1374 }
1375 14u32 => {
1376 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
1377 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
1378 field_number: 14u32,
1379 expected: 0u8,
1380 actual: tag.wire_type() as u8,
1381 });
1382 }
1383 self.updated_at = ::core::option::Option::Some(
1384 ::buffa::types::decode_int64(buf)?,
1385 );
1386 }
1387 _ => {
1388 self.__buffa_unknown_fields
1389 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
1390 }
1391 }
1392 ::core::result::Result::Ok(())
1393 }
1394 fn clear(&mut self) {
1395 self.name.clear();
1396 self.id = ::core::option::Option::None;
1397 self.on_securable_type.clear();
1398 self.on_securable_fullname.clear();
1399 self.policy_type = ::buffa::EnumValue::from(0);
1400 self.to_principals.clear();
1401 self.except_principals.clear();
1402 self.when_condition = ::core::option::Option::None;
1403 self.match_columns.clear();
1404 self.function = ::core::option::Option::None;
1405 self.comment = ::core::option::Option::None;
1406 self.created_at = ::core::option::Option::None;
1407 self.updated_at = ::core::option::Option::None;
1408 self.__buffa_unknown_fields.clear();
1409 }
1410}
1411impl ::buffa::ExtensionSet for PolicyInfo {
1412 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.PolicyInfo";
1413 fn unknown_fields(&self) -> &::buffa::UnknownFields {
1414 &self.__buffa_unknown_fields
1415 }
1416 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
1417 &mut self.__buffa_unknown_fields
1418 }
1419}
1420impl<'de> serde::Deserialize<'de> for PolicyInfo {
1421 fn deserialize<D: serde::Deserializer<'de>>(
1422 d: D,
1423 ) -> ::core::result::Result<Self, D::Error> {
1424 struct _V;
1425 impl<'de> serde::de::Visitor<'de> for _V {
1426 type Value = PolicyInfo;
1427 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1428 f.write_str("struct PolicyInfo")
1429 }
1430 #[allow(clippy::field_reassign_with_default)]
1431 fn visit_map<A: serde::de::MapAccess<'de>>(
1432 self,
1433 mut map: A,
1434 ) -> ::core::result::Result<PolicyInfo, A::Error> {
1435 let mut __f_name: ::core::option::Option<
1436 ::buffa::alloc::string::String,
1437 > = None;
1438 let mut __f_id: ::core::option::Option<
1439 ::core::option::Option<::buffa::alloc::string::String>,
1440 > = None;
1441 let mut __f_on_securable_type: ::core::option::Option<
1442 ::buffa::alloc::string::String,
1443 > = None;
1444 let mut __f_on_securable_fullname: ::core::option::Option<
1445 ::buffa::alloc::string::String,
1446 > = None;
1447 let mut __f_policy_type: ::core::option::Option<
1448 ::buffa::EnumValue<PolicyType>,
1449 > = None;
1450 let mut __f_to_principals: ::core::option::Option<
1451 ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
1452 > = None;
1453 let mut __f_except_principals: ::core::option::Option<
1454 ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
1455 > = None;
1456 let mut __f_when_condition: ::core::option::Option<
1457 ::core::option::Option<::buffa::alloc::string::String>,
1458 > = None;
1459 let mut __f_match_columns: ::core::option::Option<
1460 ::buffa::alloc::vec::Vec<MatchColumn>,
1461 > = None;
1462 let mut __f_comment: ::core::option::Option<
1463 ::core::option::Option<::buffa::alloc::string::String>,
1464 > = None;
1465 let mut __f_created_at: ::core::option::Option<
1466 ::core::option::Option<i64>,
1467 > = None;
1468 let mut __f_updated_at: ::core::option::Option<
1469 ::core::option::Option<i64>,
1470 > = None;
1471 let mut __oneof_function: ::core::option::Option<
1472 __buffa::oneof::policy_info::Function,
1473 > = None;
1474 while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
1475 match key.as_str() {
1476 "name" => {
1477 __f_name = Some({
1478 struct _S;
1479 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1480 type Value = ::buffa::alloc::string::String;
1481 fn deserialize<D: serde::Deserializer<'de>>(
1482 self,
1483 d: D,
1484 ) -> ::core::result::Result<
1485 ::buffa::alloc::string::String,
1486 D::Error,
1487 > {
1488 ::buffa::json_helpers::proto_string::deserialize(d)
1489 }
1490 }
1491 map.next_value_seed(_S)?
1492 });
1493 }
1494 "id" => {
1495 __f_id = Some(
1496 map
1497 .next_value::<
1498 ::core::option::Option<::buffa::alloc::string::String>,
1499 >()?,
1500 );
1501 }
1502 "onSecurableType" | "on_securable_type" => {
1503 __f_on_securable_type = Some({
1504 struct _S;
1505 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1506 type Value = ::buffa::alloc::string::String;
1507 fn deserialize<D: serde::Deserializer<'de>>(
1508 self,
1509 d: D,
1510 ) -> ::core::result::Result<
1511 ::buffa::alloc::string::String,
1512 D::Error,
1513 > {
1514 ::buffa::json_helpers::proto_string::deserialize(d)
1515 }
1516 }
1517 map.next_value_seed(_S)?
1518 });
1519 }
1520 "onSecurableFullname" | "on_securable_fullname" => {
1521 __f_on_securable_fullname = Some({
1522 struct _S;
1523 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1524 type Value = ::buffa::alloc::string::String;
1525 fn deserialize<D: serde::Deserializer<'de>>(
1526 self,
1527 d: D,
1528 ) -> ::core::result::Result<
1529 ::buffa::alloc::string::String,
1530 D::Error,
1531 > {
1532 ::buffa::json_helpers::proto_string::deserialize(d)
1533 }
1534 }
1535 map.next_value_seed(_S)?
1536 });
1537 }
1538 "policyType" | "policy_type" => {
1539 __f_policy_type = Some({
1540 struct _S;
1541 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1542 type Value = ::buffa::EnumValue<PolicyType>;
1543 fn deserialize<D: serde::Deserializer<'de>>(
1544 self,
1545 d: D,
1546 ) -> ::core::result::Result<
1547 ::buffa::EnumValue<PolicyType>,
1548 D::Error,
1549 > {
1550 ::buffa::json_helpers::proto_enum::deserialize(d)
1551 }
1552 }
1553 map.next_value_seed(_S)?
1554 });
1555 }
1556 "toPrincipals" | "to_principals" => {
1557 __f_to_principals = Some({
1558 struct _S;
1559 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1560 type Value = ::buffa::alloc::vec::Vec<
1561 ::buffa::alloc::string::String,
1562 >;
1563 fn deserialize<D: serde::Deserializer<'de>>(
1564 self,
1565 d: D,
1566 ) -> ::core::result::Result<
1567 ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
1568 D::Error,
1569 > {
1570 ::buffa::json_helpers::null_as_default(d)
1571 }
1572 }
1573 map.next_value_seed(_S)?
1574 });
1575 }
1576 "exceptPrincipals" | "except_principals" => {
1577 __f_except_principals = Some({
1578 struct _S;
1579 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1580 type Value = ::buffa::alloc::vec::Vec<
1581 ::buffa::alloc::string::String,
1582 >;
1583 fn deserialize<D: serde::Deserializer<'de>>(
1584 self,
1585 d: D,
1586 ) -> ::core::result::Result<
1587 ::buffa::alloc::vec::Vec<::buffa::alloc::string::String>,
1588 D::Error,
1589 > {
1590 ::buffa::json_helpers::null_as_default(d)
1591 }
1592 }
1593 map.next_value_seed(_S)?
1594 });
1595 }
1596 "whenCondition" | "when_condition" => {
1597 __f_when_condition = Some(
1598 map
1599 .next_value::<
1600 ::core::option::Option<::buffa::alloc::string::String>,
1601 >()?,
1602 );
1603 }
1604 "matchColumns" | "match_columns" => {
1605 __f_match_columns = Some({
1606 struct _S;
1607 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1608 type Value = ::buffa::alloc::vec::Vec<MatchColumn>;
1609 fn deserialize<D: serde::Deserializer<'de>>(
1610 self,
1611 d: D,
1612 ) -> ::core::result::Result<
1613 ::buffa::alloc::vec::Vec<MatchColumn>,
1614 D::Error,
1615 > {
1616 ::buffa::json_helpers::null_as_default(d)
1617 }
1618 }
1619 map.next_value_seed(_S)?
1620 });
1621 }
1622 "comment" => {
1623 __f_comment = Some(
1624 map
1625 .next_value::<
1626 ::core::option::Option<::buffa::alloc::string::String>,
1627 >()?,
1628 );
1629 }
1630 "createdAt" | "created_at" => {
1631 __f_created_at = Some({
1632 struct _S;
1633 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1634 type Value = ::core::option::Option<i64>;
1635 fn deserialize<D: serde::Deserializer<'de>>(
1636 self,
1637 d: D,
1638 ) -> ::core::result::Result<
1639 ::core::option::Option<i64>,
1640 D::Error,
1641 > {
1642 ::buffa::json_helpers::opt_int64::deserialize(d)
1643 }
1644 }
1645 map.next_value_seed(_S)?
1646 });
1647 }
1648 "updatedAt" | "updated_at" => {
1649 __f_updated_at = Some({
1650 struct _S;
1651 impl<'de> serde::de::DeserializeSeed<'de> for _S {
1652 type Value = ::core::option::Option<i64>;
1653 fn deserialize<D: serde::Deserializer<'de>>(
1654 self,
1655 d: D,
1656 ) -> ::core::result::Result<
1657 ::core::option::Option<i64>,
1658 D::Error,
1659 > {
1660 ::buffa::json_helpers::opt_int64::deserialize(d)
1661 }
1662 }
1663 map.next_value_seed(_S)?
1664 });
1665 }
1666 "rowFilter" | "row_filter" => {
1667 let v: ::core::option::Option<FunctionRef> = map
1668 .next_value_seed(
1669 ::buffa::json_helpers::NullableDeserializeSeed(
1670 ::buffa::json_helpers::DefaultDeserializeSeed::<
1671 FunctionRef,
1672 >::new(),
1673 ),
1674 )?;
1675 if let Some(v) = v {
1676 if __oneof_function.is_some() {
1677 return Err(
1678 serde::de::Error::custom(
1679 "multiple oneof fields set for 'function'",
1680 ),
1681 );
1682 }
1683 __oneof_function = Some(
1684 __buffa::oneof::policy_info::Function::RowFilter(
1685 ::buffa::alloc::boxed::Box::new(v),
1686 ),
1687 );
1688 }
1689 }
1690 "columnMask" | "column_mask" => {
1691 let v: ::core::option::Option<FunctionRef> = map
1692 .next_value_seed(
1693 ::buffa::json_helpers::NullableDeserializeSeed(
1694 ::buffa::json_helpers::DefaultDeserializeSeed::<
1695 FunctionRef,
1696 >::new(),
1697 ),
1698 )?;
1699 if let Some(v) = v {
1700 if __oneof_function.is_some() {
1701 return Err(
1702 serde::de::Error::custom(
1703 "multiple oneof fields set for 'function'",
1704 ),
1705 );
1706 }
1707 __oneof_function = Some(
1708 __buffa::oneof::policy_info::Function::ColumnMask(
1709 ::buffa::alloc::boxed::Box::new(v),
1710 ),
1711 );
1712 }
1713 }
1714 _ => {
1715 map.next_value::<serde::de::IgnoredAny>()?;
1716 }
1717 }
1718 }
1719 let mut __r = <PolicyInfo as ::core::default::Default>::default();
1720 if let ::core::option::Option::Some(v) = __f_name {
1721 __r.name = v;
1722 }
1723 if let ::core::option::Option::Some(v) = __f_id {
1724 __r.id = v;
1725 }
1726 if let ::core::option::Option::Some(v) = __f_on_securable_type {
1727 __r.on_securable_type = v;
1728 }
1729 if let ::core::option::Option::Some(v) = __f_on_securable_fullname {
1730 __r.on_securable_fullname = v;
1731 }
1732 if let ::core::option::Option::Some(v) = __f_policy_type {
1733 __r.policy_type = v;
1734 }
1735 if let ::core::option::Option::Some(v) = __f_to_principals {
1736 __r.to_principals = v;
1737 }
1738 if let ::core::option::Option::Some(v) = __f_except_principals {
1739 __r.except_principals = v;
1740 }
1741 if let ::core::option::Option::Some(v) = __f_when_condition {
1742 __r.when_condition = v;
1743 }
1744 if let ::core::option::Option::Some(v) = __f_match_columns {
1745 __r.match_columns = v;
1746 }
1747 if let ::core::option::Option::Some(v) = __f_comment {
1748 __r.comment = v;
1749 }
1750 if let ::core::option::Option::Some(v) = __f_created_at {
1751 __r.created_at = v;
1752 }
1753 if let ::core::option::Option::Some(v) = __f_updated_at {
1754 __r.updated_at = v;
1755 }
1756 __r.function = __oneof_function;
1757 Ok(__r)
1758 }
1759 }
1760 d.deserialize_map(_V)
1761 }
1762}
1763impl ::buffa::json_helpers::ProtoElemJson for PolicyInfo {
1764 fn serialize_proto_json<S: ::serde::Serializer>(
1765 v: &Self,
1766 s: S,
1767 ) -> ::core::result::Result<S::Ok, S::Error> {
1768 ::serde::Serialize::serialize(v, s)
1769 }
1770 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
1771 d: D,
1772 ) -> ::core::result::Result<Self, D::Error> {
1773 <Self as ::serde::Deserialize>::deserialize(d)
1774 }
1775}
1776#[doc(hidden)]
1777pub const __POLICY_INFO_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
1778 type_url: "type.googleapis.com/unitycatalog.policies.v1.PolicyInfo",
1779 to_json: ::buffa::type_registry::any_to_json::<PolicyInfo>,
1780 from_json: ::buffa::type_registry::any_from_json::<PolicyInfo>,
1781 is_wkt: false,
1782};
1783pub mod policy_info {
1784 #[allow(unused_imports)]
1785 use super::*;
1786 #[doc(inline)]
1787 pub use super::__buffa::oneof::policy_info::Function;
1788 #[doc(inline)]
1789 pub use super::__buffa::view::oneof::policy_info::Function as FunctionView;
1790}
1791#[derive(Clone, PartialEq, Default)]
1793#[derive(::serde::Serialize, ::serde::Deserialize)]
1794#[serde(default)]
1795pub struct ListPoliciesRequest {
1796 #[serde(
1802 rename = "on_securable_type",
1803 alias = "onSecurableType",
1804 with = "::buffa::json_helpers::proto_string",
1805 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1806 )]
1807 pub on_securable_type: ::buffa::alloc::string::String,
1808 #[serde(
1812 rename = "on_securable_fullname",
1813 alias = "onSecurableFullname",
1814 with = "::buffa::json_helpers::proto_string",
1815 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
1816 )]
1817 pub on_securable_fullname: ::buffa::alloc::string::String,
1818 #[serde(
1825 rename = "include_inherited",
1826 alias = "includeInherited",
1827 skip_serializing_if = "::core::option::Option::is_none"
1828 )]
1829 pub include_inherited: ::core::option::Option<bool>,
1830 #[serde(
1834 rename = "max_results",
1835 alias = "maxResults",
1836 with = "::buffa::json_helpers::opt_int32",
1837 skip_serializing_if = "::core::option::Option::is_none"
1838 )]
1839 pub max_results: ::core::option::Option<i32>,
1840 #[serde(
1844 rename = "page_token",
1845 alias = "pageToken",
1846 skip_serializing_if = "::core::option::Option::is_none"
1847 )]
1848 pub page_token: ::core::option::Option<::buffa::alloc::string::String>,
1849 #[serde(skip)]
1850 #[doc(hidden)]
1851 pub __buffa_unknown_fields: ::buffa::UnknownFields,
1852}
1853impl ::core::fmt::Debug for ListPoliciesRequest {
1854 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1855 f.debug_struct("ListPoliciesRequest")
1856 .field("on_securable_type", &self.on_securable_type)
1857 .field("on_securable_fullname", &self.on_securable_fullname)
1858 .field("include_inherited", &self.include_inherited)
1859 .field("max_results", &self.max_results)
1860 .field("page_token", &self.page_token)
1861 .finish()
1862 }
1863}
1864impl ListPoliciesRequest {
1865 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesRequest";
1870}
1871impl ListPoliciesRequest {
1872 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1873 #[inline]
1874 pub fn with_include_inherited(mut self, value: bool) -> Self {
1876 self.include_inherited = Some(value);
1877 self
1878 }
1879 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1880 #[inline]
1881 pub fn with_max_results(mut self, value: i32) -> Self {
1883 self.max_results = Some(value);
1884 self
1885 }
1886 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
1887 #[inline]
1888 pub fn with_page_token(
1890 mut self,
1891 value: impl Into<::buffa::alloc::string::String>,
1892 ) -> Self {
1893 self.page_token = Some(value.into());
1894 self
1895 }
1896}
1897impl ::buffa::DefaultInstance for ListPoliciesRequest {
1898 fn default_instance() -> &'static Self {
1899 static VALUE: ::buffa::__private::OnceBox<ListPoliciesRequest> = ::buffa::__private::OnceBox::new();
1900 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
1901 }
1902}
1903impl ::buffa::MessageName for ListPoliciesRequest {
1904 const PACKAGE: &'static str = "unitycatalog.policies.v1";
1905 const NAME: &'static str = "ListPoliciesRequest";
1906 const FULL_NAME: &'static str = "unitycatalog.policies.v1.ListPoliciesRequest";
1907 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesRequest";
1908}
1909impl ::buffa::Message for ListPoliciesRequest {
1910 #[allow(clippy::let_and_return)]
1916 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
1917 #[allow(unused_imports)]
1918 use ::buffa::Enumeration as _;
1919 let mut size = 0u32;
1920 if !self.on_securable_type.is_empty() {
1921 size
1922 += 1u32
1923 + ::buffa::types::string_encoded_len(&self.on_securable_type) as u32;
1924 }
1925 if !self.on_securable_fullname.is_empty() {
1926 size
1927 += 1u32
1928 + ::buffa::types::string_encoded_len(&self.on_securable_fullname)
1929 as u32;
1930 }
1931 if self.include_inherited.is_some() {
1932 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
1933 }
1934 if let Some(v) = self.max_results {
1935 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
1936 }
1937 if let Some(ref v) = self.page_token {
1938 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
1939 }
1940 size += self.__buffa_unknown_fields.encoded_len() as u32;
1941 size
1942 }
1943 fn write_to(
1944 &self,
1945 _cache: &mut ::buffa::SizeCache,
1946 buf: &mut impl ::buffa::bytes::BufMut,
1947 ) {
1948 #[allow(unused_imports)]
1949 use ::buffa::Enumeration as _;
1950 if !self.on_securable_type.is_empty() {
1951 ::buffa::encoding::Tag::new(
1952 1u32,
1953 ::buffa::encoding::WireType::LengthDelimited,
1954 )
1955 .encode(buf);
1956 ::buffa::types::encode_string(&self.on_securable_type, buf);
1957 }
1958 if !self.on_securable_fullname.is_empty() {
1959 ::buffa::encoding::Tag::new(
1960 2u32,
1961 ::buffa::encoding::WireType::LengthDelimited,
1962 )
1963 .encode(buf);
1964 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
1965 }
1966 if let Some(v) = self.include_inherited {
1967 ::buffa::encoding::Tag::new(3u32, ::buffa::encoding::WireType::Varint)
1968 .encode(buf);
1969 ::buffa::types::encode_bool(v, buf);
1970 }
1971 if let Some(v) = self.max_results {
1972 ::buffa::encoding::Tag::new(4u32, ::buffa::encoding::WireType::Varint)
1973 .encode(buf);
1974 ::buffa::types::encode_int32(v, buf);
1975 }
1976 if let Some(ref v) = self.page_token {
1977 ::buffa::encoding::Tag::new(
1978 5u32,
1979 ::buffa::encoding::WireType::LengthDelimited,
1980 )
1981 .encode(buf);
1982 ::buffa::types::encode_string(v, buf);
1983 }
1984 self.__buffa_unknown_fields.write_to(buf);
1985 }
1986 fn merge_field(
1987 &mut self,
1988 tag: ::buffa::encoding::Tag,
1989 buf: &mut impl ::buffa::bytes::Buf,
1990 depth: u32,
1991 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
1992 #[allow(unused_imports)]
1993 use ::buffa::bytes::Buf as _;
1994 #[allow(unused_imports)]
1995 use ::buffa::Enumeration as _;
1996 match tag.field_number() {
1997 1u32 => {
1998 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
1999 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2000 field_number: 1u32,
2001 expected: 2u8,
2002 actual: tag.wire_type() as u8,
2003 });
2004 }
2005 ::buffa::types::merge_string(&mut self.on_securable_type, buf)?;
2006 }
2007 2u32 => {
2008 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2009 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2010 field_number: 2u32,
2011 expected: 2u8,
2012 actual: tag.wire_type() as u8,
2013 });
2014 }
2015 ::buffa::types::merge_string(&mut self.on_securable_fullname, buf)?;
2016 }
2017 3u32 => {
2018 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2019 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2020 field_number: 3u32,
2021 expected: 0u8,
2022 actual: tag.wire_type() as u8,
2023 });
2024 }
2025 self.include_inherited = ::core::option::Option::Some(
2026 ::buffa::types::decode_bool(buf)?,
2027 );
2028 }
2029 4u32 => {
2030 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
2031 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2032 field_number: 4u32,
2033 expected: 0u8,
2034 actual: tag.wire_type() as u8,
2035 });
2036 }
2037 self.max_results = ::core::option::Option::Some(
2038 ::buffa::types::decode_int32(buf)?,
2039 );
2040 }
2041 5u32 => {
2042 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2043 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2044 field_number: 5u32,
2045 expected: 2u8,
2046 actual: tag.wire_type() as u8,
2047 });
2048 }
2049 ::buffa::types::merge_string(
2050 self
2051 .page_token
2052 .get_or_insert_with(::buffa::alloc::string::String::new),
2053 buf,
2054 )?;
2055 }
2056 _ => {
2057 self.__buffa_unknown_fields
2058 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2059 }
2060 }
2061 ::core::result::Result::Ok(())
2062 }
2063 fn clear(&mut self) {
2064 self.on_securable_type.clear();
2065 self.on_securable_fullname.clear();
2066 self.include_inherited = ::core::option::Option::None;
2067 self.max_results = ::core::option::Option::None;
2068 self.page_token = ::core::option::Option::None;
2069 self.__buffa_unknown_fields.clear();
2070 }
2071}
2072impl ::buffa::ExtensionSet for ListPoliciesRequest {
2073 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.ListPoliciesRequest";
2074 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2075 &self.__buffa_unknown_fields
2076 }
2077 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2078 &mut self.__buffa_unknown_fields
2079 }
2080}
2081impl ::buffa::json_helpers::ProtoElemJson for ListPoliciesRequest {
2082 fn serialize_proto_json<S: ::serde::Serializer>(
2083 v: &Self,
2084 s: S,
2085 ) -> ::core::result::Result<S::Ok, S::Error> {
2086 ::serde::Serialize::serialize(v, s)
2087 }
2088 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2089 d: D,
2090 ) -> ::core::result::Result<Self, D::Error> {
2091 <Self as ::serde::Deserialize>::deserialize(d)
2092 }
2093}
2094#[doc(hidden)]
2095pub const __LIST_POLICIES_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2096 type_url: "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesRequest",
2097 to_json: ::buffa::type_registry::any_to_json::<ListPoliciesRequest>,
2098 from_json: ::buffa::type_registry::any_from_json::<ListPoliciesRequest>,
2099 is_wkt: false,
2100};
2101#[derive(Clone, PartialEq, Default)]
2103#[derive(::serde::Serialize, ::serde::Deserialize)]
2104#[serde(default)]
2105pub struct ListPoliciesResponse {
2106 #[serde(
2110 rename = "policies",
2111 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_vec",
2112 deserialize_with = "::buffa::json_helpers::null_as_default"
2113 )]
2114 pub policies: ::buffa::alloc::vec::Vec<PolicyInfo>,
2115 #[serde(
2119 rename = "next_page_token",
2120 alias = "nextPageToken",
2121 skip_serializing_if = "::core::option::Option::is_none"
2122 )]
2123 pub next_page_token: ::core::option::Option<::buffa::alloc::string::String>,
2124 #[serde(skip)]
2125 #[doc(hidden)]
2126 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2127}
2128impl ::core::fmt::Debug for ListPoliciesResponse {
2129 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2130 f.debug_struct("ListPoliciesResponse")
2131 .field("policies", &self.policies)
2132 .field("next_page_token", &self.next_page_token)
2133 .finish()
2134 }
2135}
2136impl ListPoliciesResponse {
2137 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesResponse";
2142}
2143impl ListPoliciesResponse {
2144 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2145 #[inline]
2146 pub fn with_next_page_token(
2148 mut self,
2149 value: impl Into<::buffa::alloc::string::String>,
2150 ) -> Self {
2151 self.next_page_token = Some(value.into());
2152 self
2153 }
2154}
2155impl ::buffa::DefaultInstance for ListPoliciesResponse {
2156 fn default_instance() -> &'static Self {
2157 static VALUE: ::buffa::__private::OnceBox<ListPoliciesResponse> = ::buffa::__private::OnceBox::new();
2158 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2159 }
2160}
2161impl ::buffa::MessageName for ListPoliciesResponse {
2162 const PACKAGE: &'static str = "unitycatalog.policies.v1";
2163 const NAME: &'static str = "ListPoliciesResponse";
2164 const FULL_NAME: &'static str = "unitycatalog.policies.v1.ListPoliciesResponse";
2165 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesResponse";
2166}
2167impl ::buffa::Message for ListPoliciesResponse {
2168 #[allow(clippy::let_and_return)]
2174 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2175 #[allow(unused_imports)]
2176 use ::buffa::Enumeration as _;
2177 let mut size = 0u32;
2178 for v in &self.policies {
2179 let __slot = __cache.reserve();
2180 let inner_size = v.compute_size(__cache);
2181 __cache.set(__slot, inner_size);
2182 size
2183 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2184 + inner_size;
2185 }
2186 if let Some(ref v) = self.next_page_token {
2187 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
2188 }
2189 size += self.__buffa_unknown_fields.encoded_len() as u32;
2190 size
2191 }
2192 fn write_to(
2193 &self,
2194 __cache: &mut ::buffa::SizeCache,
2195 buf: &mut impl ::buffa::bytes::BufMut,
2196 ) {
2197 #[allow(unused_imports)]
2198 use ::buffa::Enumeration as _;
2199 for v in &self.policies {
2200 ::buffa::encoding::Tag::new(
2201 1u32,
2202 ::buffa::encoding::WireType::LengthDelimited,
2203 )
2204 .encode(buf);
2205 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
2206 v.write_to(__cache, buf);
2207 }
2208 if let Some(ref v) = self.next_page_token {
2209 ::buffa::encoding::Tag::new(
2210 2u32,
2211 ::buffa::encoding::WireType::LengthDelimited,
2212 )
2213 .encode(buf);
2214 ::buffa::types::encode_string(v, buf);
2215 }
2216 self.__buffa_unknown_fields.write_to(buf);
2217 }
2218 fn merge_field(
2219 &mut self,
2220 tag: ::buffa::encoding::Tag,
2221 buf: &mut impl ::buffa::bytes::Buf,
2222 depth: u32,
2223 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2224 #[allow(unused_imports)]
2225 use ::buffa::bytes::Buf as _;
2226 #[allow(unused_imports)]
2227 use ::buffa::Enumeration as _;
2228 match tag.field_number() {
2229 1u32 => {
2230 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2231 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2232 field_number: 1u32,
2233 expected: 2u8,
2234 actual: tag.wire_type() as u8,
2235 });
2236 }
2237 let mut elem = ::core::default::Default::default();
2238 ::buffa::Message::merge_length_delimited(&mut elem, buf, depth)?;
2239 self.policies.push(elem);
2240 }
2241 2u32 => {
2242 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2243 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2244 field_number: 2u32,
2245 expected: 2u8,
2246 actual: tag.wire_type() as u8,
2247 });
2248 }
2249 ::buffa::types::merge_string(
2250 self
2251 .next_page_token
2252 .get_or_insert_with(::buffa::alloc::string::String::new),
2253 buf,
2254 )?;
2255 }
2256 _ => {
2257 self.__buffa_unknown_fields
2258 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2259 }
2260 }
2261 ::core::result::Result::Ok(())
2262 }
2263 fn clear(&mut self) {
2264 self.policies.clear();
2265 self.next_page_token = ::core::option::Option::None;
2266 self.__buffa_unknown_fields.clear();
2267 }
2268}
2269impl ::buffa::ExtensionSet for ListPoliciesResponse {
2270 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.ListPoliciesResponse";
2271 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2272 &self.__buffa_unknown_fields
2273 }
2274 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2275 &mut self.__buffa_unknown_fields
2276 }
2277}
2278impl ::buffa::json_helpers::ProtoElemJson for ListPoliciesResponse {
2279 fn serialize_proto_json<S: ::serde::Serializer>(
2280 v: &Self,
2281 s: S,
2282 ) -> ::core::result::Result<S::Ok, S::Error> {
2283 ::serde::Serialize::serialize(v, s)
2284 }
2285 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2286 d: D,
2287 ) -> ::core::result::Result<Self, D::Error> {
2288 <Self as ::serde::Deserialize>::deserialize(d)
2289 }
2290}
2291#[doc(hidden)]
2292pub const __LIST_POLICIES_RESPONSE_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2293 type_url: "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesResponse",
2294 to_json: ::buffa::type_registry::any_to_json::<ListPoliciesResponse>,
2295 from_json: ::buffa::type_registry::any_from_json::<ListPoliciesResponse>,
2296 is_wkt: false,
2297};
2298#[derive(Clone, PartialEq, Default)]
2300#[derive(::serde::Serialize, ::serde::Deserialize)]
2301#[serde(default)]
2302pub struct CreatePolicyRequest {
2303 #[serde(
2309 rename = "on_securable_type",
2310 alias = "onSecurableType",
2311 with = "::buffa::json_helpers::proto_string",
2312 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2313 )]
2314 pub on_securable_type: ::buffa::alloc::string::String,
2315 #[serde(
2319 rename = "on_securable_fullname",
2320 alias = "onSecurableFullname",
2321 with = "::buffa::json_helpers::proto_string",
2322 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2323 )]
2324 pub on_securable_fullname: ::buffa::alloc::string::String,
2325 #[serde(
2329 rename = "policy_info",
2330 alias = "policyInfo",
2331 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2332 )]
2333 pub policy_info: ::buffa::MessageField<PolicyInfo>,
2334 #[serde(skip)]
2335 #[doc(hidden)]
2336 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2337}
2338impl ::core::fmt::Debug for CreatePolicyRequest {
2339 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2340 f.debug_struct("CreatePolicyRequest")
2341 .field("on_securable_type", &self.on_securable_type)
2342 .field("on_securable_fullname", &self.on_securable_fullname)
2343 .field("policy_info", &self.policy_info)
2344 .finish()
2345 }
2346}
2347impl CreatePolicyRequest {
2348 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.CreatePolicyRequest";
2353}
2354impl ::buffa::DefaultInstance for CreatePolicyRequest {
2355 fn default_instance() -> &'static Self {
2356 static VALUE: ::buffa::__private::OnceBox<CreatePolicyRequest> = ::buffa::__private::OnceBox::new();
2357 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2358 }
2359}
2360impl ::buffa::MessageName for CreatePolicyRequest {
2361 const PACKAGE: &'static str = "unitycatalog.policies.v1";
2362 const NAME: &'static str = "CreatePolicyRequest";
2363 const FULL_NAME: &'static str = "unitycatalog.policies.v1.CreatePolicyRequest";
2364 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.CreatePolicyRequest";
2365}
2366impl ::buffa::Message for CreatePolicyRequest {
2367 #[allow(clippy::let_and_return)]
2373 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2374 #[allow(unused_imports)]
2375 use ::buffa::Enumeration as _;
2376 let mut size = 0u32;
2377 if !self.on_securable_type.is_empty() {
2378 size
2379 += 1u32
2380 + ::buffa::types::string_encoded_len(&self.on_securable_type) as u32;
2381 }
2382 if !self.on_securable_fullname.is_empty() {
2383 size
2384 += 1u32
2385 + ::buffa::types::string_encoded_len(&self.on_securable_fullname)
2386 as u32;
2387 }
2388 if self.policy_info.is_set() {
2389 let __slot = __cache.reserve();
2390 let inner_size = self.policy_info.compute_size(__cache);
2391 __cache.set(__slot, inner_size);
2392 size
2393 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2394 + inner_size;
2395 }
2396 size += self.__buffa_unknown_fields.encoded_len() as u32;
2397 size
2398 }
2399 fn write_to(
2400 &self,
2401 __cache: &mut ::buffa::SizeCache,
2402 buf: &mut impl ::buffa::bytes::BufMut,
2403 ) {
2404 #[allow(unused_imports)]
2405 use ::buffa::Enumeration as _;
2406 if !self.on_securable_type.is_empty() {
2407 ::buffa::encoding::Tag::new(
2408 1u32,
2409 ::buffa::encoding::WireType::LengthDelimited,
2410 )
2411 .encode(buf);
2412 ::buffa::types::encode_string(&self.on_securable_type, buf);
2413 }
2414 if !self.on_securable_fullname.is_empty() {
2415 ::buffa::encoding::Tag::new(
2416 2u32,
2417 ::buffa::encoding::WireType::LengthDelimited,
2418 )
2419 .encode(buf);
2420 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
2421 }
2422 if self.policy_info.is_set() {
2423 ::buffa::encoding::Tag::new(
2424 3u32,
2425 ::buffa::encoding::WireType::LengthDelimited,
2426 )
2427 .encode(buf);
2428 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
2429 self.policy_info.write_to(__cache, buf);
2430 }
2431 self.__buffa_unknown_fields.write_to(buf);
2432 }
2433 fn merge_field(
2434 &mut self,
2435 tag: ::buffa::encoding::Tag,
2436 buf: &mut impl ::buffa::bytes::Buf,
2437 depth: u32,
2438 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2439 #[allow(unused_imports)]
2440 use ::buffa::bytes::Buf as _;
2441 #[allow(unused_imports)]
2442 use ::buffa::Enumeration as _;
2443 match tag.field_number() {
2444 1u32 => {
2445 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2446 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2447 field_number: 1u32,
2448 expected: 2u8,
2449 actual: tag.wire_type() as u8,
2450 });
2451 }
2452 ::buffa::types::merge_string(&mut self.on_securable_type, buf)?;
2453 }
2454 2u32 => {
2455 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2456 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2457 field_number: 2u32,
2458 expected: 2u8,
2459 actual: tag.wire_type() as u8,
2460 });
2461 }
2462 ::buffa::types::merge_string(&mut self.on_securable_fullname, buf)?;
2463 }
2464 3u32 => {
2465 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2466 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2467 field_number: 3u32,
2468 expected: 2u8,
2469 actual: tag.wire_type() as u8,
2470 });
2471 }
2472 ::buffa::Message::merge_length_delimited(
2473 self.policy_info.get_or_insert_default(),
2474 buf,
2475 depth,
2476 )?;
2477 }
2478 _ => {
2479 self.__buffa_unknown_fields
2480 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2481 }
2482 }
2483 ::core::result::Result::Ok(())
2484 }
2485 fn clear(&mut self) {
2486 self.on_securable_type.clear();
2487 self.on_securable_fullname.clear();
2488 self.policy_info = ::buffa::MessageField::none();
2489 self.__buffa_unknown_fields.clear();
2490 }
2491}
2492impl ::buffa::ExtensionSet for CreatePolicyRequest {
2493 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.CreatePolicyRequest";
2494 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2495 &self.__buffa_unknown_fields
2496 }
2497 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2498 &mut self.__buffa_unknown_fields
2499 }
2500}
2501impl ::buffa::json_helpers::ProtoElemJson for CreatePolicyRequest {
2502 fn serialize_proto_json<S: ::serde::Serializer>(
2503 v: &Self,
2504 s: S,
2505 ) -> ::core::result::Result<S::Ok, S::Error> {
2506 ::serde::Serialize::serialize(v, s)
2507 }
2508 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2509 d: D,
2510 ) -> ::core::result::Result<Self, D::Error> {
2511 <Self as ::serde::Deserialize>::deserialize(d)
2512 }
2513}
2514#[doc(hidden)]
2515pub const __CREATE_POLICY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2516 type_url: "type.googleapis.com/unitycatalog.policies.v1.CreatePolicyRequest",
2517 to_json: ::buffa::type_registry::any_to_json::<CreatePolicyRequest>,
2518 from_json: ::buffa::type_registry::any_from_json::<CreatePolicyRequest>,
2519 is_wkt: false,
2520};
2521#[derive(Clone, PartialEq, Default)]
2523#[derive(::serde::Serialize, ::serde::Deserialize)]
2524#[serde(default)]
2525pub struct GetPolicyRequest {
2526 #[serde(
2532 rename = "on_securable_type",
2533 alias = "onSecurableType",
2534 with = "::buffa::json_helpers::proto_string",
2535 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2536 )]
2537 pub on_securable_type: ::buffa::alloc::string::String,
2538 #[serde(
2542 rename = "on_securable_fullname",
2543 alias = "onSecurableFullname",
2544 with = "::buffa::json_helpers::proto_string",
2545 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2546 )]
2547 pub on_securable_fullname: ::buffa::alloc::string::String,
2548 #[serde(
2552 rename = "name",
2553 with = "::buffa::json_helpers::proto_string",
2554 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2555 )]
2556 pub name: ::buffa::alloc::string::String,
2557 #[serde(skip)]
2558 #[doc(hidden)]
2559 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2560}
2561impl ::core::fmt::Debug for GetPolicyRequest {
2562 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2563 f.debug_struct("GetPolicyRequest")
2564 .field("on_securable_type", &self.on_securable_type)
2565 .field("on_securable_fullname", &self.on_securable_fullname)
2566 .field("name", &self.name)
2567 .finish()
2568 }
2569}
2570impl GetPolicyRequest {
2571 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.GetPolicyRequest";
2576}
2577impl ::buffa::DefaultInstance for GetPolicyRequest {
2578 fn default_instance() -> &'static Self {
2579 static VALUE: ::buffa::__private::OnceBox<GetPolicyRequest> = ::buffa::__private::OnceBox::new();
2580 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2581 }
2582}
2583impl ::buffa::MessageName for GetPolicyRequest {
2584 const PACKAGE: &'static str = "unitycatalog.policies.v1";
2585 const NAME: &'static str = "GetPolicyRequest";
2586 const FULL_NAME: &'static str = "unitycatalog.policies.v1.GetPolicyRequest";
2587 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.GetPolicyRequest";
2588}
2589impl ::buffa::Message for GetPolicyRequest {
2590 #[allow(clippy::let_and_return)]
2596 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
2597 #[allow(unused_imports)]
2598 use ::buffa::Enumeration as _;
2599 let mut size = 0u32;
2600 if !self.on_securable_type.is_empty() {
2601 size
2602 += 1u32
2603 + ::buffa::types::string_encoded_len(&self.on_securable_type) as u32;
2604 }
2605 if !self.on_securable_fullname.is_empty() {
2606 size
2607 += 1u32
2608 + ::buffa::types::string_encoded_len(&self.on_securable_fullname)
2609 as u32;
2610 }
2611 if !self.name.is_empty() {
2612 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
2613 }
2614 size += self.__buffa_unknown_fields.encoded_len() as u32;
2615 size
2616 }
2617 fn write_to(
2618 &self,
2619 _cache: &mut ::buffa::SizeCache,
2620 buf: &mut impl ::buffa::bytes::BufMut,
2621 ) {
2622 #[allow(unused_imports)]
2623 use ::buffa::Enumeration as _;
2624 if !self.on_securable_type.is_empty() {
2625 ::buffa::encoding::Tag::new(
2626 1u32,
2627 ::buffa::encoding::WireType::LengthDelimited,
2628 )
2629 .encode(buf);
2630 ::buffa::types::encode_string(&self.on_securable_type, buf);
2631 }
2632 if !self.on_securable_fullname.is_empty() {
2633 ::buffa::encoding::Tag::new(
2634 2u32,
2635 ::buffa::encoding::WireType::LengthDelimited,
2636 )
2637 .encode(buf);
2638 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
2639 }
2640 if !self.name.is_empty() {
2641 ::buffa::encoding::Tag::new(
2642 3u32,
2643 ::buffa::encoding::WireType::LengthDelimited,
2644 )
2645 .encode(buf);
2646 ::buffa::types::encode_string(&self.name, buf);
2647 }
2648 self.__buffa_unknown_fields.write_to(buf);
2649 }
2650 fn merge_field(
2651 &mut self,
2652 tag: ::buffa::encoding::Tag,
2653 buf: &mut impl ::buffa::bytes::Buf,
2654 depth: u32,
2655 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2656 #[allow(unused_imports)]
2657 use ::buffa::bytes::Buf as _;
2658 #[allow(unused_imports)]
2659 use ::buffa::Enumeration as _;
2660 match tag.field_number() {
2661 1u32 => {
2662 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2663 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2664 field_number: 1u32,
2665 expected: 2u8,
2666 actual: tag.wire_type() as u8,
2667 });
2668 }
2669 ::buffa::types::merge_string(&mut self.on_securable_type, buf)?;
2670 }
2671 2u32 => {
2672 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2673 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2674 field_number: 2u32,
2675 expected: 2u8,
2676 actual: tag.wire_type() as u8,
2677 });
2678 }
2679 ::buffa::types::merge_string(&mut self.on_securable_fullname, buf)?;
2680 }
2681 3u32 => {
2682 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2683 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2684 field_number: 3u32,
2685 expected: 2u8,
2686 actual: tag.wire_type() as u8,
2687 });
2688 }
2689 ::buffa::types::merge_string(&mut self.name, buf)?;
2690 }
2691 _ => {
2692 self.__buffa_unknown_fields
2693 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2694 }
2695 }
2696 ::core::result::Result::Ok(())
2697 }
2698 fn clear(&mut self) {
2699 self.on_securable_type.clear();
2700 self.on_securable_fullname.clear();
2701 self.name.clear();
2702 self.__buffa_unknown_fields.clear();
2703 }
2704}
2705impl ::buffa::ExtensionSet for GetPolicyRequest {
2706 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.GetPolicyRequest";
2707 fn unknown_fields(&self) -> &::buffa::UnknownFields {
2708 &self.__buffa_unknown_fields
2709 }
2710 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
2711 &mut self.__buffa_unknown_fields
2712 }
2713}
2714impl ::buffa::json_helpers::ProtoElemJson for GetPolicyRequest {
2715 fn serialize_proto_json<S: ::serde::Serializer>(
2716 v: &Self,
2717 s: S,
2718 ) -> ::core::result::Result<S::Ok, S::Error> {
2719 ::serde::Serialize::serialize(v, s)
2720 }
2721 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
2722 d: D,
2723 ) -> ::core::result::Result<Self, D::Error> {
2724 <Self as ::serde::Deserialize>::deserialize(d)
2725 }
2726}
2727#[doc(hidden)]
2728pub const __GET_POLICY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
2729 type_url: "type.googleapis.com/unitycatalog.policies.v1.GetPolicyRequest",
2730 to_json: ::buffa::type_registry::any_to_json::<GetPolicyRequest>,
2731 from_json: ::buffa::type_registry::any_from_json::<GetPolicyRequest>,
2732 is_wkt: false,
2733};
2734#[derive(Clone, PartialEq, Default)]
2736#[derive(::serde::Serialize, ::serde::Deserialize)]
2737#[serde(default)]
2738pub struct UpdatePolicyRequest {
2739 #[serde(
2745 rename = "on_securable_type",
2746 alias = "onSecurableType",
2747 with = "::buffa::json_helpers::proto_string",
2748 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2749 )]
2750 pub on_securable_type: ::buffa::alloc::string::String,
2751 #[serde(
2755 rename = "on_securable_fullname",
2756 alias = "onSecurableFullname",
2757 with = "::buffa::json_helpers::proto_string",
2758 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2759 )]
2760 pub on_securable_fullname: ::buffa::alloc::string::String,
2761 #[serde(
2765 rename = "name",
2766 with = "::buffa::json_helpers::proto_string",
2767 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
2768 )]
2769 pub name: ::buffa::alloc::string::String,
2770 #[serde(
2774 rename = "policy_info",
2775 alias = "policyInfo",
2776 skip_serializing_if = "::buffa::json_helpers::skip_if::is_unset_message_field"
2777 )]
2778 pub policy_info: ::buffa::MessageField<PolicyInfo>,
2779 #[serde(
2783 rename = "update_mask",
2784 alias = "updateMask",
2785 skip_serializing_if = "::core::option::Option::is_none"
2786 )]
2787 pub update_mask: ::core::option::Option<::buffa::alloc::string::String>,
2788 #[serde(skip)]
2789 #[doc(hidden)]
2790 pub __buffa_unknown_fields: ::buffa::UnknownFields,
2791}
2792impl ::core::fmt::Debug for UpdatePolicyRequest {
2793 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2794 f.debug_struct("UpdatePolicyRequest")
2795 .field("on_securable_type", &self.on_securable_type)
2796 .field("on_securable_fullname", &self.on_securable_fullname)
2797 .field("name", &self.name)
2798 .field("policy_info", &self.policy_info)
2799 .field("update_mask", &self.update_mask)
2800 .finish()
2801 }
2802}
2803impl UpdatePolicyRequest {
2804 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.UpdatePolicyRequest";
2809}
2810impl UpdatePolicyRequest {
2811 #[must_use = "with_* setters return `self` by value; assign or chain the result"]
2812 #[inline]
2813 pub fn with_update_mask(
2815 mut self,
2816 value: impl Into<::buffa::alloc::string::String>,
2817 ) -> Self {
2818 self.update_mask = Some(value.into());
2819 self
2820 }
2821}
2822impl ::buffa::DefaultInstance for UpdatePolicyRequest {
2823 fn default_instance() -> &'static Self {
2824 static VALUE: ::buffa::__private::OnceBox<UpdatePolicyRequest> = ::buffa::__private::OnceBox::new();
2825 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
2826 }
2827}
2828impl ::buffa::MessageName for UpdatePolicyRequest {
2829 const PACKAGE: &'static str = "unitycatalog.policies.v1";
2830 const NAME: &'static str = "UpdatePolicyRequest";
2831 const FULL_NAME: &'static str = "unitycatalog.policies.v1.UpdatePolicyRequest";
2832 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.UpdatePolicyRequest";
2833}
2834impl ::buffa::Message for UpdatePolicyRequest {
2835 #[allow(clippy::let_and_return)]
2841 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
2842 #[allow(unused_imports)]
2843 use ::buffa::Enumeration as _;
2844 let mut size = 0u32;
2845 if !self.on_securable_type.is_empty() {
2846 size
2847 += 1u32
2848 + ::buffa::types::string_encoded_len(&self.on_securable_type) as u32;
2849 }
2850 if !self.on_securable_fullname.is_empty() {
2851 size
2852 += 1u32
2853 + ::buffa::types::string_encoded_len(&self.on_securable_fullname)
2854 as u32;
2855 }
2856 if !self.name.is_empty() {
2857 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
2858 }
2859 if self.policy_info.is_set() {
2860 let __slot = __cache.reserve();
2861 let inner_size = self.policy_info.compute_size(__cache);
2862 __cache.set(__slot, inner_size);
2863 size
2864 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
2865 + inner_size;
2866 }
2867 if let Some(ref v) = self.update_mask {
2868 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
2869 }
2870 size += self.__buffa_unknown_fields.encoded_len() as u32;
2871 size
2872 }
2873 fn write_to(
2874 &self,
2875 __cache: &mut ::buffa::SizeCache,
2876 buf: &mut impl ::buffa::bytes::BufMut,
2877 ) {
2878 #[allow(unused_imports)]
2879 use ::buffa::Enumeration as _;
2880 if !self.on_securable_type.is_empty() {
2881 ::buffa::encoding::Tag::new(
2882 1u32,
2883 ::buffa::encoding::WireType::LengthDelimited,
2884 )
2885 .encode(buf);
2886 ::buffa::types::encode_string(&self.on_securable_type, buf);
2887 }
2888 if !self.on_securable_fullname.is_empty() {
2889 ::buffa::encoding::Tag::new(
2890 2u32,
2891 ::buffa::encoding::WireType::LengthDelimited,
2892 )
2893 .encode(buf);
2894 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
2895 }
2896 if !self.name.is_empty() {
2897 ::buffa::encoding::Tag::new(
2898 3u32,
2899 ::buffa::encoding::WireType::LengthDelimited,
2900 )
2901 .encode(buf);
2902 ::buffa::types::encode_string(&self.name, buf);
2903 }
2904 if self.policy_info.is_set() {
2905 ::buffa::encoding::Tag::new(
2906 4u32,
2907 ::buffa::encoding::WireType::LengthDelimited,
2908 )
2909 .encode(buf);
2910 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
2911 self.policy_info.write_to(__cache, buf);
2912 }
2913 if let Some(ref v) = self.update_mask {
2914 ::buffa::encoding::Tag::new(
2915 5u32,
2916 ::buffa::encoding::WireType::LengthDelimited,
2917 )
2918 .encode(buf);
2919 ::buffa::types::encode_string(v, buf);
2920 }
2921 self.__buffa_unknown_fields.write_to(buf);
2922 }
2923 fn merge_field(
2924 &mut self,
2925 tag: ::buffa::encoding::Tag,
2926 buf: &mut impl ::buffa::bytes::Buf,
2927 depth: u32,
2928 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
2929 #[allow(unused_imports)]
2930 use ::buffa::bytes::Buf as _;
2931 #[allow(unused_imports)]
2932 use ::buffa::Enumeration as _;
2933 match tag.field_number() {
2934 1u32 => {
2935 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2936 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2937 field_number: 1u32,
2938 expected: 2u8,
2939 actual: tag.wire_type() as u8,
2940 });
2941 }
2942 ::buffa::types::merge_string(&mut self.on_securable_type, buf)?;
2943 }
2944 2u32 => {
2945 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2946 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2947 field_number: 2u32,
2948 expected: 2u8,
2949 actual: tag.wire_type() as u8,
2950 });
2951 }
2952 ::buffa::types::merge_string(&mut self.on_securable_fullname, buf)?;
2953 }
2954 3u32 => {
2955 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2956 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2957 field_number: 3u32,
2958 expected: 2u8,
2959 actual: tag.wire_type() as u8,
2960 });
2961 }
2962 ::buffa::types::merge_string(&mut self.name, buf)?;
2963 }
2964 4u32 => {
2965 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2966 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2967 field_number: 4u32,
2968 expected: 2u8,
2969 actual: tag.wire_type() as u8,
2970 });
2971 }
2972 ::buffa::Message::merge_length_delimited(
2973 self.policy_info.get_or_insert_default(),
2974 buf,
2975 depth,
2976 )?;
2977 }
2978 5u32 => {
2979 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
2980 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
2981 field_number: 5u32,
2982 expected: 2u8,
2983 actual: tag.wire_type() as u8,
2984 });
2985 }
2986 ::buffa::types::merge_string(
2987 self
2988 .update_mask
2989 .get_or_insert_with(::buffa::alloc::string::String::new),
2990 buf,
2991 )?;
2992 }
2993 _ => {
2994 self.__buffa_unknown_fields
2995 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
2996 }
2997 }
2998 ::core::result::Result::Ok(())
2999 }
3000 fn clear(&mut self) {
3001 self.on_securable_type.clear();
3002 self.on_securable_fullname.clear();
3003 self.name.clear();
3004 self.policy_info = ::buffa::MessageField::none();
3005 self.update_mask = ::core::option::Option::None;
3006 self.__buffa_unknown_fields.clear();
3007 }
3008}
3009impl ::buffa::ExtensionSet for UpdatePolicyRequest {
3010 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.UpdatePolicyRequest";
3011 fn unknown_fields(&self) -> &::buffa::UnknownFields {
3012 &self.__buffa_unknown_fields
3013 }
3014 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3015 &mut self.__buffa_unknown_fields
3016 }
3017}
3018impl ::buffa::json_helpers::ProtoElemJson for UpdatePolicyRequest {
3019 fn serialize_proto_json<S: ::serde::Serializer>(
3020 v: &Self,
3021 s: S,
3022 ) -> ::core::result::Result<S::Ok, S::Error> {
3023 ::serde::Serialize::serialize(v, s)
3024 }
3025 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3026 d: D,
3027 ) -> ::core::result::Result<Self, D::Error> {
3028 <Self as ::serde::Deserialize>::deserialize(d)
3029 }
3030}
3031#[doc(hidden)]
3032pub const __UPDATE_POLICY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3033 type_url: "type.googleapis.com/unitycatalog.policies.v1.UpdatePolicyRequest",
3034 to_json: ::buffa::type_registry::any_to_json::<UpdatePolicyRequest>,
3035 from_json: ::buffa::type_registry::any_from_json::<UpdatePolicyRequest>,
3036 is_wkt: false,
3037};
3038#[derive(Clone, PartialEq, Default)]
3040#[derive(::serde::Serialize, ::serde::Deserialize)]
3041#[serde(default)]
3042pub struct DeletePolicyRequest {
3043 #[serde(
3049 rename = "on_securable_type",
3050 alias = "onSecurableType",
3051 with = "::buffa::json_helpers::proto_string",
3052 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3053 )]
3054 pub on_securable_type: ::buffa::alloc::string::String,
3055 #[serde(
3059 rename = "on_securable_fullname",
3060 alias = "onSecurableFullname",
3061 with = "::buffa::json_helpers::proto_string",
3062 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3063 )]
3064 pub on_securable_fullname: ::buffa::alloc::string::String,
3065 #[serde(
3069 rename = "name",
3070 with = "::buffa::json_helpers::proto_string",
3071 skip_serializing_if = "::buffa::json_helpers::skip_if::is_empty_str"
3072 )]
3073 pub name: ::buffa::alloc::string::String,
3074 #[serde(skip)]
3075 #[doc(hidden)]
3076 pub __buffa_unknown_fields: ::buffa::UnknownFields,
3077}
3078impl ::core::fmt::Debug for DeletePolicyRequest {
3079 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3080 f.debug_struct("DeletePolicyRequest")
3081 .field("on_securable_type", &self.on_securable_type)
3082 .field("on_securable_fullname", &self.on_securable_fullname)
3083 .field("name", &self.name)
3084 .finish()
3085 }
3086}
3087impl DeletePolicyRequest {
3088 pub const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.DeletePolicyRequest";
3093}
3094impl ::buffa::DefaultInstance for DeletePolicyRequest {
3095 fn default_instance() -> &'static Self {
3096 static VALUE: ::buffa::__private::OnceBox<DeletePolicyRequest> = ::buffa::__private::OnceBox::new();
3097 VALUE.get_or_init(|| ::buffa::alloc::boxed::Box::new(Self::default()))
3098 }
3099}
3100impl ::buffa::MessageName for DeletePolicyRequest {
3101 const PACKAGE: &'static str = "unitycatalog.policies.v1";
3102 const NAME: &'static str = "DeletePolicyRequest";
3103 const FULL_NAME: &'static str = "unitycatalog.policies.v1.DeletePolicyRequest";
3104 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.DeletePolicyRequest";
3105}
3106impl ::buffa::Message for DeletePolicyRequest {
3107 #[allow(clippy::let_and_return)]
3113 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3114 #[allow(unused_imports)]
3115 use ::buffa::Enumeration as _;
3116 let mut size = 0u32;
3117 if !self.on_securable_type.is_empty() {
3118 size
3119 += 1u32
3120 + ::buffa::types::string_encoded_len(&self.on_securable_type) as u32;
3121 }
3122 if !self.on_securable_fullname.is_empty() {
3123 size
3124 += 1u32
3125 + ::buffa::types::string_encoded_len(&self.on_securable_fullname)
3126 as u32;
3127 }
3128 if !self.name.is_empty() {
3129 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
3130 }
3131 size += self.__buffa_unknown_fields.encoded_len() as u32;
3132 size
3133 }
3134 fn write_to(
3135 &self,
3136 _cache: &mut ::buffa::SizeCache,
3137 buf: &mut impl ::buffa::bytes::BufMut,
3138 ) {
3139 #[allow(unused_imports)]
3140 use ::buffa::Enumeration as _;
3141 if !self.on_securable_type.is_empty() {
3142 ::buffa::encoding::Tag::new(
3143 1u32,
3144 ::buffa::encoding::WireType::LengthDelimited,
3145 )
3146 .encode(buf);
3147 ::buffa::types::encode_string(&self.on_securable_type, buf);
3148 }
3149 if !self.on_securable_fullname.is_empty() {
3150 ::buffa::encoding::Tag::new(
3151 2u32,
3152 ::buffa::encoding::WireType::LengthDelimited,
3153 )
3154 .encode(buf);
3155 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
3156 }
3157 if !self.name.is_empty() {
3158 ::buffa::encoding::Tag::new(
3159 3u32,
3160 ::buffa::encoding::WireType::LengthDelimited,
3161 )
3162 .encode(buf);
3163 ::buffa::types::encode_string(&self.name, buf);
3164 }
3165 self.__buffa_unknown_fields.write_to(buf);
3166 }
3167 fn merge_field(
3168 &mut self,
3169 tag: ::buffa::encoding::Tag,
3170 buf: &mut impl ::buffa::bytes::Buf,
3171 depth: u32,
3172 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3173 #[allow(unused_imports)]
3174 use ::buffa::bytes::Buf as _;
3175 #[allow(unused_imports)]
3176 use ::buffa::Enumeration as _;
3177 match tag.field_number() {
3178 1u32 => {
3179 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3180 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3181 field_number: 1u32,
3182 expected: 2u8,
3183 actual: tag.wire_type() as u8,
3184 });
3185 }
3186 ::buffa::types::merge_string(&mut self.on_securable_type, buf)?;
3187 }
3188 2u32 => {
3189 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3190 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3191 field_number: 2u32,
3192 expected: 2u8,
3193 actual: tag.wire_type() as u8,
3194 });
3195 }
3196 ::buffa::types::merge_string(&mut self.on_securable_fullname, buf)?;
3197 }
3198 3u32 => {
3199 if tag.wire_type() != ::buffa::encoding::WireType::LengthDelimited {
3200 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3201 field_number: 3u32,
3202 expected: 2u8,
3203 actual: tag.wire_type() as u8,
3204 });
3205 }
3206 ::buffa::types::merge_string(&mut self.name, buf)?;
3207 }
3208 _ => {
3209 self.__buffa_unknown_fields
3210 .push(::buffa::encoding::decode_unknown_field(tag, buf, depth)?);
3211 }
3212 }
3213 ::core::result::Result::Ok(())
3214 }
3215 fn clear(&mut self) {
3216 self.on_securable_type.clear();
3217 self.on_securable_fullname.clear();
3218 self.name.clear();
3219 self.__buffa_unknown_fields.clear();
3220 }
3221}
3222impl ::buffa::ExtensionSet for DeletePolicyRequest {
3223 const PROTO_FQN: &'static str = "unitycatalog.policies.v1.DeletePolicyRequest";
3224 fn unknown_fields(&self) -> &::buffa::UnknownFields {
3225 &self.__buffa_unknown_fields
3226 }
3227 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
3228 &mut self.__buffa_unknown_fields
3229 }
3230}
3231impl ::buffa::json_helpers::ProtoElemJson for DeletePolicyRequest {
3232 fn serialize_proto_json<S: ::serde::Serializer>(
3233 v: &Self,
3234 s: S,
3235 ) -> ::core::result::Result<S::Ok, S::Error> {
3236 ::serde::Serialize::serialize(v, s)
3237 }
3238 fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
3239 d: D,
3240 ) -> ::core::result::Result<Self, D::Error> {
3241 <Self as ::serde::Deserialize>::deserialize(d)
3242 }
3243}
3244#[doc(hidden)]
3245pub const __DELETE_POLICY_REQUEST_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
3246 type_url: "type.googleapis.com/unitycatalog.policies.v1.DeletePolicyRequest",
3247 to_json: ::buffa::type_registry::any_to_json::<DeletePolicyRequest>,
3248 from_json: ::buffa::type_registry::any_from_json::<DeletePolicyRequest>,
3249 is_wkt: false,
3250};
3251#[allow(
3252 non_camel_case_types,
3253 dead_code,
3254 unused_imports,
3255 unused_qualifications,
3256 clippy::derivable_impls,
3257 clippy::match_single_binding,
3258 clippy::uninlined_format_args,
3259 clippy::doc_lazy_continuation,
3260 clippy::module_inception
3261)]
3262pub mod __buffa {
3263 #[allow(unused_imports)]
3264 use super::*;
3265 pub mod view {
3266 #[allow(unused_imports)]
3267 use super::*;
3268 #[derive(Clone, Debug, Default)]
3271 pub struct MatchColumnView<'a> {
3272 pub alias: &'a str,
3277 pub condition: &'a str,
3281 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3282 }
3283 impl<'a> MatchColumnView<'a> {
3284 #[doc(hidden)]
3292 pub fn _decode_depth(
3293 buf: &'a [u8],
3294 depth: u32,
3295 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3296 let mut view = Self::default();
3297 view._merge_into_view(buf, depth)?;
3298 ::core::result::Result::Ok(view)
3299 }
3300 #[doc(hidden)]
3308 pub fn _merge_into_view(
3309 &mut self,
3310 buf: &'a [u8],
3311 depth: u32,
3312 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3313 let _ = depth;
3314 #[allow(unused_variables)]
3315 let view = self;
3316 let mut cur: &'a [u8] = buf;
3317 while !cur.is_empty() {
3318 let before_tag = cur;
3319 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
3320 match tag.field_number() {
3321 1u32 => {
3322 if tag.wire_type()
3323 != ::buffa::encoding::WireType::LengthDelimited
3324 {
3325 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3326 field_number: 1u32,
3327 expected: 2u8,
3328 actual: tag.wire_type() as u8,
3329 });
3330 }
3331 view.alias = ::buffa::types::borrow_str(&mut cur)?;
3332 }
3333 2u32 => {
3334 if tag.wire_type()
3335 != ::buffa::encoding::WireType::LengthDelimited
3336 {
3337 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3338 field_number: 2u32,
3339 expected: 2u8,
3340 actual: tag.wire_type() as u8,
3341 });
3342 }
3343 view.condition = ::buffa::types::borrow_str(&mut cur)?;
3344 }
3345 _ => {
3346 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
3347 let span_len = before_tag.len() - cur.len();
3348 view.__buffa_unknown_fields
3349 .push_raw(&before_tag[..span_len]);
3350 }
3351 }
3352 }
3353 ::core::result::Result::Ok(())
3354 }
3355 }
3356 impl<'a> ::buffa::MessageView<'a> for MatchColumnView<'a> {
3357 type Owned = super::super::MatchColumn;
3358 fn decode_view(
3359 buf: &'a [u8],
3360 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3361 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
3362 }
3363 fn decode_view_with_limit(
3364 buf: &'a [u8],
3365 depth: u32,
3366 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3367 Self::_decode_depth(buf, depth)
3368 }
3369 fn to_owned_message(&self) -> super::super::MatchColumn {
3370 self.to_owned_from_source(None)
3371 }
3372 #[allow(clippy::useless_conversion, clippy::needless_update)]
3373 fn to_owned_from_source(
3374 &self,
3375 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
3376 ) -> super::super::MatchColumn {
3377 #[allow(unused_imports)]
3378 use ::buffa::alloc::string::ToString as _;
3379 let _ = __buffa_src;
3380 super::super::MatchColumn {
3381 alias: self.alias.to_string(),
3382 condition: self.condition.to_string(),
3383 __buffa_unknown_fields: self
3384 .__buffa_unknown_fields
3385 .to_owned()
3386 .unwrap_or_default()
3387 .into(),
3388 ..::core::default::Default::default()
3389 }
3390 }
3391 }
3392 impl<'a> ::buffa::ViewEncode<'a> for MatchColumnView<'a> {
3393 #[allow(clippy::needless_borrow, clippy::let_and_return)]
3394 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3395 #[allow(unused_imports)]
3396 use ::buffa::Enumeration as _;
3397 let mut size = 0u32;
3398 if !self.alias.is_empty() {
3399 size
3400 += 1u32 + ::buffa::types::string_encoded_len(&self.alias) as u32;
3401 }
3402 if !self.condition.is_empty() {
3403 size
3404 += 1u32
3405 + ::buffa::types::string_encoded_len(&self.condition) as u32;
3406 }
3407 size += self.__buffa_unknown_fields.encoded_len() as u32;
3408 size
3409 }
3410 #[allow(clippy::needless_borrow)]
3411 fn write_to(
3412 &self,
3413 _cache: &mut ::buffa::SizeCache,
3414 buf: &mut impl ::buffa::bytes::BufMut,
3415 ) {
3416 #[allow(unused_imports)]
3417 use ::buffa::Enumeration as _;
3418 if !self.alias.is_empty() {
3419 ::buffa::encoding::Tag::new(
3420 1u32,
3421 ::buffa::encoding::WireType::LengthDelimited,
3422 )
3423 .encode(buf);
3424 ::buffa::types::encode_string(&self.alias, buf);
3425 }
3426 if !self.condition.is_empty() {
3427 ::buffa::encoding::Tag::new(
3428 2u32,
3429 ::buffa::encoding::WireType::LengthDelimited,
3430 )
3431 .encode(buf);
3432 ::buffa::types::encode_string(&self.condition, buf);
3433 }
3434 self.__buffa_unknown_fields.write_to(buf);
3435 }
3436 }
3437 impl<'__a> ::serde::Serialize for MatchColumnView<'__a> {
3449 fn serialize<__S: ::serde::Serializer>(
3450 &self,
3451 __s: __S,
3452 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3453 use ::serde::ser::SerializeMap as _;
3454 let mut __map = __s.serialize_map(::core::option::Option::None)?;
3455 if !::buffa::json_helpers::skip_if::is_empty_str(self.alias) {
3456 __map.serialize_entry("alias", self.alias)?;
3457 }
3458 if !::buffa::json_helpers::skip_if::is_empty_str(self.condition) {
3459 __map.serialize_entry("condition", self.condition)?;
3460 }
3461 __map.end()
3462 }
3463 }
3464 impl<'a> ::buffa::MessageName for MatchColumnView<'a> {
3465 const PACKAGE: &'static str = "unitycatalog.policies.v1";
3466 const NAME: &'static str = "MatchColumn";
3467 const FULL_NAME: &'static str = "unitycatalog.policies.v1.MatchColumn";
3468 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.MatchColumn";
3469 }
3470 impl<'v> ::buffa::DefaultViewInstance for MatchColumnView<'v> {
3471 fn default_view_instance<'a>() -> &'a Self
3472 where
3473 Self: 'a,
3474 {
3475 static VALUE: ::buffa::__private::OnceBox<MatchColumnView<'static>> = ::buffa::__private::OnceBox::new();
3476 VALUE
3477 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
3478 <MatchColumnView<'static>>::default(),
3479 ))
3480 }
3481 }
3482 impl ::buffa::ViewReborrow for MatchColumnView<'static> {
3483 type Reborrowed<'b> = MatchColumnView<'b>;
3484 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
3485 this
3486 }
3487 }
3488 #[derive(Clone, Debug)]
3494 pub struct MatchColumnOwnedView(::buffa::OwnedView<MatchColumnView<'static>>);
3495 impl MatchColumnOwnedView {
3496 pub fn decode(
3506 bytes: ::buffa::bytes::Bytes,
3507 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3508 ::core::result::Result::Ok(
3509 MatchColumnOwnedView(::buffa::OwnedView::decode(bytes)?),
3510 )
3511 }
3512 pub fn decode_with_options(
3520 bytes: ::buffa::bytes::Bytes,
3521 opts: &::buffa::DecodeOptions,
3522 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3523 ::core::result::Result::Ok(
3524 MatchColumnOwnedView(
3525 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
3526 ),
3527 )
3528 }
3529 pub fn from_owned(
3536 msg: &super::super::MatchColumn,
3537 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3538 ::core::result::Result::Ok(
3539 MatchColumnOwnedView(::buffa::OwnedView::from_owned(msg)?),
3540 )
3541 }
3542 #[must_use]
3544 pub fn view(&self) -> &MatchColumnView<'_> {
3545 self.0.reborrow()
3546 }
3547 #[must_use]
3549 pub fn to_owned_message(&self) -> super::super::MatchColumn {
3550 self.0.to_owned_message()
3551 }
3552 #[must_use]
3554 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
3555 self.0.bytes()
3556 }
3557 #[must_use]
3559 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
3560 self.0.into_bytes()
3561 }
3562 #[must_use]
3567 pub fn alias(&self) -> &'_ str {
3568 self.0.reborrow().alias
3569 }
3570 #[must_use]
3574 pub fn condition(&self) -> &'_ str {
3575 self.0.reborrow().condition
3576 }
3577 }
3578 impl ::core::convert::From<::buffa::OwnedView<MatchColumnView<'static>>>
3579 for MatchColumnOwnedView {
3580 fn from(inner: ::buffa::OwnedView<MatchColumnView<'static>>) -> Self {
3581 MatchColumnOwnedView(inner)
3582 }
3583 }
3584 impl ::core::convert::From<MatchColumnOwnedView>
3585 for ::buffa::OwnedView<MatchColumnView<'static>> {
3586 fn from(wrapper: MatchColumnOwnedView) -> Self {
3587 wrapper.0
3588 }
3589 }
3590 impl ::core::convert::AsRef<::buffa::OwnedView<MatchColumnView<'static>>>
3591 for MatchColumnOwnedView {
3592 fn as_ref(&self) -> &::buffa::OwnedView<MatchColumnView<'static>> {
3593 &self.0
3594 }
3595 }
3596 impl ::buffa::HasMessageView for super::super::MatchColumn {
3597 type View<'a> = MatchColumnView<'a>;
3598 type ViewHandle = MatchColumnOwnedView;
3599 }
3600 impl ::serde::Serialize for MatchColumnOwnedView {
3601 fn serialize<__S: ::serde::Serializer>(
3602 &self,
3603 __s: __S,
3604 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3605 ::serde::Serialize::serialize(&self.0, __s)
3606 }
3607 }
3608 #[derive(Clone, Debug, Default)]
3610 pub struct FunctionArgView<'a> {
3611 pub value: ::core::option::Option<
3612 super::super::__buffa::view::oneof::function_arg::Value<'a>,
3613 >,
3614 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3615 }
3616 impl<'a> FunctionArgView<'a> {
3617 #[doc(hidden)]
3625 pub fn _decode_depth(
3626 buf: &'a [u8],
3627 depth: u32,
3628 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3629 let mut view = Self::default();
3630 view._merge_into_view(buf, depth)?;
3631 ::core::result::Result::Ok(view)
3632 }
3633 #[doc(hidden)]
3641 pub fn _merge_into_view(
3642 &mut self,
3643 buf: &'a [u8],
3644 depth: u32,
3645 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
3646 let _ = depth;
3647 #[allow(unused_variables)]
3648 let view = self;
3649 let mut cur: &'a [u8] = buf;
3650 while !cur.is_empty() {
3651 let before_tag = cur;
3652 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
3653 match tag.field_number() {
3654 1u32 => {
3655 if tag.wire_type()
3656 != ::buffa::encoding::WireType::LengthDelimited
3657 {
3658 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3659 field_number: 1u32,
3660 expected: 2u8,
3661 actual: tag.wire_type() as u8,
3662 });
3663 }
3664 view.value = Some(
3665 super::super::__buffa::view::oneof::function_arg::Value::Alias(
3666 ::buffa::types::borrow_str(&mut cur)?,
3667 ),
3668 );
3669 }
3670 2u32 => {
3671 if tag.wire_type()
3672 != ::buffa::encoding::WireType::LengthDelimited
3673 {
3674 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
3675 field_number: 2u32,
3676 expected: 2u8,
3677 actual: tag.wire_type() as u8,
3678 });
3679 }
3680 view.value = Some(
3681 super::super::__buffa::view::oneof::function_arg::Value::Constant(
3682 ::buffa::types::borrow_str(&mut cur)?,
3683 ),
3684 );
3685 }
3686 _ => {
3687 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
3688 let span_len = before_tag.len() - cur.len();
3689 view.__buffa_unknown_fields
3690 .push_raw(&before_tag[..span_len]);
3691 }
3692 }
3693 }
3694 ::core::result::Result::Ok(())
3695 }
3696 }
3697 impl<'a> ::buffa::MessageView<'a> for FunctionArgView<'a> {
3698 type Owned = super::super::FunctionArg;
3699 fn decode_view(
3700 buf: &'a [u8],
3701 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3702 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
3703 }
3704 fn decode_view_with_limit(
3705 buf: &'a [u8],
3706 depth: u32,
3707 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3708 Self::_decode_depth(buf, depth)
3709 }
3710 fn to_owned_message(&self) -> super::super::FunctionArg {
3711 self.to_owned_from_source(None)
3712 }
3713 #[allow(clippy::useless_conversion, clippy::needless_update)]
3714 fn to_owned_from_source(
3715 &self,
3716 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
3717 ) -> super::super::FunctionArg {
3718 #[allow(unused_imports)]
3719 use ::buffa::alloc::string::ToString as _;
3720 let _ = __buffa_src;
3721 super::super::FunctionArg {
3722 value: self
3723 .value
3724 .as_ref()
3725 .map(|v| match v {
3726 super::super::__buffa::view::oneof::function_arg::Value::Alias(
3727 v,
3728 ) => {
3729 super::super::__buffa::oneof::function_arg::Value::Alias(
3730 v.to_string(),
3731 )
3732 }
3733 super::super::__buffa::view::oneof::function_arg::Value::Constant(
3734 v,
3735 ) => {
3736 super::super::__buffa::oneof::function_arg::Value::Constant(
3737 v.to_string(),
3738 )
3739 }
3740 }),
3741 __buffa_unknown_fields: self
3742 .__buffa_unknown_fields
3743 .to_owned()
3744 .unwrap_or_default()
3745 .into(),
3746 ..::core::default::Default::default()
3747 }
3748 }
3749 }
3750 impl<'a> ::buffa::ViewEncode<'a> for FunctionArgView<'a> {
3751 #[allow(clippy::needless_borrow, clippy::let_and_return)]
3752 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
3753 #[allow(unused_imports)]
3754 use ::buffa::Enumeration as _;
3755 let mut size = 0u32;
3756 if let ::core::option::Option::Some(ref v) = self.value {
3757 match v {
3758 super::super::__buffa::view::oneof::function_arg::Value::Alias(
3759 x,
3760 ) => {
3761 size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
3762 }
3763 super::super::__buffa::view::oneof::function_arg::Value::Constant(
3764 x,
3765 ) => {
3766 size += 1u32 + ::buffa::types::string_encoded_len(x) as u32;
3767 }
3768 }
3769 }
3770 size += self.__buffa_unknown_fields.encoded_len() as u32;
3771 size
3772 }
3773 #[allow(clippy::needless_borrow)]
3774 fn write_to(
3775 &self,
3776 _cache: &mut ::buffa::SizeCache,
3777 buf: &mut impl ::buffa::bytes::BufMut,
3778 ) {
3779 #[allow(unused_imports)]
3780 use ::buffa::Enumeration as _;
3781 if let ::core::option::Option::Some(ref v) = self.value {
3782 match v {
3783 super::super::__buffa::view::oneof::function_arg::Value::Alias(
3784 x,
3785 ) => {
3786 ::buffa::encoding::Tag::new(
3787 1u32,
3788 ::buffa::encoding::WireType::LengthDelimited,
3789 )
3790 .encode(buf);
3791 ::buffa::types::encode_string(x, buf);
3792 }
3793 super::super::__buffa::view::oneof::function_arg::Value::Constant(
3794 x,
3795 ) => {
3796 ::buffa::encoding::Tag::new(
3797 2u32,
3798 ::buffa::encoding::WireType::LengthDelimited,
3799 )
3800 .encode(buf);
3801 ::buffa::types::encode_string(x, buf);
3802 }
3803 }
3804 }
3805 self.__buffa_unknown_fields.write_to(buf);
3806 }
3807 }
3808 impl<'__a> ::serde::Serialize for FunctionArgView<'__a> {
3820 fn serialize<__S: ::serde::Serializer>(
3821 &self,
3822 __s: __S,
3823 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3824 use ::serde::ser::SerializeMap as _;
3825 let mut __map = __s.serialize_map(::core::option::Option::None)?;
3826 if let ::core::option::Option::Some(ref __ov) = self.value {
3827 match __ov {
3828 super::super::__buffa::view::oneof::function_arg::Value::Alias(
3829 v,
3830 ) => {
3831 __map.serialize_entry("alias", v)?;
3832 }
3833 super::super::__buffa::view::oneof::function_arg::Value::Constant(
3834 v,
3835 ) => {
3836 __map.serialize_entry("constant", v)?;
3837 }
3838 }
3839 }
3840 __map.end()
3841 }
3842 }
3843 impl<'a> ::buffa::MessageName for FunctionArgView<'a> {
3844 const PACKAGE: &'static str = "unitycatalog.policies.v1";
3845 const NAME: &'static str = "FunctionArg";
3846 const FULL_NAME: &'static str = "unitycatalog.policies.v1.FunctionArg";
3847 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.FunctionArg";
3848 }
3849 impl<'v> ::buffa::DefaultViewInstance for FunctionArgView<'v> {
3850 fn default_view_instance<'a>() -> &'a Self
3851 where
3852 Self: 'a,
3853 {
3854 static VALUE: ::buffa::__private::OnceBox<FunctionArgView<'static>> = ::buffa::__private::OnceBox::new();
3855 VALUE
3856 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
3857 <FunctionArgView<'static>>::default(),
3858 ))
3859 }
3860 }
3861 impl ::buffa::ViewReborrow for FunctionArgView<'static> {
3862 type Reborrowed<'b> = FunctionArgView<'b>;
3863 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
3864 this
3865 }
3866 }
3867 #[derive(Clone, Debug)]
3873 pub struct FunctionArgOwnedView(::buffa::OwnedView<FunctionArgView<'static>>);
3874 impl FunctionArgOwnedView {
3875 pub fn decode(
3885 bytes: ::buffa::bytes::Bytes,
3886 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3887 ::core::result::Result::Ok(
3888 FunctionArgOwnedView(::buffa::OwnedView::decode(bytes)?),
3889 )
3890 }
3891 pub fn decode_with_options(
3899 bytes: ::buffa::bytes::Bytes,
3900 opts: &::buffa::DecodeOptions,
3901 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3902 ::core::result::Result::Ok(
3903 FunctionArgOwnedView(
3904 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
3905 ),
3906 )
3907 }
3908 pub fn from_owned(
3915 msg: &super::super::FunctionArg,
3916 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
3917 ::core::result::Result::Ok(
3918 FunctionArgOwnedView(::buffa::OwnedView::from_owned(msg)?),
3919 )
3920 }
3921 #[must_use]
3923 pub fn view(&self) -> &FunctionArgView<'_> {
3924 self.0.reborrow()
3925 }
3926 #[must_use]
3928 pub fn to_owned_message(&self) -> super::super::FunctionArg {
3929 self.0.to_owned_message()
3930 }
3931 #[must_use]
3933 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
3934 self.0.bytes()
3935 }
3936 #[must_use]
3938 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
3939 self.0.into_bytes()
3940 }
3941 #[must_use]
3943 pub fn value(
3944 &self,
3945 ) -> ::core::option::Option<
3946 &super::super::__buffa::view::oneof::function_arg::Value<'_>,
3947 > {
3948 self.0.reborrow().value.as_ref()
3949 }
3950 }
3951 impl ::core::convert::From<::buffa::OwnedView<FunctionArgView<'static>>>
3952 for FunctionArgOwnedView {
3953 fn from(inner: ::buffa::OwnedView<FunctionArgView<'static>>) -> Self {
3954 FunctionArgOwnedView(inner)
3955 }
3956 }
3957 impl ::core::convert::From<FunctionArgOwnedView>
3958 for ::buffa::OwnedView<FunctionArgView<'static>> {
3959 fn from(wrapper: FunctionArgOwnedView) -> Self {
3960 wrapper.0
3961 }
3962 }
3963 impl ::core::convert::AsRef<::buffa::OwnedView<FunctionArgView<'static>>>
3964 for FunctionArgOwnedView {
3965 fn as_ref(&self) -> &::buffa::OwnedView<FunctionArgView<'static>> {
3966 &self.0
3967 }
3968 }
3969 impl ::buffa::HasMessageView for super::super::FunctionArg {
3970 type View<'a> = FunctionArgView<'a>;
3971 type ViewHandle = FunctionArgOwnedView;
3972 }
3973 impl ::serde::Serialize for FunctionArgOwnedView {
3974 fn serialize<__S: ::serde::Serializer>(
3975 &self,
3976 __s: __S,
3977 ) -> ::core::result::Result<__S::Ok, __S::Error> {
3978 ::serde::Serialize::serialize(&self.0, __s)
3979 }
3980 }
3981 #[derive(Clone, Debug, Default)]
3984 pub struct FunctionRefView<'a> {
3985 pub function_name: &'a str,
3989 pub using: ::buffa::RepeatedView<
3993 'a,
3994 super::super::__buffa::view::FunctionArgView<'a>,
3995 >,
3996 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
3997 }
3998 impl<'a> FunctionRefView<'a> {
3999 #[doc(hidden)]
4007 pub fn _decode_depth(
4008 buf: &'a [u8],
4009 depth: u32,
4010 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4011 let mut view = Self::default();
4012 view._merge_into_view(buf, depth)?;
4013 ::core::result::Result::Ok(view)
4014 }
4015 #[doc(hidden)]
4023 pub fn _merge_into_view(
4024 &mut self,
4025 buf: &'a [u8],
4026 depth: u32,
4027 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4028 let _ = depth;
4029 #[allow(unused_variables)]
4030 let view = self;
4031 let mut cur: &'a [u8] = buf;
4032 while !cur.is_empty() {
4033 let before_tag = cur;
4034 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
4035 match tag.field_number() {
4036 1u32 => {
4037 if tag.wire_type()
4038 != ::buffa::encoding::WireType::LengthDelimited
4039 {
4040 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4041 field_number: 1u32,
4042 expected: 2u8,
4043 actual: tag.wire_type() as u8,
4044 });
4045 }
4046 view.function_name = ::buffa::types::borrow_str(&mut cur)?;
4047 }
4048 2u32 => {
4049 if tag.wire_type()
4050 != ::buffa::encoding::WireType::LengthDelimited
4051 {
4052 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4053 field_number: 2u32,
4054 expected: 2u8,
4055 actual: tag.wire_type() as u8,
4056 });
4057 }
4058 if depth == 0 {
4059 return Err(::buffa::DecodeError::RecursionLimitExceeded);
4060 }
4061 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
4062 view.using
4063 .push(
4064 super::super::__buffa::view::FunctionArgView::_decode_depth(
4065 sub,
4066 depth - 1,
4067 )?,
4068 );
4069 }
4070 _ => {
4071 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
4072 let span_len = before_tag.len() - cur.len();
4073 view.__buffa_unknown_fields
4074 .push_raw(&before_tag[..span_len]);
4075 }
4076 }
4077 }
4078 ::core::result::Result::Ok(())
4079 }
4080 }
4081 impl<'a> ::buffa::MessageView<'a> for FunctionRefView<'a> {
4082 type Owned = super::super::FunctionRef;
4083 fn decode_view(
4084 buf: &'a [u8],
4085 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4086 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
4087 }
4088 fn decode_view_with_limit(
4089 buf: &'a [u8],
4090 depth: u32,
4091 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4092 Self::_decode_depth(buf, depth)
4093 }
4094 fn to_owned_message(&self) -> super::super::FunctionRef {
4095 self.to_owned_from_source(None)
4096 }
4097 #[allow(clippy::useless_conversion, clippy::needless_update)]
4098 fn to_owned_from_source(
4099 &self,
4100 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
4101 ) -> super::super::FunctionRef {
4102 #[allow(unused_imports)]
4103 use ::buffa::alloc::string::ToString as _;
4104 let _ = __buffa_src;
4105 super::super::FunctionRef {
4106 function_name: self.function_name.to_string(),
4107 using: self
4108 .using
4109 .iter()
4110 .map(|v| v.to_owned_from_source(__buffa_src))
4111 .collect(),
4112 __buffa_unknown_fields: self
4113 .__buffa_unknown_fields
4114 .to_owned()
4115 .unwrap_or_default()
4116 .into(),
4117 ..::core::default::Default::default()
4118 }
4119 }
4120 }
4121 impl<'a> ::buffa::ViewEncode<'a> for FunctionRefView<'a> {
4122 #[allow(clippy::needless_borrow, clippy::let_and_return)]
4123 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4124 #[allow(unused_imports)]
4125 use ::buffa::Enumeration as _;
4126 let mut size = 0u32;
4127 if !self.function_name.is_empty() {
4128 size
4129 += 1u32
4130 + ::buffa::types::string_encoded_len(&self.function_name)
4131 as u32;
4132 }
4133 for v in &self.using {
4134 let __slot = __cache.reserve();
4135 let inner_size = v.compute_size(__cache);
4136 __cache.set(__slot, inner_size);
4137 size
4138 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4139 + inner_size;
4140 }
4141 size += self.__buffa_unknown_fields.encoded_len() as u32;
4142 size
4143 }
4144 #[allow(clippy::needless_borrow)]
4145 fn write_to(
4146 &self,
4147 __cache: &mut ::buffa::SizeCache,
4148 buf: &mut impl ::buffa::bytes::BufMut,
4149 ) {
4150 #[allow(unused_imports)]
4151 use ::buffa::Enumeration as _;
4152 if !self.function_name.is_empty() {
4153 ::buffa::encoding::Tag::new(
4154 1u32,
4155 ::buffa::encoding::WireType::LengthDelimited,
4156 )
4157 .encode(buf);
4158 ::buffa::types::encode_string(&self.function_name, buf);
4159 }
4160 for v in &self.using {
4161 ::buffa::encoding::Tag::new(
4162 2u32,
4163 ::buffa::encoding::WireType::LengthDelimited,
4164 )
4165 .encode(buf);
4166 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
4167 v.write_to(__cache, buf);
4168 }
4169 self.__buffa_unknown_fields.write_to(buf);
4170 }
4171 }
4172 impl<'__a> ::serde::Serialize for FunctionRefView<'__a> {
4184 fn serialize<__S: ::serde::Serializer>(
4185 &self,
4186 __s: __S,
4187 ) -> ::core::result::Result<__S::Ok, __S::Error> {
4188 use ::serde::ser::SerializeMap as _;
4189 let mut __map = __s.serialize_map(::core::option::Option::None)?;
4190 if !::buffa::json_helpers::skip_if::is_empty_str(self.function_name) {
4191 __map.serialize_entry("function_name", self.function_name)?;
4192 }
4193 if !self.using.is_empty() {
4194 __map.serialize_entry("using", &*self.using)?;
4195 }
4196 __map.end()
4197 }
4198 }
4199 impl<'a> ::buffa::MessageName for FunctionRefView<'a> {
4200 const PACKAGE: &'static str = "unitycatalog.policies.v1";
4201 const NAME: &'static str = "FunctionRef";
4202 const FULL_NAME: &'static str = "unitycatalog.policies.v1.FunctionRef";
4203 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.FunctionRef";
4204 }
4205 impl<'v> ::buffa::DefaultViewInstance for FunctionRefView<'v> {
4206 fn default_view_instance<'a>() -> &'a Self
4207 where
4208 Self: 'a,
4209 {
4210 static VALUE: ::buffa::__private::OnceBox<FunctionRefView<'static>> = ::buffa::__private::OnceBox::new();
4211 VALUE
4212 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
4213 <FunctionRefView<'static>>::default(),
4214 ))
4215 }
4216 }
4217 impl ::buffa::ViewReborrow for FunctionRefView<'static> {
4218 type Reborrowed<'b> = FunctionRefView<'b>;
4219 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
4220 this
4221 }
4222 }
4223 #[derive(Clone, Debug)]
4229 pub struct FunctionRefOwnedView(::buffa::OwnedView<FunctionRefView<'static>>);
4230 impl FunctionRefOwnedView {
4231 pub fn decode(
4241 bytes: ::buffa::bytes::Bytes,
4242 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4243 ::core::result::Result::Ok(
4244 FunctionRefOwnedView(::buffa::OwnedView::decode(bytes)?),
4245 )
4246 }
4247 pub fn decode_with_options(
4255 bytes: ::buffa::bytes::Bytes,
4256 opts: &::buffa::DecodeOptions,
4257 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4258 ::core::result::Result::Ok(
4259 FunctionRefOwnedView(
4260 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
4261 ),
4262 )
4263 }
4264 pub fn from_owned(
4271 msg: &super::super::FunctionRef,
4272 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4273 ::core::result::Result::Ok(
4274 FunctionRefOwnedView(::buffa::OwnedView::from_owned(msg)?),
4275 )
4276 }
4277 #[must_use]
4279 pub fn view(&self) -> &FunctionRefView<'_> {
4280 self.0.reborrow()
4281 }
4282 #[must_use]
4284 pub fn to_owned_message(&self) -> super::super::FunctionRef {
4285 self.0.to_owned_message()
4286 }
4287 #[must_use]
4289 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
4290 self.0.bytes()
4291 }
4292 #[must_use]
4294 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
4295 self.0.into_bytes()
4296 }
4297 #[must_use]
4301 pub fn function_name(&self) -> &'_ str {
4302 self.0.reborrow().function_name
4303 }
4304 #[must_use]
4308 pub fn using(
4309 &self,
4310 ) -> &::buffa::RepeatedView<
4311 '_,
4312 super::super::__buffa::view::FunctionArgView<'_>,
4313 > {
4314 &self.0.reborrow().using
4315 }
4316 }
4317 impl ::core::convert::From<::buffa::OwnedView<FunctionRefView<'static>>>
4318 for FunctionRefOwnedView {
4319 fn from(inner: ::buffa::OwnedView<FunctionRefView<'static>>) -> Self {
4320 FunctionRefOwnedView(inner)
4321 }
4322 }
4323 impl ::core::convert::From<FunctionRefOwnedView>
4324 for ::buffa::OwnedView<FunctionRefView<'static>> {
4325 fn from(wrapper: FunctionRefOwnedView) -> Self {
4326 wrapper.0
4327 }
4328 }
4329 impl ::core::convert::AsRef<::buffa::OwnedView<FunctionRefView<'static>>>
4330 for FunctionRefOwnedView {
4331 fn as_ref(&self) -> &::buffa::OwnedView<FunctionRefView<'static>> {
4332 &self.0
4333 }
4334 }
4335 impl ::buffa::HasMessageView for super::super::FunctionRef {
4336 type View<'a> = FunctionRefView<'a>;
4337 type ViewHandle = FunctionRefOwnedView;
4338 }
4339 impl ::serde::Serialize for FunctionRefOwnedView {
4340 fn serialize<__S: ::serde::Serializer>(
4341 &self,
4342 __s: __S,
4343 ) -> ::core::result::Result<__S::Ok, __S::Error> {
4344 ::serde::Serialize::serialize(&self.0, __s)
4345 }
4346 }
4347 #[derive(Clone, Debug, Default)]
4353 pub struct PolicyInfoView<'a> {
4354 pub name: &'a str,
4358 pub id: ::core::option::Option<&'a str>,
4362 pub on_securable_type: &'a str,
4368 pub on_securable_fullname: &'a str,
4372 pub policy_type: ::buffa::EnumValue<super::super::PolicyType>,
4376 pub to_principals: ::buffa::RepeatedView<'a, &'a str>,
4380 pub except_principals: ::buffa::RepeatedView<'a, &'a str>,
4384 pub when_condition: ::core::option::Option<&'a str>,
4389 pub match_columns: ::buffa::RepeatedView<
4394 'a,
4395 super::super::__buffa::view::MatchColumnView<'a>,
4396 >,
4397 pub comment: ::core::option::Option<&'a str>,
4401 pub created_at: ::core::option::Option<i64>,
4405 pub updated_at: ::core::option::Option<i64>,
4409 pub function: ::core::option::Option<
4410 super::super::__buffa::view::oneof::policy_info::Function<'a>,
4411 >,
4412 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
4413 }
4414 impl<'a> PolicyInfoView<'a> {
4415 #[doc(hidden)]
4423 pub fn _decode_depth(
4424 buf: &'a [u8],
4425 depth: u32,
4426 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4427 let mut view = Self::default();
4428 view._merge_into_view(buf, depth)?;
4429 ::core::result::Result::Ok(view)
4430 }
4431 #[doc(hidden)]
4439 pub fn _merge_into_view(
4440 &mut self,
4441 buf: &'a [u8],
4442 depth: u32,
4443 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
4444 let _ = depth;
4445 #[allow(unused_variables)]
4446 let view = self;
4447 let mut cur: &'a [u8] = buf;
4448 while !cur.is_empty() {
4449 let before_tag = cur;
4450 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
4451 match tag.field_number() {
4452 1u32 => {
4453 if tag.wire_type()
4454 != ::buffa::encoding::WireType::LengthDelimited
4455 {
4456 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4457 field_number: 1u32,
4458 expected: 2u8,
4459 actual: tag.wire_type() as u8,
4460 });
4461 }
4462 view.name = ::buffa::types::borrow_str(&mut cur)?;
4463 }
4464 2u32 => {
4465 if tag.wire_type()
4466 != ::buffa::encoding::WireType::LengthDelimited
4467 {
4468 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4469 field_number: 2u32,
4470 expected: 2u8,
4471 actual: tag.wire_type() as u8,
4472 });
4473 }
4474 view.id = Some(::buffa::types::borrow_str(&mut cur)?);
4475 }
4476 3u32 => {
4477 if tag.wire_type()
4478 != ::buffa::encoding::WireType::LengthDelimited
4479 {
4480 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4481 field_number: 3u32,
4482 expected: 2u8,
4483 actual: tag.wire_type() as u8,
4484 });
4485 }
4486 view.on_securable_type = ::buffa::types::borrow_str(
4487 &mut cur,
4488 )?;
4489 }
4490 4u32 => {
4491 if tag.wire_type()
4492 != ::buffa::encoding::WireType::LengthDelimited
4493 {
4494 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4495 field_number: 4u32,
4496 expected: 2u8,
4497 actual: tag.wire_type() as u8,
4498 });
4499 }
4500 view.on_securable_fullname = ::buffa::types::borrow_str(
4501 &mut cur,
4502 )?;
4503 }
4504 5u32 => {
4505 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4506 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4507 field_number: 5u32,
4508 expected: 0u8,
4509 actual: tag.wire_type() as u8,
4510 });
4511 }
4512 view.policy_type = ::buffa::EnumValue::from(
4513 ::buffa::types::decode_int32(&mut cur)?,
4514 );
4515 }
4516 8u32 => {
4517 if tag.wire_type()
4518 != ::buffa::encoding::WireType::LengthDelimited
4519 {
4520 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4521 field_number: 8u32,
4522 expected: 2u8,
4523 actual: tag.wire_type() as u8,
4524 });
4525 }
4526 view.when_condition = Some(
4527 ::buffa::types::borrow_str(&mut cur)?,
4528 );
4529 }
4530 12u32 => {
4531 if tag.wire_type()
4532 != ::buffa::encoding::WireType::LengthDelimited
4533 {
4534 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4535 field_number: 12u32,
4536 expected: 2u8,
4537 actual: tag.wire_type() as u8,
4538 });
4539 }
4540 view.comment = Some(::buffa::types::borrow_str(&mut cur)?);
4541 }
4542 13u32 => {
4543 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4544 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4545 field_number: 13u32,
4546 expected: 0u8,
4547 actual: tag.wire_type() as u8,
4548 });
4549 }
4550 view.created_at = Some(
4551 ::buffa::types::decode_int64(&mut cur)?,
4552 );
4553 }
4554 14u32 => {
4555 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
4556 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4557 field_number: 14u32,
4558 expected: 0u8,
4559 actual: tag.wire_type() as u8,
4560 });
4561 }
4562 view.updated_at = Some(
4563 ::buffa::types::decode_int64(&mut cur)?,
4564 );
4565 }
4566 6u32 => {
4567 if tag.wire_type()
4568 != ::buffa::encoding::WireType::LengthDelimited
4569 {
4570 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4571 field_number: 6u32,
4572 expected: 2u8,
4573 actual: tag.wire_type() as u8,
4574 });
4575 }
4576 view.to_principals
4577 .push(::buffa::types::borrow_str(&mut cur)?);
4578 }
4579 7u32 => {
4580 if tag.wire_type()
4581 != ::buffa::encoding::WireType::LengthDelimited
4582 {
4583 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4584 field_number: 7u32,
4585 expected: 2u8,
4586 actual: tag.wire_type() as u8,
4587 });
4588 }
4589 view.except_principals
4590 .push(::buffa::types::borrow_str(&mut cur)?);
4591 }
4592 9u32 => {
4593 if tag.wire_type()
4594 != ::buffa::encoding::WireType::LengthDelimited
4595 {
4596 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4597 field_number: 9u32,
4598 expected: 2u8,
4599 actual: tag.wire_type() as u8,
4600 });
4601 }
4602 if depth == 0 {
4603 return Err(::buffa::DecodeError::RecursionLimitExceeded);
4604 }
4605 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
4606 view.match_columns
4607 .push(
4608 super::super::__buffa::view::MatchColumnView::_decode_depth(
4609 sub,
4610 depth - 1,
4611 )?,
4612 );
4613 }
4614 10u32 => {
4615 if tag.wire_type()
4616 != ::buffa::encoding::WireType::LengthDelimited
4617 {
4618 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4619 field_number: 10u32,
4620 expected: 2u8,
4621 actual: tag.wire_type() as u8,
4622 });
4623 }
4624 if depth == 0 {
4625 return Err(::buffa::DecodeError::RecursionLimitExceeded);
4626 }
4627 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
4628 if let Some(
4629 super::super::__buffa::view::oneof::policy_info::Function::RowFilter(
4630 ref mut existing,
4631 ),
4632 ) = view.function
4633 {
4634 existing._merge_into_view(sub, depth - 1)?;
4635 } else {
4636 view.function = Some(
4637 super::super::__buffa::view::oneof::policy_info::Function::RowFilter(
4638 ::buffa::alloc::boxed::Box::new(
4639 super::super::__buffa::view::FunctionRefView::_decode_depth(
4640 sub,
4641 depth - 1,
4642 )?,
4643 ),
4644 ),
4645 );
4646 }
4647 }
4648 11u32 => {
4649 if tag.wire_type()
4650 != ::buffa::encoding::WireType::LengthDelimited
4651 {
4652 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
4653 field_number: 11u32,
4654 expected: 2u8,
4655 actual: tag.wire_type() as u8,
4656 });
4657 }
4658 if depth == 0 {
4659 return Err(::buffa::DecodeError::RecursionLimitExceeded);
4660 }
4661 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
4662 if let Some(
4663 super::super::__buffa::view::oneof::policy_info::Function::ColumnMask(
4664 ref mut existing,
4665 ),
4666 ) = view.function
4667 {
4668 existing._merge_into_view(sub, depth - 1)?;
4669 } else {
4670 view.function = Some(
4671 super::super::__buffa::view::oneof::policy_info::Function::ColumnMask(
4672 ::buffa::alloc::boxed::Box::new(
4673 super::super::__buffa::view::FunctionRefView::_decode_depth(
4674 sub,
4675 depth - 1,
4676 )?,
4677 ),
4678 ),
4679 );
4680 }
4681 }
4682 _ => {
4683 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
4684 let span_len = before_tag.len() - cur.len();
4685 view.__buffa_unknown_fields
4686 .push_raw(&before_tag[..span_len]);
4687 }
4688 }
4689 }
4690 ::core::result::Result::Ok(())
4691 }
4692 }
4693 impl<'a> ::buffa::MessageView<'a> for PolicyInfoView<'a> {
4694 type Owned = super::super::PolicyInfo;
4695 fn decode_view(
4696 buf: &'a [u8],
4697 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4698 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
4699 }
4700 fn decode_view_with_limit(
4701 buf: &'a [u8],
4702 depth: u32,
4703 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
4704 Self::_decode_depth(buf, depth)
4705 }
4706 fn to_owned_message(&self) -> super::super::PolicyInfo {
4707 self.to_owned_from_source(None)
4708 }
4709 #[allow(clippy::useless_conversion, clippy::needless_update)]
4710 fn to_owned_from_source(
4711 &self,
4712 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
4713 ) -> super::super::PolicyInfo {
4714 #[allow(unused_imports)]
4715 use ::buffa::alloc::string::ToString as _;
4716 let _ = __buffa_src;
4717 super::super::PolicyInfo {
4718 name: self.name.to_string(),
4719 id: self.id.map(|s| s.to_string()),
4720 on_securable_type: self.on_securable_type.to_string(),
4721 on_securable_fullname: self.on_securable_fullname.to_string(),
4722 policy_type: self.policy_type,
4723 to_principals: self
4724 .to_principals
4725 .iter()
4726 .map(|s| s.to_string())
4727 .collect(),
4728 except_principals: self
4729 .except_principals
4730 .iter()
4731 .map(|s| s.to_string())
4732 .collect(),
4733 when_condition: self.when_condition.map(|s| s.to_string()),
4734 match_columns: self
4735 .match_columns
4736 .iter()
4737 .map(|v| v.to_owned_from_source(__buffa_src))
4738 .collect(),
4739 comment: self.comment.map(|s| s.to_string()),
4740 created_at: self.created_at,
4741 updated_at: self.updated_at,
4742 function: self
4743 .function
4744 .as_ref()
4745 .map(|v| match v {
4746 super::super::__buffa::view::oneof::policy_info::Function::RowFilter(
4747 v,
4748 ) => {
4749 super::super::__buffa::oneof::policy_info::Function::RowFilter(
4750 ::buffa::alloc::boxed::Box::new(
4751 v.to_owned_from_source(__buffa_src),
4752 ),
4753 )
4754 }
4755 super::super::__buffa::view::oneof::policy_info::Function::ColumnMask(
4756 v,
4757 ) => {
4758 super::super::__buffa::oneof::policy_info::Function::ColumnMask(
4759 ::buffa::alloc::boxed::Box::new(
4760 v.to_owned_from_source(__buffa_src),
4761 ),
4762 )
4763 }
4764 }),
4765 __buffa_unknown_fields: self
4766 .__buffa_unknown_fields
4767 .to_owned()
4768 .unwrap_or_default()
4769 .into(),
4770 ..::core::default::Default::default()
4771 }
4772 }
4773 }
4774 impl<'a> ::buffa::ViewEncode<'a> for PolicyInfoView<'a> {
4775 #[allow(clippy::needless_borrow, clippy::let_and_return)]
4776 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
4777 #[allow(unused_imports)]
4778 use ::buffa::Enumeration as _;
4779 let mut size = 0u32;
4780 if !self.name.is_empty() {
4781 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
4782 }
4783 if let Some(ref v) = self.id {
4784 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4785 }
4786 if !self.on_securable_type.is_empty() {
4787 size
4788 += 1u32
4789 + ::buffa::types::string_encoded_len(&self.on_securable_type)
4790 as u32;
4791 }
4792 if !self.on_securable_fullname.is_empty() {
4793 size
4794 += 1u32
4795 + ::buffa::types::string_encoded_len(
4796 &self.on_securable_fullname,
4797 ) as u32;
4798 }
4799 {
4800 let val = self.policy_type.to_i32();
4801 if val != 0 {
4802 size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
4803 }
4804 }
4805 for v in &self.to_principals {
4806 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4807 }
4808 for v in &self.except_principals {
4809 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4810 }
4811 if let Some(ref v) = self.when_condition {
4812 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4813 }
4814 for v in &self.match_columns {
4815 let __slot = __cache.reserve();
4816 let inner_size = v.compute_size(__cache);
4817 __cache.set(__slot, inner_size);
4818 size
4819 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
4820 + inner_size;
4821 }
4822 if let ::core::option::Option::Some(ref v) = self.function {
4823 match v {
4824 super::super::__buffa::view::oneof::policy_info::Function::RowFilter(
4825 x,
4826 ) => {
4827 let __slot = __cache.reserve();
4828 let inner = x.compute_size(__cache);
4829 __cache.set(__slot, inner);
4830 size
4831 += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
4832 + inner;
4833 }
4834 super::super::__buffa::view::oneof::policy_info::Function::ColumnMask(
4835 x,
4836 ) => {
4837 let __slot = __cache.reserve();
4838 let inner = x.compute_size(__cache);
4839 __cache.set(__slot, inner);
4840 size
4841 += 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
4842 + inner;
4843 }
4844 }
4845 }
4846 if let Some(ref v) = self.comment {
4847 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
4848 }
4849 if let Some(v) = self.created_at {
4850 size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
4851 }
4852 if let Some(v) = self.updated_at {
4853 size += 1u32 + ::buffa::types::int64_encoded_len(v) as u32;
4854 }
4855 size += self.__buffa_unknown_fields.encoded_len() as u32;
4856 size
4857 }
4858 #[allow(clippy::needless_borrow)]
4859 fn write_to(
4860 &self,
4861 __cache: &mut ::buffa::SizeCache,
4862 buf: &mut impl ::buffa::bytes::BufMut,
4863 ) {
4864 #[allow(unused_imports)]
4865 use ::buffa::Enumeration as _;
4866 if !self.name.is_empty() {
4867 ::buffa::encoding::Tag::new(
4868 1u32,
4869 ::buffa::encoding::WireType::LengthDelimited,
4870 )
4871 .encode(buf);
4872 ::buffa::types::encode_string(&self.name, buf);
4873 }
4874 if let Some(ref v) = self.id {
4875 ::buffa::encoding::Tag::new(
4876 2u32,
4877 ::buffa::encoding::WireType::LengthDelimited,
4878 )
4879 .encode(buf);
4880 ::buffa::types::encode_string(v, buf);
4881 }
4882 if !self.on_securable_type.is_empty() {
4883 ::buffa::encoding::Tag::new(
4884 3u32,
4885 ::buffa::encoding::WireType::LengthDelimited,
4886 )
4887 .encode(buf);
4888 ::buffa::types::encode_string(&self.on_securable_type, buf);
4889 }
4890 if !self.on_securable_fullname.is_empty() {
4891 ::buffa::encoding::Tag::new(
4892 4u32,
4893 ::buffa::encoding::WireType::LengthDelimited,
4894 )
4895 .encode(buf);
4896 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
4897 }
4898 {
4899 let val = self.policy_type.to_i32();
4900 if val != 0 {
4901 ::buffa::encoding::Tag::new(
4902 5u32,
4903 ::buffa::encoding::WireType::Varint,
4904 )
4905 .encode(buf);
4906 ::buffa::types::encode_int32(val, buf);
4907 }
4908 }
4909 for v in &self.to_principals {
4910 ::buffa::encoding::Tag::new(
4911 6u32,
4912 ::buffa::encoding::WireType::LengthDelimited,
4913 )
4914 .encode(buf);
4915 ::buffa::types::encode_string(v, buf);
4916 }
4917 for v in &self.except_principals {
4918 ::buffa::encoding::Tag::new(
4919 7u32,
4920 ::buffa::encoding::WireType::LengthDelimited,
4921 )
4922 .encode(buf);
4923 ::buffa::types::encode_string(v, buf);
4924 }
4925 if let Some(ref v) = self.when_condition {
4926 ::buffa::encoding::Tag::new(
4927 8u32,
4928 ::buffa::encoding::WireType::LengthDelimited,
4929 )
4930 .encode(buf);
4931 ::buffa::types::encode_string(v, buf);
4932 }
4933 for v in &self.match_columns {
4934 ::buffa::encoding::Tag::new(
4935 9u32,
4936 ::buffa::encoding::WireType::LengthDelimited,
4937 )
4938 .encode(buf);
4939 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
4940 v.write_to(__cache, buf);
4941 }
4942 if let ::core::option::Option::Some(ref v) = self.function {
4943 match v {
4944 super::super::__buffa::view::oneof::policy_info::Function::RowFilter(
4945 x,
4946 ) => {
4947 ::buffa::encoding::Tag::new(
4948 10u32,
4949 ::buffa::encoding::WireType::LengthDelimited,
4950 )
4951 .encode(buf);
4952 ::buffa::encoding::encode_varint(
4953 __cache.consume_next() as u64,
4954 buf,
4955 );
4956 x.write_to(__cache, buf);
4957 }
4958 super::super::__buffa::view::oneof::policy_info::Function::ColumnMask(
4959 x,
4960 ) => {
4961 ::buffa::encoding::Tag::new(
4962 11u32,
4963 ::buffa::encoding::WireType::LengthDelimited,
4964 )
4965 .encode(buf);
4966 ::buffa::encoding::encode_varint(
4967 __cache.consume_next() as u64,
4968 buf,
4969 );
4970 x.write_to(__cache, buf);
4971 }
4972 }
4973 }
4974 if let Some(ref v) = self.comment {
4975 ::buffa::encoding::Tag::new(
4976 12u32,
4977 ::buffa::encoding::WireType::LengthDelimited,
4978 )
4979 .encode(buf);
4980 ::buffa::types::encode_string(v, buf);
4981 }
4982 if let Some(v) = self.created_at {
4983 ::buffa::encoding::Tag::new(
4984 13u32,
4985 ::buffa::encoding::WireType::Varint,
4986 )
4987 .encode(buf);
4988 ::buffa::types::encode_int64(v, buf);
4989 }
4990 if let Some(v) = self.updated_at {
4991 ::buffa::encoding::Tag::new(
4992 14u32,
4993 ::buffa::encoding::WireType::Varint,
4994 )
4995 .encode(buf);
4996 ::buffa::types::encode_int64(v, buf);
4997 }
4998 self.__buffa_unknown_fields.write_to(buf);
4999 }
5000 }
5001 impl<'__a> ::serde::Serialize for PolicyInfoView<'__a> {
5013 fn serialize<__S: ::serde::Serializer>(
5014 &self,
5015 __s: __S,
5016 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5017 use ::serde::ser::SerializeMap as _;
5018 let mut __map = __s.serialize_map(::core::option::Option::None)?;
5019 if !::buffa::json_helpers::skip_if::is_empty_str(self.name) {
5020 __map.serialize_entry("name", self.name)?;
5021 }
5022 if let ::core::option::Option::Some(__v) = self.id {
5023 __map.serialize_entry("id", __v)?;
5024 }
5025 if !::buffa::json_helpers::skip_if::is_empty_str(
5026 self.on_securable_type,
5027 ) {
5028 __map.serialize_entry("on_securable_type", self.on_securable_type)?;
5029 }
5030 if !::buffa::json_helpers::skip_if::is_empty_str(
5031 self.on_securable_fullname,
5032 ) {
5033 __map
5034 .serialize_entry(
5035 "onSecurableFullname",
5036 self.on_securable_fullname,
5037 )?;
5038 }
5039 if !::buffa::json_helpers::skip_if::is_default_enum_value(
5040 &self.policy_type,
5041 ) {
5042 __map.serialize_entry("policy_type", &self.policy_type)?;
5043 }
5044 if !self.to_principals.is_empty() {
5045 __map.serialize_entry("to_principals", &*self.to_principals)?;
5046 }
5047 if !self.except_principals.is_empty() {
5048 __map.serialize_entry("except_principals", &*self.except_principals)?;
5049 }
5050 if let ::core::option::Option::Some(__v) = self.when_condition {
5051 __map.serialize_entry("when_condition", __v)?;
5052 }
5053 if !self.match_columns.is_empty() {
5054 __map.serialize_entry("match_columns", &*self.match_columns)?;
5055 }
5056 if let ::core::option::Option::Some(__v) = self.comment {
5057 __map.serialize_entry("comment", __v)?;
5058 }
5059 if let ::core::option::Option::Some(__v) = self.created_at {
5060 struct _W(i64);
5061 impl ::serde::Serialize for _W {
5062 fn serialize<__S: ::serde::Serializer>(
5063 &self,
5064 __s: __S,
5065 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5066 ::buffa::json_helpers::int64::serialize(&self.0, __s)
5067 }
5068 }
5069 __map.serialize_entry("created_at", &_W(__v))?;
5070 }
5071 if let ::core::option::Option::Some(__v) = self.updated_at {
5072 struct _W(i64);
5073 impl ::serde::Serialize for _W {
5074 fn serialize<__S: ::serde::Serializer>(
5075 &self,
5076 __s: __S,
5077 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5078 ::buffa::json_helpers::int64::serialize(&self.0, __s)
5079 }
5080 }
5081 __map.serialize_entry("updated_at", &_W(__v))?;
5082 }
5083 if let ::core::option::Option::Some(ref __ov) = self.function {
5084 match __ov {
5085 super::super::__buffa::view::oneof::policy_info::Function::RowFilter(
5086 v,
5087 ) => {
5088 __map.serialize_entry("row_filter", v)?;
5089 }
5090 super::super::__buffa::view::oneof::policy_info::Function::ColumnMask(
5091 v,
5092 ) => {
5093 __map.serialize_entry("column_mask", v)?;
5094 }
5095 }
5096 }
5097 __map.end()
5098 }
5099 }
5100 impl<'a> ::buffa::MessageName for PolicyInfoView<'a> {
5101 const PACKAGE: &'static str = "unitycatalog.policies.v1";
5102 const NAME: &'static str = "PolicyInfo";
5103 const FULL_NAME: &'static str = "unitycatalog.policies.v1.PolicyInfo";
5104 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.PolicyInfo";
5105 }
5106 impl<'v> ::buffa::DefaultViewInstance for PolicyInfoView<'v> {
5107 fn default_view_instance<'a>() -> &'a Self
5108 where
5109 Self: 'a,
5110 {
5111 static VALUE: ::buffa::__private::OnceBox<PolicyInfoView<'static>> = ::buffa::__private::OnceBox::new();
5112 VALUE
5113 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
5114 <PolicyInfoView<'static>>::default(),
5115 ))
5116 }
5117 }
5118 impl ::buffa::ViewReborrow for PolicyInfoView<'static> {
5119 type Reborrowed<'b> = PolicyInfoView<'b>;
5120 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
5121 this
5122 }
5123 }
5124 #[derive(Clone, Debug)]
5130 pub struct PolicyInfoOwnedView(::buffa::OwnedView<PolicyInfoView<'static>>);
5131 impl PolicyInfoOwnedView {
5132 pub fn decode(
5142 bytes: ::buffa::bytes::Bytes,
5143 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5144 ::core::result::Result::Ok(
5145 PolicyInfoOwnedView(::buffa::OwnedView::decode(bytes)?),
5146 )
5147 }
5148 pub fn decode_with_options(
5156 bytes: ::buffa::bytes::Bytes,
5157 opts: &::buffa::DecodeOptions,
5158 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5159 ::core::result::Result::Ok(
5160 PolicyInfoOwnedView(
5161 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
5162 ),
5163 )
5164 }
5165 pub fn from_owned(
5172 msg: &super::super::PolicyInfo,
5173 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5174 ::core::result::Result::Ok(
5175 PolicyInfoOwnedView(::buffa::OwnedView::from_owned(msg)?),
5176 )
5177 }
5178 #[must_use]
5180 pub fn view(&self) -> &PolicyInfoView<'_> {
5181 self.0.reborrow()
5182 }
5183 #[must_use]
5185 pub fn to_owned_message(&self) -> super::super::PolicyInfo {
5186 self.0.to_owned_message()
5187 }
5188 #[must_use]
5190 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
5191 self.0.bytes()
5192 }
5193 #[must_use]
5195 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
5196 self.0.into_bytes()
5197 }
5198 #[must_use]
5202 pub fn name(&self) -> &'_ str {
5203 self.0.reborrow().name
5204 }
5205 #[must_use]
5209 pub fn id(&self) -> ::core::option::Option<&'_ str> {
5210 self.0.reborrow().id
5211 }
5212 #[must_use]
5218 pub fn on_securable_type(&self) -> &'_ str {
5219 self.0.reborrow().on_securable_type
5220 }
5221 #[must_use]
5225 pub fn on_securable_fullname(&self) -> &'_ str {
5226 self.0.reborrow().on_securable_fullname
5227 }
5228 #[must_use]
5232 pub fn policy_type(&self) -> ::buffa::EnumValue<super::super::PolicyType> {
5233 self.0.reborrow().policy_type
5234 }
5235 #[must_use]
5239 pub fn to_principals(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
5240 &self.0.reborrow().to_principals
5241 }
5242 #[must_use]
5246 pub fn except_principals(&self) -> &::buffa::RepeatedView<'_, &'_ str> {
5247 &self.0.reborrow().except_principals
5248 }
5249 #[must_use]
5254 pub fn when_condition(&self) -> ::core::option::Option<&'_ str> {
5255 self.0.reborrow().when_condition
5256 }
5257 #[must_use]
5262 pub fn match_columns(
5263 &self,
5264 ) -> &::buffa::RepeatedView<
5265 '_,
5266 super::super::__buffa::view::MatchColumnView<'_>,
5267 > {
5268 &self.0.reborrow().match_columns
5269 }
5270 #[must_use]
5274 pub fn comment(&self) -> ::core::option::Option<&'_ str> {
5275 self.0.reborrow().comment
5276 }
5277 #[must_use]
5281 pub fn created_at(&self) -> ::core::option::Option<i64> {
5282 self.0.reborrow().created_at
5283 }
5284 #[must_use]
5288 pub fn updated_at(&self) -> ::core::option::Option<i64> {
5289 self.0.reborrow().updated_at
5290 }
5291 #[must_use]
5293 pub fn function(
5294 &self,
5295 ) -> ::core::option::Option<
5296 &super::super::__buffa::view::oneof::policy_info::Function<'_>,
5297 > {
5298 self.0.reborrow().function.as_ref()
5299 }
5300 }
5301 impl ::core::convert::From<::buffa::OwnedView<PolicyInfoView<'static>>>
5302 for PolicyInfoOwnedView {
5303 fn from(inner: ::buffa::OwnedView<PolicyInfoView<'static>>) -> Self {
5304 PolicyInfoOwnedView(inner)
5305 }
5306 }
5307 impl ::core::convert::From<PolicyInfoOwnedView>
5308 for ::buffa::OwnedView<PolicyInfoView<'static>> {
5309 fn from(wrapper: PolicyInfoOwnedView) -> Self {
5310 wrapper.0
5311 }
5312 }
5313 impl ::core::convert::AsRef<::buffa::OwnedView<PolicyInfoView<'static>>>
5314 for PolicyInfoOwnedView {
5315 fn as_ref(&self) -> &::buffa::OwnedView<PolicyInfoView<'static>> {
5316 &self.0
5317 }
5318 }
5319 impl ::buffa::HasMessageView for super::super::PolicyInfo {
5320 type View<'a> = PolicyInfoView<'a>;
5321 type ViewHandle = PolicyInfoOwnedView;
5322 }
5323 impl ::serde::Serialize for PolicyInfoOwnedView {
5324 fn serialize<__S: ::serde::Serializer>(
5325 &self,
5326 __s: __S,
5327 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5328 ::serde::Serialize::serialize(&self.0, __s)
5329 }
5330 }
5331 #[derive(Clone, Debug, Default)]
5333 pub struct ListPoliciesRequestView<'a> {
5334 pub on_securable_type: &'a str,
5340 pub on_securable_fullname: &'a str,
5344 pub include_inherited: ::core::option::Option<bool>,
5351 pub max_results: ::core::option::Option<i32>,
5355 pub page_token: ::core::option::Option<&'a str>,
5359 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
5360 }
5361 impl<'a> ListPoliciesRequestView<'a> {
5362 #[doc(hidden)]
5370 pub fn _decode_depth(
5371 buf: &'a [u8],
5372 depth: u32,
5373 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5374 let mut view = Self::default();
5375 view._merge_into_view(buf, depth)?;
5376 ::core::result::Result::Ok(view)
5377 }
5378 #[doc(hidden)]
5386 pub fn _merge_into_view(
5387 &mut self,
5388 buf: &'a [u8],
5389 depth: u32,
5390 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5391 let _ = depth;
5392 #[allow(unused_variables)]
5393 let view = self;
5394 let mut cur: &'a [u8] = buf;
5395 while !cur.is_empty() {
5396 let before_tag = cur;
5397 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
5398 match tag.field_number() {
5399 1u32 => {
5400 if tag.wire_type()
5401 != ::buffa::encoding::WireType::LengthDelimited
5402 {
5403 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5404 field_number: 1u32,
5405 expected: 2u8,
5406 actual: tag.wire_type() as u8,
5407 });
5408 }
5409 view.on_securable_type = ::buffa::types::borrow_str(
5410 &mut cur,
5411 )?;
5412 }
5413 2u32 => {
5414 if tag.wire_type()
5415 != ::buffa::encoding::WireType::LengthDelimited
5416 {
5417 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5418 field_number: 2u32,
5419 expected: 2u8,
5420 actual: tag.wire_type() as u8,
5421 });
5422 }
5423 view.on_securable_fullname = ::buffa::types::borrow_str(
5424 &mut cur,
5425 )?;
5426 }
5427 3u32 => {
5428 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
5429 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5430 field_number: 3u32,
5431 expected: 0u8,
5432 actual: tag.wire_type() as u8,
5433 });
5434 }
5435 view.include_inherited = Some(
5436 ::buffa::types::decode_bool(&mut cur)?,
5437 );
5438 }
5439 4u32 => {
5440 if tag.wire_type() != ::buffa::encoding::WireType::Varint {
5441 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5442 field_number: 4u32,
5443 expected: 0u8,
5444 actual: tag.wire_type() as u8,
5445 });
5446 }
5447 view.max_results = Some(
5448 ::buffa::types::decode_int32(&mut cur)?,
5449 );
5450 }
5451 5u32 => {
5452 if tag.wire_type()
5453 != ::buffa::encoding::WireType::LengthDelimited
5454 {
5455 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5456 field_number: 5u32,
5457 expected: 2u8,
5458 actual: tag.wire_type() as u8,
5459 });
5460 }
5461 view.page_token = Some(
5462 ::buffa::types::borrow_str(&mut cur)?,
5463 );
5464 }
5465 _ => {
5466 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
5467 let span_len = before_tag.len() - cur.len();
5468 view.__buffa_unknown_fields
5469 .push_raw(&before_tag[..span_len]);
5470 }
5471 }
5472 }
5473 ::core::result::Result::Ok(())
5474 }
5475 }
5476 impl<'a> ::buffa::MessageView<'a> for ListPoliciesRequestView<'a> {
5477 type Owned = super::super::ListPoliciesRequest;
5478 fn decode_view(
5479 buf: &'a [u8],
5480 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5481 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
5482 }
5483 fn decode_view_with_limit(
5484 buf: &'a [u8],
5485 depth: u32,
5486 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5487 Self::_decode_depth(buf, depth)
5488 }
5489 fn to_owned_message(&self) -> super::super::ListPoliciesRequest {
5490 self.to_owned_from_source(None)
5491 }
5492 #[allow(clippy::useless_conversion, clippy::needless_update)]
5493 fn to_owned_from_source(
5494 &self,
5495 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
5496 ) -> super::super::ListPoliciesRequest {
5497 #[allow(unused_imports)]
5498 use ::buffa::alloc::string::ToString as _;
5499 let _ = __buffa_src;
5500 super::super::ListPoliciesRequest {
5501 on_securable_type: self.on_securable_type.to_string(),
5502 on_securable_fullname: self.on_securable_fullname.to_string(),
5503 include_inherited: self.include_inherited,
5504 max_results: self.max_results,
5505 page_token: self.page_token.map(|s| s.to_string()),
5506 __buffa_unknown_fields: self
5507 .__buffa_unknown_fields
5508 .to_owned()
5509 .unwrap_or_default()
5510 .into(),
5511 ..::core::default::Default::default()
5512 }
5513 }
5514 }
5515 impl<'a> ::buffa::ViewEncode<'a> for ListPoliciesRequestView<'a> {
5516 #[allow(clippy::needless_borrow, clippy::let_and_return)]
5517 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
5518 #[allow(unused_imports)]
5519 use ::buffa::Enumeration as _;
5520 let mut size = 0u32;
5521 if !self.on_securable_type.is_empty() {
5522 size
5523 += 1u32
5524 + ::buffa::types::string_encoded_len(&self.on_securable_type)
5525 as u32;
5526 }
5527 if !self.on_securable_fullname.is_empty() {
5528 size
5529 += 1u32
5530 + ::buffa::types::string_encoded_len(
5531 &self.on_securable_fullname,
5532 ) as u32;
5533 }
5534 if self.include_inherited.is_some() {
5535 size += 1u32 + ::buffa::types::BOOL_ENCODED_LEN as u32;
5536 }
5537 if let Some(v) = self.max_results {
5538 size += 1u32 + ::buffa::types::int32_encoded_len(v) as u32;
5539 }
5540 if let Some(ref v) = self.page_token {
5541 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
5542 }
5543 size += self.__buffa_unknown_fields.encoded_len() as u32;
5544 size
5545 }
5546 #[allow(clippy::needless_borrow)]
5547 fn write_to(
5548 &self,
5549 _cache: &mut ::buffa::SizeCache,
5550 buf: &mut impl ::buffa::bytes::BufMut,
5551 ) {
5552 #[allow(unused_imports)]
5553 use ::buffa::Enumeration as _;
5554 if !self.on_securable_type.is_empty() {
5555 ::buffa::encoding::Tag::new(
5556 1u32,
5557 ::buffa::encoding::WireType::LengthDelimited,
5558 )
5559 .encode(buf);
5560 ::buffa::types::encode_string(&self.on_securable_type, buf);
5561 }
5562 if !self.on_securable_fullname.is_empty() {
5563 ::buffa::encoding::Tag::new(
5564 2u32,
5565 ::buffa::encoding::WireType::LengthDelimited,
5566 )
5567 .encode(buf);
5568 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
5569 }
5570 if let Some(v) = self.include_inherited {
5571 ::buffa::encoding::Tag::new(
5572 3u32,
5573 ::buffa::encoding::WireType::Varint,
5574 )
5575 .encode(buf);
5576 ::buffa::types::encode_bool(v, buf);
5577 }
5578 if let Some(v) = self.max_results {
5579 ::buffa::encoding::Tag::new(
5580 4u32,
5581 ::buffa::encoding::WireType::Varint,
5582 )
5583 .encode(buf);
5584 ::buffa::types::encode_int32(v, buf);
5585 }
5586 if let Some(ref v) = self.page_token {
5587 ::buffa::encoding::Tag::new(
5588 5u32,
5589 ::buffa::encoding::WireType::LengthDelimited,
5590 )
5591 .encode(buf);
5592 ::buffa::types::encode_string(v, buf);
5593 }
5594 self.__buffa_unknown_fields.write_to(buf);
5595 }
5596 }
5597 impl<'__a> ::serde::Serialize for ListPoliciesRequestView<'__a> {
5609 fn serialize<__S: ::serde::Serializer>(
5610 &self,
5611 __s: __S,
5612 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5613 use ::serde::ser::SerializeMap as _;
5614 let mut __map = __s.serialize_map(::core::option::Option::None)?;
5615 if !::buffa::json_helpers::skip_if::is_empty_str(
5616 self.on_securable_type,
5617 ) {
5618 __map.serialize_entry("on_securable_type", self.on_securable_type)?;
5619 }
5620 if !::buffa::json_helpers::skip_if::is_empty_str(
5621 self.on_securable_fullname,
5622 ) {
5623 __map
5624 .serialize_entry(
5625 "onSecurableFullname",
5626 self.on_securable_fullname,
5627 )?;
5628 }
5629 if let ::core::option::Option::Some(__v) = self.include_inherited {
5630 __map.serialize_entry("include_inherited", &__v)?;
5631 }
5632 if let ::core::option::Option::Some(__v) = self.max_results {
5633 struct _W(i32);
5634 impl ::serde::Serialize for _W {
5635 fn serialize<__S: ::serde::Serializer>(
5636 &self,
5637 __s: __S,
5638 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5639 ::buffa::json_helpers::int32::serialize(&self.0, __s)
5640 }
5641 }
5642 __map.serialize_entry("max_results", &_W(__v))?;
5643 }
5644 if let ::core::option::Option::Some(__v) = self.page_token {
5645 __map.serialize_entry("page_token", __v)?;
5646 }
5647 __map.end()
5648 }
5649 }
5650 impl<'a> ::buffa::MessageName for ListPoliciesRequestView<'a> {
5651 const PACKAGE: &'static str = "unitycatalog.policies.v1";
5652 const NAME: &'static str = "ListPoliciesRequest";
5653 const FULL_NAME: &'static str = "unitycatalog.policies.v1.ListPoliciesRequest";
5654 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesRequest";
5655 }
5656 impl<'v> ::buffa::DefaultViewInstance for ListPoliciesRequestView<'v> {
5657 fn default_view_instance<'a>() -> &'a Self
5658 where
5659 Self: 'a,
5660 {
5661 static VALUE: ::buffa::__private::OnceBox<
5662 ListPoliciesRequestView<'static>,
5663 > = ::buffa::__private::OnceBox::new();
5664 VALUE
5665 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
5666 <ListPoliciesRequestView<'static>>::default(),
5667 ))
5668 }
5669 }
5670 impl ::buffa::ViewReborrow for ListPoliciesRequestView<'static> {
5671 type Reborrowed<'b> = ListPoliciesRequestView<'b>;
5672 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
5673 this
5674 }
5675 }
5676 #[derive(Clone, Debug)]
5682 pub struct ListPoliciesRequestOwnedView(
5683 ::buffa::OwnedView<ListPoliciesRequestView<'static>>,
5684 );
5685 impl ListPoliciesRequestOwnedView {
5686 pub fn decode(
5696 bytes: ::buffa::bytes::Bytes,
5697 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5698 ::core::result::Result::Ok(
5699 ListPoliciesRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
5700 )
5701 }
5702 pub fn decode_with_options(
5710 bytes: ::buffa::bytes::Bytes,
5711 opts: &::buffa::DecodeOptions,
5712 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5713 ::core::result::Result::Ok(
5714 ListPoliciesRequestOwnedView(
5715 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
5716 ),
5717 )
5718 }
5719 pub fn from_owned(
5726 msg: &super::super::ListPoliciesRequest,
5727 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5728 ::core::result::Result::Ok(
5729 ListPoliciesRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
5730 )
5731 }
5732 #[must_use]
5734 pub fn view(&self) -> &ListPoliciesRequestView<'_> {
5735 self.0.reborrow()
5736 }
5737 #[must_use]
5739 pub fn to_owned_message(&self) -> super::super::ListPoliciesRequest {
5740 self.0.to_owned_message()
5741 }
5742 #[must_use]
5744 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
5745 self.0.bytes()
5746 }
5747 #[must_use]
5749 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
5750 self.0.into_bytes()
5751 }
5752 #[must_use]
5758 pub fn on_securable_type(&self) -> &'_ str {
5759 self.0.reborrow().on_securable_type
5760 }
5761 #[must_use]
5765 pub fn on_securable_fullname(&self) -> &'_ str {
5766 self.0.reborrow().on_securable_fullname
5767 }
5768 #[must_use]
5775 pub fn include_inherited(&self) -> ::core::option::Option<bool> {
5776 self.0.reborrow().include_inherited
5777 }
5778 #[must_use]
5782 pub fn max_results(&self) -> ::core::option::Option<i32> {
5783 self.0.reborrow().max_results
5784 }
5785 #[must_use]
5789 pub fn page_token(&self) -> ::core::option::Option<&'_ str> {
5790 self.0.reborrow().page_token
5791 }
5792 }
5793 impl ::core::convert::From<::buffa::OwnedView<ListPoliciesRequestView<'static>>>
5794 for ListPoliciesRequestOwnedView {
5795 fn from(
5796 inner: ::buffa::OwnedView<ListPoliciesRequestView<'static>>,
5797 ) -> Self {
5798 ListPoliciesRequestOwnedView(inner)
5799 }
5800 }
5801 impl ::core::convert::From<ListPoliciesRequestOwnedView>
5802 for ::buffa::OwnedView<ListPoliciesRequestView<'static>> {
5803 fn from(wrapper: ListPoliciesRequestOwnedView) -> Self {
5804 wrapper.0
5805 }
5806 }
5807 impl ::core::convert::AsRef<::buffa::OwnedView<ListPoliciesRequestView<'static>>>
5808 for ListPoliciesRequestOwnedView {
5809 fn as_ref(&self) -> &::buffa::OwnedView<ListPoliciesRequestView<'static>> {
5810 &self.0
5811 }
5812 }
5813 impl ::buffa::HasMessageView for super::super::ListPoliciesRequest {
5814 type View<'a> = ListPoliciesRequestView<'a>;
5815 type ViewHandle = ListPoliciesRequestOwnedView;
5816 }
5817 impl ::serde::Serialize for ListPoliciesRequestOwnedView {
5818 fn serialize<__S: ::serde::Serializer>(
5819 &self,
5820 __s: __S,
5821 ) -> ::core::result::Result<__S::Ok, __S::Error> {
5822 ::serde::Serialize::serialize(&self.0, __s)
5823 }
5824 }
5825 #[derive(Clone, Debug, Default)]
5827 pub struct ListPoliciesResponseView<'a> {
5828 pub policies: ::buffa::RepeatedView<
5832 'a,
5833 super::super::__buffa::view::PolicyInfoView<'a>,
5834 >,
5835 pub next_page_token: ::core::option::Option<&'a str>,
5839 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
5840 }
5841 impl<'a> ListPoliciesResponseView<'a> {
5842 #[doc(hidden)]
5850 pub fn _decode_depth(
5851 buf: &'a [u8],
5852 depth: u32,
5853 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5854 let mut view = Self::default();
5855 view._merge_into_view(buf, depth)?;
5856 ::core::result::Result::Ok(view)
5857 }
5858 #[doc(hidden)]
5866 pub fn _merge_into_view(
5867 &mut self,
5868 buf: &'a [u8],
5869 depth: u32,
5870 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
5871 let _ = depth;
5872 #[allow(unused_variables)]
5873 let view = self;
5874 let mut cur: &'a [u8] = buf;
5875 while !cur.is_empty() {
5876 let before_tag = cur;
5877 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
5878 match tag.field_number() {
5879 2u32 => {
5880 if tag.wire_type()
5881 != ::buffa::encoding::WireType::LengthDelimited
5882 {
5883 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5884 field_number: 2u32,
5885 expected: 2u8,
5886 actual: tag.wire_type() as u8,
5887 });
5888 }
5889 view.next_page_token = Some(
5890 ::buffa::types::borrow_str(&mut cur)?,
5891 );
5892 }
5893 1u32 => {
5894 if tag.wire_type()
5895 != ::buffa::encoding::WireType::LengthDelimited
5896 {
5897 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
5898 field_number: 1u32,
5899 expected: 2u8,
5900 actual: tag.wire_type() as u8,
5901 });
5902 }
5903 if depth == 0 {
5904 return Err(::buffa::DecodeError::RecursionLimitExceeded);
5905 }
5906 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
5907 view.policies
5908 .push(
5909 super::super::__buffa::view::PolicyInfoView::_decode_depth(
5910 sub,
5911 depth - 1,
5912 )?,
5913 );
5914 }
5915 _ => {
5916 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
5917 let span_len = before_tag.len() - cur.len();
5918 view.__buffa_unknown_fields
5919 .push_raw(&before_tag[..span_len]);
5920 }
5921 }
5922 }
5923 ::core::result::Result::Ok(())
5924 }
5925 }
5926 impl<'a> ::buffa::MessageView<'a> for ListPoliciesResponseView<'a> {
5927 type Owned = super::super::ListPoliciesResponse;
5928 fn decode_view(
5929 buf: &'a [u8],
5930 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5931 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
5932 }
5933 fn decode_view_with_limit(
5934 buf: &'a [u8],
5935 depth: u32,
5936 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
5937 Self::_decode_depth(buf, depth)
5938 }
5939 fn to_owned_message(&self) -> super::super::ListPoliciesResponse {
5940 self.to_owned_from_source(None)
5941 }
5942 #[allow(clippy::useless_conversion, clippy::needless_update)]
5943 fn to_owned_from_source(
5944 &self,
5945 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
5946 ) -> super::super::ListPoliciesResponse {
5947 #[allow(unused_imports)]
5948 use ::buffa::alloc::string::ToString as _;
5949 let _ = __buffa_src;
5950 super::super::ListPoliciesResponse {
5951 policies: self
5952 .policies
5953 .iter()
5954 .map(|v| v.to_owned_from_source(__buffa_src))
5955 .collect(),
5956 next_page_token: self.next_page_token.map(|s| s.to_string()),
5957 __buffa_unknown_fields: self
5958 .__buffa_unknown_fields
5959 .to_owned()
5960 .unwrap_or_default()
5961 .into(),
5962 ..::core::default::Default::default()
5963 }
5964 }
5965 }
5966 impl<'a> ::buffa::ViewEncode<'a> for ListPoliciesResponseView<'a> {
5967 #[allow(clippy::needless_borrow, clippy::let_and_return)]
5968 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
5969 #[allow(unused_imports)]
5970 use ::buffa::Enumeration as _;
5971 let mut size = 0u32;
5972 for v in &self.policies {
5973 let __slot = __cache.reserve();
5974 let inner_size = v.compute_size(__cache);
5975 __cache.set(__slot, inner_size);
5976 size
5977 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
5978 + inner_size;
5979 }
5980 if let Some(ref v) = self.next_page_token {
5981 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
5982 }
5983 size += self.__buffa_unknown_fields.encoded_len() as u32;
5984 size
5985 }
5986 #[allow(clippy::needless_borrow)]
5987 fn write_to(
5988 &self,
5989 __cache: &mut ::buffa::SizeCache,
5990 buf: &mut impl ::buffa::bytes::BufMut,
5991 ) {
5992 #[allow(unused_imports)]
5993 use ::buffa::Enumeration as _;
5994 for v in &self.policies {
5995 ::buffa::encoding::Tag::new(
5996 1u32,
5997 ::buffa::encoding::WireType::LengthDelimited,
5998 )
5999 .encode(buf);
6000 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
6001 v.write_to(__cache, buf);
6002 }
6003 if let Some(ref v) = self.next_page_token {
6004 ::buffa::encoding::Tag::new(
6005 2u32,
6006 ::buffa::encoding::WireType::LengthDelimited,
6007 )
6008 .encode(buf);
6009 ::buffa::types::encode_string(v, buf);
6010 }
6011 self.__buffa_unknown_fields.write_to(buf);
6012 }
6013 }
6014 impl<'__a> ::serde::Serialize for ListPoliciesResponseView<'__a> {
6026 fn serialize<__S: ::serde::Serializer>(
6027 &self,
6028 __s: __S,
6029 ) -> ::core::result::Result<__S::Ok, __S::Error> {
6030 use ::serde::ser::SerializeMap as _;
6031 let mut __map = __s.serialize_map(::core::option::Option::None)?;
6032 if !self.policies.is_empty() {
6033 __map.serialize_entry("policies", &*self.policies)?;
6034 }
6035 if let ::core::option::Option::Some(__v) = self.next_page_token {
6036 __map.serialize_entry("next_page_token", __v)?;
6037 }
6038 __map.end()
6039 }
6040 }
6041 impl<'a> ::buffa::MessageName for ListPoliciesResponseView<'a> {
6042 const PACKAGE: &'static str = "unitycatalog.policies.v1";
6043 const NAME: &'static str = "ListPoliciesResponse";
6044 const FULL_NAME: &'static str = "unitycatalog.policies.v1.ListPoliciesResponse";
6045 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.ListPoliciesResponse";
6046 }
6047 impl<'v> ::buffa::DefaultViewInstance for ListPoliciesResponseView<'v> {
6048 fn default_view_instance<'a>() -> &'a Self
6049 where
6050 Self: 'a,
6051 {
6052 static VALUE: ::buffa::__private::OnceBox<
6053 ListPoliciesResponseView<'static>,
6054 > = ::buffa::__private::OnceBox::new();
6055 VALUE
6056 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
6057 <ListPoliciesResponseView<'static>>::default(),
6058 ))
6059 }
6060 }
6061 impl ::buffa::ViewReborrow for ListPoliciesResponseView<'static> {
6062 type Reborrowed<'b> = ListPoliciesResponseView<'b>;
6063 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
6064 this
6065 }
6066 }
6067 #[derive(Clone, Debug)]
6073 pub struct ListPoliciesResponseOwnedView(
6074 ::buffa::OwnedView<ListPoliciesResponseView<'static>>,
6075 );
6076 impl ListPoliciesResponseOwnedView {
6077 pub fn decode(
6087 bytes: ::buffa::bytes::Bytes,
6088 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6089 ::core::result::Result::Ok(
6090 ListPoliciesResponseOwnedView(::buffa::OwnedView::decode(bytes)?),
6091 )
6092 }
6093 pub fn decode_with_options(
6101 bytes: ::buffa::bytes::Bytes,
6102 opts: &::buffa::DecodeOptions,
6103 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6104 ::core::result::Result::Ok(
6105 ListPoliciesResponseOwnedView(
6106 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
6107 ),
6108 )
6109 }
6110 pub fn from_owned(
6117 msg: &super::super::ListPoliciesResponse,
6118 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6119 ::core::result::Result::Ok(
6120 ListPoliciesResponseOwnedView(::buffa::OwnedView::from_owned(msg)?),
6121 )
6122 }
6123 #[must_use]
6125 pub fn view(&self) -> &ListPoliciesResponseView<'_> {
6126 self.0.reborrow()
6127 }
6128 #[must_use]
6130 pub fn to_owned_message(&self) -> super::super::ListPoliciesResponse {
6131 self.0.to_owned_message()
6132 }
6133 #[must_use]
6135 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
6136 self.0.bytes()
6137 }
6138 #[must_use]
6140 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
6141 self.0.into_bytes()
6142 }
6143 #[must_use]
6147 pub fn policies(
6148 &self,
6149 ) -> &::buffa::RepeatedView<
6150 '_,
6151 super::super::__buffa::view::PolicyInfoView<'_>,
6152 > {
6153 &self.0.reborrow().policies
6154 }
6155 #[must_use]
6159 pub fn next_page_token(&self) -> ::core::option::Option<&'_ str> {
6160 self.0.reborrow().next_page_token
6161 }
6162 }
6163 impl ::core::convert::From<::buffa::OwnedView<ListPoliciesResponseView<'static>>>
6164 for ListPoliciesResponseOwnedView {
6165 fn from(
6166 inner: ::buffa::OwnedView<ListPoliciesResponseView<'static>>,
6167 ) -> Self {
6168 ListPoliciesResponseOwnedView(inner)
6169 }
6170 }
6171 impl ::core::convert::From<ListPoliciesResponseOwnedView>
6172 for ::buffa::OwnedView<ListPoliciesResponseView<'static>> {
6173 fn from(wrapper: ListPoliciesResponseOwnedView) -> Self {
6174 wrapper.0
6175 }
6176 }
6177 impl ::core::convert::AsRef<
6178 ::buffa::OwnedView<ListPoliciesResponseView<'static>>,
6179 > for ListPoliciesResponseOwnedView {
6180 fn as_ref(&self) -> &::buffa::OwnedView<ListPoliciesResponseView<'static>> {
6181 &self.0
6182 }
6183 }
6184 impl ::buffa::HasMessageView for super::super::ListPoliciesResponse {
6185 type View<'a> = ListPoliciesResponseView<'a>;
6186 type ViewHandle = ListPoliciesResponseOwnedView;
6187 }
6188 impl ::serde::Serialize for ListPoliciesResponseOwnedView {
6189 fn serialize<__S: ::serde::Serializer>(
6190 &self,
6191 __s: __S,
6192 ) -> ::core::result::Result<__S::Ok, __S::Error> {
6193 ::serde::Serialize::serialize(&self.0, __s)
6194 }
6195 }
6196 #[derive(Clone, Debug, Default)]
6198 pub struct CreatePolicyRequestView<'a> {
6199 pub on_securable_type: &'a str,
6205 pub on_securable_fullname: &'a str,
6209 pub policy_info: ::buffa::MessageFieldView<
6213 super::super::__buffa::view::PolicyInfoView<'a>,
6214 >,
6215 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
6216 }
6217 impl<'a> CreatePolicyRequestView<'a> {
6218 #[doc(hidden)]
6226 pub fn _decode_depth(
6227 buf: &'a [u8],
6228 depth: u32,
6229 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6230 let mut view = Self::default();
6231 view._merge_into_view(buf, depth)?;
6232 ::core::result::Result::Ok(view)
6233 }
6234 #[doc(hidden)]
6242 pub fn _merge_into_view(
6243 &mut self,
6244 buf: &'a [u8],
6245 depth: u32,
6246 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6247 let _ = depth;
6248 #[allow(unused_variables)]
6249 let view = self;
6250 let mut cur: &'a [u8] = buf;
6251 while !cur.is_empty() {
6252 let before_tag = cur;
6253 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
6254 match tag.field_number() {
6255 1u32 => {
6256 if tag.wire_type()
6257 != ::buffa::encoding::WireType::LengthDelimited
6258 {
6259 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6260 field_number: 1u32,
6261 expected: 2u8,
6262 actual: tag.wire_type() as u8,
6263 });
6264 }
6265 view.on_securable_type = ::buffa::types::borrow_str(
6266 &mut cur,
6267 )?;
6268 }
6269 2u32 => {
6270 if tag.wire_type()
6271 != ::buffa::encoding::WireType::LengthDelimited
6272 {
6273 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6274 field_number: 2u32,
6275 expected: 2u8,
6276 actual: tag.wire_type() as u8,
6277 });
6278 }
6279 view.on_securable_fullname = ::buffa::types::borrow_str(
6280 &mut cur,
6281 )?;
6282 }
6283 3u32 => {
6284 if tag.wire_type()
6285 != ::buffa::encoding::WireType::LengthDelimited
6286 {
6287 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6288 field_number: 3u32,
6289 expected: 2u8,
6290 actual: tag.wire_type() as u8,
6291 });
6292 }
6293 if depth == 0 {
6294 return Err(::buffa::DecodeError::RecursionLimitExceeded);
6295 }
6296 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
6297 match view.policy_info.as_mut() {
6298 Some(existing) => existing._merge_into_view(sub, depth - 1)?,
6299 None => {
6300 view.policy_info = ::buffa::MessageFieldView::set(
6301 super::super::__buffa::view::PolicyInfoView::_decode_depth(
6302 sub,
6303 depth - 1,
6304 )?,
6305 );
6306 }
6307 }
6308 }
6309 _ => {
6310 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
6311 let span_len = before_tag.len() - cur.len();
6312 view.__buffa_unknown_fields
6313 .push_raw(&before_tag[..span_len]);
6314 }
6315 }
6316 }
6317 ::core::result::Result::Ok(())
6318 }
6319 }
6320 impl<'a> ::buffa::MessageView<'a> for CreatePolicyRequestView<'a> {
6321 type Owned = super::super::CreatePolicyRequest;
6322 fn decode_view(
6323 buf: &'a [u8],
6324 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6325 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
6326 }
6327 fn decode_view_with_limit(
6328 buf: &'a [u8],
6329 depth: u32,
6330 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6331 Self::_decode_depth(buf, depth)
6332 }
6333 fn to_owned_message(&self) -> super::super::CreatePolicyRequest {
6334 self.to_owned_from_source(None)
6335 }
6336 #[allow(clippy::useless_conversion, clippy::needless_update)]
6337 fn to_owned_from_source(
6338 &self,
6339 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
6340 ) -> super::super::CreatePolicyRequest {
6341 #[allow(unused_imports)]
6342 use ::buffa::alloc::string::ToString as _;
6343 let _ = __buffa_src;
6344 super::super::CreatePolicyRequest {
6345 on_securable_type: self.on_securable_type.to_string(),
6346 on_securable_fullname: self.on_securable_fullname.to_string(),
6347 policy_info: match self.policy_info.as_option() {
6348 Some(v) => {
6349 ::buffa::MessageField::<
6350 super::super::PolicyInfo,
6351 >::some(v.to_owned_from_source(__buffa_src))
6352 }
6353 None => ::buffa::MessageField::none(),
6354 },
6355 __buffa_unknown_fields: self
6356 .__buffa_unknown_fields
6357 .to_owned()
6358 .unwrap_or_default()
6359 .into(),
6360 ..::core::default::Default::default()
6361 }
6362 }
6363 }
6364 impl<'a> ::buffa::ViewEncode<'a> for CreatePolicyRequestView<'a> {
6365 #[allow(clippy::needless_borrow, clippy::let_and_return)]
6366 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
6367 #[allow(unused_imports)]
6368 use ::buffa::Enumeration as _;
6369 let mut size = 0u32;
6370 if !self.on_securable_type.is_empty() {
6371 size
6372 += 1u32
6373 + ::buffa::types::string_encoded_len(&self.on_securable_type)
6374 as u32;
6375 }
6376 if !self.on_securable_fullname.is_empty() {
6377 size
6378 += 1u32
6379 + ::buffa::types::string_encoded_len(
6380 &self.on_securable_fullname,
6381 ) as u32;
6382 }
6383 if self.policy_info.is_set() {
6384 let __slot = __cache.reserve();
6385 let inner_size = self.policy_info.compute_size(__cache);
6386 __cache.set(__slot, inner_size);
6387 size
6388 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
6389 + inner_size;
6390 }
6391 size += self.__buffa_unknown_fields.encoded_len() as u32;
6392 size
6393 }
6394 #[allow(clippy::needless_borrow)]
6395 fn write_to(
6396 &self,
6397 __cache: &mut ::buffa::SizeCache,
6398 buf: &mut impl ::buffa::bytes::BufMut,
6399 ) {
6400 #[allow(unused_imports)]
6401 use ::buffa::Enumeration as _;
6402 if !self.on_securable_type.is_empty() {
6403 ::buffa::encoding::Tag::new(
6404 1u32,
6405 ::buffa::encoding::WireType::LengthDelimited,
6406 )
6407 .encode(buf);
6408 ::buffa::types::encode_string(&self.on_securable_type, buf);
6409 }
6410 if !self.on_securable_fullname.is_empty() {
6411 ::buffa::encoding::Tag::new(
6412 2u32,
6413 ::buffa::encoding::WireType::LengthDelimited,
6414 )
6415 .encode(buf);
6416 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
6417 }
6418 if self.policy_info.is_set() {
6419 ::buffa::encoding::Tag::new(
6420 3u32,
6421 ::buffa::encoding::WireType::LengthDelimited,
6422 )
6423 .encode(buf);
6424 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
6425 self.policy_info.write_to(__cache, buf);
6426 }
6427 self.__buffa_unknown_fields.write_to(buf);
6428 }
6429 }
6430 impl<'__a> ::serde::Serialize for CreatePolicyRequestView<'__a> {
6442 fn serialize<__S: ::serde::Serializer>(
6443 &self,
6444 __s: __S,
6445 ) -> ::core::result::Result<__S::Ok, __S::Error> {
6446 use ::serde::ser::SerializeMap as _;
6447 let mut __map = __s.serialize_map(::core::option::Option::None)?;
6448 if !::buffa::json_helpers::skip_if::is_empty_str(
6449 self.on_securable_type,
6450 ) {
6451 __map.serialize_entry("on_securable_type", self.on_securable_type)?;
6452 }
6453 if !::buffa::json_helpers::skip_if::is_empty_str(
6454 self.on_securable_fullname,
6455 ) {
6456 __map
6457 .serialize_entry(
6458 "onSecurableFullname",
6459 self.on_securable_fullname,
6460 )?;
6461 }
6462 {
6463 if let ::core::option::Option::Some(__v) = self
6464 .policy_info
6465 .as_option()
6466 {
6467 __map.serialize_entry("policy_info", __v)?;
6468 }
6469 }
6470 __map.end()
6471 }
6472 }
6473 impl<'a> ::buffa::MessageName for CreatePolicyRequestView<'a> {
6474 const PACKAGE: &'static str = "unitycatalog.policies.v1";
6475 const NAME: &'static str = "CreatePolicyRequest";
6476 const FULL_NAME: &'static str = "unitycatalog.policies.v1.CreatePolicyRequest";
6477 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.CreatePolicyRequest";
6478 }
6479 impl<'v> ::buffa::DefaultViewInstance for CreatePolicyRequestView<'v> {
6480 fn default_view_instance<'a>() -> &'a Self
6481 where
6482 Self: 'a,
6483 {
6484 static VALUE: ::buffa::__private::OnceBox<
6485 CreatePolicyRequestView<'static>,
6486 > = ::buffa::__private::OnceBox::new();
6487 VALUE
6488 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
6489 <CreatePolicyRequestView<'static>>::default(),
6490 ))
6491 }
6492 }
6493 impl ::buffa::ViewReborrow for CreatePolicyRequestView<'static> {
6494 type Reborrowed<'b> = CreatePolicyRequestView<'b>;
6495 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
6496 this
6497 }
6498 }
6499 #[derive(Clone, Debug)]
6505 pub struct CreatePolicyRequestOwnedView(
6506 ::buffa::OwnedView<CreatePolicyRequestView<'static>>,
6507 );
6508 impl CreatePolicyRequestOwnedView {
6509 pub fn decode(
6519 bytes: ::buffa::bytes::Bytes,
6520 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6521 ::core::result::Result::Ok(
6522 CreatePolicyRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
6523 )
6524 }
6525 pub fn decode_with_options(
6533 bytes: ::buffa::bytes::Bytes,
6534 opts: &::buffa::DecodeOptions,
6535 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6536 ::core::result::Result::Ok(
6537 CreatePolicyRequestOwnedView(
6538 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
6539 ),
6540 )
6541 }
6542 pub fn from_owned(
6549 msg: &super::super::CreatePolicyRequest,
6550 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6551 ::core::result::Result::Ok(
6552 CreatePolicyRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
6553 )
6554 }
6555 #[must_use]
6557 pub fn view(&self) -> &CreatePolicyRequestView<'_> {
6558 self.0.reborrow()
6559 }
6560 #[must_use]
6562 pub fn to_owned_message(&self) -> super::super::CreatePolicyRequest {
6563 self.0.to_owned_message()
6564 }
6565 #[must_use]
6567 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
6568 self.0.bytes()
6569 }
6570 #[must_use]
6572 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
6573 self.0.into_bytes()
6574 }
6575 #[must_use]
6581 pub fn on_securable_type(&self) -> &'_ str {
6582 self.0.reborrow().on_securable_type
6583 }
6584 #[must_use]
6588 pub fn on_securable_fullname(&self) -> &'_ str {
6589 self.0.reborrow().on_securable_fullname
6590 }
6591 #[must_use]
6595 pub fn policy_info(
6596 &self,
6597 ) -> &::buffa::MessageFieldView<
6598 super::super::__buffa::view::PolicyInfoView<'_>,
6599 > {
6600 &self.0.reborrow().policy_info
6601 }
6602 }
6603 impl ::core::convert::From<::buffa::OwnedView<CreatePolicyRequestView<'static>>>
6604 for CreatePolicyRequestOwnedView {
6605 fn from(
6606 inner: ::buffa::OwnedView<CreatePolicyRequestView<'static>>,
6607 ) -> Self {
6608 CreatePolicyRequestOwnedView(inner)
6609 }
6610 }
6611 impl ::core::convert::From<CreatePolicyRequestOwnedView>
6612 for ::buffa::OwnedView<CreatePolicyRequestView<'static>> {
6613 fn from(wrapper: CreatePolicyRequestOwnedView) -> Self {
6614 wrapper.0
6615 }
6616 }
6617 impl ::core::convert::AsRef<::buffa::OwnedView<CreatePolicyRequestView<'static>>>
6618 for CreatePolicyRequestOwnedView {
6619 fn as_ref(&self) -> &::buffa::OwnedView<CreatePolicyRequestView<'static>> {
6620 &self.0
6621 }
6622 }
6623 impl ::buffa::HasMessageView for super::super::CreatePolicyRequest {
6624 type View<'a> = CreatePolicyRequestView<'a>;
6625 type ViewHandle = CreatePolicyRequestOwnedView;
6626 }
6627 impl ::serde::Serialize for CreatePolicyRequestOwnedView {
6628 fn serialize<__S: ::serde::Serializer>(
6629 &self,
6630 __s: __S,
6631 ) -> ::core::result::Result<__S::Ok, __S::Error> {
6632 ::serde::Serialize::serialize(&self.0, __s)
6633 }
6634 }
6635 #[derive(Clone, Debug, Default)]
6637 pub struct GetPolicyRequestView<'a> {
6638 pub on_securable_type: &'a str,
6644 pub on_securable_fullname: &'a str,
6648 pub name: &'a str,
6652 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
6653 }
6654 impl<'a> GetPolicyRequestView<'a> {
6655 #[doc(hidden)]
6663 pub fn _decode_depth(
6664 buf: &'a [u8],
6665 depth: u32,
6666 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6667 let mut view = Self::default();
6668 view._merge_into_view(buf, depth)?;
6669 ::core::result::Result::Ok(view)
6670 }
6671 #[doc(hidden)]
6679 pub fn _merge_into_view(
6680 &mut self,
6681 buf: &'a [u8],
6682 depth: u32,
6683 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
6684 let _ = depth;
6685 #[allow(unused_variables)]
6686 let view = self;
6687 let mut cur: &'a [u8] = buf;
6688 while !cur.is_empty() {
6689 let before_tag = cur;
6690 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
6691 match tag.field_number() {
6692 1u32 => {
6693 if tag.wire_type()
6694 != ::buffa::encoding::WireType::LengthDelimited
6695 {
6696 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6697 field_number: 1u32,
6698 expected: 2u8,
6699 actual: tag.wire_type() as u8,
6700 });
6701 }
6702 view.on_securable_type = ::buffa::types::borrow_str(
6703 &mut cur,
6704 )?;
6705 }
6706 2u32 => {
6707 if tag.wire_type()
6708 != ::buffa::encoding::WireType::LengthDelimited
6709 {
6710 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6711 field_number: 2u32,
6712 expected: 2u8,
6713 actual: tag.wire_type() as u8,
6714 });
6715 }
6716 view.on_securable_fullname = ::buffa::types::borrow_str(
6717 &mut cur,
6718 )?;
6719 }
6720 3u32 => {
6721 if tag.wire_type()
6722 != ::buffa::encoding::WireType::LengthDelimited
6723 {
6724 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
6725 field_number: 3u32,
6726 expected: 2u8,
6727 actual: tag.wire_type() as u8,
6728 });
6729 }
6730 view.name = ::buffa::types::borrow_str(&mut cur)?;
6731 }
6732 _ => {
6733 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
6734 let span_len = before_tag.len() - cur.len();
6735 view.__buffa_unknown_fields
6736 .push_raw(&before_tag[..span_len]);
6737 }
6738 }
6739 }
6740 ::core::result::Result::Ok(())
6741 }
6742 }
6743 impl<'a> ::buffa::MessageView<'a> for GetPolicyRequestView<'a> {
6744 type Owned = super::super::GetPolicyRequest;
6745 fn decode_view(
6746 buf: &'a [u8],
6747 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6748 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
6749 }
6750 fn decode_view_with_limit(
6751 buf: &'a [u8],
6752 depth: u32,
6753 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6754 Self::_decode_depth(buf, depth)
6755 }
6756 fn to_owned_message(&self) -> super::super::GetPolicyRequest {
6757 self.to_owned_from_source(None)
6758 }
6759 #[allow(clippy::useless_conversion, clippy::needless_update)]
6760 fn to_owned_from_source(
6761 &self,
6762 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
6763 ) -> super::super::GetPolicyRequest {
6764 #[allow(unused_imports)]
6765 use ::buffa::alloc::string::ToString as _;
6766 let _ = __buffa_src;
6767 super::super::GetPolicyRequest {
6768 on_securable_type: self.on_securable_type.to_string(),
6769 on_securable_fullname: self.on_securable_fullname.to_string(),
6770 name: self.name.to_string(),
6771 __buffa_unknown_fields: self
6772 .__buffa_unknown_fields
6773 .to_owned()
6774 .unwrap_or_default()
6775 .into(),
6776 ..::core::default::Default::default()
6777 }
6778 }
6779 }
6780 impl<'a> ::buffa::ViewEncode<'a> for GetPolicyRequestView<'a> {
6781 #[allow(clippy::needless_borrow, clippy::let_and_return)]
6782 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
6783 #[allow(unused_imports)]
6784 use ::buffa::Enumeration as _;
6785 let mut size = 0u32;
6786 if !self.on_securable_type.is_empty() {
6787 size
6788 += 1u32
6789 + ::buffa::types::string_encoded_len(&self.on_securable_type)
6790 as u32;
6791 }
6792 if !self.on_securable_fullname.is_empty() {
6793 size
6794 += 1u32
6795 + ::buffa::types::string_encoded_len(
6796 &self.on_securable_fullname,
6797 ) as u32;
6798 }
6799 if !self.name.is_empty() {
6800 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
6801 }
6802 size += self.__buffa_unknown_fields.encoded_len() as u32;
6803 size
6804 }
6805 #[allow(clippy::needless_borrow)]
6806 fn write_to(
6807 &self,
6808 _cache: &mut ::buffa::SizeCache,
6809 buf: &mut impl ::buffa::bytes::BufMut,
6810 ) {
6811 #[allow(unused_imports)]
6812 use ::buffa::Enumeration as _;
6813 if !self.on_securable_type.is_empty() {
6814 ::buffa::encoding::Tag::new(
6815 1u32,
6816 ::buffa::encoding::WireType::LengthDelimited,
6817 )
6818 .encode(buf);
6819 ::buffa::types::encode_string(&self.on_securable_type, buf);
6820 }
6821 if !self.on_securable_fullname.is_empty() {
6822 ::buffa::encoding::Tag::new(
6823 2u32,
6824 ::buffa::encoding::WireType::LengthDelimited,
6825 )
6826 .encode(buf);
6827 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
6828 }
6829 if !self.name.is_empty() {
6830 ::buffa::encoding::Tag::new(
6831 3u32,
6832 ::buffa::encoding::WireType::LengthDelimited,
6833 )
6834 .encode(buf);
6835 ::buffa::types::encode_string(&self.name, buf);
6836 }
6837 self.__buffa_unknown_fields.write_to(buf);
6838 }
6839 }
6840 impl<'__a> ::serde::Serialize for GetPolicyRequestView<'__a> {
6852 fn serialize<__S: ::serde::Serializer>(
6853 &self,
6854 __s: __S,
6855 ) -> ::core::result::Result<__S::Ok, __S::Error> {
6856 use ::serde::ser::SerializeMap as _;
6857 let mut __map = __s.serialize_map(::core::option::Option::None)?;
6858 if !::buffa::json_helpers::skip_if::is_empty_str(
6859 self.on_securable_type,
6860 ) {
6861 __map.serialize_entry("on_securable_type", self.on_securable_type)?;
6862 }
6863 if !::buffa::json_helpers::skip_if::is_empty_str(
6864 self.on_securable_fullname,
6865 ) {
6866 __map
6867 .serialize_entry(
6868 "onSecurableFullname",
6869 self.on_securable_fullname,
6870 )?;
6871 }
6872 if !::buffa::json_helpers::skip_if::is_empty_str(self.name) {
6873 __map.serialize_entry("name", self.name)?;
6874 }
6875 __map.end()
6876 }
6877 }
6878 impl<'a> ::buffa::MessageName for GetPolicyRequestView<'a> {
6879 const PACKAGE: &'static str = "unitycatalog.policies.v1";
6880 const NAME: &'static str = "GetPolicyRequest";
6881 const FULL_NAME: &'static str = "unitycatalog.policies.v1.GetPolicyRequest";
6882 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.GetPolicyRequest";
6883 }
6884 impl<'v> ::buffa::DefaultViewInstance for GetPolicyRequestView<'v> {
6885 fn default_view_instance<'a>() -> &'a Self
6886 where
6887 Self: 'a,
6888 {
6889 static VALUE: ::buffa::__private::OnceBox<
6890 GetPolicyRequestView<'static>,
6891 > = ::buffa::__private::OnceBox::new();
6892 VALUE
6893 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
6894 <GetPolicyRequestView<'static>>::default(),
6895 ))
6896 }
6897 }
6898 impl ::buffa::ViewReborrow for GetPolicyRequestView<'static> {
6899 type Reborrowed<'b> = GetPolicyRequestView<'b>;
6900 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
6901 this
6902 }
6903 }
6904 #[derive(Clone, Debug)]
6910 pub struct GetPolicyRequestOwnedView(
6911 ::buffa::OwnedView<GetPolicyRequestView<'static>>,
6912 );
6913 impl GetPolicyRequestOwnedView {
6914 pub fn decode(
6924 bytes: ::buffa::bytes::Bytes,
6925 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6926 ::core::result::Result::Ok(
6927 GetPolicyRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
6928 )
6929 }
6930 pub fn decode_with_options(
6938 bytes: ::buffa::bytes::Bytes,
6939 opts: &::buffa::DecodeOptions,
6940 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6941 ::core::result::Result::Ok(
6942 GetPolicyRequestOwnedView(
6943 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
6944 ),
6945 )
6946 }
6947 pub fn from_owned(
6954 msg: &super::super::GetPolicyRequest,
6955 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
6956 ::core::result::Result::Ok(
6957 GetPolicyRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
6958 )
6959 }
6960 #[must_use]
6962 pub fn view(&self) -> &GetPolicyRequestView<'_> {
6963 self.0.reborrow()
6964 }
6965 #[must_use]
6967 pub fn to_owned_message(&self) -> super::super::GetPolicyRequest {
6968 self.0.to_owned_message()
6969 }
6970 #[must_use]
6972 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
6973 self.0.bytes()
6974 }
6975 #[must_use]
6977 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
6978 self.0.into_bytes()
6979 }
6980 #[must_use]
6986 pub fn on_securable_type(&self) -> &'_ str {
6987 self.0.reborrow().on_securable_type
6988 }
6989 #[must_use]
6993 pub fn on_securable_fullname(&self) -> &'_ str {
6994 self.0.reborrow().on_securable_fullname
6995 }
6996 #[must_use]
7000 pub fn name(&self) -> &'_ str {
7001 self.0.reborrow().name
7002 }
7003 }
7004 impl ::core::convert::From<::buffa::OwnedView<GetPolicyRequestView<'static>>>
7005 for GetPolicyRequestOwnedView {
7006 fn from(inner: ::buffa::OwnedView<GetPolicyRequestView<'static>>) -> Self {
7007 GetPolicyRequestOwnedView(inner)
7008 }
7009 }
7010 impl ::core::convert::From<GetPolicyRequestOwnedView>
7011 for ::buffa::OwnedView<GetPolicyRequestView<'static>> {
7012 fn from(wrapper: GetPolicyRequestOwnedView) -> Self {
7013 wrapper.0
7014 }
7015 }
7016 impl ::core::convert::AsRef<::buffa::OwnedView<GetPolicyRequestView<'static>>>
7017 for GetPolicyRequestOwnedView {
7018 fn as_ref(&self) -> &::buffa::OwnedView<GetPolicyRequestView<'static>> {
7019 &self.0
7020 }
7021 }
7022 impl ::buffa::HasMessageView for super::super::GetPolicyRequest {
7023 type View<'a> = GetPolicyRequestView<'a>;
7024 type ViewHandle = GetPolicyRequestOwnedView;
7025 }
7026 impl ::serde::Serialize for GetPolicyRequestOwnedView {
7027 fn serialize<__S: ::serde::Serializer>(
7028 &self,
7029 __s: __S,
7030 ) -> ::core::result::Result<__S::Ok, __S::Error> {
7031 ::serde::Serialize::serialize(&self.0, __s)
7032 }
7033 }
7034 #[derive(Clone, Debug, Default)]
7036 pub struct UpdatePolicyRequestView<'a> {
7037 pub on_securable_type: &'a str,
7043 pub on_securable_fullname: &'a str,
7047 pub name: &'a str,
7051 pub policy_info: ::buffa::MessageFieldView<
7055 super::super::__buffa::view::PolicyInfoView<'a>,
7056 >,
7057 pub update_mask: ::core::option::Option<&'a str>,
7061 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
7062 }
7063 impl<'a> UpdatePolicyRequestView<'a> {
7064 #[doc(hidden)]
7072 pub fn _decode_depth(
7073 buf: &'a [u8],
7074 depth: u32,
7075 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7076 let mut view = Self::default();
7077 view._merge_into_view(buf, depth)?;
7078 ::core::result::Result::Ok(view)
7079 }
7080 #[doc(hidden)]
7088 pub fn _merge_into_view(
7089 &mut self,
7090 buf: &'a [u8],
7091 depth: u32,
7092 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7093 let _ = depth;
7094 #[allow(unused_variables)]
7095 let view = self;
7096 let mut cur: &'a [u8] = buf;
7097 while !cur.is_empty() {
7098 let before_tag = cur;
7099 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
7100 match tag.field_number() {
7101 1u32 => {
7102 if tag.wire_type()
7103 != ::buffa::encoding::WireType::LengthDelimited
7104 {
7105 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7106 field_number: 1u32,
7107 expected: 2u8,
7108 actual: tag.wire_type() as u8,
7109 });
7110 }
7111 view.on_securable_type = ::buffa::types::borrow_str(
7112 &mut cur,
7113 )?;
7114 }
7115 2u32 => {
7116 if tag.wire_type()
7117 != ::buffa::encoding::WireType::LengthDelimited
7118 {
7119 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7120 field_number: 2u32,
7121 expected: 2u8,
7122 actual: tag.wire_type() as u8,
7123 });
7124 }
7125 view.on_securable_fullname = ::buffa::types::borrow_str(
7126 &mut cur,
7127 )?;
7128 }
7129 3u32 => {
7130 if tag.wire_type()
7131 != ::buffa::encoding::WireType::LengthDelimited
7132 {
7133 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7134 field_number: 3u32,
7135 expected: 2u8,
7136 actual: tag.wire_type() as u8,
7137 });
7138 }
7139 view.name = ::buffa::types::borrow_str(&mut cur)?;
7140 }
7141 4u32 => {
7142 if tag.wire_type()
7143 != ::buffa::encoding::WireType::LengthDelimited
7144 {
7145 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7146 field_number: 4u32,
7147 expected: 2u8,
7148 actual: tag.wire_type() as u8,
7149 });
7150 }
7151 if depth == 0 {
7152 return Err(::buffa::DecodeError::RecursionLimitExceeded);
7153 }
7154 let sub = ::buffa::types::borrow_bytes(&mut cur)?;
7155 match view.policy_info.as_mut() {
7156 Some(existing) => existing._merge_into_view(sub, depth - 1)?,
7157 None => {
7158 view.policy_info = ::buffa::MessageFieldView::set(
7159 super::super::__buffa::view::PolicyInfoView::_decode_depth(
7160 sub,
7161 depth - 1,
7162 )?,
7163 );
7164 }
7165 }
7166 }
7167 5u32 => {
7168 if tag.wire_type()
7169 != ::buffa::encoding::WireType::LengthDelimited
7170 {
7171 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7172 field_number: 5u32,
7173 expected: 2u8,
7174 actual: tag.wire_type() as u8,
7175 });
7176 }
7177 view.update_mask = Some(
7178 ::buffa::types::borrow_str(&mut cur)?,
7179 );
7180 }
7181 _ => {
7182 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
7183 let span_len = before_tag.len() - cur.len();
7184 view.__buffa_unknown_fields
7185 .push_raw(&before_tag[..span_len]);
7186 }
7187 }
7188 }
7189 ::core::result::Result::Ok(())
7190 }
7191 }
7192 impl<'a> ::buffa::MessageView<'a> for UpdatePolicyRequestView<'a> {
7193 type Owned = super::super::UpdatePolicyRequest;
7194 fn decode_view(
7195 buf: &'a [u8],
7196 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7197 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
7198 }
7199 fn decode_view_with_limit(
7200 buf: &'a [u8],
7201 depth: u32,
7202 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7203 Self::_decode_depth(buf, depth)
7204 }
7205 fn to_owned_message(&self) -> super::super::UpdatePolicyRequest {
7206 self.to_owned_from_source(None)
7207 }
7208 #[allow(clippy::useless_conversion, clippy::needless_update)]
7209 fn to_owned_from_source(
7210 &self,
7211 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
7212 ) -> super::super::UpdatePolicyRequest {
7213 #[allow(unused_imports)]
7214 use ::buffa::alloc::string::ToString as _;
7215 let _ = __buffa_src;
7216 super::super::UpdatePolicyRequest {
7217 on_securable_type: self.on_securable_type.to_string(),
7218 on_securable_fullname: self.on_securable_fullname.to_string(),
7219 name: self.name.to_string(),
7220 policy_info: match self.policy_info.as_option() {
7221 Some(v) => {
7222 ::buffa::MessageField::<
7223 super::super::PolicyInfo,
7224 >::some(v.to_owned_from_source(__buffa_src))
7225 }
7226 None => ::buffa::MessageField::none(),
7227 },
7228 update_mask: self.update_mask.map(|s| s.to_string()),
7229 __buffa_unknown_fields: self
7230 .__buffa_unknown_fields
7231 .to_owned()
7232 .unwrap_or_default()
7233 .into(),
7234 ..::core::default::Default::default()
7235 }
7236 }
7237 }
7238 impl<'a> ::buffa::ViewEncode<'a> for UpdatePolicyRequestView<'a> {
7239 #[allow(clippy::needless_borrow, clippy::let_and_return)]
7240 fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
7241 #[allow(unused_imports)]
7242 use ::buffa::Enumeration as _;
7243 let mut size = 0u32;
7244 if !self.on_securable_type.is_empty() {
7245 size
7246 += 1u32
7247 + ::buffa::types::string_encoded_len(&self.on_securable_type)
7248 as u32;
7249 }
7250 if !self.on_securable_fullname.is_empty() {
7251 size
7252 += 1u32
7253 + ::buffa::types::string_encoded_len(
7254 &self.on_securable_fullname,
7255 ) as u32;
7256 }
7257 if !self.name.is_empty() {
7258 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
7259 }
7260 if self.policy_info.is_set() {
7261 let __slot = __cache.reserve();
7262 let inner_size = self.policy_info.compute_size(__cache);
7263 __cache.set(__slot, inner_size);
7264 size
7265 += 1u32 + ::buffa::encoding::varint_len(inner_size as u64) as u32
7266 + inner_size;
7267 }
7268 if let Some(ref v) = self.update_mask {
7269 size += 1u32 + ::buffa::types::string_encoded_len(v) as u32;
7270 }
7271 size += self.__buffa_unknown_fields.encoded_len() as u32;
7272 size
7273 }
7274 #[allow(clippy::needless_borrow)]
7275 fn write_to(
7276 &self,
7277 __cache: &mut ::buffa::SizeCache,
7278 buf: &mut impl ::buffa::bytes::BufMut,
7279 ) {
7280 #[allow(unused_imports)]
7281 use ::buffa::Enumeration as _;
7282 if !self.on_securable_type.is_empty() {
7283 ::buffa::encoding::Tag::new(
7284 1u32,
7285 ::buffa::encoding::WireType::LengthDelimited,
7286 )
7287 .encode(buf);
7288 ::buffa::types::encode_string(&self.on_securable_type, buf);
7289 }
7290 if !self.on_securable_fullname.is_empty() {
7291 ::buffa::encoding::Tag::new(
7292 2u32,
7293 ::buffa::encoding::WireType::LengthDelimited,
7294 )
7295 .encode(buf);
7296 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
7297 }
7298 if !self.name.is_empty() {
7299 ::buffa::encoding::Tag::new(
7300 3u32,
7301 ::buffa::encoding::WireType::LengthDelimited,
7302 )
7303 .encode(buf);
7304 ::buffa::types::encode_string(&self.name, buf);
7305 }
7306 if self.policy_info.is_set() {
7307 ::buffa::encoding::Tag::new(
7308 4u32,
7309 ::buffa::encoding::WireType::LengthDelimited,
7310 )
7311 .encode(buf);
7312 ::buffa::encoding::encode_varint(__cache.consume_next() as u64, buf);
7313 self.policy_info.write_to(__cache, buf);
7314 }
7315 if let Some(ref v) = self.update_mask {
7316 ::buffa::encoding::Tag::new(
7317 5u32,
7318 ::buffa::encoding::WireType::LengthDelimited,
7319 )
7320 .encode(buf);
7321 ::buffa::types::encode_string(v, buf);
7322 }
7323 self.__buffa_unknown_fields.write_to(buf);
7324 }
7325 }
7326 impl<'__a> ::serde::Serialize for UpdatePolicyRequestView<'__a> {
7338 fn serialize<__S: ::serde::Serializer>(
7339 &self,
7340 __s: __S,
7341 ) -> ::core::result::Result<__S::Ok, __S::Error> {
7342 use ::serde::ser::SerializeMap as _;
7343 let mut __map = __s.serialize_map(::core::option::Option::None)?;
7344 if !::buffa::json_helpers::skip_if::is_empty_str(
7345 self.on_securable_type,
7346 ) {
7347 __map.serialize_entry("on_securable_type", self.on_securable_type)?;
7348 }
7349 if !::buffa::json_helpers::skip_if::is_empty_str(
7350 self.on_securable_fullname,
7351 ) {
7352 __map
7353 .serialize_entry(
7354 "onSecurableFullname",
7355 self.on_securable_fullname,
7356 )?;
7357 }
7358 if !::buffa::json_helpers::skip_if::is_empty_str(self.name) {
7359 __map.serialize_entry("name", self.name)?;
7360 }
7361 {
7362 if let ::core::option::Option::Some(__v) = self
7363 .policy_info
7364 .as_option()
7365 {
7366 __map.serialize_entry("policy_info", __v)?;
7367 }
7368 }
7369 if let ::core::option::Option::Some(__v) = self.update_mask {
7370 __map.serialize_entry("update_mask", __v)?;
7371 }
7372 __map.end()
7373 }
7374 }
7375 impl<'a> ::buffa::MessageName for UpdatePolicyRequestView<'a> {
7376 const PACKAGE: &'static str = "unitycatalog.policies.v1";
7377 const NAME: &'static str = "UpdatePolicyRequest";
7378 const FULL_NAME: &'static str = "unitycatalog.policies.v1.UpdatePolicyRequest";
7379 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.UpdatePolicyRequest";
7380 }
7381 impl<'v> ::buffa::DefaultViewInstance for UpdatePolicyRequestView<'v> {
7382 fn default_view_instance<'a>() -> &'a Self
7383 where
7384 Self: 'a,
7385 {
7386 static VALUE: ::buffa::__private::OnceBox<
7387 UpdatePolicyRequestView<'static>,
7388 > = ::buffa::__private::OnceBox::new();
7389 VALUE
7390 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
7391 <UpdatePolicyRequestView<'static>>::default(),
7392 ))
7393 }
7394 }
7395 impl ::buffa::ViewReborrow for UpdatePolicyRequestView<'static> {
7396 type Reborrowed<'b> = UpdatePolicyRequestView<'b>;
7397 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
7398 this
7399 }
7400 }
7401 #[derive(Clone, Debug)]
7407 pub struct UpdatePolicyRequestOwnedView(
7408 ::buffa::OwnedView<UpdatePolicyRequestView<'static>>,
7409 );
7410 impl UpdatePolicyRequestOwnedView {
7411 pub fn decode(
7421 bytes: ::buffa::bytes::Bytes,
7422 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7423 ::core::result::Result::Ok(
7424 UpdatePolicyRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
7425 )
7426 }
7427 pub fn decode_with_options(
7435 bytes: ::buffa::bytes::Bytes,
7436 opts: &::buffa::DecodeOptions,
7437 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7438 ::core::result::Result::Ok(
7439 UpdatePolicyRequestOwnedView(
7440 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
7441 ),
7442 )
7443 }
7444 pub fn from_owned(
7451 msg: &super::super::UpdatePolicyRequest,
7452 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7453 ::core::result::Result::Ok(
7454 UpdatePolicyRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
7455 )
7456 }
7457 #[must_use]
7459 pub fn view(&self) -> &UpdatePolicyRequestView<'_> {
7460 self.0.reborrow()
7461 }
7462 #[must_use]
7464 pub fn to_owned_message(&self) -> super::super::UpdatePolicyRequest {
7465 self.0.to_owned_message()
7466 }
7467 #[must_use]
7469 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
7470 self.0.bytes()
7471 }
7472 #[must_use]
7474 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
7475 self.0.into_bytes()
7476 }
7477 #[must_use]
7483 pub fn on_securable_type(&self) -> &'_ str {
7484 self.0.reborrow().on_securable_type
7485 }
7486 #[must_use]
7490 pub fn on_securable_fullname(&self) -> &'_ str {
7491 self.0.reborrow().on_securable_fullname
7492 }
7493 #[must_use]
7497 pub fn name(&self) -> &'_ str {
7498 self.0.reborrow().name
7499 }
7500 #[must_use]
7504 pub fn policy_info(
7505 &self,
7506 ) -> &::buffa::MessageFieldView<
7507 super::super::__buffa::view::PolicyInfoView<'_>,
7508 > {
7509 &self.0.reborrow().policy_info
7510 }
7511 #[must_use]
7515 pub fn update_mask(&self) -> ::core::option::Option<&'_ str> {
7516 self.0.reborrow().update_mask
7517 }
7518 }
7519 impl ::core::convert::From<::buffa::OwnedView<UpdatePolicyRequestView<'static>>>
7520 for UpdatePolicyRequestOwnedView {
7521 fn from(
7522 inner: ::buffa::OwnedView<UpdatePolicyRequestView<'static>>,
7523 ) -> Self {
7524 UpdatePolicyRequestOwnedView(inner)
7525 }
7526 }
7527 impl ::core::convert::From<UpdatePolicyRequestOwnedView>
7528 for ::buffa::OwnedView<UpdatePolicyRequestView<'static>> {
7529 fn from(wrapper: UpdatePolicyRequestOwnedView) -> Self {
7530 wrapper.0
7531 }
7532 }
7533 impl ::core::convert::AsRef<::buffa::OwnedView<UpdatePolicyRequestView<'static>>>
7534 for UpdatePolicyRequestOwnedView {
7535 fn as_ref(&self) -> &::buffa::OwnedView<UpdatePolicyRequestView<'static>> {
7536 &self.0
7537 }
7538 }
7539 impl ::buffa::HasMessageView for super::super::UpdatePolicyRequest {
7540 type View<'a> = UpdatePolicyRequestView<'a>;
7541 type ViewHandle = UpdatePolicyRequestOwnedView;
7542 }
7543 impl ::serde::Serialize for UpdatePolicyRequestOwnedView {
7544 fn serialize<__S: ::serde::Serializer>(
7545 &self,
7546 __s: __S,
7547 ) -> ::core::result::Result<__S::Ok, __S::Error> {
7548 ::serde::Serialize::serialize(&self.0, __s)
7549 }
7550 }
7551 #[derive(Clone, Debug, Default)]
7553 pub struct DeletePolicyRequestView<'a> {
7554 pub on_securable_type: &'a str,
7560 pub on_securable_fullname: &'a str,
7564 pub name: &'a str,
7568 pub __buffa_unknown_fields: ::buffa::UnknownFieldsView<'a>,
7569 }
7570 impl<'a> DeletePolicyRequestView<'a> {
7571 #[doc(hidden)]
7579 pub fn _decode_depth(
7580 buf: &'a [u8],
7581 depth: u32,
7582 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7583 let mut view = Self::default();
7584 view._merge_into_view(buf, depth)?;
7585 ::core::result::Result::Ok(view)
7586 }
7587 #[doc(hidden)]
7595 pub fn _merge_into_view(
7596 &mut self,
7597 buf: &'a [u8],
7598 depth: u32,
7599 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
7600 let _ = depth;
7601 #[allow(unused_variables)]
7602 let view = self;
7603 let mut cur: &'a [u8] = buf;
7604 while !cur.is_empty() {
7605 let before_tag = cur;
7606 let tag = ::buffa::encoding::Tag::decode(&mut cur)?;
7607 match tag.field_number() {
7608 1u32 => {
7609 if tag.wire_type()
7610 != ::buffa::encoding::WireType::LengthDelimited
7611 {
7612 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7613 field_number: 1u32,
7614 expected: 2u8,
7615 actual: tag.wire_type() as u8,
7616 });
7617 }
7618 view.on_securable_type = ::buffa::types::borrow_str(
7619 &mut cur,
7620 )?;
7621 }
7622 2u32 => {
7623 if tag.wire_type()
7624 != ::buffa::encoding::WireType::LengthDelimited
7625 {
7626 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7627 field_number: 2u32,
7628 expected: 2u8,
7629 actual: tag.wire_type() as u8,
7630 });
7631 }
7632 view.on_securable_fullname = ::buffa::types::borrow_str(
7633 &mut cur,
7634 )?;
7635 }
7636 3u32 => {
7637 if tag.wire_type()
7638 != ::buffa::encoding::WireType::LengthDelimited
7639 {
7640 return ::core::result::Result::Err(::buffa::DecodeError::WireTypeMismatch {
7641 field_number: 3u32,
7642 expected: 2u8,
7643 actual: tag.wire_type() as u8,
7644 });
7645 }
7646 view.name = ::buffa::types::borrow_str(&mut cur)?;
7647 }
7648 _ => {
7649 ::buffa::encoding::skip_field_depth(tag, &mut cur, depth)?;
7650 let span_len = before_tag.len() - cur.len();
7651 view.__buffa_unknown_fields
7652 .push_raw(&before_tag[..span_len]);
7653 }
7654 }
7655 }
7656 ::core::result::Result::Ok(())
7657 }
7658 }
7659 impl<'a> ::buffa::MessageView<'a> for DeletePolicyRequestView<'a> {
7660 type Owned = super::super::DeletePolicyRequest;
7661 fn decode_view(
7662 buf: &'a [u8],
7663 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7664 Self::_decode_depth(buf, ::buffa::RECURSION_LIMIT)
7665 }
7666 fn decode_view_with_limit(
7667 buf: &'a [u8],
7668 depth: u32,
7669 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7670 Self::_decode_depth(buf, depth)
7671 }
7672 fn to_owned_message(&self) -> super::super::DeletePolicyRequest {
7673 self.to_owned_from_source(None)
7674 }
7675 #[allow(clippy::useless_conversion, clippy::needless_update)]
7676 fn to_owned_from_source(
7677 &self,
7678 __buffa_src: ::core::option::Option<&::buffa::bytes::Bytes>,
7679 ) -> super::super::DeletePolicyRequest {
7680 #[allow(unused_imports)]
7681 use ::buffa::alloc::string::ToString as _;
7682 let _ = __buffa_src;
7683 super::super::DeletePolicyRequest {
7684 on_securable_type: self.on_securable_type.to_string(),
7685 on_securable_fullname: self.on_securable_fullname.to_string(),
7686 name: self.name.to_string(),
7687 __buffa_unknown_fields: self
7688 .__buffa_unknown_fields
7689 .to_owned()
7690 .unwrap_or_default()
7691 .into(),
7692 ..::core::default::Default::default()
7693 }
7694 }
7695 }
7696 impl<'a> ::buffa::ViewEncode<'a> for DeletePolicyRequestView<'a> {
7697 #[allow(clippy::needless_borrow, clippy::let_and_return)]
7698 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
7699 #[allow(unused_imports)]
7700 use ::buffa::Enumeration as _;
7701 let mut size = 0u32;
7702 if !self.on_securable_type.is_empty() {
7703 size
7704 += 1u32
7705 + ::buffa::types::string_encoded_len(&self.on_securable_type)
7706 as u32;
7707 }
7708 if !self.on_securable_fullname.is_empty() {
7709 size
7710 += 1u32
7711 + ::buffa::types::string_encoded_len(
7712 &self.on_securable_fullname,
7713 ) as u32;
7714 }
7715 if !self.name.is_empty() {
7716 size += 1u32 + ::buffa::types::string_encoded_len(&self.name) as u32;
7717 }
7718 size += self.__buffa_unknown_fields.encoded_len() as u32;
7719 size
7720 }
7721 #[allow(clippy::needless_borrow)]
7722 fn write_to(
7723 &self,
7724 _cache: &mut ::buffa::SizeCache,
7725 buf: &mut impl ::buffa::bytes::BufMut,
7726 ) {
7727 #[allow(unused_imports)]
7728 use ::buffa::Enumeration as _;
7729 if !self.on_securable_type.is_empty() {
7730 ::buffa::encoding::Tag::new(
7731 1u32,
7732 ::buffa::encoding::WireType::LengthDelimited,
7733 )
7734 .encode(buf);
7735 ::buffa::types::encode_string(&self.on_securable_type, buf);
7736 }
7737 if !self.on_securable_fullname.is_empty() {
7738 ::buffa::encoding::Tag::new(
7739 2u32,
7740 ::buffa::encoding::WireType::LengthDelimited,
7741 )
7742 .encode(buf);
7743 ::buffa::types::encode_string(&self.on_securable_fullname, buf);
7744 }
7745 if !self.name.is_empty() {
7746 ::buffa::encoding::Tag::new(
7747 3u32,
7748 ::buffa::encoding::WireType::LengthDelimited,
7749 )
7750 .encode(buf);
7751 ::buffa::types::encode_string(&self.name, buf);
7752 }
7753 self.__buffa_unknown_fields.write_to(buf);
7754 }
7755 }
7756 impl<'__a> ::serde::Serialize for DeletePolicyRequestView<'__a> {
7768 fn serialize<__S: ::serde::Serializer>(
7769 &self,
7770 __s: __S,
7771 ) -> ::core::result::Result<__S::Ok, __S::Error> {
7772 use ::serde::ser::SerializeMap as _;
7773 let mut __map = __s.serialize_map(::core::option::Option::None)?;
7774 if !::buffa::json_helpers::skip_if::is_empty_str(
7775 self.on_securable_type,
7776 ) {
7777 __map.serialize_entry("on_securable_type", self.on_securable_type)?;
7778 }
7779 if !::buffa::json_helpers::skip_if::is_empty_str(
7780 self.on_securable_fullname,
7781 ) {
7782 __map
7783 .serialize_entry(
7784 "onSecurableFullname",
7785 self.on_securable_fullname,
7786 )?;
7787 }
7788 if !::buffa::json_helpers::skip_if::is_empty_str(self.name) {
7789 __map.serialize_entry("name", self.name)?;
7790 }
7791 __map.end()
7792 }
7793 }
7794 impl<'a> ::buffa::MessageName for DeletePolicyRequestView<'a> {
7795 const PACKAGE: &'static str = "unitycatalog.policies.v1";
7796 const NAME: &'static str = "DeletePolicyRequest";
7797 const FULL_NAME: &'static str = "unitycatalog.policies.v1.DeletePolicyRequest";
7798 const TYPE_URL: &'static str = "type.googleapis.com/unitycatalog.policies.v1.DeletePolicyRequest";
7799 }
7800 impl<'v> ::buffa::DefaultViewInstance for DeletePolicyRequestView<'v> {
7801 fn default_view_instance<'a>() -> &'a Self
7802 where
7803 Self: 'a,
7804 {
7805 static VALUE: ::buffa::__private::OnceBox<
7806 DeletePolicyRequestView<'static>,
7807 > = ::buffa::__private::OnceBox::new();
7808 VALUE
7809 .get_or_init(|| ::buffa::alloc::boxed::Box::new(
7810 <DeletePolicyRequestView<'static>>::default(),
7811 ))
7812 }
7813 }
7814 impl ::buffa::ViewReborrow for DeletePolicyRequestView<'static> {
7815 type Reborrowed<'b> = DeletePolicyRequestView<'b>;
7816 fn reborrow<'b>(this: &'b Self) -> &'b Self::Reborrowed<'b> {
7817 this
7818 }
7819 }
7820 #[derive(Clone, Debug)]
7826 pub struct DeletePolicyRequestOwnedView(
7827 ::buffa::OwnedView<DeletePolicyRequestView<'static>>,
7828 );
7829 impl DeletePolicyRequestOwnedView {
7830 pub fn decode(
7840 bytes: ::buffa::bytes::Bytes,
7841 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7842 ::core::result::Result::Ok(
7843 DeletePolicyRequestOwnedView(::buffa::OwnedView::decode(bytes)?),
7844 )
7845 }
7846 pub fn decode_with_options(
7854 bytes: ::buffa::bytes::Bytes,
7855 opts: &::buffa::DecodeOptions,
7856 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7857 ::core::result::Result::Ok(
7858 DeletePolicyRequestOwnedView(
7859 ::buffa::OwnedView::decode_with_options(bytes, opts)?,
7860 ),
7861 )
7862 }
7863 pub fn from_owned(
7870 msg: &super::super::DeletePolicyRequest,
7871 ) -> ::core::result::Result<Self, ::buffa::DecodeError> {
7872 ::core::result::Result::Ok(
7873 DeletePolicyRequestOwnedView(::buffa::OwnedView::from_owned(msg)?),
7874 )
7875 }
7876 #[must_use]
7878 pub fn view(&self) -> &DeletePolicyRequestView<'_> {
7879 self.0.reborrow()
7880 }
7881 #[must_use]
7883 pub fn to_owned_message(&self) -> super::super::DeletePolicyRequest {
7884 self.0.to_owned_message()
7885 }
7886 #[must_use]
7888 pub fn bytes(&self) -> &::buffa::bytes::Bytes {
7889 self.0.bytes()
7890 }
7891 #[must_use]
7893 pub fn into_bytes(self) -> ::buffa::bytes::Bytes {
7894 self.0.into_bytes()
7895 }
7896 #[must_use]
7902 pub fn on_securable_type(&self) -> &'_ str {
7903 self.0.reborrow().on_securable_type
7904 }
7905 #[must_use]
7909 pub fn on_securable_fullname(&self) -> &'_ str {
7910 self.0.reborrow().on_securable_fullname
7911 }
7912 #[must_use]
7916 pub fn name(&self) -> &'_ str {
7917 self.0.reborrow().name
7918 }
7919 }
7920 impl ::core::convert::From<::buffa::OwnedView<DeletePolicyRequestView<'static>>>
7921 for DeletePolicyRequestOwnedView {
7922 fn from(
7923 inner: ::buffa::OwnedView<DeletePolicyRequestView<'static>>,
7924 ) -> Self {
7925 DeletePolicyRequestOwnedView(inner)
7926 }
7927 }
7928 impl ::core::convert::From<DeletePolicyRequestOwnedView>
7929 for ::buffa::OwnedView<DeletePolicyRequestView<'static>> {
7930 fn from(wrapper: DeletePolicyRequestOwnedView) -> Self {
7931 wrapper.0
7932 }
7933 }
7934 impl ::core::convert::AsRef<::buffa::OwnedView<DeletePolicyRequestView<'static>>>
7935 for DeletePolicyRequestOwnedView {
7936 fn as_ref(&self) -> &::buffa::OwnedView<DeletePolicyRequestView<'static>> {
7937 &self.0
7938 }
7939 }
7940 impl ::buffa::HasMessageView for super::super::DeletePolicyRequest {
7941 type View<'a> = DeletePolicyRequestView<'a>;
7942 type ViewHandle = DeletePolicyRequestOwnedView;
7943 }
7944 impl ::serde::Serialize for DeletePolicyRequestOwnedView {
7945 fn serialize<__S: ::serde::Serializer>(
7946 &self,
7947 __s: __S,
7948 ) -> ::core::result::Result<__S::Ok, __S::Error> {
7949 ::serde::Serialize::serialize(&self.0, __s)
7950 }
7951 }
7952 pub mod oneof {
7953 #[allow(unused_imports)]
7954 use super::*;
7955 pub mod function_arg {
7956 #[allow(unused_imports)]
7957 use super::*;
7958 #[derive(Clone, Debug)]
7959 pub enum Value<'a> {
7960 Alias(&'a str),
7961 Constant(&'a str),
7962 }
7963 }
7964 pub mod policy_info {
7965 #[allow(unused_imports)]
7966 use super::*;
7967 #[derive(Clone, Debug)]
7968 pub enum Function<'a> {
7969 RowFilter(
7970 ::buffa::alloc::boxed::Box<
7971 super::super::super::super::__buffa::view::FunctionRefView<
7972 'a,
7973 >,
7974 >,
7975 ),
7976 ColumnMask(
7977 ::buffa::alloc::boxed::Box<
7978 super::super::super::super::__buffa::view::FunctionRefView<
7979 'a,
7980 >,
7981 >,
7982 ),
7983 }
7984 }
7985 }
7986 }
7987 pub mod oneof {
7988 #[allow(unused_imports)]
7989 use super::*;
7990 pub mod function_arg {
7991 #[allow(unused_imports)]
7992 use super::*;
7993 #[derive(Clone, PartialEq, Debug)]
7994 pub enum Value {
7995 Alias(::buffa::alloc::string::String),
7996 Constant(::buffa::alloc::string::String),
7997 }
7998 impl ::buffa::Oneof for Value {}
7999 impl serde::Serialize for Value {
8000 fn serialize<S: serde::Serializer>(
8001 &self,
8002 s: S,
8003 ) -> ::core::result::Result<S::Ok, S::Error> {
8004 use serde::ser::SerializeMap;
8005 let mut map = s.serialize_map(Some(1))?;
8006 match self {
8007 Self::Alias(v) => {
8008 map.serialize_entry("alias", v)?;
8009 }
8010 Self::Constant(v) => {
8011 map.serialize_entry("constant", v)?;
8012 }
8013 }
8014 map.end()
8015 }
8016 }
8017 }
8018 pub mod policy_info {
8019 #[allow(unused_imports)]
8020 use super::*;
8021 #[derive(Clone, PartialEq, Debug)]
8022 pub enum Function {
8023 RowFilter(::buffa::alloc::boxed::Box<super::super::super::FunctionRef>),
8024 ColumnMask(::buffa::alloc::boxed::Box<super::super::super::FunctionRef>),
8025 }
8026 impl ::buffa::Oneof for Function {}
8027 impl serde::Serialize for Function {
8028 fn serialize<S: serde::Serializer>(
8029 &self,
8030 s: S,
8031 ) -> ::core::result::Result<S::Ok, S::Error> {
8032 use serde::ser::SerializeMap;
8033 let mut map = s.serialize_map(Some(1))?;
8034 match self {
8035 Self::RowFilter(v) => {
8036 map.serialize_entry("row_filter", v)?;
8037 }
8038 Self::ColumnMask(v) => {
8039 map.serialize_entry("column_mask", v)?;
8040 }
8041 }
8042 map.end()
8043 }
8044 }
8045 }
8046 }
8047 pub fn register_types(reg: &mut ::buffa::type_registry::TypeRegistry) {
8049 reg.register_json_any(super::__MATCH_COLUMN_JSON_ANY);
8050 reg.register_json_any(super::__FUNCTION_ARG_JSON_ANY);
8051 reg.register_json_any(super::__FUNCTION_REF_JSON_ANY);
8052 reg.register_json_any(super::__POLICY_INFO_JSON_ANY);
8053 reg.register_json_any(super::__LIST_POLICIES_REQUEST_JSON_ANY);
8054 reg.register_json_any(super::__LIST_POLICIES_RESPONSE_JSON_ANY);
8055 reg.register_json_any(super::__CREATE_POLICY_REQUEST_JSON_ANY);
8056 reg.register_json_any(super::__GET_POLICY_REQUEST_JSON_ANY);
8057 reg.register_json_any(super::__UPDATE_POLICY_REQUEST_JSON_ANY);
8058 reg.register_json_any(super::__DELETE_POLICY_REQUEST_JSON_ANY);
8059 }
8060}
8061#[doc(inline)]
8062pub use self::__buffa::view::MatchColumnView;
8063#[doc(inline)]
8064pub use self::__buffa::view::MatchColumnOwnedView;
8065#[doc(inline)]
8066pub use self::__buffa::view::FunctionArgView;
8067#[doc(inline)]
8068pub use self::__buffa::view::FunctionArgOwnedView;
8069#[doc(inline)]
8070pub use self::__buffa::view::FunctionRefView;
8071#[doc(inline)]
8072pub use self::__buffa::view::FunctionRefOwnedView;
8073#[doc(inline)]
8074pub use self::__buffa::view::PolicyInfoView;
8075#[doc(inline)]
8076pub use self::__buffa::view::PolicyInfoOwnedView;
8077#[doc(inline)]
8078pub use self::__buffa::view::ListPoliciesRequestView;
8079#[doc(inline)]
8080pub use self::__buffa::view::ListPoliciesRequestOwnedView;
8081#[doc(inline)]
8082pub use self::__buffa::view::ListPoliciesResponseView;
8083#[doc(inline)]
8084pub use self::__buffa::view::ListPoliciesResponseOwnedView;
8085#[doc(inline)]
8086pub use self::__buffa::view::CreatePolicyRequestView;
8087#[doc(inline)]
8088pub use self::__buffa::view::CreatePolicyRequestOwnedView;
8089#[doc(inline)]
8090pub use self::__buffa::view::GetPolicyRequestView;
8091#[doc(inline)]
8092pub use self::__buffa::view::GetPolicyRequestOwnedView;
8093#[doc(inline)]
8094pub use self::__buffa::view::UpdatePolicyRequestView;
8095#[doc(inline)]
8096pub use self::__buffa::view::UpdatePolicyRequestOwnedView;
8097#[doc(inline)]
8098pub use self::__buffa::view::DeletePolicyRequestView;
8099#[doc(inline)]
8100pub use self::__buffa::view::DeletePolicyRequestOwnedView;
8101#[doc(inline)]
8102pub use self::__buffa::register_types;