control

package
v0.23.5 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelManagedBy            = "mnbr.eu/managed-by"
	LabelValueMangedByControl = "mnbcontrol"
	LabelService              = "mnbr.eu/svc"
	LabelTTL                  = "mnbr.eu/ttl"
	LabelActiveBlueprint      = "mnbr.eu/active-blueprint"
	LabelDNSARecordID         = "mnbr.eu/dns-a-record-id"
	LabelDNSAAAARecordID      = "mnbr.eu/dns-aaaa-record-id"
	LabelServerType           = "mnbr.eu/server-type"
)
View Source
const (
	DNSEndpoint = "https://dns.hetzner.com/api/v1"
)

Variables

View Source
var (
	ErrUnauthorized     = errors.New("unauthorized")
	ErrIllegalArguments = errors.New("illegal arguments")
)
View Source
var (
	MaxTTL = 24 * time.Hour
)

Functions

func AuthCallback

func AuthCallback(ctx *gin.Context)

func AuthLogin

func AuthLogin(ctx *gin.Context)

func AuthLogout

func AuthLogout(ctx *gin.Context)

func AuthSetup

func AuthSetup(callbackURL string)

Types

type APIError

type APIError struct {
	Error string `json:"error"`
}

type ChangeServerTypeRequest

type ChangeServerTypeRequest struct {
	ServerName string `json:"serverName"`
	ServerType string `json:"serverType"`
}

type Config

type Config struct {
	ListenAddr             string
	Location               *hcloud.Location
	Networks               []*hcloud.Network
	SSHKeys                []*hcloud.SSHKey
	DNSZoneID              string
	DiscordGuildID         string
	DiscordChannelID       string
	DiscordAdminRoleID     string
	DiscordUserRoleID      string
	DiscordPowerUserRoleID string
}

type Control

type Control struct {
	Config *Config
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Control, error)

func (*Control) Authorize

func (control *Control) Authorize() gin.HandlerFunc

func (*Control) ChangeServerType

func (control *Control) ChangeServerType(ctx *gin.Context)

func (*Control) ExtendServer

func (control *Control) ExtendServer(ctx *gin.Context)

func (*Control) ListServers

func (control *Control) ListServers(ctx *gin.Context)

func (*Control) NewServer

func (control *Control) NewServer(ctx *gin.Context)

func (*Control) RebootServer

func (control *Control) RebootServer(ctx *gin.Context)

func (*Control) Run

func (control *Control) Run() error

func (*Control) StartServer

func (control *Control) StartServer(ctx *gin.Context)

func (*Control) TerminateServer

func (control *Control) TerminateServer(ctx *gin.Context)

type CreateDNSRecordRequest

type CreateDNSRecordRequest struct {
	ZoneID string `json:"zone_id"`
	Type   string `json:"type"`
	Name   string `json:"name"`
	Value  string `json:"value"`
	TTL    int    `json:"ttl"`
}

type CreateDNSRecordResponse

type CreateDNSRecordResponse struct {
	Record struct {
		ID string `json:"id"`
	} `json:"record"`
}

type CreateNewServerRequest

type CreateNewServerRequest struct {
	ServerName string `json:"serverName"`
	ServerType string `json:"serverType"`
	TTL        string `json:"ttl"`
}

type ExtendServerRequest

type ExtendServerRequest struct {
	ServerName string `json:"serverName"`
	TTL        string `json:"ttl"`
	Inverse    bool   `json:"inverse"`
}

type StartServerRequest

type StartServerRequest struct {
	ServerName string `json:"serverName"`
	TTL        string `json:"ttl"`
}

Jump to

Keyboard shortcuts

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