1
#pragma once
2

            
3
#include "envoy/config/core/v3/health_check.pb.h"
4
#include "envoy/extensions/health_checkers/thrift/v3/thrift.pb.h"
5
#include "envoy/extensions/health_checkers/thrift/v3/thrift.pb.validate.h"
6

            
7
#include "source/common/config/utility.h"
8
#include "source/common/protobuf/protobuf.h"
9
#include "source/common/protobuf/utility.h"
10

            
11
namespace Envoy {
12
namespace Extensions {
13
namespace HealthCheckers {
14
namespace ThriftHealthChecker {
15

            
16
namespace {
17

            
18
static const envoy::extensions::health_checkers::thrift::v3::Thrift
19
getThriftHealthCheckConfig(const envoy::config::core::v3::HealthCheck& health_check_config,
20
13
                           ProtobufMessage::ValidationVisitor& validation_visitor) {
21
13
  ProtobufTypes::MessagePtr config =
22
13
      ProtobufTypes::MessagePtr{new envoy::extensions::health_checkers::thrift::v3::Thrift()};
23
13
  THROW_IF_NOT_OK(Envoy::Config::Utility::translateOpaqueConfig(
24
13
      health_check_config.custom_health_check().typed_config(), validation_visitor, *config));
25
13
  return MessageUtil::downcastAndValidate<
26
13
      const envoy::extensions::health_checkers::thrift::v3::Thrift&>(*config, validation_visitor);
27
13
}
28

            
29
} // namespace
30
} // namespace ThriftHealthChecker
31
} // namespace HealthCheckers
32
} // namespace Extensions
33
} // namespace Envoy