https://github.com/jpbede/netpalmgo
Go client package for the netpalm REST API
https://github.com/jpbede/netpalmgo
go golang netpalm netpalm-api network-automation
Last synced: about 1 year ago
JSON representation
Go client package for the netpalm REST API
- Host: GitHub
- URL: https://github.com/jpbede/netpalmgo
- Owner: jpbede
- License: mit
- Created: 2020-11-09T20:26:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-16T13:53:10.000Z (about 5 years ago)
- Last Synced: 2025-02-08T20:17:43.766Z (over 1 year ago)
- Topics: go, golang, netpalm, netpalm-api, network-automation
- Language: Go
- Homepage:
- Size: 103 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# netpalmgo
[](https://app.codacy.com/gh/jpbede/netpalmgo?utm_source=github.com&utm_medium=referral&utm_content=jpbede/netpalmgo&utm_campaign=Badge_Grade)
[](https://pkg.go.dev/go.bnck.me/netpalm)

[](https://codecov.io/gh/jpbede/netpalmgo)
[](https://goreportcard.com/report/github.com/jpbede/netpalmgo)
Go package for [netpalm API](https://github.com/tbotnz/netpalm)
## netpalmgo support
I maintain a community on the networktocode slack channel
#netpalmgo on networktocode.slack.com
## Examples
### Queueing a get task
```go
package main
import (
"context"
"go.bnck.me/netpalm"
"go.bnck.me/netpalm/models"
)
func main() {
nc := netpalmgo.New("https://netapi.mynet.net", "")
m := models.GetConfigRequest{
Library: models.LibraryNetmiko,
ConnectionArgs: models.ConnectionArgs{
DeviceType: "cisco_ios",
Host: "10.10.10.1",
Username: "admin",
Password: "abc123",
},
QueueStrategy: models.QueueStrategyFIFO,
Command: []string{"show ip bgp sum"},
}
// send task
d, err := nc.GetConfig().WithRequest(context.Background(), m)
if err != nil {
panic(err)
}
// wait blocking for task to finish
d, err = nc.WaitForResult(context.Background(), d)
if err != nil {
panic(err)
}
}
```
### Queueing a set command
```go
package main
import (
"context"
"go.bnck.me/netpalm"
"go.bnck.me/netpalm/models"
)
func main() {
nc := netpalmgo.New("https://netapi.mynet.net", "")
m := models.SetConfigRequest{
Library: models.LibraryNetmiko,
ConnectionArgs: models.ConnectionArgs{
DeviceType: "cisco_ios",
Host: "10.10.10.1",
Username: "admin",
Password: "abc123",
},
QueueStrategy: models.QueueStrategyFIFO,
Config: []string{
"set int tunnel tun0 remote-ip 192.168.2.1",
},
}
// send set task
d, err := nc.SetConfig().Set(context.Background(), false, m)
if err != nil {
panic(err)
}
// wait blocking for task to finish
d, err = nc.WaitForResult(context.Background(), d)
if err != nil {
panic(err)
}
}
```