anypoint-cli-v4 plugins:install anypoint-cli-pdk-plugin
Upgrading PDK
To update a custom policy project, you must update each of these separately versioned Flex Gateway Policy Development Kit (PDK) components:
-
Anypoint CLI PDK plugin
-
PDK Rust libraries
-
Anypoint Cargo plugin
-
Policy Rust Version
-
WASI Crate
When you upgrade your Anypoint CLI PDK plugin, you must manually upgrade the PDK Rust libraries and Anypoint Cargo plugin to be compatible with the new plugin version. All the PDK custom policies on your device use the same Anypoint CLI PDK plugin. When you create a new custom policy project, the PDK Rust libraries and Anypoint Cargo plugin versions are the same as the Anypoint CLI PDK plugin used to create the project and are independent from other policy projects.
To upgrade a custom policy project created with an earlier version of the Anypoint CLI PDK plugin:
Upgrade the Anypoint CLI PDK Plugin
When editing a custom policy created with an earlier plugin version, ensure your PDK Rust libraries and Anypoint Cargo plugin match your Anypoint CLI PDK plugin version.
To upgrade your Anypoint CLI PDK plugin to the latest version, execute the following command:
To verify your current plugin version, execute the following command:
anypoint-cli-v4 plugins
For example, the following PDK plugin version is 1.6.0:
anypoint-cli-pdk-plugin 1.6.0
├─ anypoint-cli-command 1.5.2
│ └─ @oclif/plugin-help 5.1.12
└─ @oclif/plugin-version 1.0.4
Upgrade the PDK Rust Libraries
The PDK Rust library is the Rust code library used by a specific custom policy. Different custom policies might use different PDK library versions.
To upgrade the PDK Rust code libraries, modify the pdk dependency and pdk-test dev-dependency versions in the cargo.toml file of the custom policy. The pdk and pdk-test versions must match and your Anypoint CLI PDK plugin must support the specified version.
In the following example, both dependency versions are 1.6.0. Modify it to your required version:
[dependencies]
pdk = { version = "1.6.0" }
[dev-dependencies]
pdk-test = { version = "1.6.0" }
Upgrade the Anypoint Cargo Plugin
The Anypoint Cargo plugin extends the functionality of Cargo for use with the PDK Rust Libraries.
To upgrade your Anypoint Cargo plugin:
-
Open the
Makefileof your custom policy. -
Find the
install-cargo-anypointtarget, for example:install-cargo-anypoint: cargo install cargo-anypoint@1.6.0
-
Change the version after the
@character to the required version. -
Save the
Makefile. -
Execute the
make setupcommand:make setupExecuting the make setupcommand for a certain policy installs that policy’s Anypoint Cargo plugin version. -
Execute the following command to verify the correct version is installed:
cargo anypoint --version
Upgrade a Policy’s Rust Version
To upgrade your Policy’s Rust version:
-
Ensure the Rust version is downloaded on your device.
To update Rust, see Rust Requirements for Using PDK.
-
Open the
cargo.tomlof your custom policy. -
Find your Rust version. For example:
rust-version = "1.87.0"
-
Update your Rust version. For example:
rust-version = "1.88.0"
-
Save the
cargo.tomlfile.
Upgrade a Policy’s WASI Crate
To upgrade your Rust WebAssembly System Interface (WASI) Crate from wasm32-wasi to wasm32-wasip1:
-
Open the
Makefileof your custom policy. -
Find this line:
TARGET := wasm32-wasi
-
Replace
wasm32-wasiwithwasm32-wasip1:TARGET := wasm32-wasip1
-
Save the
Makefile. -
Open the
tests/common/mod.rsof your custom policy. -
Find the this line:
pub const POLICY_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/wasm32-wasi/release"); -
Replace
wasm32-wasiwithwasm32-wasip1:pub const POLICY_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/target/wasm32-wasip1/release"); -
Save the
mod.rsfile.
Upgrade Policies with Versions Earlier Than 1.6.0
In PDK 1.6.0, the PDK libraries moved from the Anypoint platform to crates.io. When upgrading from versions earlier than 1.6.0, you must update the dependencies to point to the new location. To upgrade policies with versions earlier than 1.6.0:
-
Upgrade the PDK Rust libraries:
-
Locate the
dependenciesanddev-dependenciesin your policy’scargo.toml:[dependencies] pdk = { version = "1.5.0", registry = "anypoint" } [dev-dependencies] pdk-test = { version = "1.5.0", registry = "anypoint" } -
Update the version and remove the
registry = "anypoint":[dependencies] pdk = { version = "1.6.0" } [dev-dependencies] pdk-test = { version = "1.6.0" } -
Save the
cargo.tomlfile.
-
-
Upgrade the Anypoint Cargo Plugin:
-
Open the
Makefileof your custom policy. -
Find the
install-cargo-anypointtarget, for example:install-cargo-anypoint: cargo install cargo-anypoint@1.5.0 --registry anypoint --config .cargo/config.toml
-
Update the version and remove the
--registryand--configflags:install-cargo-anypoint: cargo install cargo-anypoint@1.6.0
-
Save the
Makefilefile.
-
-
Remove the Anypoint Platform registry references from your
setupcommand:-
Open the
Makefileof your custom policy. -
Find the
setuptarget, for example:.PHONY: setup setup: registry-creds login install-cargo-anypoint ## Setup all required tools to build cargo fetch
-
Remove the Anypoint Platform registry references:
.PHONY: setup setup: install-cargo-anypoint ## Setup all required tools to build cargo fetch
-
Delete the
loginandregistry-credstargets. For example:To find an example of the targets, see the
loginandregistry-credstargets in the Certification Policy. -
Save the
Makefilefile.
-
-
Execute
make setupto install the updated versions.



