helpers

package
v0.0.0-...-08f6c10 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigFilePath

func ConfigFilePath() (string, error)

func DeleteServer

func DeleteServer(sclient *hcloud.ServerClient, serverName string) error

func DeleteVolume

func DeleteVolume(vclient *hcloud.VolumeClient, serverName string) error

func DestroyAllDeadServers

func DestroyAllDeadServers(client *hcloud.Client) error

Remove all servers at hetzner project which is running beyond 24 hours. This is because we want to reduce cost at all times and we really don't want dead expesive servers running around wasting our money. So to accomplish that we simply destroy servers older than 24 hours or with age of 24 hours. We destroy servers whenever we see them or connect with the api.

"If you are 1 day old then you are dead to me." -- Antony J.R

func DumpJsonFile

func DumpJsonFile(obj map[string]string, path string) error

func DumpJsonString

func DumpJsonString(obj map[string]string, path string) (string, error)

func FileExists

func FileExists(FilePath string) (bool, error)

func GetSFTPClient

func GetSFTPClient(conn *ssh.Client) (*sftp.Client, error)

func GetSSHFingerprint

func GetSSHFingerprint(pubkey string) (string, error)

func GetServerAgeInHours

func GetServerAgeInHours(sclient *hcloud.ServerClient, serverName string) (int, error)

func GetVolumeLinuxDeviceForServer

func GetVolumeLinuxDeviceForServer(client *hcloud.Client, serverName string) (string, error)

func ReadVarsJsonFile

func ReadVarsJsonFile(path string) (map[string]string, error)

func SFTPCopyFileToRemote

func SFTPCopyFileToRemote(client *sftp.Client, dest string, source string) error

func SFTPFileExistsAtRemote

func SFTPFileExistsAtRemote(conn *ssh.Client, path string) bool

func ServerNameFromSHA256

func ServerNameFromSHA256(sum string) string

Short SHA256 Sum is used since sha256 sum is simply too long for a server name in Hetzner. It's concatenation of first 7 characters and last 7 characters of the original sha256 sum hex.

func TryDeleteServer

func TryDeleteServer(client *hcloud.Client, serverName string, maxTries int, interval int) error

func UpdateSSHKeyLabel

func UpdateSSHKeyLabel(sclient *hcloud.SSHKeyClient, sshKey *hcloud.SSHKey, key string, value string) (*hcloud.SSHKey, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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