Defining and packaging a global scoped user-defined policy for the DataPower API Gateway
A global scoped user-defined policy is available to APIs in any of the Catalogs in any provider organization. You define your global scoped policy by creating a .cfg configuration file. This configuration file consists of DataPower® API Gateway CLI commands that specify the actions of your policy. You then package this file with any dependent files that are referenced from the CLI commands.
Define a set-variable assembly policy
These commands define a set-variable assembly policy that sets a variable called param1 to the value supplied by the API developer in the API assembly editor. The variable $(local.parameter.credential) refers to an input field labeled credential that is displayed in the properties window for the policy when it is added to an API assembly, and the value of the variable will be set to the value entered in that field.
Define a gateway script assembly policy
This command defines a gateway script assembly policy that executes the Gateway Script in the file abc.js this file must be packaged with the configuration file when the policy is deployed to the DataPower API Gateway. The gateway script-location command must specify the location of the file in the gateway extension folder on the gateway after the policy is deployed, the root of which will be temporary:///filestores/extensions/gateway-extension.
Build the DataPower API Gateway configuration for the policy
These commands specify the policies, in the required sequence, that will be invoked by the user-defined policy.
Create the policy
These commands create the user-defined policy and define the information that will be displayed in the properties window for the policy when it is added to an API assembly. The parameter section causes an input field labeled credential to be displayed; it is the value entered in this field, by the API developer