Documentation ¶
Overview ¶
Package hvclient provides the interfaces to communicate with the API of Hivelocity. We use interfaces to make mocking easier.
Index ¶
Constants ¶
View Source
const PowerStatusOff = "OFF"
PowerStatusOff is "OFF".
View Source
const PowerStatusOn = "ON"
PowerStatusOn is "ON".
Variables ¶
View Source
var ( // ErrDeviceNotFound gets returned if no matching device was found. ErrDeviceNotFound = fmt.Errorf("device was not found") // ErrDeviceShutDownAlready indicates that the device is shut down already. ErrDeviceShutDownAlready = fmt.Errorf("device is shut down already") // ErrDeviceTurnedOnAlready indicates that the device turned on already. ErrDeviceTurnedOnAlready = fmt.Errorf("device is turned on already") // ErrRateLimitExceeded indicates that the device turned on already. ErrRateLimitExceeded = fmt.Errorf("rate limit exceeded") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { PowerOnDevice(ctx context.Context, deviceID int32) error ProvisionDevice(ctx context.Context, deviceID int32, opts hv.BareMetalDeviceUpdate) (hv.BareMetalDevice, error) ListDevices(context.Context) ([]hv.BareMetalDevice, error) ShutdownDevice(ctx context.Context, deviceID int32) error ListImages(ctx context.Context, productID int32) ([]string, error) ListSSHKeys(context.Context) ([]hv.SshKeyResponse, error) // GetDevice return the device. If the device is not found ErrDeviceNotFound is returned. GetDevice(ctx context.Context, deviceID int32) (hv.BareMetalDevice, error) // SetDeviceTags sets the tags to the given list. SetDeviceTags(ctx context.Context, deviceID int32, tags []string) error }
Client collects all methods used by the controller in the Hivelocity API.
type HivelocityFactory ¶
type HivelocityFactory struct{}
HivelocityFactory implements the Factory interface.
func (*HivelocityFactory) NewClient ¶
func (f *HivelocityFactory) NewClient(hvAPIKey string) Client
NewClient creates new Hivelocity clients.
Click to show internal directories.
Click to hide internal directories.