--- swagger: "2.0" info: x-ibm-name: "Test_Redact" title: "Test_Redact" version: "1.0.0" schemes: - "https" host: "$(catalog.host)" basePath: "/" consumes: - "application/json" produces: - "application/json" securityDefinitions: clientIdHeader: type: "apiKey" in: "header" name: "X-IBM-Client-Id" security: - clientIdHeader: [] x-ibm-configuration: testable: true enforced: true cors: enabled: true assembly: execute: - gatewayscript: title: "add headers" version: "1.0.0" source: "// fetch header from recent request\nvar thisRequestHeader = apim.getvariable('message.headers');\n\ // add 1st header field\nthisRequestHeader['X-a-header-i-want-to-add'] =\ \ \"custom_value\";\n// add 2nd header field\nthisRequestHeader['X-another-header-i-want-to-add']\ \ = \"custom_value\";\n// write results back to message\napim.setvariable('message.headers',thisRequestHeader);\ \ \n" description: "adds 2 headers to the request message" - gatewayscript: title: "change and delete headers" version: "1.0.0" source: "// fetch header from recent request\nvar thisRequestHeader = apim.getvariable('message.headers');\n\ // change header -\n// could be used for masking headers\nthisRequestHeader['X-a-header-i-want-to-add']\ \ = \"custom_value_changed\";\n// store it back in the message\napim.setvariable('message.headers',thisRequestHeader);\ \ \n// delete header\napim.setvariable('message.headers.X-another-header-i-want-to-add',\ \ '', 'clear');\n" description: "changes one header field and deletes the other" - redact: title: "redact1 remove parameter" actions: - action: "remove" from: - "all" path: "//*[@name='myParam1']" version: "1.0.0" description: "uses the redact policy to remove a parameter\n(scope: all -\ \ request, response, logs)" - redact: title: "redact2 mask parameter" actions: - action: "redact" from: - "all" path: "//*[@name='myParam2']" version: "1.0.0" description: "uses the redact policy to mask a parameter\n(scope: all - request,\ \ response, logs)" - proxy: title: "proxy" timeout: 60 verb: "keep" cache-response: "protocol" cache-ttl: 900 version: "1.0.0" target-url: "http://httpbin.org/get" description: "calls a proxy to show the results of the request modifications" - activity-log: title: "activity-log" content: "none" error-content: "none" version: "1.0.0" catch: [] phase: "realized" paths: /test_redact: get: responses: 200: description: "200 OK" parameters: - name: "myParam1" type: "string" required: false in: "query" - name: "myParam2" type: "string" required: false in: "query" tags: []