Contact Us 1-800-596-4880

Developing Custom Policies

After installing the Prerequisites, you can develop custom policies by using Flex Gateway Policy Development Kit (PDK).

The custom policy lifecycle consists of all the steps of developing a custom policy that occur in PDK. The following steps do not include steps that occur outside of PDK, such as applying a policy, which is the same for all Flex Gateway policies.

After you create a new project, you might iteratively complete some steps. For example, while writing the policy’s source code, you might need to return to add additional parameters, or you might need to recompile the policy after debugging the source code.

To create a custom policy with PDK, follow these steps:

  1. Create a new project.

  2. Define a schema definition.

    Modify the definition/gcl.yaml file to define metadata and configuration parameters for your custom policy.

  3. Configure custom policy features in Rust.

    Use the rust code examples to implement your custom logic in the src/lib.rs file.

  4. Compile your custom policy.

    Compiling your policy creates the WebAssembly binary file and configuration files necessary to upload your policy to Exchange and deploy it to a Flex Gateway.

  5. Debug Your Policy with the PDK Debugging Playground.

    Use the playground provided with PDK to debug the functionality of your custom policy locally.

  6. Write Integration Tests.

    Write intergration tests to ensure your custom policy is compatible with your other services and to ensure that each new policy version does not introduce regression errors.

  7. Publish your policy on Exchange.

    Publish your policy on Exchange to distribute a beta version of your policy for testing with your Flex Gateway configuration. To deploy a policy to Flex Gateway, see step 9.

  8. Release your policy on Exchange.

    Release your policy on Exchange to distribute a production-ready policy.

  9. Deploy your custom policy to a production environment by applying it to an API instance deployed on Flex Gateway.

  10. Configure a new version of this API instance by returning to step 2.