Contact Free trial Login

Enable a Resource Level Support for a Custom Policy

To enable a resource level support for your custom policy you need to add some YAML and XML code to existing custom policy configuration and definition files, respectively, to support resource level policies in Mule 3.8.1 and later.

  1. In the XML definition file, change the standard pointcut definition as follows:

    FROM:

    <pointcut>
      <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
    </pointcut>

    TO:

    {{#pointcutData.length}}
      {{#pointcutData}}
        <pointcut>
          <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
          <resource methodRegex="{{methodRegex}}" uriTemplateRegex="{{uriTemplateRegex}}"/>
        </pointcut>
      {{/pointcutData}}
    {{/pointcutData.length}}
    {{^pointcutData.length}}
      <pointcut>
        <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
      </pointcut>
    {{/pointcutData.length}}
  2. Add the following key/value pair to the YAML file:

    resourceLevelSupported: true

  3. In Anypoint Platform, click API Manager.

  4. In API Administration, choose Custom policies.

  5. Click Add Custom Policy.

  6. In Add Custom Policy, give the new policy a name, for example myResourceLevelPolicy.

  7. Browse to and select the YAML and XML files you created or downloaded.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.