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

            
3
namespace Envoy {
4
namespace Rds {
5

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

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

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