Line data Source code
1 : #include "source/common/rds/util.h" 2 : 3 : namespace Envoy { 4 : namespace Rds { 5 : 6 74 : ProtobufTypes::MessagePtr cloneProto(ProtoTraits& proto_traits, const Protobuf::Message& rc) { 7 74 : auto clone = proto_traits.createEmptyProto(); 8 74 : clone->CheckTypeAndMergeFrom(rc); 9 74 : return clone; 10 74 : } 11 : 12 206 : std::string resourceName(ProtoTraits& proto_traits, const Protobuf::Message& rc) { 13 206 : Protobuf::ReflectableMessage reflectable_message = createReflectableMessage(rc); 14 206 : const Protobuf::FieldDescriptor* field = reflectable_message->GetDescriptor()->FindFieldByNumber( 15 206 : proto_traits.resourceNameFieldNumber()); 16 206 : if (!field) { 17 0 : return {}; 18 0 : } 19 206 : const Protobuf::Reflection* reflection = reflectable_message->GetReflection(); 20 206 : return reflection->GetString(*reflectable_message, field); 21 206 : } 22 : 23 : } // namespace Rds 24 : } // namespace Envoy