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

# README

Tests

go-meraki

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

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

Basic Usage

package main

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

func main() {
    client, _ := meraki.NewClient("abc123")

    res, _ := client.Get("/organizations")
    println(res.Get("0.name").String())
}

This will print something like:

My First Organization

Result manipulation

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

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

for _, obj := range res.Array() {
    println(obj.Get("@pretty").String()) // pretty print network objects
}

POST data creation

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

body := meraki.Body{}.
    Set("name", "NewNetwork1").
    Set("productTypes", []string{"switch"})
client.Post("/organizations/123456/networks", 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.
BaseUrl modifies the API base URL.
MaxRetries modifies the maximum number of retries from the default of 3.
NewClient creates a new Meraki HTTP client.
NoLogPayload prevents logging of payloads.
RequestPerSecond modifies the maximum number of requests per second.
RequestTimeout modifies the HTTP request timeout from the default of 60 seconds.
UserAgent modifies the HTTP user agent string.

# 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 Meraki client.
Req wraps http.Request for API requests.
Res is an API response returned by client requests.