Skip to content

Commit

Permalink
mixer: add header operation templates (#612)
Browse files Browse the repository at this point in the history
* add header operation templates

Signed-off-by: Kuat Yessenov <kuat@google.com>

* comment

Signed-off-by: Kuat Yessenov <kuat@google.com>

* add comment

Signed-off-by: Kuat Yessenov <kuat@google.com>

* add comment

Signed-off-by: Kuat Yessenov <kuat@google.com>

* use repeated

Signed-off-by: Kuat Yessenov <kuat@google.com>
  • Loading branch information
kyessenov authored and istio-testing committed Aug 17, 2018
1 parent e0ffa87 commit 864a733
Show file tree
Hide file tree
Showing 4 changed files with 390 additions and 47 deletions.
31 changes: 31 additions & 0 deletions policy/v1beta1/cfg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,34 @@ message Rule {

// Optional. The actions that will be executed when match evaluates to `true`.
repeated Action actions = 2;

// A template for an HTTP header manipulation.
message HeaderOperationTemplate {

// Required. Header name.
string name = 1;

// Optional. Header values to replace or append.
repeated string values = 2;

// Header operation type.
enum Operation {
REPLACE = 0; // replaces the header with the given name
REMOVE = 1; // removes the header with the given name (the value is ignored)
APPEND = 2; // appends the values to the existing values (preserving existing values)
}

// Optional. Header operation type. Default operation is to replace the value of the header by name.
Operation operation = 3;
}

// Optional. Templatized operations on the request headers using attributes produced by the
// rule actions.
repeated HeaderOperationTemplate request_header_operations = 3;

// Optional. Templatized operations on the response headers using attributes produced by the
// rule actions.
repeated HeaderOperationTemplate response_header_operations = 4;
}

// Action describes which [Handler][istio.policy.v1beta1.Handler] to invoke and what data to pass to it for processing.
Expand All @@ -146,6 +174,9 @@ message Action {
// Referenced instances are evaluated by resolving the attributes/literals for all the fields.
// The constructed objects are then passed to the `handler` referenced within this action.
repeated string instances = 3;

// Optional. A handle to refer to the results of the action.
string name = 4;
}

// An Instance tells Mixer how to create instances for particular template.
Expand Down
173 changes: 139 additions & 34 deletions policy/v1beta1/fixed_cfg.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 103 additions & 1 deletion policy/v1beta1/istio.policy.v1beta1.pb.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
location: https://istio.io/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html
layout: protoc-gen-docs
generator: protoc-gen-docs
number_of_entries: 15
number_of_entries: 17
---
<p>Describes the rules used to configure Mixer&rsquo;s policy and telemetry features.</p>

Expand Down Expand Up @@ -47,6 +47,14 @@ <h2 id="Action">Action</h2>
Referenced instances are evaluated by resolving the attributes/literals for all the fields.
The constructed objects are then passed to the <code>handler</code> referenced within this action.</p>

</td>
</tr>
<tr id="Action-name">
<td><code>name</code></td>
<td><code>string</code></td>
<td>
<p>Optional. A handle to refer to the results of the action.</p>

</td>
</tr>
</tbody>
Expand Down Expand Up @@ -559,6 +567,100 @@ <h2 id="Rule">Rule</h2>
<td>
<p>Optional. The actions that will be executed when match evaluates to <code>true</code>.</p>

</td>
</tr>
<tr id="Rule-request_header_operations">
<td><code>requestHeaderOperations</code></td>
<td><code><a href="#Rule-HeaderOperationTemplate">Rule.HeaderOperationTemplate[]</a></code></td>
<td>
<p>Optional. Templatized operations on the request headers using attributes produced by the
rule actions.</p>

</td>
</tr>
<tr id="Rule-response_header_operations">
<td><code>responseHeaderOperations</code></td>
<td><code><a href="#Rule-HeaderOperationTemplate">Rule.HeaderOperationTemplate[]</a></code></td>
<td>
<p>Optional. Templatized operations on the response headers using attributes produced by the
rule actions.</p>

</td>
</tr>
</tbody>
</table>
</section>
<h2 id="Rule-HeaderOperationTemplate">Rule.HeaderOperationTemplate</h2>
<section>
<p>A template for an HTTP header manipulation.</p>

<table class="message-fields">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr id="Rule-HeaderOperationTemplate-name">
<td><code>name</code></td>
<td><code>string</code></td>
<td>
<p>Required. Header name.</p>

</td>
</tr>
<tr id="Rule-HeaderOperationTemplate-values">
<td><code>values</code></td>
<td><code>string[]</code></td>
<td>
<p>Optional. Header values to replace or append.</p>

</td>
</tr>
<tr id="Rule-HeaderOperationTemplate-operation">
<td><code>operation</code></td>
<td><code><a href="#Rule-HeaderOperationTemplate-Operation">Rule.HeaderOperationTemplate.Operation</a></code></td>
<td>
<p>Optional. Header operation type. Default operation is to replace the value of the header by name.</p>

</td>
</tr>
</tbody>
</table>
</section>
<h2 id="Rule-HeaderOperationTemplate-Operation">Rule.HeaderOperationTemplate.Operation</h2>
<section>
<p>Header operation type.</p>

<table class="enum-values">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr id="Rule-HeaderOperationTemplate-Operation-REPLACE">
<td><code>REPLACE</code></td>
<td>
<p>replaces the header with the given name</p>

</td>
</tr>
<tr id="Rule-HeaderOperationTemplate-Operation-REMOVE">
<td><code>REMOVE</code></td>
<td>
<p>removes the header with the given name (the value is ignored)</p>

</td>
</tr>
<tr id="Rule-HeaderOperationTemplate-Operation-APPEND">
<td><code>APPEND</code></td>
<td>
<p>appends the values to the existing values (preserving existing values)</p>

</td>
</tr>
</tbody>
Expand Down
Loading

0 comments on commit 864a733

Please sign in to comment.