Getting Started with Bigsuds–a New Python Library for iControl
I imagine the progression for you, the reader, will be something like this in the first six- or seven-hundred milliseconds after reading the title: Oh cool! Wait, what? Don’t we already have like two...
Published Nov 07, 2012
Version 1.0JRahm
Admin
Joined January 20, 2005
JRahm
Admin
Joined January 20, 2005
JRahm
Dec 06, 2013Admin
Hi Phil! With bigsuds, a sequence (in the API docs as []) is represented as a dictionary like so:
[{'key': 'val', 'key2': 'val2'}]
and a sequence-sequence (in the API docs as [][]) just wrapped in one more list:
[[{'key': 'val', 'key2': 'val2'}] ]
So to create a virtual server, either of these methods will work:
b.LocalLB.VirtualServer.create( \
definitions = [{'name': '/Common/vip10', 'address': '172.16.5.5', 'port': 80, 'protocol': 'PROTOCOL_TCP'}], \
wildmasks = ['255.255.255.255'], \
resources = [{'type': 'RESOURCE_TYPE_POOL', 'default_pool_name': '/Common/testpool'}], \
profiles = [[{'profile_context': 'PROFILE_CONTEXT_TYPE_ALL', 'profile_name': '/Common/tcp'}]] \
)
b.LocalLB.VirtualServer.create( \
[{'name': '/Common/vip11', 'address': '172.16.5.6', 'port': 80, 'protocol': 'PROTOCOL_TCP'}], \
['255.255.255.255'], \
[{'type': 'RESOURCE_TYPE_POOL', 'default_pool_name': '/Common/testpool'}], \
[[{'profile_context': 'PROFILE_CONTEXT_TYPE_ALL', 'profile_name': '/Common/tcp'}]] \
)