-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Skyinfoblox is the GoLang API wrapper for Infoblox. The wrapper uses the REST API interface provided by Infoblox. Skyinfoblox currently supports v2.3.1 of the Infoblox API. There is also command line interface which can be built by running make
in the root of this repo.
The Infoblox API documentation may be accessed by appending /wapidoc/
to the Infoblox server URL. E.g https://example-infoblox.example.com/wapidoc/
The CLI may be built by running make
in the root of the repo. Make will build the skyinfoblox binary.
$ make
The Infoblox server credentials may either be passed as options to skyinfoblox
on the command line or by setting environment variables.
Passing credentials as options
./skyinfoblox -username example-user -password examplePassword -server https://example-infoblox.example.com ....
Setting credentials through environment variables
$ export IBX_USERNAME="example-user"
$ export IBX_PASSWORD="examplePassword"
$ export IBX_SERVER="https://example-infoblox.example.com"
General help
$ ./skyinfoblox-cli -h
Help for a sub-command. E.g. zone-create
$ ./skyinfoblox-cli sub-command -h
The CLI has sub-commands for each Infoblox object type. Please see the links under Infoblox Objects
for specific examples.
import(
"github.com/sky-uk/skyinfoblox"
)
client := skyinfoblox.NewInfobloxClient(
infobloxServer, // e.g. https://example-infoblox.example.com
infobloxUsername,
infobloxPassword,
allowUnverifiedSSL, // ignore certificate errors (boolean)
debug, // enable debugging (boolean)
)
// create a new client
client := skyinfoblox.NewInfobloxClient(infobloxServer, infobloxUsername, infobloxPassword, true, true)
This is an example of how to perform a request. More detailed examples may be found under Infoblox Objects below.
E.g. admingroup
// Prepare a request...
// returnFields is specific to each object type and determines which attributes are returned from the Infoblox API.
returnFields := []string{"name", "comment", "disable", "roles", "email_addresses", "superuser", "access_method"}
adminGroupName := "example-group"
getAdminGroupAPI := admingroup.NewGet(adminGroupName, returnFields)
// Perform the request...
err := client.Do(getAdminGroupAPI)
if err != nil {
// handle errors....
}
E.g. returned response object is an interface and we need to cast it as an *admingroup.IBXAdminGroup.
response := *adminGroupShowAPI.ResponseObject().(*admingroup.IBXAdminGroup)
adminGroupName := response.Name
httpStatus := getAdminGroupAPI.StatusCode()
The following Infoblox Objects may be managed through these bindings:
- Admin Group
- DHCP Range
- Network
- Name Server Group Auth
- Name Server Group Delegation
- Records
- Zone Auth
- Zone Forward
$ make test