---
schema_version: "1"
id: a00f42cfefd6a2e5ced3d5b73fb7e9613201478fa38ea5a7b5175e4dddecd537
title: Creating Mule Gateway PDK Policies
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/pdk/1.4/policies-pdk-mule-policies.md
canonical_url: https://docs.mulesoft.com/pdk/1.4/policies-pdk-mule-policies
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c83b981296be4b6fed8ae4e4310bdd6a456f227844ea071b4c0d4c56b5c6a671
description: MuleSoft Documentation Site
release: "1.4"
latest: false
---
---
product: Omni Gateway Policy Development Kit (PDK)
version: 1.4
---

# Creating Mule Gateway PDK Policies

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Flex Gateway Policy Development Kit (PDK) supports creating Mule Gateway policies to enhance your
experience:

- Creating policies

- Defining the configuration schema

- Deploying policies to Exchange

The PDK Anypoint CLI plugin generates custom policy folders with all required policy files. In the
folder, PDK includes a Makefile with commands to build the policy UI and deploy to Exchange.

To create Mule custom policies:

1.  Ensure you meet the [Before You Begin](#before-you-begin) prerequisites.

2.  [Create a custom policy](#create-policy).

3.  [Define a policy schema](#define-schema).

4.  [Define policy logic](#define-policy-logic).

5.  [Publish and release the policy](#publish-policies).

## Before You Begin

Before you begin, ensure you meet the these prerequisites:

- PDK supported operating system with Make installed

  See
  [Supported Operating Systems](https://docs.mulesoft.com/pdk/latest/policies-pdk-prerequisites#supported-operating-systems).

- Anypoint CLI

  See [Anypoint CLI PDK Requirements](https://docs.mulesoft.com/pdk/latest/policies-pdk-prerequisites#cli).

- Java

  For supported Java versions, see [Java Support](https://docs.mulesoft.com/general/java-support).

- [Apache Maven](https://maven.apache.org/)

  Apache Maven is a prerequisite for the [Mule Maven Plugin](https://docs.mulesoft.com/mule-runtime/latest/mmp-concept).
  PDK Mule Policy projects include an embedded Mule Maven Plugin so downloading the plugin is not
  required. To ensure your Maven version is compatible with the latest plugin, see
  [Mule Maven Plugin Release Notes](https://docs.mulesoft.com/release-notes/mule-maven-plugin/mule-maven-plugin-release-notes).

- MuleSoft’s Maven archetype

  Configure MuleSoft’s Maven archetype by adding the following code section to Maven’s
  `settings.xml` file:

  ```xml
   <profiles>
     <profile>
       <id>archetype-repository</id>
       <repositories>
         <repository>
           <id>archetype</id>
           <name>Mule Repository</name>
           <url>https://repository.mulesoft.org/nexus/content/repositories/public</url>
           <releases>
             <enabled>true</enabled>
             <checksumPolicy>fail</checksumPolicy>
           </releases>
           <snapshots>
             <enabled>true</enabled>
             <checksumPolicy>warn</checksumPolicy>
           </snapshots>
         </repository>
       </repositories>
     </profile>
   </profiles>
  ```

## Create a Mule Custom Policy with PDK

To create your custom policy execute:

```cmd
pdk policy-project create --name <policy-name> --implementation-technology mule4
```

Running this command generates a custom policy folder with the policy name. The folder contains a
makefile that provides all the callable actions required during the policy development lifecycle.

## Define a Policy Schema

Use the `gcl.yaml` file inside you policy project to define the policy’s schema. PDK generates your
policy’s UI json from the parameters defined in the schema definition. This replaces the previous
need of manually writing a `config.json` schema file.

To define a schema definition, see
[Defining a Policy Schema Definition](https://docs.mulesoft.com/pdk/1.4/policies-pdk-create-schema-definition). Include all parameters
in schema that you reference in you `template.xml` file.

> [!NOTE] Mule Gateway custom policies support the Dataweave format, but don’t support DataWeave
> Bindings. For more information, see
> [DataWeave Expressions](https://docs.mulesoft.com/pdk/1.4/policies-pdk-create-schema-definition#dataweave-expressions).

## Define the Policy Logic

Define the policy logic in the `template.xml` file.

The `template.xml` file, by default, contains the logic for a basic policy that sets the returned
HTTP Response payload to a “Hello World!” message. View the file to see the logic.

For more policy logic examples, see:

- [Developing a Custom Response Policy](https://docs.mulesoft.com/mule-gateway/policies-custom-response-example)

- [Developing a Custom Policy Using the Event Authentication Extension](https://docs.mulesoft.com/mule-gateway/policies-custom-set-authentication-example)

## Publish and Release Policies

PDK publishes Mule Gateway and Flex Gateway policies in the same way.

To publish and release policies, see
[Publishing Unified-Model Policies to Exchange](https://docs.mulesoft.com/pdk/latest/policies-pdk-publish-policies).

## See Also

- [Mule Gateway Custom Policies](https://docs.mulesoft.com/mule-gateway/policies-custom-overview)
