rpc

package
v0.0.0-...-bc55ff7 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: CC0-1.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BMCService

type BMCService interface {
	RPCHandler(w http.ResponseWriter, r *http.Request)
}

func NewBMCService

func NewBMCService(cfg config.Config) BMCService

type BootDeviceParams

type BootDeviceParams struct {
	Device     string `json:"device"`
	Persistent bool   `json:"persistent"`
	EFIBoot    bool   `json:"efiBoot"`
}

BootDeviceParams are the parameters options used when setting a boot device.

type Machine

type Machine struct {
	MacAddress string `json:"mac"`
	PortIdx    string `json:"port"`
}

type Method

type Method string
const (
	BootDeviceMethod   Method = "setBootDevice"
	PowerSetMethod     Method = "setPowerState"
	PowerGetMethod     Method = "getPowerState"
	VirtualMediaMethod Method = "setVirtualMedia"
	PingMethod         Method = "ping"
)

type PowerGetResult

type PowerGetResult string
const (
	PoweredOn  PowerGetResult = "on"
	PoweredOff PowerGetResult = "off"
)

func (PowerGetResult) String

func (p PowerGetResult) String() string

type PowerSetParams

type PowerSetParams struct {
	State string `json:"state"`
}

PowerSetParams are the parameters options used when setting the power state.

type RequestPayload

type RequestPayload struct {
	ID     int64  `json:"id"`
	Host   string `json:"host"`
	Method Method `json:"method"`
	Params any    `json:"params,omitempty"`
}

RequestPayload is the payload sent to the ConsumerURL.

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*ResponseError) String

func (r *ResponseError) String() string

type ResponsePayload

type ResponsePayload struct {
	// ID is the ID of the response. It should match the ID of the request but is not enforced.
	ID     int64          `json:"id"`
	Host   string         `json:"host"`
	Result any            `json:"result,omitempty"`
	Error  *ResponseError `json:"error,omitempty"`
}

ResponsePayload is the payload received from the ConsumerURL. The Result field is an interface{} so that different methods can define the contract according to their needs.

type VirtualMediaParams

type VirtualMediaParams struct {
	MediaURL string `json:"mediaUrl"`
	Kind     string `json:"kind"`
}

PowerGetParams are the parameters options used when getting the power state.

Jump to

Keyboard shortcuts

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