1
#include "source/extensions/http/early_header_mutation/header_mutation/config.h"
2

            
3
#include "source/common/config/utility.h"
4

            
5
namespace Envoy {
6
namespace Extensions {
7
namespace Http {
8
namespace EarlyHeaderMutation {
9
namespace HeaderMutation {
10

            
11
Envoy::Http::EarlyHeaderMutationPtr
12
Factory::createExtension(const Protobuf::Message& message,
13
3
                         Server::Configuration::FactoryContext& context) {
14
3
  auto mptr = Envoy::Config::Utility::translateAnyToFactoryConfig(
15
3
      *Envoy::Protobuf::DynamicCastMessage<const Protobuf::Any>(&message),
16
3
      context.messageValidationVisitor(), *this);
17
3
  const auto& proto_config = MessageUtil::downcastAndValidate<
18
3
      const envoy::extensions::http::early_header_mutation::header_mutation::v3::HeaderMutation&>(
19
3
      *mptr, context.messageValidationVisitor());
20
3
  return std::make_unique<HeaderMutation>(proto_config, context.serverFactoryContext());
21
3
}
22

            
23
REGISTER_FACTORY(Factory, Envoy::Http::EarlyHeaderMutationFactory);
24

            
25
} // namespace HeaderMutation
26
} // namespace EarlyHeaderMutation
27
} // namespace Http
28
} // namespace Extensions
29
} // namespace Envoy