api

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package api provides metal machine management via API.

Index

Constants

This section is empty.

Variables

View Source
var DefaultDice = NewFailureDice(0, 0)

DefaultDice is used in the api.Client.

Default value is to have no failures.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides management over simple API.

func NewClient

func NewClient(spec metalv1.ManagementAPI) (*Client, error)

NewClient returns new API client to manage metal machine.

func (*Client) Close

func (c *Client) Close() error

Close the client.

func (*Client) IsFake

func (c *Client) IsFake() bool

IsFake returns false.

func (*Client) IsPoweredOn

func (c *Client) IsPoweredOn() (bool, error)

IsPoweredOn checks current power state.

func (*Client) PowerCycle

func (c *Client) PowerCycle() error

PowerCycle will power cycle a given machine.

func (*Client) PowerOff

func (c *Client) PowerOff() error

PowerOff will power off a given machine.

func (*Client) PowerOn

func (c *Client) PowerOn() error

PowerOn will power on a given machine.

func (*Client) SetPXE

func (c *Client) SetPXE(mode types.PXEMode) error

SetPXE makes sure the node will pxe boot next time.

type FailureDice

type FailureDice struct {
	// contains filtered or unexported fields
}

func NewFailureDice

func NewFailureDice(explicitFailureProbability, silentFailureProbability float64) *FailureDice

NewFailureDice creates new failure dice with specified probabilities.

func (*FailureDice) Roll

func (dice *FailureDice) Roll() SimulatedFailure

Roll the dice to get the expected failure mode.

type SimulatedFailure

type SimulatedFailure int

SimulatedFailure modes.

const (
	ExplicitFailure SimulatedFailure = iota
	SilentFailure
	NoFailure
)

Simulated failure constants.

Jump to

Keyboard shortcuts

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