Documentation ¶
Overview ¶
Package bmclib client.go is intended to be the main public API. Its purpose is to make interacting with bmclib as friendly as possible.
Index ¶
- type Auth
- type Client
- func (c *Client) ClearSystemEventLog(ctx context.Context) (err error)
- func (c *Client) Close(ctx context.Context) (err error)
- func (c *Client) CreateUser(ctx context.Context, user, pass, role string) (ok bool, err error)
- func (c *Client) DeactivateSOL(ctx context.Context) (err error)
- func (c *Client) DeleteUser(ctx context.Context, user string) (ok bool, err error)
- func (c *Client) FilterForCompatible(ctx context.Context)
- func (c *Client) FirmwareInstall(ctx context.Context, component string, operationApplyTime string, ...) (taskID string, err error)
- func (c *Client) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error)
- func (c *Client) FirmwareInstallSteps(ctx context.Context, component string) (actions []constants.FirmwareInstallStep, err error)
- func (c *Client) FirmwareInstallUploadAndInitiate(ctx context.Context, component string, file *os.File) (taskID string, err error)
- func (c *Client) FirmwareInstallUploaded(ctx context.Context, component, uploadVerifyTaskID string) (installTaskID string, err error)
- func (c *Client) FirmwareTaskStatus(ctx context.Context, kind constants.FirmwareInstallStep, ...) (state constants.TaskState, status string, err error)
- func (c *Client) FirmwareUpload(ctx context.Context, component string, file *os.File) (uploadVerifyTaskID string, err error)
- func (c *Client) For(provider string) *Client
- func (c *Client) GetBiosConfiguration(ctx context.Context) (biosConfig map[string]string, err error)
- func (c *Client) GetBootDeviceOverride(ctx context.Context) (override bmc.BootDeviceOverride, err error)
- func (c *Client) GetMetadata() bmc.Metadata
- func (c *Client) GetPowerState(ctx context.Context) (state string, err error)
- func (c *Client) GetSystemEventLog(ctx context.Context) (entries bmc.SystemEventLogEntries, err error)
- func (c *Client) GetSystemEventLogRaw(ctx context.Context) (eventlog string, err error)
- func (c *Client) Inventory(ctx context.Context) (device *common.Device, err error)
- func (c *Client) MountFloppyImage(ctx context.Context, image io.Reader) (err error)
- func (c *Client) Open(ctx context.Context) error
- func (c *Client) PostCode(ctx context.Context) (status string, code int, err error)
- func (c *Client) PreferProtocol(protocols ...string) *Client
- func (c *Client) PreferProvider(name string) *Client
- func (c *Client) ReadUsers(ctx context.Context) (users []map[string]string, err error)
- func (c *Client) RegisterSpanAttributes(m bmc.Metadata, span oteltrace.Span)
- func (c *Client) ResetBMC(ctx context.Context, resetType string) (ok bool, err error)
- func (c *Client) ResetBiosConfiguration(ctx context.Context) (err error)
- func (c *Client) Screenshot(ctx context.Context) (image []byte, fileType string, err error)
- func (c *Client) SendNMI(ctx context.Context) error
- func (c *Client) SetBiosConfiguration(ctx context.Context, biosConfig map[string]string) (err error)
- func (c *Client) SetBiosConfigurationFromFile(ctx context.Context, cfg string) (err error)
- func (c *Client) SetBootDevice(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)
- func (c *Client) SetPowerState(ctx context.Context, state string) (ok bool, err error)
- func (c *Client) SetVirtualMedia(ctx context.Context, kind string, mediaURL string) (ok bool, err error)
- func (c *Client) Supports(features ...registrar.Feature) *Client
- func (c *Client) UnmountFloppyImage(ctx context.Context) (err error)
- func (c *Client) UpdateUser(ctx context.Context, user, pass, role string) (ok bool, err error)
- func (c *Client) Using(protocol string) *Client
- type Option
- func WithAsrockrackHTTPClient(httpClient *http.Client) Option
- func WithAsrockrackPort(port string) Option
- func WithDellRedfishUseBasicAuth(useBasicAuth bool) Option
- func WithDellRedfishVersionsNotCompatible(versions []string) Option
- func WithHTTPClient(c *http.Client) Option
- func WithIntelAMTHostScheme(hostScheme string) Option
- func WithIntelAMTPort(port uint32) Option
- func WithIpmitoolCipherSuite(cipherSuite string) Option
- func WithIpmitoolPath(path string) Option
- func WithIpmitoolPort(port string) Option
- func WithLogger(logger logr.Logger) Option
- func WithPerProviderTimeout(timeout time.Duration) Option
- func WithRPCOpt(opt rpc.Provider) Option
- func WithRedfishEtagMatchDisabled(d bool) Option
- func WithRedfishHTTPClient(httpClient *http.Client) Option
- func WithRedfishPort(port string) Option
- func WithRedfishSystemName(name string) Option
- func WithRedfishUseBasicAuth(useBasicAuth bool) Option
- func WithRedfishVersionsNotCompatible(versions []string) Option
- func WithRegistry(registry *registrar.Registry) Option
- func WithSecureTLS(rootCAs *x509.CertPool) Option
- func WithTracerProvider(provider oteltrace.TracerProvider) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Auth Auth Logger logr.Logger Registry *registrar.Registry // contains filtered or unexported fields }
Client for BMC interactions
func (*Client) ClearSystemEventLog ¶
func (*Client) CreateUser ¶
CreateUser pass through to library function
func (*Client) DeactivateSOL ¶ added in v2.2.1
DeactivateSOL pass through library function to deactivate active SOL sessions
func (*Client) DeleteUser ¶
DeleteUser pass through to library function
func (*Client) FilterForCompatible ¶
FilterForCompatible removes any drivers/providers that are not compatible. It wraps the Client.Registry.FilterForCompatible func in order to provide a per provider timeout.
func (*Client) FirmwareInstall ¶
func (c *Client) FirmwareInstall(ctx context.Context, component string, operationApplyTime string, forceInstall bool, reader io.Reader) (taskID string, err error)
FirmwareInstall pass through library function to upload firmware and install firmware
func (*Client) FirmwareInstallStatus ¶
func (c *Client) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error)
Note: this interface is to be deprecated in favour of a more generic FirmwareTaskStatus.
FirmwareInstallStatus pass through library function to check firmware install status
func (*Client) FirmwareInstallSteps ¶ added in v2.2.0
func (c *Client) FirmwareInstallSteps(ctx context.Context, component string) (actions []constants.FirmwareInstallStep, err error)
FirmwareInstallSteps return the order of actions required install firmware for a component.
func (*Client) FirmwareInstallUploadAndInitiate ¶ added in v2.2.0
func (*Client) FirmwareInstallUploaded ¶ added in v2.2.0
func (c *Client) FirmwareInstallUploaded(ctx context.Context, component, uploadVerifyTaskID string) (installTaskID string, err error)
FirmwareInstallUploaded kicks off firmware install for a firmware uploaded with FirmwareUpload.
func (*Client) FirmwareTaskStatus ¶ added in v2.2.0
func (c *Client) FirmwareTaskStatus(ctx context.Context, kind constants.FirmwareInstallStep, component, taskID, installVersion string) (state constants.TaskState, status string, err error)
FirmwareTaskStatus pass through library function to check firmware task statuses
func (*Client) FirmwareUpload ¶ added in v2.2.0
func (c *Client) FirmwareUpload(ctx context.Context, component string, file *os.File) (uploadVerifyTaskID string, err error)
FirmwareUpload just uploads the firmware for install, it returns a task ID to verify the upload status.
func (*Client) For ¶
For removes any provider from the registry that is not the given provider. This is a one time/temporary reordering of the providers in the registry. This reorder is not preserved. It is only used for the call that uses the returned Client.
func (*Client) GetBiosConfiguration ¶
func (*Client) GetBootDeviceOverride ¶ added in v2.2.0
func (c *Client) GetBootDeviceOverride(ctx context.Context) (override bmc.BootDeviceOverride, err error)
GetBootDeviceOverride pass through to library function
func (*Client) GetMetadata ¶
GetMetadata returns the metadata that is populated after each BMC function/method call
func (*Client) GetPowerState ¶
GetPowerState pass through to library function
func (*Client) GetSystemEventLog ¶ added in v2.2.0
func (c *Client) GetSystemEventLog(ctx context.Context) (entries bmc.SystemEventLogEntries, err error)
GetSystemEventLog queries for the SEL and returns the entries in an opinionated format.
func (*Client) GetSystemEventLogRaw ¶ added in v2.2.0
GetSystemEventLogRaw queries for the SEL and returns the raw response.
func (*Client) Inventory ¶
Inventory pass through library function to collect hardware and firmware inventory
func (*Client) MountFloppyImage ¶ added in v2.2.0
func (*Client) Open ¶
Open calls the OpenConnectionFromInterfaces library function Any providers/drivers that do not successfully connect are removed from the client.Registry.Drivers. If client.Registry.Drivers ends up being empty then we error.
func (*Client) PostCode ¶
PostCodeGetter pass through library function to return the BIOS/UEFI POST code
func (*Client) PreferProtocol ¶
PreferProtocol reorders the providers in the registry to have the given protocol first. Matching providers order is preserved. This is a one time/temporary reordering of the providers in the registry. This reorder is not preserved. It is only used for the call that uses the returned Client.
func (*Client) PreferProvider ¶
PreferProvider reorders the registry to have the given provider first. This is a one time/temporary reordering of the providers in the registry. This reorder is not preserved. It is only used for the call that uses the returned Client. Update the Client.Registry to make the change permanent. For example, `cl.Registry.Drivers = cl.Registry.PreferDriver("ipmitool")`
func (*Client) RegisterSpanAttributes ¶ added in v2.2.0
func (*Client) ResetBiosConfiguration ¶ added in v2.2.4
func (*Client) Screenshot ¶
func (*Client) SetBiosConfiguration ¶ added in v2.2.4
func (*Client) SetBiosConfigurationFromFile ¶ added in v2.3.1
func (*Client) SetBootDevice ¶
func (c *Client) SetBootDevice(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)
SetBootDevice pass through to library function
func (*Client) SetPowerState ¶
SetPowerState pass through to library function
func (*Client) SetVirtualMedia ¶
func (c *Client) SetVirtualMedia(ctx context.Context, kind string, mediaURL string) (ok bool, err error)
SetVirtualMedia controls the virtual media simulated by the BMC as being connected to the server. Specifically, the method ejects any currently attached virtual media, and then if mediaURL isn't empty, attaches a virtual media device of type kind whose contents are streamed from the indicated URL.
func (*Client) Supports ¶
Supports removes any provider from the registry that does not support the given features. This is a one time/temporary reordering of the providers in the registry. This reorder is not preserved. It is only used for the call that uses the returned Client.
func (*Client) UnmountFloppyImage ¶ added in v2.2.0
func (*Client) UpdateUser ¶
UpdateUser pass through to library function
type Option ¶
type Option func(*Client)
Option for setting optional Client values
func WithAsrockrackPort ¶
func WithDellRedfishVersionsNotCompatible ¶
WithDellRedfishVersionsNotCompatible sets 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).
func WithIntelAMTHostScheme ¶
func WithIntelAMTPort ¶
func WithIpmitoolCipherSuite ¶
func WithIpmitoolPath ¶
func WithIpmitoolPort ¶
func WithPerProviderTimeout ¶
WithPerProviderTimeout sets the timeout when interacting with a BMC. This timeout value is applied per provider. When not defined and a context with a timeout is passed to a method, the default timeout will be the context timeout duration divided by the number of providers in the registry, meaning, the len(Client.Registry.Drivers). If this per provider timeout is not defined and no context timeout is defined, the defaultConnectTimeout is used.
func WithRPCOpt ¶
func WithRedfishHTTPClient ¶
func WithRedfishPort ¶
func WithRedfishSystemName ¶ added in v2.3.4
func WithRedfishUseBasicAuth ¶
func WithRedfishVersionsNotCompatible ¶
WithRedfishVersionsNotCompatible sets 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).
func WithRegistry ¶
WithRegistry sets the Registry
func WithSecureTLS ¶
WithSecureTLS enforces trusted TLS connections, with an optional CA certificate pool. Using this option with an nil pool uses the system CAs.
func WithTracerProvider ¶ added in v2.2.0
func WithTracerProvider(provider oteltrace.TracerProvider) Option
WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified a noop tracerprovider is used.
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
bios
bios is an example commmand that retrieves BIOS configuration information and prints it out
|
bios is an example commmand that retrieves BIOS configuration information and prints it out |
create-users
create-users is an example commmand that utilizes the 'v1' bmclib interface methods to create user entries in a BMC using the redfish driver.
|
create-users is an example commmand that utilizes the 'v1' bmclib interface methods to create user entries in a BMC using the redfish driver. |
floppy-image
inventory is an example commmand that utilizes the 'v1' bmclib interface methods to upload and mount, unmount a floppy image.
|
inventory is an example commmand that utilizes the 'v1' bmclib interface methods to upload and mount, unmount a floppy image. |
install-firmware
install-firmware is an example command that utilizes the 'v1' bmclib interface methods to flash a firmware image to a BMC.
|
install-firmware is an example command that utilizes the 'v1' bmclib interface methods to flash a firmware image to a BMC. |
inventory
inventory is an example commmand that utilizes the 'v1' bmclib interface methods to gather inventory from a BMC using the redfish driver.
|
inventory is an example commmand that utilizes the 'v1' bmclib interface methods to gather inventory from a BMC using the redfish driver. |
screenshot
status is an example commmand that utilizes the 'v1' bmclib interface methods to capture a screenshot.
|
status is an example commmand that utilizes the 'v1' bmclib interface methods to capture a screenshot. |
status
status is an example commmand that utilizes the 'v1' bmclib interface methods to gather the BMC version, power state, and bios version from a BMC using the redfish driver.
|
status is an example commmand that utilizes the 'v1' bmclib interface methods to gather the BMC version, power state, and bios version from a BMC using the redfish driver. |
virtualmedia
Virtual Media is an example command to mount and umount virtual media (ISO) on a BMC.
|
Virtual Media is an example command to mount and umount virtual media (ISO) on a BMC. |
rpc
Package rpc is a provider that defines an HTTP request/response contract for handling BMC interactions.
|
Package rpc is a provider that defines an HTTP request/response contract for handling BMC interactions. |