Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

Rest AP related IRule

bindummawat
Altostratus
Altostratus

Hi,

I am trying to automate one of my application scenario with F5 GTM.

I have listener which I created using REST API of F5. Now I want to setup a iRule (create iRule and apply it to the listener) through Rest API endpoint.

Can someone help me to figure out this?

3 REPLIES 3

You can just attach the irule to the LTM virtual as the GTM/DNS listener is an actual LTM virtual server and there are a lot examples for that:

https://community.f5.com/t5/technical-forum/assign-irule-to-virtual-server-with-icontrol-rest/td-p/2...

https://community.f5.com/t5/technical-forum/examples-of-json-for-adding-an-irule-for-a-virtual-serve...

 

Thank you! I got dragged to some other work. I will try this and update here if it works for me.

bindummawat
Altostratus
Altostratus

I was able to add iRule. Now trying to attach that rule to Listener but getting error, Trying using this page: https://clouddocs.f5.com/cli/tmsh-reference/v13/modules/gtm/gtm_listener.html

Tried different ways but no success so far, Let me know what is wrong with my request:

1) First attempt:  

{"name":"listener1.example.com","rules": {"name":"ruleTest"},"address":"<mylistenerIp>","sourceAddressTranslation": {"type":"automap"},"translateAddress":"enabled","translatePort":"enabled","enabled":true}

Error:

{"code":400,"message":"Found unexpected json pair at property /gtm/listener/~Common~listener1.example.com/rules. The json pair is \"name\":\"ecsRuleTest\".","errorStack":[],"apiError":1}