This is a work in progress to define the BigIP REST api in swagger, and use swagger-codegen to produce a library.
REST API for F5 BigIP. List of operations is not complete, nor known to be accurate.
This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.
- API version: 12.0
- Package version: v0.0.1-3-g67a31cb
- Build package: class io.swagger.codegen.languages.GoClientCodegen
- Build Info: Codegen IMG: 008d236784eb
For more information, please visit https://devcentral.f5.com/
Install the package into your project dir
go get github.com/bmarshall13/go-bigip-rest
Here is a simple example to list virtual servers:
package main
import (
"flag"
"fmt"
"github.com/bmarshall13/go-bigip-rest"
)
func main() {
user := flag.String("user", "admin", "username on BIG-IP")
pass := flag.String("pass", "admin", "password on BIG-IP")
tlsNoVerify := flag.Bool("skipTlsVerify", false, "Don't verifiy BigIP certificate")
flag.Parse()
if flag.NArg() != 1 {
panic(fmt.Sprintf("Usage: f5api [--user USER] [--pass PASS] [--skipTlsVerify] <bigip>\n"))
}
host := flag.Arg(0)
fmt.Printf("Connecting to BIG-IP %v (%v/%v)\n", host, *user, *pass)
f5 := f5api.NewClient(host, *user, *pass, *tlsNoVerify)
err := f5.DoLogin()
if err != nil {
panic(fmt.Sprintf("Error logging in: %v", err))
}
// Example: list all the virtuals (compare to "show /ltm virtual")
virtuals, err := f5.Ltm.GetVirtualList()
if err != nil {
panic(fmt.Sprintf("Error getting list of virtual servers: %v", err))
}
for _, virtual := range virtuals.Items {
fmt.Printf("Virtual %v Destination %v\n", virtual.Name, virtual.Destination)
}
}
Operations are grouped by the first API path element:
- Ltm operations are grouped in the f5api.LtmApi
- Net operations are grouped in the f5api.NetApi
- Shared operations are grouped in the f5api.SharedApi
- Sys operations are grouped in the f5api.SysApi