-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1575 from wso2/Nashaath-patch-33
Add content on applying advanced settings on mediation policies
- Loading branch information
Showing
9 changed files
with
66 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# About API Policies | ||
|
||
API policies are units of business logic that you can apply to modify the flow of API invocations. | ||
|
||
You can apply a policy to alter the `Request`, `Response`, or `Error` flow of an API invocation before it reaches the backend or the client. For example, you can add a policy to the response flow to transform the payload from JSON to XML and add a header to the response. | ||
|
||
## Inbuilt mediation policies | ||
|
||
Choreo supports a set of inbuilt mediation policies that can handle common API transformation and mediation tasks. These policies run within a single mediation service, making it straightforward to implement and manage complex mediation logic. The following inbuilt policies are available in Choreo: | ||
|
||
- **JSON to XML**: Transforms a JSON payload in a request or response into XML format. This policy is applicable only to JSON payloads in mediation flows. Applying it to a non-JSON payload terminates the flow. This policy cannot be used more than once on the same resource because the payload will already be converted to XML. | ||
- **XML to JSON**: Converts an XML payload in a request or response into JSON format. This policy is applicable only to XML payloads in mediation flows. Applying it to a non-XML payload terminates the flow. This policy cannot be used more than once on the same resource because the payload will already be converted to JSON. | ||
- **Remove Query Parameter**: Removes specified query parameters from a request. You can use this policy multiple times to remove different parameters. Attempting to remove a non-existent parameter has no effect. If the parameter exists, it will be removed; otherwise, the request proceeds as usual. | ||
- **Remove Header**: Removes specified headers from a request or response. You can attach this policy multiple times to remove multiple headers. The header name must be static, but you can use placeholders to configure different values for different environments. For example, `${headerName}`. | ||
- **Add Query Parameter**: Adds query parameters to a request. You can attach this policy multiple times to add various parameters. Adding the same parameter multiple times creates an array of values. The parameter name and value must be static, but you can use placeholders to configure different values for different environments. For example, `${fooValue}`. | ||
- **Add Header**: Adds headers to a request or response. If the same header is added multiple times, values are appended rather than overwritten. The header name and value must be static, but you can use placeholders to configure different values for different environments. For example, `${authzHeaderValue}`. | ||
- **Set Header**: Sets headers in a request or response, overwriting any existing values. You can attach this policy multiple times to set multiple headers. Each time the same header is set, it replaces the previous value. The header name and value must be static, but you can use placeholders to configure different values for different environments. For example, `${authzHeaderValue}`. | ||
- **Rewrite Resource Path**: Modifies the resource path of an HTTP request by replacing the original path with a new relative path. You can apply this policy multiple times, but only the last instance will take effect. The new path must be static, but you can use placeholders to configure different values for different environments. For example, `${myResourcePath}`. | ||
- **Log Message**: Logs the payload and headers of a request or response. Attaching this policy multiple times results in duplicate log entries. By default, headers and payloads are not logged. To log them, you can enable `Log Headers` and `Log Payload` parameters. To exclude specific headers when logging, you can use the `Excluded Headers` parameter, which takes a comma-separated list of header names. An error will occur if payload logging is enabled but the payload cannot be read. | ||
|
||
These inbuilt mediation policies provide flexibility to manage API requests and responses, allowing for custom transformations and logic without requiring custom code. | ||
|
||
For details on attaching and managing one or more policies to an API proxy component implementation via the Choreo Console, see [Attach and Manage Policies](../api-policies/attach-and-manage-policies.md). | ||
|
||
For details on applying advanced settings on mediation policies, see [Apply Advanced Settings on Mediation Policies](../api-policies/apply-advanced-settings-on-mediation-policies.md). |
28 changes: 28 additions & 0 deletions
28
...cs/api-management/api-policies/apply-advanced-settings-on-mediation-policies.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Apply Advanced Settings on Mediation Policies | ||
|
||
Advanced settings for mediation policies are available for proxy components with an attached mediation policy. For details on attaching a mediation policy to a proxy component, see [Attach and Manage Policies](../api-policies/attach-and-manage-policies.md). | ||
|
||
The approach to applying advanced settings depends on whether the proxy component is deployed or not. | ||
|
||
## Mediation policy advanced settings | ||
|
||
| **Setting** | **Purpose** | **How to apply** | **Impact** | | ||
|---------------------------------|----------------|-------------------|--------------| | ||
| **HTTP version** | By default, Choreo supports HTTP 1.1. If necessary, you can change to HTTP 1.0 or HTTP 2.0. | Specify the required HTTP version in the **Advanced Settings** field. <br> ![HTTP version setting](../../assets/img/api-management/api-policies/advanced-settings/http-version-setting.png) | The mediation application will use the specified HTTP version when interacting with backend services. | | ||
| **Hostname verification** | Choreo enables hostname verification by default when using mTLS. You can disable it if necessary. | Set the `verifyHostname` parameter to `false` in the **Advanced Settings** field. <br> ![Hostname verification setting](../../assets/img/api-management/api-policies/advanced-settings/hostname-verification-setting.png) | Hostname verification will be skipped during mTLS interactions. | | ||
| **Minimum evictable idle time** | Determines how long (in seconds) an outgoing connection remains idle before eviction. The default is 300 seconds. | Set the required idle time in the **Advanced Settings** field. <br> ![Minimum evictable idle time setting](../../assets/img/api-management/api-policies/advanced-settings/minimum-evictable-idle-time-setting.png) | Idle connections will be closed and evicted after the defined period. | | ||
| **Detailed access log** | By default, logs related to the mediation application are generated and can be viewed as [runtime logs](../../monitoring-and-insights/view-logs.md#runtime-logs). You can disable these logs if necessary. | Set the `detailedAccessLog` parameter in the **Advanced Settings** field. <br> ![Detailed access log setting](../../assets/img/api-management/api-policies/advanced-settings/detailed-access-log-setting.png) | Logs related to the mediation application will not be generated. | | ||
|
||
## Configure advanced settings for a proxy component | ||
|
||
To configure advanced settings for a proxy component with an attached mediation policy, follow these steps: | ||
|
||
1. Sign in to the [Choreo Console](https://console.choreo.dev). | ||
2. In the **Component Listing** pane, click on the REST API Proxy component for which you want to configure advanced settings. | ||
3. In the left navigation menu, click **Deploy**. | ||
4. Depending on the deployment status of the proxy component, follow one of these steps: | ||
- If the proxy component is not deployed, go to the **Set Up** card and click **Configure & Deploy**. | ||
- If the proxy component is already deployed, go to the respective environment card depending on the environment you want to apply advanced settings, and then click the **Environment Variables** icon. | ||
5. In the **Configurations** pane that opens, expand the **Defaultable Configurables** section. | ||
6. In the **Advanced Settings** field, configure the necessary settings as described in the [Mediation policy advanced settings](#mediation-policy-advanced-settings) section. | ||
7. Click **Save & Deploy**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+101 KB
...g/api-management/api-policies/advanced-settings/detailed-access-log-setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+99.8 KB
...api-management/api-policies/advanced-settings/hostname-verification-setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+98.5 KB
...sets/img/api-management/api-policies/advanced-settings/http-version-setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+101 KB
...nagement/api-policies/advanced-settings/minimum-evictable-idle-time-setting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters