Go package to leverage REST API
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.
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") }
Published May 05, 2015
Version 1.0scottdware_8248
Nimbostratus
Joined March 12, 2010
scottdware_8248
Nimbostratus
Joined March 12, 2010
- JRahm_128324Historic F5 AccountNice work
- scottdware_8248NimbostratusThank you very much!
- crodriguezRet. EmployeeDitto that sentiment! Clear and concise, as well.
- Chase_AbbottEmployeeSo 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_8248NimbostratusThanks, 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_223NimbostratusGreat job..
- scottdware_8248NimbostratusThank you!