Skip to content

netascode/go-fmc

Tests

go-fmc

go-fmc is a Go client library for Cisco Secure FMC (Firewall Management 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-fmc, install Go and go get:

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

Basic Usage

package main

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

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

    res, _ := client.Get("/api/fmc_config/v1/domain/{DOMAIN_UUID}/object/networks")
    println(res.Get("items.0.name").String())
}

This will print something like:

any-ipv4

Result manipulation

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

res, _ := client.Get("/api/fmc_config/v1/domain/{DOMAIN_UUID}/object/networks")

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

POST data creation

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

body := fmc.Body{}.
    Set("name", "net1").
    Set("value", "1.5.4.0/24")
client.Post("/api/fmc_config/v1/domain/{DOMAIN_UUID}/object/networks", body.Str)

Documentation

See the documentation for more details.

About

A Go client library for Cisco Secure FMC.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages