22-Jun-2018 12:15 - edited 10-Mar-2023 08:48
Last time out we looked at using request parameters. Stephan Manthey posted a comment on some of the advanced queries with the options parameter he uses and asked how they might be supported in the SDK. We’ll take the use cases one at a time, and show how to build that query.
method: DELETE
path:/mgmt/tm/sys/management-route
query: options=* or options=all
This isn't actually possible via the SDK until version 3.0.17, set to release today or Monday, but you can download the development branch to test it out if you like. I had to add a delete_collection method for this to work. The command to use this method in the SDK is:
x = b.tm.sys.management_route.delete_collection(requests_params={'params': 'options=*'}
method: DELETE
path:/mgmt/tm/ltm/pool
query: options=pool_test_*
Via the SDK:
x = b.tm.ltm.pool.delete_collection(requests_params={'params': 'options=pool_test_*'}
method: POST
path:/mgmt/tm/sys/config
query: options=partitions { my_partition }
Via the SDK:
x = b.tm.sys.config.exec_cmd('save', requests_params={'params': 'options=partitions { my_partition }'}
Note you can save more than one partition if you like, separated by whitespace within the curly braces.
method: GET
path:/mgmt/tm/ltm/pool/~Common~mypool/stats
query: options=detail
Via the SDK:
x = b.tm.ltm.pool.get_collection(requests_params={'params': 'options=detail'}
Thanks again to Stephan for sharing the advanced query parameters he uses in his environment, hopefully these quick recipes with how to apply them in the SDK will help to expand your toolbox.