go-ise
is a Go client library for Cisco ISE. It is based on Nathan's excellent goaci module and features a simple, extensible API and advanced JSON manipulation.
To start using go-ise
, install Go and go get
:
$ go get -u github.com/netascode/go-ise
package main
import "github.com/netascode/go-ise"
func main() {
client, _ := ise.NewClient("https://1.1.1.1", "user", "pwd")
res, _ := client.Get("/ers/config/internaluser")
println(res.Get("SearchResult.resources.#.name").String())
}
This will print something like:
["user1","user2","user3"]
ise.Result
uses GJSON to simplify handling JSON results. See the GJSON documentation for more detail.
res, _ := client.Get("/ers/config/internaluser")
for _, user := range res.Get("SearchResult.resources").Array() {
println(user.Get("@pretty").String()) // pretty print internal users
}
ise.Body
is a wrapper for SJSON. SJSON supports a path syntax simplifying JSON creation.
body := ise.Body{}.
Set("InternalUser.name", "User1").
Set("InternalUser.password", "Cisco123")
client.Post("/ers/config/internaluser", body.Str)
See the documentation for more details.