fork of https://github.com/stmcginnis/gofish
gophish is a Golang library for interacting with DMTF Redfish and SNIA Swordfish enabled devices. For the moment, the goal of this repo is to stay up to date with https://github.com/stmcginnis/gofish.
Basic usage:
package main
import (
"fmt"
"github.com/jacobweinstock/gophish"
)
func main() {
config := gophish.ClientConfig{
Endpoint: "https://localhost:5000",
Username: "admin",
Password: "admin",
Insecure: true,
}
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
c, err := gophish.Connect(ctx, config)
if err != nil {
panic(err)
}
defer c.Logout(ctx)
// Query the chassis data using the session token
chassis, err := c.Service.Systems(ctx)
if err != nil {
panic(err)
}
for _, chass := range chassis {
fmt.Println("Chassis:", chass.PowerState)
}
}