Answered
0
0

Trying to transform/map log data from one vendor to another.  For example PAN to Cisco security.

Vendor1 have data as {“approved”:”y”} vs. vendor2 as {“granted”:”yes”}

The “key” can be changed by using the iteration/for-each with array/insert-at, and creating an object with new key names.

But, couldn’t figure out a way to iteratively change the “value”

 

  • You must to post comments
Best Answer
0
0

Inside the action iteration, use data set to set the “id” in an object and lazy chain condition switch to detect the “value”. Inside the condition switch use, data/set again to set the “value”

Save the below configuration as a .json file and upload in your AutoFlow

{"Data":[],"File":[],"Flow":[],"FlowTest":[],"Inbound":[{"id":"<1599257674351121000.0.2043332109.1336410113.164999>","meta":{},"value":{"name":"Sandro Example","port":27700,"type":"http server"}}],"InboundEndpoint":[{"id":"<1599257683370929000.0.2043332109.1336410113.166837>","meta":{"index":["inbound","<1599257674351121000.0.2043332109.1336410113.164999>"]},"value":{"default-test":"<1599257683371188000.0.2043332109.1335361541.119584>","method":"GET","name":"EP1","path":"/","type":"endpoint"}}],"InboundEndpointFlow":[{"id":"<1599257683370929000.0.2043332109.1336410113.166837>","meta":{"index":["inbound","<1599257674351121000.0.2043332109.1336410113.164999>"]},"value":[{"$action":"communication/http-request","body":"","header":{},"method":"GET","mock-result":{"body":"","headers":{},"status-code":200},"name":"get aws guardduty data","output-location":{"__LDATA__":["aws_response"]},"query":{},"timeout":5000,"url":"https://autoflow-files.s3-us-west-2.amazonaws.com/guardduty+data.json","use-mock-result":false},{"$action":"json/decode","json":{"__LDATA__":["aws_response","body"]},"name":"json/decode aws response body","output-location":{"__LDATA__":["aws_response","body"]}},{"$action":"iteration/map","array":{"__LDATA__":["aws_response","body"]},"do":[{"$action":"data/set","at-location":{"__LDATA__":["value"]},"name":"set new object","value":{"aid":{"__LDATA__":["value","accountId"]},"new_region":{"__LDATA__":["value","region"]},"new_service":{"action":{"new_actionType":{"__LDATA__":["value","service","action","actionType"]}}}}},{"$action":"conditional/switch","cases":[{"do":[{"$action":"data/set","at-location":{"__LDATA__":["value","aid"]},"value":"1"}],"name":"123456789","value":"123456789"}],"default":[],"name":"change aid","target":{"__LDATA__":["value","aid"]}},{"$action":"conditional/switch","cases":[{"do":[{"$action":"data/set","at-location":{"__LDATA__":["value","new_region"]},"value":"west"}],"name":"us-west-2","value":"us-west-2"}],"default":[],"name":"change region","target":{"__LDATA__":["value","new_region"]}}],"index-location":{"__LDATA__":["index"]},"name":"iterate of aws response body","output-location":{"__LDATA__":["result"]},"value-location":{"__LDATA__":["value"]}}]}],"InboundEndpointTest":[{"id":"<1599257683371188000.0.2043332109.1335361541.119584>","meta":{"index":["inbound","<1599257674351121000.0.2043332109.1336410113.164999>","endpoint","<1599257683370929000.0.2043332109.1336410113.166837>"]},"value":{"name":"default-test-input","request":{"body":"","header":{},"path":{},"query":{}}}}],"Schema":[],"SchemaEntry":[],"Timer":[],"TimerFlow":[],"Variable":[]}

 

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.