Forum Discussion

Landono's avatar
Landono
Icon for Nimbostratus rankNimbostratus
Jul 23, 2015

Add to LTM Policies with iControl REST

Currently we have a LTM policy that handles our path-based routing for one of our virtual servers. We modify it with a tmsh command, but we're looking to move it over to an iControl REST call. I'm pretty familiar with the REST interface but for the life of me I can't seem to get the request correct. Here is the command we are trying to replicate:

tmsh modify ltm policy policy_https_pool_selector rules add { foo { actions replace-all-with { 0 { forward select pool pool_foo } 1 { server-ssl disable } } conditions replace-all-with { 0 { http-uri path starts-with values { /foo} } } } }

I know it needs to be a PUT call to the policy itself to add this rule, but again I can't seem to get the format correct. Any help here would be greatly appreciated.

1 Reply

  • Hi, you need to POST your new rule to /mgmt/tm/ltm/policy/policy_https_pool_selector/rules

     

    your need to increment the rule ordinal parameter.

     

    here is a payload example which complement a policy created with your command line :

     

    {
                "name" : "foo2",
                "ordinal" : 1,
                "actionsReference" : {
                    "items" : [{
                            "name" : "0",
                            "code" : 0,
                            "forward" : true,
                            "pool" : "/Common/pool_foo",
                            "port" : 0,
                            "request" : true,
                            "select" : true,
                            "status" : 0,
                            "vlanId" : 0
                        }, {
    
                            "name" : "1",
                            "generation" : 4532,
                            "code" : 0,
                            "disable" : true,
                            "port" : 0,
                            "request" : true,
                            "serverSsl" : true,
                            "status" : 0,
                            "vlanId" : 0
                        }
                    ]
                },
                "conditionsReference" : {
                    "items" : [{
    
                            "name" : "0",
                            "caseInsensitive" : true,
                            "external" : true,
                            "httpUri" : true,
                            "index" : 0,
                            "path" : true,
                            "present" : true,
                            "remote" : true,
                            "request" : true,
                            "startsWith" : true,
                            "values" : ["/foo"]
                        }
                    ]
                }
            }