utils

package
v0.0.0-...-3796b3f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateBackoff

func CalculateBackoff(retry int) time.Duration

func ConnectToEC2ViaSSH

func ConnectToEC2ViaSSH(config SSHConfig) (*ssh.Client, error)

func ConnectToEC2ViaSSHWithRetry

func ConnectToEC2ViaSSHWithRetry(sshConfig SSHConfig) (*ssh.Client, error)

func GenerateCryptoID

func GenerateCryptoID(length int) string

func GenerateRandomID

func GenerateRandomID(length int) string

func GenerateTimestampID

func GenerateTimestampID() string

func GenerateUUID

func GenerateUUID() string

func GetInstanceIDByPublicIP

func GetInstanceIDByPublicIP(publicIP string) (string, error)

func GetPublicIPByInstanceID

func GetPublicIPByInstanceID(instanceID, awsRegion string) (string, error)

func LoadConfig

func LoadConfig[T any](baseDir, filename string, data *T) error

func OpenBrowser

func OpenBrowser(url string) error

func RunCommandOnEC2

func RunCommandOnEC2(client *ssh.Client, command string) error

func SaveConfig

func SaveConfig[T any](data T, baseDir, filename string) error

func StartEC2Instance

func StartEC2Instance(instanceID, region string) error

func StopEC2Instance

func StopEC2Instance(instanceID, region string) error

func UploadFileToS3

func UploadFileToS3(filePath string, bucket string, region string) error

func WaitForInstanceRunning

func WaitForInstanceRunning(instanceID, region string) error

Types

type ProgressLogger

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

func NewProgressLogger

func NewProgressLogger(totalRetries int, authTimeout time.Duration) *ProgressLogger

func (*ProgressLogger) LogCompletion

func (pl *ProgressLogger) LogCompletion(success bool, message string)

func (*ProgressLogger) LogProgress

func (pl *ProgressLogger) LogProgress(retries int, message string)

type SSHConfig

type SSHConfig struct {
	Host       string
	Port       string
	User       string
	PrivateKey []byte
}

func GetSSHConfig

func GetSSHConfig(serverIP string, user string) (SSHConfig, error)

Jump to

Keyboard shortcuts

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