| 77 | } |
| 78 | |
| 79 | absl::StatusOr<Value> FromObject( |
| 80 | const google::protobuf::Any& any, |
| 81 | const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool, |
| 82 | google::protobuf::MessageFactory* absl_nonnull message_factory, |
| 83 | google::protobuf::Arena* absl_nonnull arena) { |
| 84 | if (any.type_url() == "type.googleapis.com/google.protobuf.Duration") { |
| 85 | google::protobuf::Duration duration; |
| 86 | if (!any.UnpackTo(&duration)) { |
| 87 | return absl::InvalidArgumentError("invalid duration"); |
| 88 | } |
| 89 | absl::Duration d = internal::DecodeDuration(duration); |
| 90 | CEL_RETURN_IF_ERROR(cel::internal::ValidateDuration(d)); |
| 91 | return cel::DurationValue(d); |
| 92 | } else if (any.type_url() == |
| 93 | "type.googleapis.com/google.protobuf.Timestamp") { |
| 94 | google::protobuf::Timestamp timestamp; |
| 95 | if (!any.UnpackTo(×tamp)) { |
| 96 | return absl::InvalidArgumentError("invalid timestamp"); |
| 97 | } |
| 98 | absl::Time time = internal::DecodeTime(timestamp); |
| 99 | CEL_RETURN_IF_ERROR(cel::internal::ValidateTimestamp(time)); |
| 100 | return cel::TimestampValue(time); |
| 101 | } |
| 102 | |
| 103 | return extensions::ProtoMessageToValue(any, descriptor_pool, message_factory, |
| 104 | arena); |
| 105 | } |
| 106 | |
| 107 | absl::StatusOr<MapValue> MapValueFromExpr( |
| 108 | const ExprMapValue& map_value, |
no test coverage detected