Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/netascode/go-fmc
A Go client library for Cisco Secure FMC.
https://github.com/netascode/go-fmc
cisco fmc go golang secure
Last synced: about 2 months ago
JSON representation
A Go client library for Cisco Secure FMC.
- Host: GitHub
- URL: https://github.com/netascode/go-fmc
- Owner: netascode
- License: mpl-2.0
- Created: 2024-01-06T16:10:14.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-10-17T08:38:38.000Z (3 months ago)
- Last Synced: 2024-10-19T11:23:31.176Z (2 months ago)
- Topics: cisco, fmc, go, golang, secure
- Language: Go
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Tests](https://github.com/netascode/go-fmc/actions/workflows/test.yml/badge.svg)](https://github.com/netascode/go-fmc/actions/workflows/test.yml)
# go-fmc
`go-fmc` is a Go client library for Cisco Secure FMC (Firewall Management Center). It is based on Nathan's excellent [goaci](https://github.com/brightpuddle/goaci) module and features a simple, extensible API and [advanced JSON manipulation](#result-manipulation).
## Getting Started
### Installing
To start using `go-fmc`, install Go and `go get`:
`$ go get -u github.com/netascode/go-fmc`
### Basic Usage
```go
package mainimport "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](https://github.com/tidwall/gjson) documentation for more detail.
```go
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](https://github.com/tidwall/sjson). SJSON supports a path syntax simplifying JSON creation.
```go
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](https://godoc.org/github.com/netascode/go-fmc) for more details.