Nav
You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

To Add Resource Level Policy Support to a 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:

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

    TO:

    
                
             
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    {{#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.

Download Example XML and YAML Files

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.

+