redfish

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package redfish wraps gofish to provide service-focused Redfish operations (inventory, power control, and firmware upload) for NV-Switch trays with minimal coupling to underlying transport details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedfishClient

type RedfishClient struct {
	*gofish.APIClient
	gofish.ClientConfig
	// contains filtered or unexported fields
}

RedfishClient manages a gofish API client and BMC context to perform typed Redfish operations against a device.

func New

func New(ctx context.Context, b *bmc.BMC, reuse_connections bool) (*RedfishClient, error)

New creates a RedfishClient for the given BMC and context.

func (*RedfishClient) EnsureHttpPushUriApplyTimeImmediate

func (c *RedfishClient) EnsureHttpPushUriApplyTimeImmediate() error

EnsureHttpPushUriApplyTimeImmediate checks the current apply time and sets it to Immediate if needed. Returns nil if already Immediate or successfully set. Returns error only on real failures.

func (*RedfishClient) FirmwareInventories

func (c *RedfishClient) FirmwareInventories() ([]*redfish.SoftwareInventory, error)

FirmwareInventories lists software/firmware inventories.

func (*RedfishClient) GetHttpPushUriApplyTime

func (c *RedfishClient) GetHttpPushUriApplyTime() (string, error)

GetHttpPushUriApplyTime returns the current HttpPushUriApplyTime setting from UpdateService. Returns the ApplyTime string (e.g., "Immediate", "OnReset") or empty string if not found.

func (*RedfishClient) GetTaskStatus

func (c *RedfishClient) GetTaskStatus(taskURI string) (string, int, error)

GetTaskStatus queries the status of a task

func (*RedfishClient) GetTaskURI

func (c *RedfishClient) GetTaskURI(resp *http.Response) (string, error)

GetTaskURI extracts task URI from firmware update response

func (*RedfishClient) PowerCycle

func (c *RedfishClient) PowerCycle() (*http.Response, error)

PowerCycle performs a power cycle on the NV-Switch tray via Redfish.

func (*RedfishClient) QueryChassis

func (c *RedfishClient) QueryChassis() (*redfish.Chassis, error)

QueryChassis fetches the NV-Switch chassis or returns an error if not found.

func (*RedfishClient) QueryManager

func (c *RedfishClient) QueryManager() (*redfish.Manager, error)

QueryManager fetches the BMC manager or returns an error if not found.

func (*RedfishClient) ResetBMC

func (c *RedfishClient) ResetBMC(resetType ResetBMCType) (*http.Response, error)

ResetBMC resets the BMC manager.

func (*RedfishClient) ResetSystem

func (c *RedfishClient) ResetSystem(resetType ResetType) (*http.Response, error)

ResetSystem performs a ComputerSystem.Reset action on the NV-Switch tray via Redfish.

func (*RedfishClient) SetHttpPushUriApplyTimeImmediate

func (c *RedfishClient) SetHttpPushUriApplyTimeImmediate() (*http.Response, error)

SetHttpPushUriApplyTimeImmediate configures firmware apply time to Immediate on UpdateService.

func (*RedfishClient) UpdateFirmware

func (c *RedfishClient) UpdateFirmware(fw io.Reader) (*http.Response, error)

UpdateFirmware ensures apply time is Immediate then uploads firmware from the reader. It first checks the current apply time setting and only attempts to change it if needed.

func (*RedfishClient) UpdateFirmwareByPath

func (c *RedfishClient) UpdateFirmwareByPath(firmwarePath string) (*http.Response, error)

UpdateFirmwareByPath opens a local file and performs UpdateFirmware.

func (*RedfishClient) UpdateService

func (c *RedfishClient) UpdateService() (*redfish.UpdateService, error)

UpdateService returns the Redfish UpdateService resource.

func (*RedfishClient) UploadFirmware

func (c *RedfishClient) UploadFirmware(fw io.Reader) (*http.Response, error)

UploadFirmware uploads firmware from an io.Reader using basic auth.

func (*RedfishClient) UploadFirmwareByPath

func (c *RedfishClient) UploadFirmwareByPath(firmwarePath string) (*http.Response, error)

UploadFirmwareByPath opens a local file and uploads it via UpdateService.

type ResetBMCType

type ResetBMCType string
const (
	GracefulBMCRestart ResetBMCType = "GracefulRestart"
	ForceBMCRestart    ResetBMCType = "ForceRestart"
)

type ResetType

type ResetType string

ResetType represents a Redfish ComputerSystem.Reset action.

const (
	ResetForceOff         ResetType = "ForceOff"
	ResetPowerCycle       ResetType = "PowerCycle"
	ResetGracefulShutdown ResetType = "GracefulShutdown"
	ResetOn               ResetType = "On"
	ResetForceOn          ResetType = "ForceOn"
	ResetGracefulRestart  ResetType = "GracefulRestart"
	ResetForceRestart     ResetType = "ForceRestart"
)

type TaskResponse

type TaskResponse struct {
	TaskURI string `json:"@odata.id"`
}

TaskResponse represents a Redfish task response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL