robot

package
v0.0.0-...-82cfb88 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RebootHardware signals the hardware to restart.
	RebootHardware = Reboot("hw")
	// RebootManually tells a technician to reboot the server.
	RebootManually = Reboot("man")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Firewall

type Firewall struct {
	ServerIP         string `json:"server_ip"`
	ServerNumber     int    `json:"server_number"`
	Status           string
	FilterIPv6       bool `json:"filter_ipv6"`
	WhiteListHetzner bool `json:"whitelist_hos"`
	Port             string
	Rules            struct {
		Input  []FirewallRule `json:"input"`
		Output []FirewallRule `json:"output"`
	}
}

Firewall combines firewall details and firewall rules.

func (Firewall) String

func (fw Firewall) String() string

type FirewallRule

type FirewallRule struct {
	IPVersion       string `json:"ip_version"`
	Name            string
	DestinationIP   string `json:"dst_ip"`
	SourceIP        string `json:"src_ip"`
	DestinationPort string `json:"dst_port"`
	SourcePort      string `json:"src_port"`
	Protocol        string
	TCPFlags        string `json:"tcp_flags"`
	Action          string
}

FirewallRule represents a single firewall rule.

func (FirewallRule) String

func (r FirewallRule) String() string

type FirewallWrapper

type FirewallWrapper struct {
	Firewall Firewall
}

FirewallResponse is returned by calling hetzners API.

type Reboot

type Reboot string

Reboot defines who to reboot a server.

type RescueMode

type RescueMode struct {
	ServerIP     string `json:"server_ip"`
	ServerNumber int    `json:"server_number"`
	Active       bool
	Password     string
}

RescueMode are the rescue mode details.

type RescueModeOptions

type RescueModeOptions struct {
	ServerIP     string `json:"server_ip"`
	ServerNumber int    `json:"server_number"`
	Active       bool
	Password     string
	Os           []string
	Arch         []int
}

RescueModeOptions are the rescue mode options.

type RescueModeOptionsResponse

type RescueModeOptionsResponse struct {
	RescueMode RescueModeOptions `json:"rescue"`
}

RescueModeResponse is returned by calling out to hetzners API.

type RescueModeResponse

type RescueModeResponse struct {
	RescueMode RescueMode `json:"rescue"`
}

RescueModeResponse is returned by calling out to hetzners API.

type Server

type Server struct {
	Username string
	Password string
	IP       string
}

Server represents a server in hetzners API.

func (Server) DisableFirewall

func (s Server) DisableFirewall() error

DisableFirewall disables Hetzners IPv4 firewall.

func (Server) DisableRescueMode

func (s Server) DisableRescueMode() error

DisableRescueMode disables rescue mode for a node.

func (Server) EnableFirewall

func (s Server) EnableFirewall() error

EnableFirewall enables Hetzners IPv4 firewall.

func (Server) EnableRescueMode

func (s Server) EnableRescueMode(rescueOS, rescueArch string) (RescueMode, error)

EnableRescueMode enables rescue mode of a node.

func (Server) FirewallStatus

func (s Server) FirewallStatus() (string, error)

FirewallStatus prints the status of hetzners firewall.

func (Server) Reboot

func (s Server) Reboot(rst Reboot) error

Reboot sends a reboot command to hetzners API.

func (Server) RescueModeOptions

func (s Server) RescueModeOptions() (RescueModeOptions, error)

RescueModeOptions returns the rescue mode options.

func (Server) RescueModePassword

func (s Server) RescueModePassword() (string, bool, error)

RescueModePassword resturns the password and status of the rescue mode.

func (Server) RescueModeStatus

func (s Server) RescueModeStatus() (bool, error)

RescueModeStatus returns the activation status of the rescue mode.

Jump to

Keyboard shortcuts

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