Skip to content

Commit b8510ff

Browse files
Merge pull request #232537 from dlepow/pol5
[APIM] Policy expression support in policies - 5
2 parents d90fedc + 4f58cb2 commit b8510ff

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

articles/api-management/set-body-policy.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Use the `set-body` policy to set the message body for incoming and outgoing requ
3232

3333
| Attribute | Description | Required | Default |
3434
| ----------------- | ------------------------------------------------------ | -------- | ------- |
35-
|template|Used to change the templating mode that the `set-body` policy will run in. Currently the only supported value is:<br /><br />- `liquid` - the `set-body` policy will use the liquid templating engine |No| N/A|
36-
|xsi-nil| Used to control how elements marked with `xsi:nil="true"` are represented in XML payloads. Set to one of the following values:<br /><br />- `blank` - `nil` is represented with an empty string.<br />- `null` - `nil` is represented with a null value.|No | `blank` |
35+
|template|Used to change the templating mode that the `set-body` policy runs in. Currently the only supported value is:<br /><br />- `liquid` - the `set-body` policy will use the liquid templating engine |No| N/A|
36+
|xsi-nil| Used to control how elements marked with `xsi:nil="true"` are represented in XML payloads. Set to one of the following values:<br /><br />- `blank` - `nil` is represented with an empty string.<br />- `null` - `nil` is represented with a null value.<br/></br>Policy expressions aren't allowed. |No | `blank` |
3737

3838
For accessing information about the request and response, the Liquid template can bind to a context object with the following properties: <br />
3939
<pre>context.
@@ -82,10 +82,10 @@ OriginalUrl.
8282

8383
### Usage notes
8484

85-
- If you are using the `set-body` policy to return a new or updated body, you don't need to set `preserveContent` to `true` because you are explicitly supplying the new body contents.
86-
- Preserving the content of a response in the inbound pipeline doesn't make sense because there is no response yet.
85+
- If you're using the `set-body` policy to return a new or updated body, you don't need to set `preserveContent` to `true` because you're explicitly supplying the new body contents.
86+
- Preserving the content of a response in the inbound pipeline doesn't make sense because there's no response yet.
8787
- Preserving the content of a request in the outbound pipeline doesn't make sense because the request has already been sent to the backend at this point.
88-
- If this policy is used when there is no message body, for example in an inbound `GET`, an exception is thrown.
88+
- If this policy is used when there's no message body, for example in an inbound `GET`, an exception is thrown.
8989

