1
#include "source/common/rds/util.h"
2

            
3
namespace Envoy {
4
namespace Rds {
5

            
6
9876
ProtobufTypes::MessagePtr cloneProto(ProtoTraits& proto_traits, const Protobuf::Message& rc) {
7
9876
  auto clone = proto_traits.createEmptyProto();
8
9876
  clone->CheckTypeAndMergeFrom(rc);
9
9876
  return clone;
10
9876
}
11

            
12
516
std::string resourceName(ProtoTraits& proto_traits, const Protobuf::Message& rc) {
13
516
  Protobuf::ReflectableMessage reflectable_message = createReflectableMessage(rc);
14
516
  const Protobuf::FieldDescriptor* field = reflectable_message->GetDescriptor()->FindFieldByNumber(
15
516
      proto_traits.resourceNameFieldNumber());
16
516
  if (!field) {
17
    return {};
18
  }
19
516
  const Protobuf::Reflection* reflection = reflectable_message->GetReflection();
20
516
  return reflection->GetString(*reflectable_message, field);
21
516
}
22

            
23
} // namespace Rds
24
} // namespace Envoy