Skip to content

jacobweinstock/gophish

Repository files navigation

Redfish and Swordfish client library

fork of https://github.com/stmcginnis/gofish

Go Doc Go Report Card Releases LICENSE

Introduction

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.

Usage

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)
    }
}

About

Redfish client library written in Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages