Forum Discussion
API Convetion confusions
The method in question is defined as
LocalLB.VirtualServer.add_rule(
in String [] virtual_servers,
in LocalLB__VirtualServer__VirtualServerRule [] [] rules
);
The brackets indicate that it's an array. When there are 2 brackets, that indicates a 2-D array.
If you think of it this way, it may make sense: The API is designed to allow you to add multiple rules to a single virtual server. If we only allowed you to act on a single virtual server, the API would look like this
LocalLB.VirtualServer.add_rule(
in String virtual_server,
in LocalLB__VirtualServer__VirtualServerRule [] rules
);
This way you pass in a single scalar value for the virtual server in question, and an array of VirtualServerRule structures (one for each rule you want to assign to the Virtual).
All our APIs are "bulk" enabled - meaning you can act on multiple objects in a single call. So for this situation, we will allow you to add multiple rules to multiple virtual servers in each method call. It may seem a bit confusing, but for folks that want to apply policy to 1000's of objects at once, it makes it a lot easier. Plus reducing roundtrip latency for 1000 calls, can give a significant speed increase on total execution time.
So, going back to the API. To allow adding rules to multiple virtuals, we need an array for the virtuals. Then for a list of rules for each virtual, we will need a 2-D array for the rules parameter - the first dimension for each virtual, the second with the list of rules for that given virtual.
Make sense?
Recent Discussions
Related Content
* 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