Skip to content

Commit

Permalink
Regex body (#35)
Browse files Browse the repository at this point in the history
* allow extractors from body
* speed test
* Merge remote-tracking branch 'origin/master' into regex-body
* dynamic meta
* refactor metadata support
* build
* more tests
* check empty output
* add env var
* fix segfault in test
* add changelog
* dynamic meta before headers
* updates
* add missing header; compile fix test
* allow list bodies
* test for regex in the ctor
* remove
* Merge remote-tracking branch 'origin/master' into regex-body
* test that right fields are set in metadata
* fix compile
  • Loading branch information
yuval-k authored and soloio-bulldozer[bot] committed Oct 25, 2019
1 parent da3f8af commit 3bf7d19
Show file tree
Hide file tree
Showing 9 changed files with 528 additions and 129 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ BUILDIFIER=$GOPATH/bin/buildifier CLANG_FORMAT=clang-format /path/to/envoy/tools

# Submit a build
```
gcloud builds submit --config=cloudbuild.yaml \
gcloud builds submit --project=solo-public --config=cloudbuild.yaml \
--substitutions=COMMIT_SHA=$(git rev-parse HEAD) .
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option java_outer_classname = "TransformationFilterProto";
option java_multiple_files = true;
option go_package = "transformation";

import "google/protobuf/empty.proto";
import "validate/validate.proto";

import "envoy/api/v2/route/route.proto";
Expand Down Expand Up @@ -52,7 +53,10 @@ message Transformation {
}

message Extraction {
string header = 1;
oneof source {
string header = 1;
google.protobuf.Empty body = 4;
}
// what information to extract. if extraction fails the result is
// an empty value.
string regex = 2;
Expand All @@ -61,7 +65,7 @@ message Extraction {

message TransformationTemplate {
bool advanced_templates = 1;
// Extractors are in the origin request language domain
// Extractors are in the original request language domain
map<string, Extraction> extractors = 2;

map<string, InjaTemplate> headers = 3;
Expand All @@ -71,6 +75,22 @@ message TransformationTemplate {
Passthrough passthrough = 5;
MergeExtractorsToBody merge_extractors_to_body = 6;
}

enum RequestBodyParse {
ParseAsJson = 0;
DontParse = 1;
}
RequestBodyParse parse_body_behavior = 7;
bool ignore_error_on_parse = 8;

message DynamicMetadataValue {
// optional. if not set filter namespace will be used.
string metadata_namespace = 1;
string key = 2 [(validate.rules).string = {min_bytes: 1}];
InjaTemplate value = 3;
}
repeated DynamicMetadataValue dynamic_metadata_values = 9;

}

/*
Expand Down
4 changes: 4 additions & 0 deletions changelog/v0.1.18/body-transform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog:
- type: NEW_FEATURE
issueLink: https://github.com/solo-io/envoy-gloo/issues/37
description: Add body() function to template, allow using templates wit dynamic metadata, add env() function to template
3 changes: 2 additions & 1 deletion source/extensions/filters/http/transformation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ envoy_cc_library(
deps = [
":transformer_lib",
"//api/envoy/config/filter/http/transformation/v2:pkg_cc_proto",
"//source/extensions/filters/http:solo_well_known_names",
"@envoy//include/envoy/buffer:buffer_interface",
"@envoy//include/envoy/http:header_map_interface",
"@envoy//source/common/common:macros",
"@envoy//source/common/common:regex_lib",
"@envoy//source/common/common:utility_lib",
"@envoy//source/common/protobuf",
"@envoy//source/common/common:regex_lib",
"@inja//:inja-lib",
"@json//:json-lib",
],
Expand Down
Loading

0 comments on commit 3bf7d19

Please sign in to comment.