This folder contains a variety of sample policies that can be used with
IBM API Connect v5. These policies can also be used for the V5 Compatible
gateway configuration of API Connect 2018 or API Connect v10.x
Instructions on how to reuse a sample policy
You can download any of the policies provided and reuse them to make your own by following these instructions:
-
Download policy sample, e.g. gatewayscript-policy, to your system (zip file gatewayscript-policy.zip). You will have to click on “View Raw” to be prompted with the download option.
-
Once downloaded to your system, unzip the file. There should be a yaml definition (e.g. gatewayscript-policy.yaml) and an implementation folder. The DataPower artifacts can be found in the implementation folder in a zip file. The zip file may have the same name as the one downloaded (in the case of the GatewayScript policy, gatewayscript-policy.zip).
-
Login to the DataPower appliance and create a new DataPower domain (e.g. "foo")
-
Import the gatewayscript-policy.zip policy implementation into the new domain foo.
-
From the File Explorer, open the domain configuration file foo.cfg, and do a global find/replace of all “gatewayscript-policy” references with “alice-policy”, assuming here that “alice-policy” will be your new policy name.
-
Create a folder structure “local://policy/alice-policy”
-
Move all contents from “local://policy/gatewayscript-policy” to “local://policy/alice-policy”
-
Restart the foo domain (don't save your configuration before this) to get the DataPower appliance to load the the newly renamed objects.
-
Verify all of the artifacts from “alice-policy” policy are there.
-
Make changes to the processing rules to implement your policy requirements. See: http://www.ibm.com/support/knowledgecenter/SSMNED_5.0.0/com.ibm.apic.policy.doc/capim_custpolicies_overview.html
-
Export your “alice-policy-main” rule action, and give it the name “alice-policy” which after download will be “alice-policy.zip”.
-
Modify the yaml file so that it matches the new policy implementation.
-
Now we have a new yaml file and a new implementation. We just need to create a zip file with all the artifacts: the yaml file, and implementation folder. This will become our new policy to be consumed by APIm.
-
Finally, go to your APIm environment and import the zip file. If there were no naming errors, the policy should be imported correctly into the API manager.
-
Login to the DP appliance and verify the policy was deployed correctly, the rule name will now look like: alice-main_apim_e55cce330e4b0b436ff65a06f_v1.0