# README
go-nd
go-nd
is a Go client library for Cisco Nexus Dashboard. It is based on Nathan's excellent goaci module and features a simple, extensible API and advanced JSON manipulation.
Getting Started
Installing
To start using go-nd
, install Go and go get
:
$ go get -u github.com/netascode/go-nd
Basic Usage
package main
import "github.com/netascode/go-nd"
func main() {
client, _ := nd.NewClient("1.1.1.1", "/appcenter/cisco/ndfc/api/v1", "user", "pwd", "", true)
res, _ := client.Get("/lan-fabric/rest/control/fabrics")
println(res.Get("0.id").String())
}
This will print something like:
3
Result manipulation
nd.Result
uses GJSON to simplify handling JSON results. See the GJSON documentation for more detail.
res, _ := client.Get("/lan-fabric/rest/control/fabrics")
for _, group := range res.Array() {
println(group.Get("@pretty").String()) // pretty print fabrics
}
POST data creation
nd.Body
is a wrapper for SJSON. SJSON supports a path syntax simplifying JSON creation.
body := nd.Body{}.
Set("templatename", "test").
Set("content", "##template properties \nname= test;\ndescription= ;\ntags= ;\nsupportedPlatforms= All;\ntemplateType= POLICY;\ntemplateSubType= VLAN;\ncontentType= TEMPLATE_CLI;##template variables\r\n##\r\n##template content\r\n##")
client.Post("/configtemplate/rest/config/templates/template", body.Str)
Documentation
See the documentation for more details.
# Functions
BackoffDelayFactor modifies the backoff delay factor from the default of 3.
BackoffMaxDelay modifies the maximum delay between two retries from the default of 60.
BackoffMinDelay modifies the minimum delay between two retries from the default of 2.
MaxRetries modifies the maximum number of retries from the default of 3.
NewClient creates a new Nexus Dashboard HTTP client.
NoLogPayload prevents logging of payloads.
RequestTimeout modifies the HTTP request timeout from the default of 60 seconds.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
Res is an API response returned by client requests.