---
schema_version: "1"
id: 0e23bc1a025a8567c2b642090f7886f7bcc01f862c200292c8b831c03563a6ca
title: Custom Policy Examples
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/pdk/1.2/policies-pdk-policy-templates.md
canonical_url: https://docs.mulesoft.com/pdk/1.2/policies-pdk-policy-templates
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8d82f71ddb8a1fe04dc10e4a8cc6755111c7fbf083c4c5b44d4083dfd6b00adb
description: MuleSoft Documentation Site
release: "1.2"
latest: false
---
---
product: Omni Gateway Policy Development Kit (PDK)
version: 1.2
---

# Custom Policy Examples

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

Flex Gateway Policy Development Kit (PDK) provides example policy projects to get started
configuring your Rust source code.

Find all policy examples and their documentation in the
[PDK Custom Policy GitHub Repository](https://github.com/mulesoft/pdk-custom-policy-examples).

PDK offers the following example policies:

- [Block Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/block/README.md):
  Use the Block Policy as an example of how to block IP ranges by implementing
  [periodic functions](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-timer) and
  [HTTP calls](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-http-request).

- [Certification Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/certs/README.md):
  Use the Certification Policy as an example of how to obtain data concerning connection
  certificates.

- [CORS Validation Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/cors-validation/README.md):
  Use the CORS Validation Policy as an example of how to use functions of the
  [CORS Library](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-cors) in your custom policy.

- [Crypto Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/crypto/README.md):
  Use the Crypto Policy as an example of how to use
  [third-party libraries](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-libraries) that provide cryptography
  capabilities in your custom policy.

- [Data Caching Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/data-caching/README.md):
  Use the Data Caching Policy as an example of how to implement
  [data caching](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-caching) in your custom policy.

- [JWT Validation Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/jwt-validation/README.md):
  Use the JWT Validation Policy as an example of how to use functions of the
  [JWT Library](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-jwt) in your custom policy.

- [Metrics Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/metrics/README.md):
  Use the Metrics Policy as an example of how to periodically send data to a metric ingestion
  service by implementing [periodic functions](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-timer) and
  [HTTP calls](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-http-request).

- [Query Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/query/README.md):
  Use the Query Policy as an example of how to handle
  [DataWeave expressions](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-dataweave) in your custom policy.

- [Simple OAuth 2.0 Validation Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/simple-oauth-2-validation/README.md):
  Use the Simple OAuth 2.0 Validation Policy as an example of how to implement
  [HTTP calls](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-http-request) in your custom policy.

- [Spike Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/spike/README.md):
  Use the Spike Policy as an example of how to configure worker spike control by implementing
  [periodic functions](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-timer).

- [TLS Calls Policy Example](https://github.com/mulesoft/pdk-custom-policy-examples/blob/1.2.0/tls-calls/README.md):
  Use the TLS Calls Policy as an example of how to make HTTPS calls in your policy without
  installing certificates on the operating system running Flex Gateway.

## Set Up an Example Policy Project

To begin using an example policy project:

1.  Ensure you have installed all the [PDK prerequisites](https://docs.mulesoft.com/pdk/1.2/policies-pdk-prerequisites).

2.  Clone the
    [PDK Custom Policy GitHub Repository](https://github.com/mulesoft/pdk-custom-policy-examples)
    with the following command or your preferred GitHub interface:

    ```ssh
    git clone https://github.com/mulesoft/pdk-custom-policy-examples.git
    ```

3.  Navigate to the newly cloned directory, then copy and paste the directory of your desired policy
    into a new location.

4.  In the `cargo.toml` file of the copied policy example, replace the `group-id` with your group
    ID, for example:

    ```toml
    group_id = "<your-group-id>"
    ```

5.  Run the `make setup` command.

    ```ssh
    make setup
    ```

6.  Navigate to the `README.md` file in the example policy to read more about the policy and how to
    test it.

## See Also

- [Implementing Your Custom Policy Features in Rust](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features)
