Skip to content

virt.hetzner #

hetzner

need to create login on https://robot.hetzner.com/preferences/index

fn configure #

fn configure(instance string) !

get a new hetzner client, will create if it doesn't exist or ask for new configuration

fn get #

fn get(instance string, cfg Config) !HetznerClient[Config]

fn heroplay #

fn heroplay(mut plbook playbook.PlayBook) !

run heroscript starting from path, text or giturl

 !!hetznerclient.define
     name:'default'
     description:'ThreeFold Read Write Repo 1
     baseurl:'https://robot-ws.your-server.de'
     login:'...'
     passwd:'...'
       whitelist:'' //comma separated list of servers we whitelist to work on
```	

fn (HetznerClient[Config]) key_set #

fn (mut h HetznerClient[Config]) key_set() !

fn (HetznerClient[Config]) keys_get #

fn (mut h HetznerClient[Config]) keys_get() ![]SSHKey

fn (HetznerClient[Config]) server_boot #

fn (mut h HetznerClient[Config]) server_boot(id int) !RescueInfo

fn (HetznerClient[Config]) server_info_get #

fn (mut h HetznerClient[Config]) server_info_get(args_ ServerGetArgs) !ServerInfo

fn (HetznerClient[Config]) server_rescue #

fn (mut h HetznerClient[Config]) server_rescue(args ServerRescueArgs) !RescueInfo

put server in rescue mode

fn (HetznerClient[Config]) server_reset #

fn (mut h HetznerClient[Config]) server_reset(args ServerRebootArgs) !ResetInfo

fn (HetznerClient[Config]) servers_list #

fn (mut h HetznerClient[Config]) servers_list() ![]ServerInfo

struct Config #

@[params]
struct Config {
pub mut:
	login       string
	passwd      string @[secret]
	description string
	baseurl     string = 'https://robot-ws.your-server.de'
	whitelist   string // comma separated list of servers we whitelist to work on
}

struct HetznerClient #

struct HetznerClient[T] {
	base.BaseConfig[T]
pub mut:
	auth string
}

struct RescueInfo #

struct RescueInfo {
pub mut:
	server_ip       string
	server_ipv6_net string
	server_number   int
	os              string
	arch            int
	active          bool
	password        string
	authorized_key  []string
	host_key        []string
}

/////////////////////////RESCUE

struct SSHKey #

struct SSHKey {
pub mut:
	name        string
	fingerprint string
	type_       string @[json: 'type']
	size        int
	created_at  string
	data        string
}

struct ServerGetArgs #

struct ServerGetArgs {
pub mut:
	id   int
	name string
}

/////////////////////////GETID

struct ServerInfo #

struct ServerInfo {
pub mut:
	server_ip       string
	server_ipv6_net string
	server_number   int
	server_name     string
	product         string
	dc              string
	traffic         string
	status          string
	cancelled       bool
	paid_until      string
	ip              []string
	subnet          []Subnet
}

///////////////////////// LIST

struct ServerRebootArgs #

struct ServerRebootArgs {
pub mut:
	id   int
	name string
	wait bool = true
}

struct ServerRescueArgs #

struct ServerRescueArgs {
pub mut:
	id              int
	name            string
	wait            bool = true
	crystal_install bool
}

struct Subnet #

struct Subnet {
pub mut:
	ip   string
	mask string
}