Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update output document of Envoy plugin. #7241

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/content/envoy-primer.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ When Envoy receives a policy decision, it expects a JSON object with the followi
* `http_status` (optional): a number representing the HTTP status code
* `body` (optional): the response body
* `dynamic_metadata` (optional): an object representing dynamic metadata to be consumed by the next Envoy filter.
* `query_parameters_to_remove` (optional): is an array containing the names of string query parameters to be removed.

To construct that output object using the policies demonstrated in the last section, you can use the following Rego snippet. Notice that we are using partial object rules so that any variables with undefined values simply have no key in the `result` object.

Expand All @@ -218,6 +219,7 @@ result["request_headers_to_remove"] := request_headers_to_remove
result["body"] := body
result["http_status"] := status_code
result["dynamic_metadata"] := dynamic_metadata
result["query_parameters_to_remove"] := query_parameters_to_remove
```

For a single user, including this snippet in your normal policy is fine, but when you have multiple teams writing policies, you will typically pull this bit of boilerplate into a wrapper package, so your teams can focus on writing the policies shown in the previous sections.
Expand Down