hvclient

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

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 Factory

type Factory interface {
	NewClient(hvAPIKey string) Client
}

Factory is the interface for creating new Client objects.

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.

Directories

Path Synopsis
Package mock implements mocks for important interfaces like the Hivelocity api.
Package mock implements mocks for important interfaces like the Hivelocity api.

Jump to

Keyboard shortcuts

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