Operation Switch
Applies logic based on the API operation invoked by the client.
Use the Operation Switch policy to route processing based on the API operation that the client invokes. This lets you apply different logic for GET, POST, DELETE, or other operations within one assembly.
For more information on the policy parameter descriptions, see DataPower Nano Gateway documentation.
Example of an Operation Switch policy in code view.
kind: OperationSwitch
apiVersion: api.ibm.com/v1
metadata:
name: scope_policy_ref
version: 1.0
namespace: sample
spec:
cases:
- conditions:
- verbPath:
path: '/pet'
verb: 'GET'
- operationId:
id: 'getPetById'
- path:
path: ''
- verb:
verb: 'GET'
execute:
- $ref : sample:invoke:1.0
- $ref : sample:parse:1.0
- $ref : sample:redact:1.0
otherwise:
- $ref: sample:invoke:2.0