api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

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

Api is the main struct for interacting with the BMC

func NewApi

func NewApi(opts ...func(*ApiOptions)) *Api

func (*Api) ChassisStatus

func (a *Api) ChassisStatus(host string) (*ChassisStatus, error)

ChassisStatus is a function that gets the power status of the server using the BMC API

func (*Api) GetSensorsList

func (a *Api) GetSensorsList(host string) ([]*Sensor, error)

GetSensorsList returns a list of sensors from the BMC

func (*Api) Login

func (a *Api) Login(host string, user string, password string) (*Session, error)

Login makes a request to the BMC to authenticate the user

func (*Api) Logout added in v0.0.6

func (a *Api) Logout(host string) error

Logout makes a request to the BMC to logout the user

func (*Api) PowerOff

func (a *Api) PowerOff(host string) error

PowerOn is a function that powers on server using the BMC API

func (*Api) PowerOn

func (a *Api) PowerOn(host string) error

PowerOn is a function that powers on server using the BMC API

type ApiOptions

type ApiOptions struct {
	InsecureSsl bool // skip ssl verification
	UseSsl      bool // use ssl
}

ApiOptions is a struct that holds the options for the API

type AuthorizationError

type AuthorizationError struct {
	StatusCode int
	Message    string
}

func (*AuthorizationError) Error

func (e *AuthorizationError) Error() string

type BMCAPIError

type BMCAPIError struct {
	StatusCode int
	Message    string
}

func (*BMCAPIError) Error

func (e *BMCAPIError) Error() string

type ChassisStatus

type ChassisStatus struct {
	PowerStatus int `json:"power_status"`
	LEDStatus   int `json:"led_status"`
}

type NoSessionError

type NoSessionError struct {
	Message string
}

func (*NoSessionError) Error

func (e *NoSessionError) Error() string

type Sensor

type Sensor struct {
	ID                           int    `json:"id"`
	SensorNumber                 int    `json:"sensor_number"`
	Name                         string `json:"name"`
	Reading                      string `json:"reading"`
	Unit                         string `json:"unit"`
	Type                         string `json:"type"`
	State                        string `json:"state"`
	Accessible                   string `json:"accessible"`
	LowerNonRecoverableThreshold string `json:"lower_non_recoverable_threshold"`
	LowerCriticalThreshold       string `json:"lower_critical_threshold"`
	LowerNonCriticalThreshold    string `json:"lower_non_critical_threshold"`
	HigherNonCriticalThreshold   string `json:"higher_non_critical_threshold"`
	HigherCriticalThreshold      string `json:"higher_critical_threshold"`
	Alert                        string `json:"alert"`
}

type Session

type Session struct {
	User       string
	Priveledge int
	SessionId  int
	RemoteAddr string
	ServerAddr string
	HTTPS      bool
	CSRFToken  string

	// cookies
	QSessionID string
}

Session is a struct that holds the session information for the BMC

Jump to

Keyboard shortcuts

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