Categorygithub.com/netascode/go-sdwan
modulepackage
0.1.6
Repository: https://github.com/netascode/go-sdwan.git
Documentation: pkg.go.dev

# README

Tests

go-sdwan

go-sdwan is a Go client library for Cisco SDWAN. 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-sdwan, install Go and go get:

$ go get -u github.com/netascode/go-sdwan

Basic Usage

package main

import "github.com/netascode/go-sdwan"

func main() {
    client, _ := sdwan.NewClient("1.1.1.1", "user", "pwd", true)

    res, _ := client.Get("/admin/resourcegroup")
    println(res.Get("0.id").String())
}

This will print something like:

0:RESOURCE_GROUPNode:1626378545017:2

Result manipulation

sdwan.Result uses GJSON to simplify handling JSON results. See the GJSON documentation for more detail.

res, _ := client.Get("/admin/resourcegroup")

for _, group := range res.Array() {
    println(group.Get("@pretty").String()) // pretty print resource groups
}

POST data creation

sdwan.Body is a wrapper for SJSON. SJSON supports a path syntax simplifying JSON creation.

body := sdwan.Body{}.
    Set("name", "test").
    Set("desc", "API Test")
client.Post("/admin/resourcegroup", 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 SDWAN 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

# Structs

Body wraps SJSON for building JSON body strings.
Client is an HTTP SDWAN client.
Req wraps http.Request for API requests.

# Type aliases

Res is an API response returned by client requests.