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) Close(ctx context.Context) (err error)
- func (c *Client) CreateUser(ctx context.Context, user, pass, role string) (ok bool, 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, applyAt string, forceInstall bool, ...) (taskID string, err error)
- func (c *Client) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status 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) GetMetadata() bmc.Metadata
- func (c *Client) GetPowerState(ctx context.Context) (state string, err error)
- func (c *Client) Inventory(ctx context.Context) (device *common.Device, 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) ResetBMC(ctx context.Context, resetType string) (ok bool, err error)
- func (c *Client) Screenshot(ctx context.Context) (image []byte, fileType 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) 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 WithRedfishHTTPClient(httpClient *http.Client) Option
- func WithRedfishPort(port string) Option
- func WithRedfishUseBasicAuth(useBasicAuth bool) Option
- func WithRedfishVersionsNotCompatible(versions []string) Option
- func WithRegistry(registry *registrar.Registry) Option
- func WithSecureTLS(rootCAs *x509.CertPool) 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) CreateUser ¶
CreateUser pass through to library function
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, applyAt 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)
FirmwareInstallStatus pass through library function to check firmware install 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) 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) Inventory ¶
Inventory pass through library function to collect hardware and firmware inventory
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) Screenshot ¶
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) 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 WithRedfishHTTPClient ¶
func WithRedfishPort ¶
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.
Directories ¶
Path | Synopsis |
---|---|
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. |
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. |
ipmitool-getCiphers
getCiphers and getSolCiphers retrieve the ciphers supported by the BMC for IPMI and SOL connections.
|
getCiphers and getSolCiphers retrieve the ciphers supported by the BMC for IPMI and SOL connections. |
ipmitool-sol
getCiphers and getSolCiphers retrieve the ciphers supported by the BMC for IPMI and SOL connections.
|
getCiphers and getSolCiphers retrieve the ciphers supported by the BMC for IPMI and SOL connections. |
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. |