1
#include "source/extensions/watchdog/profile_action/config.h"
2

            
3
#include "envoy/registry/registry.h"
4

            
5
#include "source/common/config/utility.h"
6
#include "source/common/protobuf/message_validator_impl.h"
7
#include "source/extensions/watchdog/profile_action/profile_action.h"
8

            
9
namespace Envoy {
10
namespace Extensions {
11
namespace Watchdog {
12
namespace ProfileAction {
13

            
14
Server::Configuration::GuardDogActionPtr ProfileActionFactory::createGuardDogActionFromProto(
15
    const envoy::config::bootstrap::v3::Watchdog::WatchdogAction& config,
16
1
    Server::Configuration::GuardDogActionFactoryContext& context) {
17
1
  auto message = createEmptyConfigProto();
18
1
  THROW_IF_NOT_OK(Config::Utility::translateOpaqueConfig(
19
1
      config.config().typed_config(), ProtobufMessage::getStrictValidationVisitor(), *message));
20
1
  return std::make_unique<ProfileAction>(dynamic_cast<ProfileActionConfig&>(*message), context);
21
1
}
22

            
23
/**
24
 * Static registration for the ProfileAction factory. @see RegistryFactory.
25
 */
26
REGISTER_FACTORY(ProfileActionFactory, Server::Configuration::GuardDogActionFactory);
27

            
28
} // namespace ProfileAction
29
} // namespace Watchdog
30
} // namespace Extensions
31
} // namespace Envoy