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

# README

Tests

go-catalystcenter

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

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

Basic Usage

package main

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

func main() {
    client, _ := cc.NewClient("https://1.1.1.1", "user", "pwd")

    res, _ := client.Get("/dna/intent/api/v2/site")
    println(res.Get("response.0.name").String())
}

This will print something like:

Site1

Result manipulation

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

res, _ := client.Get("/dna/intent/api/v2/site")

for _, site := range res.Get("response").Array() {
    println(site.Get("@pretty").String()) // pretty print sites
}

POST data creation

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

body := cc.Body{}.
    Set("type", "area").
    Set("site.area.name", "Area1").
    Set("site.area.parentName", "Global")
client.Post("/dna/intent/api/v1/site", body.Str)

Documentation

See the documentation for more details.

# Functions

Asynchronous operation.
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.
DefaultMaxAsyncWaitTime modifies the maximum wait time for async operations from the default of 30 seconds.
Insecure determines if insecure https connections are allowed.
Maximum Asynchronous operation wait time.
MaxRetries modifies the maximum number of retries from the default of 3.
NewClient creates a new Catalyst Center 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
No description provided by the author

# Variables

No description provided by the author

# Structs

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

# Type aliases

Res is an API response returned by client requests.