bmc

package
v0.0.0-...-30ff302 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NoAction is a NOP
	NoAction = Action("")
	// ColdReset does a cold reset
	ColdReset = Action("reset_cold")
	// WarmReset does a warm reset
	WarmReset = Action("reset_warm")
)
View Source
const (
	// IPFromDHCP denotes ip via dhcp configuration
	IPFromDHCP = IPSource("dhcp")
	// StaticIP denotes ip via static configuration
	StaticIP = IPSource("static")
)

Variables

View Source
var ActionsBySlug = map[string]Action{
	"reset_cold": ColdReset,
	"reset_warm": WarmReset,
}

ActionsBySlug is a reverse mapping of Action types

View Source
var IPSourceBySlug = map[string]IPSource{
	"dhcp":   IPFromDHCP,
	"static": StaticIP,
}

IPSourceBySlug is a reverse mapping of strings to IPSource

Functions

func RegisterDriver

func RegisterDriver(factory DriverFactory, driver string)

RegisterDriver is called by implementations in order to register their factory function for each device they can control

func SetupLogging

func SetupLogging(l log.Logger)

Types

type Action

type Action string

Action is used to denote the available power actions

func (*Action) UnmarshalText

func (a *Action) UnmarshalText(text []byte) error

UnmarshalText unmarshals an Action from a textual representation

type Driver

type Driver interface {
	BMC(action Action) error
	SetIPSource(source IPSource) error

	Close() error
}

Driver is the interface to control BMCs

func NewDriver

func NewDriver(ctx context.Context, name string, opts DriverOptions) (Driver, error)

NewDriver instantiates a new driver by calling the registered factory function

func NewDriverFromGinContext

func NewDriverFromGinContext(c *gin.Context) Driver

NewDriverFromGinContext creates a new Driver using info in the http request

type DriverFactory

type DriverFactory func(context.Context, DriverOptions) (Driver, error)

DriverFactory is used to instantiate a new Driver

type DriverOptions

type DriverOptions struct {
	Address  string
	Username string
	Password string
	ID       string
	Cipher   int
}

DriverOptions contain the basic options needed to connect to device

type IPSource

type IPSource string

IPSource denotes the types of ip configurations

func (*IPSource) UnmarshalText

func (s *IPSource) UnmarshalText(text []byte) error

UnmarshalText unmarshals an IPSource from a textual representation

Jump to

Keyboard shortcuts

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