---
schema_version: "1"
id: b8b267459414cf9eba928c9c6fbd7b57eea340475dbde8eff6d88b18c6c22053
title: カスタムポリシーのリソースレベルのサポートの有効化
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/mule-gateway/policies-mule3-resource-level-custom-policy.md
canonical_url: https://docs.mulesoft.com/jp/mule-gateway/policies-mule3-resource-level-custom-policy
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3d28f450bde44b844523a5c4f399698cce4e90a7cdf2aa7567fe526f8077b38c
description: MuleSoft Documentation Site
latest: true
---
# カスタムポリシーのリソースレベルのサポートの有効化

カスタムポリシーのリソースレベルのサポートを有効にするには、Mule 3.8.1 以降で、既存のカスタムポリシーの設定ファイルと定義ファイルにそれぞれ YAML コードと XML コードを追加して、リソースレベルのポリシーをサポートします。

1. XML 定義ファイルで、標準ポイントカット定義を次のように変更します。
    
    **変更前:**
    
    ```xml
    <pointcut>
      <api-platform-gw:api-pointcut apiName="{{apiName}}" apiVersion="{{apiVersionName}}"/>
    </pointcut>
    ```
    
    **変更後:**
    
    ```json
    {{#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. YAML ファイルに次のキー/値ペアを追加します。
    
    `resourceLevelSupported: true`
3. Anypoint Platform で、\[API Manager\] をクリックします。
4. \[API Administration (API 管理)\] で、\[Custom policies (カスタムポリシー)\] を選択します。
5. \[Add Custom Policy (カスタムポリシーを追加)\] をクリックします。
6. \[Add Custom Policy (カスタムポリシーを追加)\] で、新しいポリシーに名前 (「myResourceLevelPolicy」など) を付けます。
7. 作成またはダウンロードした YAML ファイルと XML ファイルを参照して選択します。

## [](#関連情報)関連情報

- [カスタムポリシー](https://docs.mulesoft.com/jp/mule-gateway/policies-mule3-custom-policies)
- [カスタムポリシーの作成](https://docs.mulesoft.com/jp/mule-gateway/policies-mule3-creating-custom-policy)