1
#include "source/common/watchdog/abort_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/common/watchdog/abort_action.h"
8

            
9
namespace Envoy {
10
namespace Watchdog {
11

            
12
Server::Configuration::GuardDogActionPtr AbortActionFactory::createGuardDogActionFromProto(
13
    const envoy::config::bootstrap::v3::Watchdog::WatchdogAction& config,
14
17
    Server::Configuration::GuardDogActionFactoryContext& context) {
15
17
  AbortActionConfig message;
16
17
  THROW_IF_NOT_OK(Config::Utility::translateOpaqueConfig(
17
17
      config.config().typed_config(), ProtobufMessage::getStrictValidationVisitor(), message));
18
17
  return std::make_unique<AbortAction>(message, context);
19
17
}
20

            
21
/**
22
 * Static registration for the Abort Action factory. @see RegisterFactory.
23
 */
24
REGISTER_FACTORY(AbortActionFactory, Server::Configuration::GuardDogActionFactory);
25

            
26
} // namespace Watchdog
27
} // namespace Envoy