Reading Time: 7 minutes

In API management, the need for tailored solutions is paramount given how dynamic APIM is. With this in mind, MuleSoft is thrilled to announce Anypoint Flex Gateway Policy Development Kit (PDK) – designed to revolutionize the design, test, validation and deployment of custom policies to extend the functionality of Anypoint Flex Gateway. 

Why do you need the Policy Development Kit (PDK)?

Anypoint Flex Gateway is an ultrafast, lightweight API Gateway to protect and secure any API, deployed anywhere. Flex Gateway comes with a rich set of included policies for security, traffic management, transformation and more. However, you need custom policies if you have unique business requirements that are not covered by the included policies.

latest report
Learn why we are the Leaders in API management and iPaaS

Flex Gateway is built on Envoy proxy which is highly extensible but introduces some complexities for custom policy developers due to the Event driven architecture. PDK implements an Async/Await pattern in Rust that allows developers to write code that is easier to understand and maintain, by hiding the asynchronous nature of the Envoy SDK.

In addition, the Envoy Web Assembly (WASM) SDK has a steep learning curve due to the minimal documentation. 

PDK provides capabilities such as: 

  • Templates
  • Wrapper functions
  • Custom logging and caching
  • Header/payload manipulation
  • Support for Dataweave expressions

PDK also allows making HTTP calls to external services, support for shared data and third party libraries that are compatible with Rust code compiled for WebAssembly. The extensive documentation and code samples that come with PDK will reduce the learning curve for building custom policies.

Build custom policies faster with an improved developer experience  

With PDK, developers can create, test, debug and publish the custom policy to Anypoint exchange after validation using popular IDE’s such as Visual Studio Code. It uses a plugin for Anypoint CLI which is a powerful command-line tool that simplifies and accelerates the management of the Anypoint platform, enhancing productivity for developers and administrators.

Anypoint Flex Gateway Policy Development Kit in Visual Studio Code

PDK automates tedious tasks, including building the policy project structure with the various artifacts like implementation and policy definition along with a template policy. This is automatically created with a single command to allow you to implement custom logic by building upon the template policy.

Jumpstart your custom policy development with PDK 

PDK is crafted to empower developers at every skill level to create, test and deploy Flex Gateway custom policies with ease. Here’s a peek of what you can find with PDK. 

SDK and development templates

The Rust SDK that comes with the PDK helps to abstract the complexities of the low level Envoy interface by providing a built-out template. In addition, it provides wrapped functions that implement various use cases, helps with code reuse, and simplifies maintenance. PDK also includes code snippets and detailed documentation to kickstart your custom policy development. 

Testing and debugging capabilities

Testing and debugging are essential to ensure custom policies are secure, performant, and function as intended in all scenarios. The PDK provides a preconfigured API instance to begin testing your policy on Flex Gateway instances registered in local mode. In addition, PDK provides the capability to write integration tests for the custom policy, including the ability for developers to mock requests and responses.

Seamless deployment user experience

PDK takes care of the end-to-end lifecycle management of the custom policy, starting from creation to validation and eventually publishing to Anypoint exchange. These custom policies can then be applied to the Flex Gateway instance from Anypoint API Manager, providing the same user experience as Mulesoft’s included policies.    

Custom Policy available in Anypoint API Manager to apply to an API

A new era in Flex Gateway customization

Create flexible security policies and extend the included policies of Anypoint Flex Gateway to cover unique use cases. As AI initiatives demand more data protection, developers can quickly build policies to detect and protect sensitive data sent to AI LLM models using APIs. Learn more about the Anypoint Flex Gateway Policy Development Kit to get started with the installation.

For more information, check out the product spotlight videos we’ve created for PDK and Anypoint Flex Gateway below, and don’t forget to sign up for a 30-day trial of Anypoint Platform to help you get started on your MuleSoft journey: