Applying a Custom Policy
To make a custom policy available to users, you add the policy to Anypoint Platform in API Manager. Users can then see and apply the custom policy listed on the Policies tab of the API version details page of an API.
To add a policy:
Go to the API Administration page, click the menu icon on the top-right, and then choose Custom policies.
The Custom policies page appears:
Click Add custom policy.
Give the policy a name and provide the files that define and configure the policy.
After you create a policy, you manage it from your custom policies page:
You can apply a policy as follows:
On the API Administration page, click a version of an API.
The API version page appears.
Scroll to the bottom of the page, and click Policies.
The list of any applied and available policies appears.
Find your custom policy in the list of available policies, and click Apply.
Properties you set up in the policy template YAML file, such as description, category, required characteristics, and provided characteristics are displayed in this list. When you click Apply, a dialog based on what you defined in the YAML file appears.
In Mule Runtime 3.8 and later and API Gateway Runtime 2.1 and later, when an online policy is malformed and it raises a parse exception, it’s stored under
failedPolicies directory inside
policies directory, waiting to be reviewed. In the next poll for policies it won’t be parsed. If you delete that policy, it is deleted from that folder too. If the folder has no policies, it is deleted.