Forum Discussion
craigvphillips_
Nimbostratus
Jun 06, 2017Adding an irule via put
Trying to add an irule to a few thousand virtuals and it does't work.
I can PATCH
{"rules": [
"awesomerule"
]
}
and it works, but it replaces the irule list with the single irule... I don't want to do this, i want to update.
If i try and PUT the above json, i get:
{
"code": 400,
"message": "0107028c:3: The source (::) and destination (10.10.10.10) addresses for virtual server (/Common/coolserver) must be be the same type (IPv4 or IPv6).",
"errorStack": [],
"apiError": 3
}
- Satoshi_Toyosa1Ret. Employee
Use
to create an iRule andPOST
to modify the content (script). e.g.,PATCH
Creating an iRule "test" (under /Common):
curl -sku admin:secret -X POST -H "Content-Type: application/json" \ -d '{"name": "test" }' \ https://mgmtPort/mgmt/tm/ltm/rule
Output:
{"kind":"tm:ltm:rule:rulestate","name":"test","partition":"Common","fullPath":"/Common/test","generation":1745,"selfLink":"https://localhost/mgmt/tm/ltm/rule/~Common~test?ver=12.1.2"}
Add the script to the rule "test":
curl -sku admin:secret -X PATCH -H "Content-Type: application/json" \ -d '{"apiAnonymous":"when CLIENT_ACCEPTED {log local0. \"hello world\"}" }' \ https://mgmtPort/mgmt/tm/ltm/rule/test
Output:
{"kind":"tm:ltm:rule:rulestate","name":"test","fullPath":"test","generation":1746,"selfLink":"https://localhost/mgmt/tm/ltm/rule/test?ver=12.1.2","apiAnonymous":"when CLIENT_ACCEPTED {log local0. \"hello world\"}"}
Verify on the LTM:
tmsh list ltm rule test ltm rule test { when CLIENT_ACCEPTED {log local0. "hello world"} }
This overrides the existing content:
curl -sku admin:secret -X PATCH -H "Content-Type: application/json" \ -d '{"apiAnonymous":"when HTTP_REQUEST {log local0. \"Bonjour monde\"}" }' \ https://mgmtPort/mgm/tm/ltm/rule/test
Verify:
tmsh list ltm rule test ltm rule test { when HTTP_REQUEST {log local0. "Bonjour monde"} }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects