redfish

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProviderName for the provider implementation
	ProviderName = "gofish"
	// ProviderProtocol for the provider implementation
	ProviderProtocol = "redfish"
)

Variables

View Source
var (
	ErrNoUserSlotsAvailable = errors.New("no user account slots available")
	ErrUserNotPresent       = errors.New("account with username was not found")
	ErrUserPassParams       = errors.New("user and pass parameters required")
	ErrUserExists           = errors.New("user exists")
	ErrInvalidUserRole      = errors.New("invalid user role")
	ValidRoles              = []string{"Administrator", "Operator", "ReadOnly", "None"}
)

Functions

func SupportedFirmwareApplyAtValues

func SupportedFirmwareApplyAtValues() []string

SupportedFirmwareApplyAtValues returns the supported redfish firmware applyAt values

Types

type Config

type Config struct {
	HttpClient *http.Client
	Port       string
	// VersionsNotCompatible	is the list of incompatible redfish versions.
	//
	// With this option set, The bmclib.Registry.FilterForCompatible(ctx) method will not proceed on
	// devices with the given redfish version(s).
	VersionsNotCompatible []string
	RootCAs               *x509.CertPool
	UseBasicAuth          bool
}

type Conn

type Conn struct {
	Log logr.Logger
	// contains filtered or unexported fields
}

Conn details for redfish client

func New

func New(host, user, pass string, log logr.Logger, opts ...Option) *Conn

New returns connection with a redfish client initialized

func (*Conn) BmcReset

func (c *Conn) BmcReset(ctx context.Context, resetType string) (ok bool, err error)

BmcReset power cycles the BMC

func (*Conn) BootDeviceSet

func (c *Conn) BootDeviceSet(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)

BootDeviceSet sets the boot device

func (*Conn) Close

func (c *Conn) Close(ctx context.Context) error

Close a connection to a BMC via redfish

func (*Conn) Compatible

func (c *Conn) Compatible(ctx context.Context) bool

Compatible tests whether a BMC is compatible with the gofish provider

func (*Conn) DeviceVendorModel

func (c *Conn) DeviceVendorModel(ctx context.Context) (vendor, model string, err error)

DeviceVendorModel returns the device manufacturer and model attributes

func (*Conn) FirmwareInstall

func (c *Conn) FirmwareInstall(ctx context.Context, component, applyAt string, forceInstall bool, reader io.Reader) (taskID string, err error)

FirmwareInstall uploads and initiates the firmware install process

func (*Conn) FirmwareInstallStatus

func (c *Conn) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (state string, err error)

FirmwareInstallStatus returns the status of the firmware install task queued

func (*Conn) GetBiosConfiguration

func (c *Conn) GetBiosConfiguration(ctx context.Context) (biosConfig map[string]string, err error)

func (*Conn) GetFirmwareInstallTaskQueued

func (c *Conn) GetFirmwareInstallTaskQueued(ctx context.Context, component string) (*gofishrf.Task, error)

GetFirmwareInstallTaskQueued returns the redfish task object for a queued update task

func (*Conn) Inventory

func (c *Conn) Inventory(ctx context.Context) (device *common.Device, err error)

func (*Conn) Name

func (c *Conn) Name() string

Name returns the client provider name.

func (*Conn) Open

func (c *Conn) Open(ctx context.Context) (err error)

Open a connection to a BMC via redfish

func (*Conn) PowerSet

func (c *Conn) PowerSet(ctx context.Context, state string) (ok bool, err error)

PowerSet sets the power state of a server

func (*Conn) PowerStateGet

func (c *Conn) PowerStateGet(ctx context.Context) (state string, err error)

PowerStateGet gets the power state of a BMC machine

func (*Conn) SetVirtualMedia

func (c *Conn) SetVirtualMedia(ctx context.Context, kind string, mediaURL string) (ok bool, err error)

SetVirtualMedia sets the virtual media

func (*Conn) UserCreate

func (c *Conn) UserCreate(ctx context.Context, user, pass, role string) (ok bool, err error)

UserCreate adds a new user account

func (*Conn) UserDelete

func (c *Conn) UserDelete(ctx context.Context, user string) (ok bool, err error)

UserDelete deletes a user account

func (*Conn) UserRead

func (c *Conn) UserRead(ctx context.Context) (users []map[string]string, err error)

UserRead returns a list of enabled user accounts

func (*Conn) UserUpdate

func (c *Conn) UserUpdate(ctx context.Context, user, pass, role string) (ok bool, err error)

UserUpdate updates a user password and role

type Option

type Option func(*Config)

Option for setting optional Client values

func WithHttpClient

func WithHttpClient(httpClient *http.Client) Option

func WithPort

func WithPort(port string) Option

func WithRootCAs

func WithRootCAs(rootCAs *x509.CertPool) Option

func WithUseBasicAuth

func WithUseBasicAuth(useBasicAuth bool) Option

func WithVersionsNotCompatible

func WithVersionsNotCompatible(versionsNotCompatible []string) Option

Jump to

Keyboard shortcuts

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