DataScript: avi.poolgroup.select

Function avi.poolgroup.select( poolgroup )
Description Selects a poolgroup for the current request. The selection does not take effect if an HTTP Request Policy was also configured with a switching action to select a pool group. The switching action of the HTTP Request Policy takes precedence over the DataScript's pool group selection.
Events HTTP_REQ
Parameter poolgroup can be a specific pool group name or an expression that evaluates to a valid pool group name.
Caveats The pool group name may be called explicitly or dynamically determined based on a Lua expression. If the pool group name does not exist or is not able to be referenced by the virtual service, an error is generated.

  • Explicit reference: A configuration error will be generated while saving the DataScript.
  • Dynamically generated reference: A runtime error is generated, which results in a 500 error return to the client.
Returns No value returned
Example 1 Forward the request to an explicit destination.
if avi.http.get_path() == "/sales/" then
   avi.poolgroup.select("sales-poolgroup")
elseif avi.http.get_path () == "/engineering/" then
   avi.poolgroup.select("engineering-poolgroup")
elseif avi.http.get_path () == "/marketing/" then
   avi.poolgroup.select("marketing-poolgroup")
end
Example 2 Forward the request to a dynamically generated destination.
www.avi.com/support/index.htm would go to the support poolgroup
www.avi.com/sales/apac/index.htm would go to the sales poolgroup
avi.poolgroup.select(avi.http.get_path_tokens(1, 1))

Updated: 2018-01-20 12:43:08 +0000