Forum Discussion
iControl - LocalLBVirtualServerVirtualServerPersistence[][] - list persistence profile for each Virtual Server
// ... code snippet
iControl.Interfaces interfaces = new iControl.Interfaces();
if (interfaces.initialize(bigip, port, user, pass))
{
Vslist = interfaces.LocalLBVirtualServer.get_list();
LocalLBVirtualServerVirtualServerPersistence[][] VSPersist = interfaces.LocalLBVirtualServer.get_persistence_profile(Vslist);
for (int rowNum = 1; rowNum <= Vslist.Length; rowNum++)
{
TableRow tempRow = new TableRow();
TableCell tempCell = new TableCell();
tempCell.Text = String.Format("{0}", Vslist[rowNum - 1]);
// end code snippet ...I can successfully use the VsList variable above, however I'm trying to list the persistence 'profile_name' using the VSPersist variable with no success. If you could show me any example of how to get to the persistence 'profile_name', I think I can go forward from your example. Thanks
3 Replies
I'm not quite sure I'm getting what you are asking but I'll give a shot at a reply. I'm assuming you are asking how to iterate through the VSPersist array to get at the persistence profile information. If that's the case, then you'll need to pull the 2-d array apart to get at the elements. The first dimension of the array is for each virtual server passed in. The second dimension is for the list of persistence profiles for that given virtual. To continue your example, I'd do something like this
for (int rowNum = 1; rowNum <= Vslist.Length; rowNum++) { TableRow tempRow = new TableRow(); TableCell tempCell = new TableCell(); tempCell.Text = String.Format("{0}", Vslist[rowNum - 1]); // Extract the list of profiles for the given virtual LocalLBVirtualServerVirtualServerPersistence [] profilesA = VSPersist[rowNum - 1]; // Iterate through each of the profiles for(int j=0; j < profilesA.Length; j++) { LocalLBVirtualServerVirtualServerPersistence profiles = profilesA[j]; String profile_name = profiles.profile_name; Boolean default_profile = profiles.default_profile; } ...Hopefully this is what you were getting at. If not, comment and let me know...
-Joe
- David_Murphy_22
Nimbostratus
Viola ... worked like a charm. I have not used the 2-d arrays before, thanks Joe.
- Excellent! Any chance you can mark my answer as "correct"?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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