Go SDK

View as Markdown

The nvfleetint package provides a handwritten Go client for the Fleet Intelligence customer API.

Install

go get github.com/NVIDIA/fleet-intelligence-client/nvfleetint

Use the Go version declared in the repository’s go.mod file or newer.

Create a client

package main
import (
"context"
"fmt"
"log"
"os"
"github.com/NVIDIA/fleet-intelligence-client/nvfleetint"
)
func main() {
client, err := nvfleetint.NewClient(
"https://api.fleet-intelligence.nvidia.com",
os.Getenv("NVFLEETINT_API_KEY"),
)
if err != nil {
log.Fatal(err)
}
page, err := client.ListNodes(context.Background(), nvfleetint.ListNodesOptions{})
if err != nil {
log.Fatal(err)
}
for _, node := range page.Nodes {
fmt.Printf("%s\t%s\n", node.UUID, node.Hostname)
}
}

Select the out-of-band node view and retrieve its BMC inventory with explicit agent options:

page, err := client.ListNodes(ctx, nvfleetint.ListNodesOptions{
AgentType: nvfleetint.NodeAgentTypeOOB,
BMCHostname: "bmc-01",
})
node, err := client.DescribeNodeWithOptions(ctx, nodeUUID, nvfleetint.DescribeNodeOptions{
AgentType: nvfleetint.NodeAgentTypeOOB,
})
if err == nil && node.OOBInventory != nil {
fmt.Println(node.OOBInventory.SchemaVersion, node.NodeKind)
for _, system := range node.OOBInventory.Systems {
if system.Status != nil {
fmt.Println(system.Status.State, system.Status.Health, system.Status.Conditions)
}
}
}

OOB node list and detail results expose the inventory classification as Node.NodeKind.

OOB inventory exposes node kinds (unknown, compute, nvswitch, and power_shelf) and nested Redfish status conditions on systems, processors, managers, chassis, PCIe devices, and firmware.

NewClient requires an HTTPS API URL and an API key. Plain HTTP is accepted only for loopback addresses used during local development.

The default per-request timeout is two minutes. Override it when constructing the client:

client, err := nvfleetint.NewClient(
apiURL,
apiKey,
nvfleetint.WithTimeout(30*time.Second),
)

Public SDK types and methods are documented in the package source under nvfleetint.

Alert timeline filter values and sorting choices are available through GetAlertTimelineFilterOptions. Pass true for the active-alert view or false for the historical view:

options, err := client.GetAlertTimelineFilterOptions(ctx, true)

Writes

SetNodeTags replaces a node’s tags with the set given. It is a replacement rather than a merge — a tag the node already carries that is absent from Tags is removed, and an empty Tags clears them all:

result, err := client.SetNodeTags(ctx, nodeUUID, nvfleetint.SetNodeTagsOptions{
Tags: []string{"gpu-health", "burn_in"},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Tags)

Tags are validated before the request is sent, so a malformed tag is named locally instead of returning an opaque 400. Unlike the read methods, a failed write is never retried.