If

Evaluates a condition and runs logic only when the condition is met.

Use the If policy to evaluate a condition and run specific logic only when the condition is met. This allows you to branch the assembly based on request headers, parameters, or payload values.

For more information on the policy parameter descriptions, see DataPower Nano Gateway documentation.

Example of an If policy in code view.


kind: if
apiVersion: api.ibm.com/v1
metadata:
  name: if-policy
  namespace: lwgw
spec:
  condition: ${request.headers.test} equals x-test
  execute:
    - $ref: lwgw:invoke-backend-1
    - $ref: lwgw:invoke-backend-2