1syntax = "proto3";
2
3package envoy.config.core.v3;
4
5import "envoy/config/core/v3/base.proto";
6import "envoy/config/core/v3/extension.proto";
7
8import "google/protobuf/struct.proto";
9
10import "envoy/annotations/deprecation.proto";
11import "udpa/annotations/status.proto";
12import "validate/validate.proto";
13
14option java_package = "io.envoyproxy.envoy.config.core.v3";
15option java_outer_classname = "SubstitutionFormatStringProto";
16option java_multiple_files = true;
17option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/core/v3;corev3";
18option (udpa.annotations.file_status).package_version_status = ACTIVE;
19
20// [#protodoc-title: Substitution format string]
21
22// Configuration to use multiple :ref:`command operators <config_access_log_command_operators>`
23// to generate a new string in either plain text or JSON format.
24// [#next-free-field: 7]
25message SubstitutionFormatString {
26  oneof format {
27    option (validate.required) = true;
28
29    // Specify a format with command operators to form a text string.
30    // Its details is described in :ref:`format string<config_access_log_format_strings>`.
31    //
32    // For example, setting ``text_format`` like below,
33    //
34    // .. validated-code-block:: yaml
35    //   :type-name: envoy.config.core.v3.SubstitutionFormatString
36    //
37    //   text_format: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n"
38    //
39    // generates plain text similar to:
40    //
41    // .. code-block:: text
42    //
43    //   upstream connect error:503:path=/foo
44    //
45    // Deprecated in favor of :ref:`text_format_source <envoy_v3_api_field_config.core.v3.SubstitutionFormatString.text_format_source>`. To migrate text format strings, use the :ref:`inline_string <envoy_v3_api_field_config.core.v3.DataSource.inline_string>` field.
46    string text_format = 1
47        [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];
48
49    // Specify a format with command operators to form a JSON string.
50    // Its details is described in :ref:`format dictionary<config_access_log_format_dictionaries>`.
51    // Values are rendered as strings, numbers, or boolean values as appropriate.
52    // Nested JSON objects may be produced by some command operators (e.g. FILTER_STATE or DYNAMIC_METADATA).
53    // See the documentation for a specific command operator for details.
54    //
55    // .. validated-code-block:: yaml
56    //   :type-name: envoy.config.core.v3.SubstitutionFormatString
57    //
58    //   json_format:
59    //     status: "%RESPONSE_CODE%"
60    //     message: "%LOCAL_REPLY_BODY%"
61    //
62    // The following JSON object would be created:
63    //
64    // .. code-block:: json
65    //
66    //  {
67    //    "status": 500,
68    //    "message": "My error message"
69    //  }
70    //
71    google.protobuf.Struct json_format = 2 [(validate.rules).message = {required: true}];
72
73    // Specify a format with command operators to form a text string.
74    // Its details is described in :ref:`format string<config_access_log_format_strings>`.
75    //
76    // For example, setting ``text_format`` like below,
77    //
78    // .. validated-code-block:: yaml
79    //   :type-name: envoy.config.core.v3.SubstitutionFormatString
80    //
81    //   text_format_source:
82    //     inline_string: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n"
83    //
84    // generates plain text similar to:
85    //
86    // .. code-block:: text
87    //
88    //   upstream connect error:503:path=/foo
89    //
90    DataSource text_format_source = 5;
91  }
92
93  // If set to true, when command operators are evaluated to null,
94  //
95  // * for ``text_format``, the output of the empty operator is changed from ``-`` to an
96  //   empty string, so that empty values are omitted entirely.
97  // * for ``json_format`` the keys with null values are omitted in the output structure.
98  bool omit_empty_values = 3;
99
100  // Specify a ``content_type`` field.
101  // If this field is not set then ``text/plain`` is used for ``text_format`` and
102  // ``application/json`` is used for ``json_format``.
103  //
104  // .. validated-code-block:: yaml
105  //   :type-name: envoy.config.core.v3.SubstitutionFormatString
106  //
107  //   content_type: "text/html; charset=UTF-8"
108  //
109  string content_type = 4
110      [(validate.rules).string = {well_known_regex: HTTP_HEADER_VALUE strict: false}];
111
112  // Specifies a collection of Formatter plugins that can be called from the access log configuration.
113  // See the formatters extensions documentation for details.
114  // [#extension-category: envoy.formatter]
115  repeated TypedExtensionConfig formatters = 6;
116}
117