Skip to content

Commit 864a733

Browse files
kyessenovistio-testing
authored andcommitted
mixer: add header operation templates (#612)
* add header operation templates Signed-off-by: Kuat Yessenov <[email protected]> * comment Signed-off-by: Kuat Yessenov <[email protected]> * add comment Signed-off-by: Kuat Yessenov <[email protected]> * add comment Signed-off-by: Kuat Yessenov <[email protected]> * use repeated Signed-off-by: Kuat Yessenov <[email protected]>
1 parent e0ffa87 commit 864a733

File tree

4 files changed

+390
-47
lines changed

4 files changed

+390
-47
lines changed

policy/v1beta1/cfg.proto

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,34 @@ message Rule {
124124

125125
// Optional. The actions that will be executed when match evaluates to `true`.
126126
repeated Action actions = 2;
127+
128+
// A template for an HTTP header manipulation.
129+
message HeaderOperationTemplate {
130+
131+
// Required. Header name.
132+
string name = 1;
133+
134+
// Optional. Header values to replace or append.
135+
repeated string values = 2;
136+
137+
// Header operation type.
138+
enum Operation {
139+
REPLACE = 0; // replaces the header with the given name
140+
REMOVE = 1; // removes the header with the given name (the value is ignored)
141+
APPEND = 2; // appends the values to the existing values (preserving existing values)
142+
}
143+
144+
// Optional. Header operation type. Default operation is to replace the value of the header by name.
145+
Operation operation = 3;
146+
}
147+
148+
// Optional. Templatized operations on the request headers using attributes produced by the
149+
// rule actions.
150+
repeated HeaderOperationTemplate request_header_operations = 3;
151+
152+
// Optional. Templatized operations on the response headers using attributes produced by the
153+
// rule actions.
154+
repeated HeaderOperationTemplate response_header_operations = 4;
127155
}
128156

129157
// Action describes which [Handler][istio.policy.v1beta1.Handler] to invoke and what data to pass to it for processing.
@@ -146,6 +174,9 @@ message Action {
146174
// Referenced instances are evaluated by resolving the attributes/literals for all the fields.
147175
// The constructed objects are then passed to the `handler` referenced within this action.
148176
repeated string instances = 3;
177+
178+
// Optional. A handle to refer to the results of the action.
179+
string name = 4;
149180
}
150181

151182
// An Instance tells Mixer how to create instances for particular template.

policy/v1beta1/fixed_cfg.pb.go

Lines changed: 139 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

policy/v1beta1/istio.policy.v1beta1.pb.html

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
location: https://istio.io/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1.html
55
layout: protoc-gen-docs
66
generator: protoc-gen-docs
7-
number_of_entries: 15
7+
number_of_entries: 17
88
---
99
<p>Describes the rules used to configure Mixer&rsquo;s policy and telemetry features.</p>
1010

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

50+
</td>
51+
</tr>
52+
<tr id="Action-name">
53+
<td><code>name</code></td>
54+
<td><code>string</code></td>
55+
<td>
56+
<p>Optional. A handle to refer to the results of the action.</p>
57+
5058
</td>
5159
</tr>
5260
</tbody>
@@ -559,6 +567,100 @@ <h2 id="Rule">Rule</h2>
559567
<td>
560568
<p>Optional. The actions that will be executed when match evaluates to <code>true</code>.</p>
561569

570+
</td>
571+
</tr>
572+
<tr id="Rule-request_header_operations">
573+
<td><code>requestHeaderOperations</code></td>
574+
<td><code><a href="#Rule-HeaderOperationTemplate">Rule.HeaderOperationTemplate[]</a></code></td>
575+
<td>
576+
<p>Optional. Templatized operations on the request headers using attributes produced by the
577+
rule actions.</p>
578+
579+
</td>
580+
</tr>
581+
<tr id="Rule-response_header_operations">
582+
<td><code>responseHeaderOperations</code></td>
583+
<td><code><a href="#Rule-HeaderOperationTemplate">Rule.HeaderOperationTemplate[]</a></code></td>
584+
<td>
585+
<p>Optional. Templatized operations on the response headers using attributes produced by the
586+
rule actions.</p>
587+
588+
</td>
589+
</tr>
590+
</tbody>
591+
</table>
592+
</section>
593+
<h2 id="Rule-HeaderOperationTemplate">Rule.HeaderOperationTemplate</h2>
594+
<section>
595+
<p>A template for an HTTP header manipulation.</p>
596+
597+
<table class="message-fields">
598+
<thead>
599+
<tr>
600+
<th>Field</th>
601+
<th>Type</th>
602+
<th>Description</th>
603+
</tr>
604+
</thead>
605+
<tbody>
606+
<tr id="Rule-HeaderOperationTemplate-name">
607+
<td><code>name</code></td>
608+
<td><code>string</code></td>
609+
<td>
610+
<p>Required. Header name.</p>
611+
612+
</td>
613+
</tr>
614+
<tr id="Rule-HeaderOperationTemplate-values">
615+
<td><code>values</code></td>
616+
<td><code>string[]</code></td>
617+
<td>
618+
<p>Optional. Header values to replace or append.</p>
619+
620+
</td>
621+
</tr>
622+
<tr id="Rule-HeaderOperationTemplate-operation">
623+
<td><code>operation</code></td>
624+
<td><code><a href="#Rule-HeaderOperationTemplate-Operation">Rule.HeaderOperationTemplate.Operation</a></code></td>
625+
<td>
626+
<p>Optional. Header operation type. Default operation is to replace the value of the header by name.</p>
627+
628+
</td>
629+
</tr>
630+
</tbody>
631+
</table>
632+
</section>
633+
<h2 id="Rule-HeaderOperationTemplate-Operation">Rule.HeaderOperationTemplate.Operation</h2>
634+
<section>
635+
<p>Header operation type.</p>
636+
637+
<table class="enum-values">
638+
<thead>
639+
<tr>
640+
<th>Name</th>
641+
<th>Description</th>
642+
</tr>
643+
</thead>
644+
<tbody>
645+
<tr id="Rule-HeaderOperationTemplate-Operation-REPLACE">
646+
<td><code>REPLACE</code></td>
647+
<td>
648+
<p>replaces the header with the given name</p>
649+
650+
</td>
651+
</tr>
652+
<tr id="Rule-HeaderOperationTemplate-Operation-REMOVE">
653+
<td><code>REMOVE</code></td>
654+
<td>
655+
<p>removes the header with the given name (the value is ignored)</p>
656+
657+
</td>
658+
</tr>
659+
<tr id="Rule-HeaderOperationTemplate-Operation-APPEND">
660+
<td><code>APPEND</code></td>
661+
<td>
662+
<p>appends the values to the existing values (preserving existing values)</p>
663+
562664
</td>
563665
</tr>
564666
</tbody>

0 commit comments

Comments
 (0)