#include "common/formatter/substitution_format_string.h" #include "common/formatter/substitution_formatter.h" namespace Envoy { namespace Formatter { FormatterPtr SubstitutionFormatStringUtils::createJsonFormatter(const ProtobufWkt::Struct& struct_format, bool preserve_types, bool omit_empty_values) { return std::make_unique(struct_format, preserve_types, omit_empty_values); } FormatterPtr SubstitutionFormatStringUtils::fromProtoConfig( const envoy::config::core::v3::SubstitutionFormatString& config) { switch (config.format_case()) { case envoy::config::core::v3::SubstitutionFormatString::FormatCase::kTextFormat: return std::make_unique(config.text_format(), config.omit_empty_values()); case envoy::config::core::v3::SubstitutionFormatString::FormatCase::kJsonFormat: { return createJsonFormatter(config.json_format(), true, config.omit_empty_values()); } default: NOT_REACHED_GCOVR_EXCL_LINE; } return nullptr; } } // namespace Formatter } // namespace Envoy