forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubstitution_format_string.h
More file actions
53 lines (45 loc) · 1.86 KB
/
substitution_format_string.h
File metadata and controls
53 lines (45 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <string>
#include "envoy/api/api.h"
#include "envoy/config/core/v3/substitution_format_string.pb.h"
#include "envoy/formatter/substitution_formatter.h"
#include "envoy/server/factory_context.h"
#include "source/common/config/datasource.h"
#include "source/common/config/utility.h"
#include "source/common/formatter/substitution_formatter.h"
#include "source/common/protobuf/message_validator_impl.h"
#include "source/common/protobuf/protobuf.h"
#include "source/common/runtime/runtime_features.h"
#include "source/server/generic_factory_context.h"
namespace Envoy {
namespace Formatter {
/**
* Utilities for using envoy::config::core::v3::SubstitutionFormatString
*/
class SubstitutionFormatStringUtils {
public:
using FormattersConfig =
ProtobufWkt::RepeatedPtrField<envoy::config::core::v3::TypedExtensionConfig>;
/**
* Parse list of formatter configurations to commands.
*/
static absl::StatusOr<std::vector<CommandParserPtr>>
parseFormatters(const FormattersConfig& formatters,
Server::Configuration::GenericFactoryContext& context,
std::vector<CommandParserPtr>&& commands_parsers = {});
/**
* Generate a formatter object from config SubstitutionFormatString.
*/
static absl::StatusOr<FormatterPtr>
fromProtoConfig(const envoy::config::core::v3::SubstitutionFormatString& config,
Server::Configuration::GenericFactoryContext& context,
std::vector<CommandParserPtr>&& command_parsers = {});
/**
* Generate a Json formatter object from proto::Struct config
*/
static FormatterPtr createJsonFormatter(const ProtobufWkt::Struct& struct_format,
bool omit_empty_values,
const std::vector<CommandParserPtr>& commands = {});
};
} // namespace Formatter
} // namespace Envoy