Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sapcc/netbox-plugins
code to manage clients for netbox plugins
https://github.com/sapcc/netbox-plugins
Last synced: 11 days ago
JSON representation
code to manage clients for netbox plugins
- Host: GitHub
- URL: https://github.com/sapcc/netbox-plugins
- Owner: sapcc
- Created: 2023-10-02T10:18:25.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-30T16:21:12.000Z (about 1 year ago)
- Last Synced: 2024-04-17T21:17:37.027Z (7 months ago)
- Language: Go
- Size: 19.5 KB
- Stars: 1
- Watchers: 33
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# netbox-plugins
code to interact with different API versions of netbox plugins## sample
```
package mainimport (
"fmt"
"os"sism "github.com/sapcc/netbox-plugins/sism/sism_v2"
clusters "github.com/sapcc/netbox-plugins/clusters/clusters_v1"
)func main() {
// initialize client with netbox url and token
c, _ := sism.New(os.Getenv("NETBOX_URL"), os.Getenv("NETBOX_TOKEN"), true)// execute sism_v2 function GetSISMDevice
res, _ := c.GetSISMDevice(12)// print result info
fmt.Println("SISM ID:", res.Id)
fmt.Println("SISM Serial:", res.Serial)
fmt.Println("Device ID:", res.Device.Id)
fmt.Println("Device Name:", res.Device.Name)cc, _ := clusters.New(os.Getenv("NETBOX_URL"), os.Getenv("NETBOX_TOKEN"), true)
wt := clusters.WritablePhysicalClusterRequest{}
wt.Name = "coolCluster"
wt.ClusterType = 5
cluster, err := cc.AddCluster(wt)
if err != nil {
fmt.Println(err)
}
fmt.Println("cluster created")
fmt.Println(cluster.Id)
fmt.Println(cluster.Name)
fmt.Println(cluster.Url)}
```