curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Reviewing PDK Prerequisites
To begin using Flex Gateway Policy Development Kit (PDK), ensure you have the following prerequisites installed.
Flex Gateway
PDK tutorials assume that you have downloaded Flex Gateway and have some prior knowledge of the product.
Policies created with PDK might be compatible with Flex Gateway versions that aren’t compatible with PDK’s integration testing framework. The Flex Gateway version used for testing doesn’t affect the functionality of the policy when deployed to a different Flex Gateway version. See the following table to ensure your Flex Gateway’s compatibility:
Component | Minimum Flex Gateway Version | Maximum Flex Gateway Version |
---|---|---|
Policies |
1.6.1 |
Latest |
Testing Framework |
1.6.1 |
1.6.1 |
Rust Requirements for Using PDK
-
Git
To download and install, see Installing Git.
-
Rust programming language v1.74.0 or later
To install or update Rust, run the following curl command:
If you do not have curl installed, see Install curl. -
Rust WebAssembly System Interface (WASI) Crate
To install or update Rust WASI, run the following command:
rustup target add wasm32-wasi
-
Cargo Generate
To install or update Cargo Generate, run the following command:
cargo install --locked cargo-generate
Supported Operating Systems
-
macOS
-
Ubuntu
To use Ubuntu, execute the following commands to install the required packages after installing the Rust Requirements for Using PDK:
sudo apt install -y build-essential sudo apt install -y pkg-config sudo apt install -y libssl-dev
-
Windows
PDK supports Windows to develop and test you custom policy. However, Flex Gateway does not support Windows in production environments. To execute the
make
commands included in PDK, install:-
Make, with either:
-
Chocolatey:
choco install make
Anypoint CLI
To configure the Anypoint CLI for PDK:
-
Install Anypoint CLI 4.x v1.4.4 or later.
To find your Anypoint CLI 4.x version, see Verify the Core Package Version. -
Authenticate to the Anypoint Platform CLI using a Connected App.
Authenticate with a Connected App by providing the app’s client ID and client secret.
In addition to the View Organization
andView Environment
scopes required to authenticate to Anypoint Platform, to complete Uploading Custom Policies to Exchange, the Connected App must have theExchange Contributor
scope applied. -
Run the following command to install or update the Anypoint CLI PDK Plugin:
anypoint-cli-v4 plugins:install anypoint-cli-pdk-plugin
Docker
Docker is required to use the local debugging environment and the integration testing framework provided with PDK. You can still build and publish policies without docker.
To install Docker, see Install Docker.
You can run Flex Gateway in Local Mode on Docker in Windows only to develop and test your policies. However, Flex Gateway does not support Windows in production environments. |
Visual Studio (Suggested IDE)
You can use PDK in any IDE or text editor, such as Microsoft Visual Studio with the Rust in Visual Studio Code Plugin installed.