9090
For more information, see the `context.Request.Body`, `context.Response.Body`, and the `IMessageBody` sections in the [Context variable](api-management-policy-expressions.md#ContextVariables) table.
9191

@@ -162,7 +162,7 @@ The following Liquid filters are supported in the `set-body` policy. For filter
162162

163163
### Accessing the body as a string
164164

165-
We are preserving the original request body so that we can access it later in the pipeline.
165+
We're preserving the original request body so that we can access it later in the pipeline.
166166

167167
```xml
168168
<set-body>
@@ -178,7 +178,7 @@ We are preserving the original request body so that we can access it later in th
178178

179179
### Accessing the body as a JObject
180180

181-
Since we are not reserving the original request body, accessing it later in the pipeline will result in an exception.
181+
Since we're not reserving the original request body, accessing it later in the pipeline will result in an exception.
182182

183183
```xml
184184
<set-body
@@ -239,7 +239,7 @@ This example shows how to perform content filtering by removing data elements fr
239239
```
240240

241241
### Access the body as URL-encoded form data
242-
The following example uses the `AsFormUrlEncodedContent()` expression to access the request body as URL-encoded form data (content type `application/x-www-form-urlencoded`), and then converts it to JSON. Since we are not reserving the original request body, accessing it later in the pipeline will result in an exception.
242+
The following example uses the `AsFormUrlEncodedContent()` expression to access the request body as URL-encoded form data (content type `application/x-www-form-urlencoded`), and then converts it to JSON. Since we're not reserving the original request body, accessing it later in the pipeline will result in an exception.
243243

244244
```xml
245245
<set-body
@@ -251,7 +251,7 @@ The following example uses the `AsFormUrlEncodedContent()` expression to access
251251
```
252252

253253
### Access and return body as URL-encoded form data
254-
The following example uses the `AsFormUrlEncodedContent()` expression to access the request body as URL-encoded form data (content type `application/x-www-form-urlencoded`), adds data to the payload, and returns URL-encoded form data. Since we are not reserving the original request body, accessing it later in the pipeline will result in an exception.
254+
The following example uses the `AsFormUrlEncodedContent()` expression to access the request body as URL-encoded form data (content type `application/x-www-form-urlencoded`), adds data to the payload, and returns URL-encoded form data. Since we're not reserving the original request body, accessing it later in the pipeline will result in an exception.
255255

256256
```xml
257257
<set-body

articles/api-management/set-header-policy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ The `set-header` policy assigns a value to an existing HTTP response and/or requ
3030

3131
|Name|Description|Required|Default|
3232
|----------|-----------------|--------------|-------------|
33-
|exists-action|Specifies action to take when the header is already specified. This attribute must have one of the following values.<br /><br /> - `override` - replaces the value of the existing header.<br />- `skip` - does not replace the existing header value.<br />- `append` - appends the value to the existing header value.<br />- `delete` - removes the header from the request.<br /><br /> When set to `override`, enlisting multiple entries with the same name results in the header being set according to all entries (which will be listed multiple times); only listed values will be set in the result.|No|`override`|
34-
|name|Specifies name of the header to be set.|Yes|N/A|
33+
|exists-action|Specifies action to take when the header is already specified. This attribute must have one of the following values.<br /><br /> - `override` - replaces the value of the existing header.<br />- `skip` - does not replace the existing header value.<br />- `append` - appends the value to the existing header value.<br />- `delete` - removes the header from the request.<br /><br /> When set to `override`, enlisting multiple entries with the same name results in the header being set according to all entries (which will be listed multiple times); only listed values will be set in the result. <br/><br/>Policy expressions are allowed.|No|`override`|
34+
|name|Specifies name of the header to be set. Policy expressions are allowed.|Yes|N/A|
3535

3636

3737
## Elements
3838

3939
|Name|Description|Required|
4040
|----------|-----------------|--------------|
41-
|value|Specifies the value of the header to be set. For multiple headers with the same name, add additional `value` elements.|No|
41+
|value|Specifies the value of the header to be set. Policy expressions are allowed. For multiple headers with the same name, add additional `value` elements.|No|
4242

4343
## Usage
4444

articles/api-management/set-method-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The `set-method` policy allows you to change the HTTP request method for a reque
2323
<set-method>HTTP method</set-method>
2424
```
2525

26-
The value of the element specifies the HTTP method, such as `POST`, `GET`, and so on.
26+
The value of the element specifies the HTTP method, such as `POST`, `GET`, and so on. Policy expressions are allowed.
2727

2828
## Usage
2929

articles/api-management/set-query-parameter-policy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ The `set-query-parameter` policy adds, replaces value of, or deletes request que
2929

3030
|Name|Description|Required|Default|
3131
|----------|-----------------|--------------|-------------|
32-
|exists-action|Specifies what action to take when the query parameter is already specified. This attribute must have one of the following values.<br /><br /> - `override` - replaces the value of the existing parameter.<br />- `skip` - does not replace the existing query parameter value.<br />- `append` - appends the value to the existing query parameter value.<br />- `delete` - removes the query parameter from the request.<br /><br /> When set to `override` enlisting multiple entries with the same name results in the query parameter being set according to all entries (which will be listed multiple times); only listed values will be set in the result.|No|`override`|
33-
|name|Specifies name of the query parameter to be set.|Yes|N/A|
32+
|exists-action|Specifies what action to take when the query parameter is already specified. This attribute must have one of the following values.<br /><br /> - `override` - replaces the value of the existing parameter.<br />- `skip` - does not replace the existing query parameter value.<br />- `append` - appends the value to the existing query parameter value.<br />- `delete` - removes the query parameter from the request.<br /><br /> When set to `override` enlisting multiple entries with the same name results in the query parameter being set according to all entries (which will be listed multiple times); only listed values will be set in the result.<br/><br/>Policy expressions are allowed. |No|`override`|
33+
|name|Specifies name of the query parameter to be set. Policy expressions are allowed. |Yes|N/A|
3434

3535
## Elements
3636

3737
|Name|Description|Required|
3838
|----------|-----------------|--------------|
39-
|value|Specifies the value of the query parameter to be set. For multiple query parameters with the same name, add additional `value` elements.|Yes|
39+
|value|Specifies the value of the query parameter to be set. For multiple query parameters with the same name, add additional `value` elements. Policy expressions are allowed. |Yes|
4040

4141
## Usage
4242

articles/api-management/set-status-policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ The `set-status` policy sets the HTTP status code to the specified value.
2828

2929
| Attribute | Description | Required | Default |
3030
| --------------- | ---------------------------------------------------------- | -------- | ------- |
31-
| code | Integer. The HTTP status code to return. | Yes | N/A |
32-
| reason | String. A description of the reason for returning the status code. | Yes | N/A |
31+
| code | Integer. The HTTP status code to return. Policy expressions are allowed. | Yes | N/A |
32+
| reason | String. A description of the reason for returning the status code. Policy expressions are allowed. | Yes | N/A |
3333

3434

3535
## Usage

articles/api-management/set-variable-policy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ The `set-variable` policy declares a [context](api-management-policy-expressions
2626

2727
| Attribute | Description | Required |
2828
| --------- | ------------------------------------------------------------------------ | -------- |
29-
| name | The name of the variable. | Yes |
30-
| value | The value of the variable. This can be an expression or a literal value. | Yes |
29+
| name | The name of the variable. Policy expressions aren't allowed. | Yes |
30+
| value | The value of the variable. This can be an expression or a literal value. Policy expressions are allowed. | Yes |
3131

3232
## Usage
3333

articles/api-management/trace-policy.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ The `trace` policy adds a custom trace into the request tracing output in the te
3535

3636
| Attribute | Description | Required | Default |
3737
| --------- | ------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
38-
| source | String literal meaningful to the trace viewer and specifying the source of the message. | Yes | N/A |
39-
| severity | Specifies the severity level of the trace. Allowed values are `verbose`, `information`, `error` (from lowest to highest). | No | `verbose` |
38+
| source | String literal meaningful to the trace viewer and specifying the source of the message. Policy expressions aren't allowed. | Yes | N/A |
39+
| severity | Specifies the severity level of the trace. Allowed values are `verbose`, `information`, `error` (from lowest to highest). Policy expressions aren't allowed. | No | `verbose` |
4040

4141
## Elements
4242

4343
|Name|Description|Required|
4444
|----------|-----------------|--------------|
45-
| message | A string or expression to be logged. | Yes |
45+
| message | A string or expression to be logged. Policy expressions are allowed. | Yes |
4646
| metadata | Adds a custom property to the Application Insights [Trace](../azure-monitor/app/data-model-complete.md#trace) telemetry. | No |
4747

4848
### metadata attributes

0 commit comments

Comments
 (0)