cancel
Showing results for 
Search instead for 
Did you mean: 
scottdware_8248
Nimbostratus
Nimbostratus

Problem this snippet solves:

If you like coding in Go (as I love to do), here's a package that leverages the REST API to allow you to manage (create, modify, delete, etc.) pools, nodes, virtual servers, routes, self IP's, vlans, interfaces, trunks, route domains, etc.

Github repository

The official documentation can be found here.

Here's a blog post that goes into more detailed examples.

How to use this snippet:

The example below is a small example of how to create and manage nodes, pools, and virtual servers.

Code :

package main

import (  
    "github.com/scottdware/go-bigip"
)

func main() {  
    f5 := bigip.NewSession("f5.company.com", "admin", "secret")

    // Node creation
    f5.CreateNode("web-server1", "10.5.1.10")
    f5.CreateNode("web-server2", "10.5.1.11")
    f5.CreateNode("web-server3", "10.5.1.12")

    // Create our pool
    f5.CreatePool("web_443_pool")

    // Add members to our pool
    f5.AddPoolMember("web_443_pool", "web-server1:443")
    f5.AddPoolMember("web_443_pool", "web-server2:443")
    f5.AddPoolMember("web_443_pool", "web-server3:443")

    // Take our #3 web server offline (disable)
    f5.PoolMemberStatus("web_443_pool", "web-server3:443", "disable")

    // Create a virtual server using the above pool
    // The second parameter is our destination, and the third is the mask. You can use CIDR notation if you wish (as shown here)
    f5.CreateVirtualServer("web_443", "0.0.0.0", "0", "web_443_pool", 443)

    // Take the #3 web server offline for all pools
    f5.NodeStatus("web-server3", "disable")

    // Remove the server from our pool
    f5.DeletePoolMember("web_443_pool", "web-server3:443")
}
Comments
JRahm_128324
Historic F5 Account
Nice work
scottdware_8248
Nimbostratus
Nimbostratus
Thank you very much!
crodriguez
F5 Employee
F5 Employee
Ditto that sentiment! Clear and concise, as well.
Chase_Abbott
F5 Employee
F5 Employee
So cool. Do you see features we could add to DevCentral to create/improve off site repos? Maybe when creating an article you can add the git repo, and we'll auto create a clone button or some other feature? I'm seeing more people post repositories and want to make sure it's easy for people to navigate between DevCentral and source.
scottdware_8248
Nimbostratus
Nimbostratus
Thanks, Chase! I think your idea of adding a place to clone a repo, etc. would be fantastic. I agree that there seems to be a lot more of that out there, now days.
krishan1970_223
Nimbostratus
Nimbostratus
Great job..
scottdware_8248
Nimbostratus
Nimbostratus
Thank you!
Version history
Last update:
‎05-May-2015 06:57
Updated by:
Contributors